43 Commits
Author SHA1 Message Date
Codex 2b7688bd75 fix(file-index): prune removed active assets on rebuild
setup / install-leaves-tree-clean (push) Canceled after 0s
Treat the source registry as authoritative during file-index rebuilds while preserving staged uploads. This prevents deleted archived sources from remaining searchable.

Tests: python3 -m unittest tests.test_file_assets tests.test_business_facts
2026-07-23 02:18:11 +00:00
Codex 6edf02c3eb fix(mcp): stage remote ingest by default
Default ticket, multipart, and text-note ingest entry points to staging without launching a job. Propagate WIKI_ARCHIVE_SOURCES from project configuration into the managed service environment.\n\nValidated with the full 206-test suite.
2026-07-16 15:56:54 +00:00
Codex 2183404966 feat(mcp): add verified ingest job phases
Expose authoritative ingest phases and supervisor-backed process liveness without semantic activity inference. Require deterministic registry, manifest, archive, file-index, and declared-output verification before an agent-successful job can finish succeeded.\n\nPreserve legacy state values, derive defaults for older job records, keep verification outside the manager lock, and retain partial outputs on verification failure.\n\nValidated with the full unittest suite (205 tests).
2026-07-16 14:26:58 +00:00
Codex a2b4bc393b feat(mcp): support bundled text and attachment ingest
Allow one multipart request to stage body text and repeated files as a Bundle with bundle-level metadata. Preserve Bundle roles through preview, job launch, prompts, cleanup, and text-note ingestion.\n\nValidated with the full unittest suite (188 tests).
2026-07-16 14:07:58 +00:00
Codex 4c5454da90 feat(business): exclude intercompany transfer orders
Allow operators to configure internal company names and identifiers, then apply the filter consistently across business templates and query routing. Preserve direct external-customer orders and provide explicit CLI and environment overrides for internal-flow audits.

Validation: python -m unittest tests.test_business_facts tests.test_wiki_skills tests.test_user_ops -v (25 tests)
2026-07-10 05:40:54 +00:00
Codex 7eb9b987ab feat(mcp): harden remote assets and job execution
Gate source-file downloads and verify registry paths and content hashes. Stream multipart uploads with bounded limits, supervise OpenCode jobs with explicit result markers and timeouts, and preserve managed endpoint security settings. Document the trusted-client boundary and add focused regression coverage.

Validation: PYTHONPATH=<staged-tree> python -m unittest discover -s tests (182 tests)
2026-07-09 21:44:48 +00:00
Codex d47bb2c549 feat(mcp): improve remote ingest guidance
Make upload-ticket auth the default remote-agent path by returning complete upload URLs and updating service output/docs.

Add validate_upload and preview_upload_metadata for lightweight file checks and exact sha256 duplicate warnings before ingest.

Expose version, capability schema, file-index freshness, queue state, and known limitations through get_mcp_capabilities.

Validation: python3 -m unittest discover -v; python3 -m compileall obsidian_wiki tests scripts; git diff --check.
2026-07-08 17:12:51 +00:00
Codex ee7defe8bf feat(mcp): add agent-friendly query capabilities
Add get_mcp_capabilities so remote agents can discover enabled tool groups and preferred entrypoints.

Add ask_wiki as a one-call query wrapper with structured result fields while keeping the legacy answer field for compatibility.

Update MCP startup guidance and docs, and cover the new query/capability behavior with tests.
2026-07-08 16:53:59 +00:00
Codex 1150107aa3 fix(mcp): harden remote service boundaries
Harden the HTTP ingest upload path by validating host/origin and method before ticket consumption, enforcing request body limits, and returning 413 for oversized uploads. Hide local runtime/log paths from default remote responses while preserving internal paths for local OpenCode prompts. Add conservative runtime cleanup for tickets, uploads, jobs, and logs, plus MemoryMax on the managed systemd unit.

Validation: python3 -m unittest tests/test_mcp_server_remote.py tests/test_mcp_ingest.py tests/test_mcp_query.py tests/test_mcp_service.py -v; python3 -m unittest discover -v; python3 -m compileall obsidian_wiki tests scripts; git diff --check. Restarted obsidian-wiki-mcp.service and confirmed ActiveState=active, SubState=running, MemoryMax=2147483648, Restart=on-failure.
2026-07-08 16:37:32 +00:00
Codex 688bebb64c feat(mcp): ingest direct text notes 2026-07-08 11:18:32 +00:00
Codex 37e6ce5673 feat(query): generalize hybrid business wiki routing 2026-07-07 16:44:24 +00:00
Codex e5f26a5540 feat(query): document hybrid business wiki answers
Teach wiki-query to split entity overview questions into an ordinary wiki context track and a read-only business facts track, then fuse the results. Update the MCP query prompt to explicitly allow read-only hybrid subagents while preserving public-only and mutating-command restrictions. Add a skill instruction regression test and update docs.

Validation: python3 -m unittest tests/test_wiki_skills.py -v; python3 -m unittest tests/test_mcp_query.py -v; python3 -m unittest tests/test_business_facts.py -v; python3 -m unittest discover -v; python3 -m compileall obsidian_wiki tests scripts; git diff --check
2026-07-07 16:05:16 +00:00
Codex 11b4261d29 fix(mcp): allow read-only business queries
Update the remote wiki-query prompt so it still forbids arbitrary shell, writes, ingest/update/rebuild, and sync/config/timer operations while explicitly allowing the read-only business facts schema/template/sql commands used by the wiki-query business route. Document the allowlist and cover it in MCP query prompt tests.

Validation: python3 -m unittest tests/test_mcp_query.py -v; python3 -m unittest tests/test_business_facts.py -v; python3 -m unittest discover -v; python3 -m compileall obsidian_wiki tests scripts; git diff --check
2026-07-06 22:46:30 +00:00
Codex 00ce531e53 test(business): smoke test every query template
Add a shared Kingdee sales-order fixture and execute every schema-listed business template at least once, ensuring each returns JSON-serializable output. Keep existing exact assertions for representative totals, rankings, staff, status, and delivery-plan templates.

Validation: python3 -m unittest discover -v; python3 -m compileall obsidian_wiki tests scripts; git diff --check
2026-07-06 22:35:45 +00:00
Codex d3f3151218 feat(business): add schema-driven query templates
Expose a business schema catalog and explicit template runner for Kingdee sales-order facts. Update wiki-query guidance so the LLM routes operational questions through templates first and guarded SQL only when needed. Refresh user docs and ops aliases, and add coverage for schema metadata, template execution, and CLI JSON output.

Validation: python3 -m unittest discover -v; python3 -m compileall obsidian_wiki tests scripts; git diff --check
2026-07-06 22:27:49 +00:00
Codex b85c26e0ba feat(cli): add unified user operations entrypoint
Add scripts/obsidian-wiki-ops.py as the repo-local command surface for common wiki, Kingdee, timer, daily update, and MCP operations.

Route the existing business and MCP shell wrappers through the unified entrypoint for compatibility, and update docs to recommend the single command path.

Validation: python3 -m unittest discover -v; python3 -m compileall obsidian_wiki tests scripts; git diff --check.
2026-07-06 21:21:14 +00:00
Codex 317b0e6feb feat(business): add staff queries and incremental sync
Add order_staff normalization, salesperson query templates, guarded read-only SQL fallback, and incremental Kingdee sync cursor handling.

Add a user-level systemd timer manager for daily Kingdee business sync and document the new workflow.

Validation: python3 -m unittest discover -v; python3 -m compileall obsidian_wiki tests scripts; git diff --check.
2026-07-06 21:08:00 +00:00
Codex dae51ab570 feat(business): preserve full Kingdee order structure
Store expanded Kingdee sales order header, line, and delivery-plan fields in the business facts database while preserving raw JSON at each level.

Add migration-safe columns, a delivery-plan table, coverage for the official response shape, and database documentation.

Validation: python3 -m unittest discover -v; python3 -m compileall obsidian_wiki tests; git diff --check.
2026-07-06 20:31:39 +00:00
Codex 72c666f165 fix(business): follow Kingdee token request body
Align the generated Kingdee token request with the official enhanced-token document: client_id, client_secret, username, accountId, language, automatic nonce, and automatic current timestamp. Treat expires_in as milliseconds by default and update docs/tests accordingly.

Validation: python3 -m unittest discover -v; python3 -m compileall obsidian_wiki tests; git diff --check.
2026-07-06 20:11:01 +00:00
Codex 4e34e5b3fe feat(business): split Kingdee token body config
Allow Kingdee token requests to be built from app key, app secret, configurable field names, optional timestamp fields, and extra JSON. Keep raw KINGDEE_TOKEN_BODY_JSON as an advanced override with current-time placeholders.

Validation: python3 -m unittest discover -v; python3 -m compileall obsidian_wiki tests; git diff --check.
2026-07-06 20:03:28 +00:00
Codex 451a39c30a docs(business): explain Kingdee env variables
Expand the generated kingdee.env template with per-variable purpose and requiredness notes, including the direct access token testing option. Cover the generated guidance with Kingdee API tests.

Validation: python3 -m unittest discover -v; python3 -m compileall obsidian_wiki tests; git diff --check.
2026-07-06 19:55:12 +00:00
Codex 5f257a7ccb feat(business): add Kingdee sales order API sync
Implement private Kingdee config generation, token login/refresh caching, paginated sales order fetching, official response-field normalization, and CLI filters for deterministic business fact sync. Update docs to keep credentials in .runtime and cover dry-run auth.

Validation: python3 -m unittest discover -v; python3 -m compileall obsidian_wiki tests; git diff --check.
2026-07-06 19:47:40 +00:00
Codex 4dfef7e099 feat(business): add Kingdee fact queries
Add a structured business facts SQLite layer for Kingdee sales orders, with fixed-template query commands for monthly order counts, sales amount, top customers, and customer trend data.

Update README, SETUP, and developer docs to describe configuration, sync commands, query examples, and the boundary between structured facts and wiki ingest.

Validation: python3 -m unittest discover -v
2026-07-06 19:19:23 +00:00
Codex 3d0203fb9e feat(mcp): configure OpenCode models per workflow
Add server-side model and variant settings for MCP ingest and query OpenCode jobs. Ingest defaults to openai/gpt-5.5 high, while query defaults to openai/gpt-5.5 minimal, and readiness/status surfaces the active settings.

Persist the settings through the managed service env file and preserve local overrides across start, tools, and token rotations. Remote MCP clients still cannot choose arbitrary models per call.

Validation: python3 -m unittest discover -v; python3 -m py_compile obsidian_wiki/mcp_ingest.py obsidian_wiki/mcp_query.py obsidian_wiki/mcp_server.py scripts/manage_mcp_service.py tests/test_mcp_ingest.py tests/test_mcp_query.py tests/test_mcp_server_remote.py tests/test_mcp_service.py; git diff --check.
2026-07-05 18:20:06 +00:00
Codex e7913d4c6b feat(mcp): add OpenCode-backed wiki query
Add a query tool group for the wiki-file-assets MCP server that queues fixed /wiki-query OpenCode jobs, exposes status/result/cancel/readiness tools, and keeps query disabled until explicitly enabled.

Document the new service switches and config, keep remote query gated in AGENTS.md, preserve token behavior, and pass proxy environment through the managed service so OpenCode smoke/query jobs can reach the model provider.

Validation: python3 -m unittest discover -v; python3 -m py_compile obsidian_wiki/mcp_query.py obsidian_wiki/mcp_server.py scripts/manage_mcp_service.py tests/test_mcp_query.py tests/test_mcp_server_remote.py tests/test_mcp_service.py; git diff --check.
2026-07-05 18:00:53 +00:00
Codex c8433a2e2e fix(mcp): remove base64 ingest tool
Remove ingest_file_base64 from the ingest MCP tool surface so remote agents use the upload-ticket HTTP multipart path instead of oversized JSON/base64 tool arguments.

Update docs and agent rules to make base64 upload explicitly unsupported as an MCP tool while preserving ticket-based uploads outside the vault.

Validation: python3 -m unittest discover -v; python3 -m py_compile obsidian_wiki/mcp_server.py tests/test_mcp_server_remote.py; git diff --check
2026-07-05 17:30:11 +00:00
Codex d3bd7f0c08 feat(mcp): issue upload tickets for ingest
Add short-lived single-use HTTP upload tickets that authenticated MCP clients can request before uploading files to /mcp-ingest/uploads. This lets remote agents use curl without needing to read or expose the main MCP bearer token, avoiding oversized base64 tool arguments for larger files.

The upload endpoint now accepts either the normal bearer token or X-Obsidian-Wiki-Upload-Token. Ticket defaults can carry project, doc_type_hint, note, start_job, and file-count limits while uploads still stage outside the vault.

Validation: python3 -m unittest discover -v; python3 -m py_compile obsidian_wiki/mcp_ingest.py obsidian_wiki/mcp_server.py tests/test_mcp_ingest.py tests/test_mcp_server_remote.py; git diff --check
2026-07-05 16:45:37 +00:00
Codex 75dea2cfaf fix(mcp): remove legacy ingest upload tools
Remove the old chunked upload MCP tools from the remote tool surface so agents only see the simplified upload paths: HTTP multipart and ingest_file_base64.

Update docs and agent rules to stop advertising the chunked fallback while keeping staged uploads outside the vault and behind the existing ingest gate.

Validation: python3 -m unittest discover -v; python3 -m py_compile obsidian_wiki/mcp_server.py tests/test_mcp_server_remote.py; git diff --check
2026-07-05 16:35:45 +00:00
Codex d7daf2f210 feat(mcp): add simplified ingest uploads
Add a one-shot IngestManager upload path, an ingest_file_base64 MCP tool, and an authenticated /mcp-ingest/uploads multipart HTTP endpoint so remote agents can transfer files without manual chunk orchestration.

Keep uploaded files in runtime staging outside the vault and let wiki-ingest/OpenCode decide archival, registry updates, and index rebuilds.

Update service output, docs, and agent rules to make the preferred upload path discoverable while preserving chunked tools as a fallback.

Validation: python3 -m unittest discover -v; python3 -m py_compile obsidian_wiki/mcp_ingest.py obsidian_wiki/mcp_server.py scripts/manage_mcp_service.py tests/test_mcp_ingest.py tests/test_mcp_server_remote.py tests/test_mcp_service.py; git diff --check
2026-07-05 16:32:33 +00:00
Codex ef2e44656d fix(mcp): persist OpenCode path for ingest service
Resolve and write an absolute OpenCode path when enabling the ingest tool group so systemd services without an interactive PATH can pass ingest readiness checks.

Preserve an existing OBSIDIAN_MCP_INGEST_OPENCODE_PATH across start, token rotation, and tool enable/disable updates instead of dropping it when rewriting the runtime env file.

Validation: python3 -m unittest discover -v; python3 -m py_compile scripts/manage_mcp_service.py tests/test_mcp_service.py; git diff --check; live MCP tools/list and check_ingest_opencode_readiness calls passed after setting the service config.
2026-07-05 16:10:09 +00:00
Codex 937d9a002f feat(mcp): configure enabled tool groups
Add OBSIDIAN_MCP_ENABLED_TOOLS as the service config source for MCP tool groups while keeping OBSIDIAN_MCP_ENABLE_INGEST as a legacy fallback.

Add mcp_service.sh tools list/enable/disable commands, preserve enabled tools across normal start and token rotation, and let start --enable-ingest/--disable-ingest update the same config file.

Teach the MCP runtime to derive file-assets and ingest registration from enabled tool groups so file asset tools can be disabled separately from ingest.

Validation: python3 -m unittest discover -v; python3 -m py_compile scripts/manage_mcp_service.py obsidian_wiki/mcp_server.py tests/test_mcp_service.py tests/test_mcp_server_remote.py; CLI tools enable/disable dry run; git diff --check.
2026-07-05 15:47:16 +00:00
Codex a1ca05f545 feat(mcp): add OpenCode ingest readiness checks
Expose a check_ingest_opencode_readiness MCP tool for remote operators and run the same static preflight before launching OpenCode ingest jobs.

The preflight validates the OpenCode binary, required run flags, project AGENTS/skill context files, and can run a no-write smoke test that proves wiki-ingest loads successfully.

Document the remote ingest workflow and clarify that wiki-file-assets is tool-first, so empty resources/prompts lists are not a failure signal.

Validation: python3 -m unittest discover -v; python3 -m py_compile obsidian_wiki/mcp_ingest.py obsidian_wiki/mcp_server.py tests/test_mcp_ingest.py tests/test_mcp_server_remote.py; git diff --check; real OpenCode smoke test passed with opencode 1.17.13.
2026-07-05 15:35:07 +00:00
Codex e7adfbe9a6 fix(mcp): stage ingest uploads outside vault
Move remote MCP ingest uploads from the vault inbox to the MCP runtime staging area so uploaded files are not accepted into the vault before wiki-ingest processes them.

Reject ingest runtime roots that resolve inside the vault, and update the generated OpenCode prompt plus docs to describe uploads as temporary staging inputs.

Validation: python3 -m unittest discover -v; python3 -m py_compile obsidian_wiki/mcp_ingest.py tests/test_mcp_ingest.py; git diff --check
2026-07-05 15:04:16 +00:00
Codex 691e5aa8ea fix(mcp): pass ingest flag through service CLI
Ensure mcp_service.sh start --enable-ingest actually writes OBSIDIAN_MCP_ENABLE_INGEST=1 by forwarding the parsed flag to start_service.

Also stop the new-token command from referencing the start-only flag, and cover both CLI paths with regression tests.

Validation: python3 -m unittest discover -v; git diff --check
2026-07-05 14:58:03 +00:00
Codex b174df642f feat(mcp): queue local OpenCode ingest jobs
Add optional write-capable MCP ingest tools for chunked uploads, SHA-verified completion, and asynchronous local OpenCode wiki-ingest jobs. The tools remain disabled by default and are gated by OBSIDIAN_MCP_ENABLE_INGEST or mcp_service.sh start --enable-ingest.

Remote clients can upload files into the vault inbox, start a restricted fixed-prompt ingest job, poll job status/result, and cancel queued or running work. The implementation keeps arbitrary prompt and shell execution out of the MCP surface.

Validation: python3 -m unittest discover -v; python3 -m py_compile obsidian_wiki/mcp_ingest.py obsidian_wiki/mcp_server.py scripts/manage_mcp_service.py tests/test_mcp_ingest.py tests/test_mcp_server_remote.py tests/test_mcp_service.py; git diff --check.
2026-07-05 14:54:29 +00:00
Codex b89d141f03 fix(mcp): preserve structured file asset identifiers
Preserve curated source-registry identifiers when rebuilding the file asset index so part-number queries such as 101049 can match drawings even when the filename omits the part number.

Raise ranking for structured identifier matches above incidental substrings like timestamps, expose safe part-number fields through the MCP result payload, and allow customer-shareable engineering deliverables in the source-file MCP profile path while keeping blocked doc types enforced.

Validation: python3 -m unittest discover -v; python3 -m py_compile obsidian_wiki/file_assets.py obsidian_wiki/mcp_assets.py tests/test_file_assets.py tests/test_mcp_assets.py; git diff --check; rebuilt the configured bjd vault file index; verified HTTP MCP search_file_assets and asset resource read for 101049 图纸.
2026-07-05 13:32:05 +00:00
Codex 57b98f1979 feat: add file asset listing prompt
Expose list_file_assets so agents can browse allowed source files without relying on empty search queries.

Add a how_to_use_wiki_file_assets prompt to make the MCP purpose and workflow visible to clients that inspect prompts/resources before tools.
2026-07-05 12:25:36 +00:00
Codex a6ef696d84 refactor: rename file asset MCP service
Rename the Streamable HTTP MCP server and generated client config key from obsidian-wiki to wiki-file-assets so remote agents see the narrower file lookup purpose.

Keep existing tool names unchanged and cover the service name in tests.
2026-07-05 12:14:25 +00:00
Codex acff3c14db fix: make remote MCP service start reliably
Use the Python module entrypoint in the user service, prepare the MCP optional runtime before restart, and serve the configured vault path instead of the repo root.

Verify binary asset resources use an octet-stream MIME type and cover service vault resolution in tests.
2026-07-05 12:05:12 +00:00
Codex d543831b5e feat: print remote config on MCP service start
Make scripts/mcp_service.sh start create the token env file when missing, then start the user service and print the remote MCP URL, Authorization header, and client JSON.

Document the one-command startup flow and cover automatic token creation with tests.
2026-07-05 11:44:24 +00:00
Codex baa8c0beae refactor: consolidate MCP service scripts
Replace per-command shell wrappers with a single scripts/mcp_service.sh entrypoint that forwards subcommands to manage_mcp_service.py.

Update docs and tests so remote MCP service management stays on the consolidated command surface.
2026-07-05 11:38:49 +00:00
Codex 31b0e8dba2 feat: support remote MCP asset server
Add Streamable HTTP transport for the source-file MCP server with bearer-token auth, configurable HTTP runtime options, and user-level systemd service helpers.

Document remote client setup and cover auth/service behavior with unit tests.
2026-07-05 11:30:42 +00:00
nac 76a480a0b7 feat(mcp): serve safe source file assets
Add a stdio MCP server for searching and reading safe engineering source files from the wiki file asset index.

The implementation uses registry-backed ACL checks, engineering-file whitelisting, asset:// resource URIs, read-only SQLite access, CLI entrypoints, optional MCP packaging, and unittest coverage for search, metadata, resource reads, blocked sources, bot ACLs, and size limits.

Validation: python3 -m unittest discover -v; python3 -m py_compile obsidian_wiki/config.py obsidian_wiki/file_assets.py obsidian_wiki/mcp_assets.py obsidian_wiki/mcp_server.py obsidian_wiki/cli.py tests/test_mcp_assets.py; real BJD vault search/read smoke tests.
2026-07-05 11:10:41 +00:00