kontexta 5.2.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/standalone/CHANGELOG.md +52 -0
- package/bundle/standalone/apps/web/.next/BUILD_ID +1 -1
- package/bundle/standalone/apps/web/.next/app-build-manifest.json +42 -42
- package/bundle/standalone/apps/web/.next/app-path-routes-manifest.json +10 -10
- package/bundle/standalone/apps/web/.next/build-manifest.json +2 -2
- package/bundle/standalone/apps/web/.next/prerender-manifest.json +16 -16
- package/bundle/standalone/apps/web/.next/required-server-files.json +1 -0
- package/bundle/standalone/apps/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/_not-found.html +1 -1
- package/bundle/standalone/apps/web/.next/server/app/_not-found.rsc +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/about/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/about/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/agents/[id]/hooks/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/agents/[id]/hooks/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/agents/[id]/mcp/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/agents/[id]/mcp/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/agents/[id]/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/agents/[id]/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/agents/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/agents/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/auth/login/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/auth/setup/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/auth/setup/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/auth/status/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/auth/token/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/auth/token/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/conflicts/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/conflicts/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/entities/[id]/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/entities/[id]/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/entities/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/entities/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/events/[id]/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/events/[id]/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/events/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/events/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/ics/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/ics/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/links/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/links/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/settings/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/settings/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/clip/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/clip/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/docker-config/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/docker-config/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/export/zip/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/export/zip/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/backlinks/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/backlinks/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/download/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/download/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/export-html/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/export-html/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/export-pdf/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/export-pdf/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/history/restore/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/history/restore/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/history/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/history/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/move/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/move/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/upload/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/files/upload/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/folders/route.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/folders/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/folders/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/git/remote/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/git/remote/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/git/sync-all/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/git/sync-all/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/hands/test-pattern/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/hands/test-pattern/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/hands/validate/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/hands/validate/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/health/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/install-snippets/route.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/install-snippets/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/install-snippets/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/mcp-tools/route.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/mcp-tools/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/mcp-tools/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/profile/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/profile/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/hands-config/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/hands-config/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/journal-config/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/journal-config/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/journal-status/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/journal-status/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/onboard/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/onboard/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/refresh/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/refresh/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/sync/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/sync/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/onboard/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/onboard/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/publish/html/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/publish/html/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/publish/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/publish/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/refresh/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/refresh/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/reindex/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/reindex/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/reports/resources/[name]/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/reports/resources/[name]/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/search/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/tags/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/version-check/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/version-check/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/welcome/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/welcome/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/ws-config/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/ws-config/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/apple-icon.png/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/calendar/page.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/calendar/page_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/favicon.ico/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/icon.png/route.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/login/page.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/page.js +4 -4
- package/bundle/standalone/apps/web/.next/server/app/page.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/preview/motifs/page.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/app/preview/motifs/page_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/preview/motifs.html +2 -2
- package/bundle/standalone/apps/web/.next/server/app/preview/motifs.rsc +1 -1
- package/bundle/standalone/apps/web/.next/server/app-paths-manifest.json +10 -10
- package/bundle/standalone/apps/web/.next/server/pages/404.html +1 -1
- package/bundle/standalone/apps/web/.next/server/pages/500.html +1 -1
- package/bundle/standalone/apps/web/.next/server/pages/_app.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/pages/_document.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/pages/_error.js.nft.json +1 -1
- package/bundle/standalone/apps/web/.next/server/server-reference-manifest.json +1 -1
- package/bundle/standalone/apps/web/.next/static/chunks/app/page-86e385abedf10ccd.js +1 -0
- package/bundle/standalone/apps/web/package.json +6 -5
- package/bundle/standalone/apps/web/server.js +1 -1
- package/bundle/standalone/apps/web/src/lib/mcp-tools.json +103 -95
- package/bundle/standalone/node_modules/kontexta-mcp/dist/agent-rules/rules-block.md +28 -185
- package/bundle/standalone/node_modules/kontexta-mcp/dist/agent-rules/rules-reference.md +207 -0
- package/bundle/standalone/node_modules/kontexta-mcp/dist/calendar-tools.js +12 -12
- package/bundle/standalone/node_modules/kontexta-mcp/dist/hands/formatter.js +1 -1
- package/bundle/standalone/node_modules/kontexta-mcp/dist/hands/schema-doc.js +1 -1
- package/bundle/standalone/node_modules/kontexta-mcp/dist/index.js +196 -68
- package/bundle/standalone/node_modules/kontexta-mcp/dist/index.js.map +1 -1
- package/bundle/standalone/node_modules/kontexta-mcp/dist/journal-capture.js +3 -3
- package/bundle/standalone/node_modules/kontexta-mcp/dist/journal-commit-upgrades-tool.js +1 -1
- package/bundle/standalone/node_modules/kontexta-mcp/dist/journal-housekeep-tool.js +1 -1
- package/bundle/standalone/node_modules/kontexta-mcp/dist/journal-tools.js +2 -2
- package/bundle/standalone/node_modules/kontexta-mcp/dist/repo-write-guard.js +1 -1
- package/bundle/standalone/node_modules/kontexta-mcp/package.json +4 -2
- package/bundle/standalone/node_modules/kxta-core/dist/agent-rules/index.d.ts +5 -0
- package/bundle/standalone/node_modules/kxta-core/dist/agent-rules/index.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/agent-rules/index.js +84 -25
- package/bundle/standalone/node_modules/kxta-core/dist/agent-rules/index.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/agent-rules/rules-block.md +28 -185
- package/bundle/standalone/node_modules/kxta-core/dist/agent-rules/rules-reference.md +207 -0
- package/bundle/standalone/node_modules/kxta-core/dist/bundle/index.d.ts +25 -1
- package/bundle/standalone/node_modules/kxta-core/dist/bundle/index.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/bundle/index.js +159 -32
- package/bundle/standalone/node_modules/kxta-core/dist/bundle/index.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/decision/engine.d.ts +71 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/engine.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/engine.js +192 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/engine.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/index.d.ts +9 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/index.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/index.js +10 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/index.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/intent-router.d.ts +20 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/intent-router.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/intent-router.js +124 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/intent-router.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/pruning.d.ts +20 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/pruning.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/pruning.js +28 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/pruning.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/sufficiency.d.ts +30 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/sufficiency.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/sufficiency.js +57 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/sufficiency.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/types.d.ts +42 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/types.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/types.js +7 -0
- package/bundle/standalone/node_modules/kxta-core/dist/decision/types.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/files/index.d.ts +3 -1
- package/bundle/standalone/node_modules/kxta-core/dist/files/index.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/files/index.js +10 -1
- package/bundle/standalone/node_modules/kxta-core/dist/files/index.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/hooks/alerts.js +2 -2
- package/bundle/standalone/node_modules/kxta-core/dist/index.d.ts +4 -1
- package/bundle/standalone/node_modules/kxta-core/dist/index.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/index.js +4 -1
- package/bundle/standalone/node_modules/kxta-core/dist/index.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/inference/bundled.d.ts +3 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/bundled.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/bundled.js +27 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/bundled.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/cache-manager.d.ts +41 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/cache-manager.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/cache-manager.js +140 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/cache-manager.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/embeddings.d.ts +7 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/embeddings.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/embeddings.js +39 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/embeddings.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/index.d.ts +16 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/index.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/index.js +17 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/index.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/runtime.d.ts +132 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/runtime.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/runtime.js +312 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/runtime.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/types.d.ts +55 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/types.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/types.js +6 -0
- package/bundle/standalone/node_modules/kxta-core/dist/inference/types.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/distill.d.ts +6 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/distill.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/journal/distill.js +50 -7
- package/bundle/standalone/node_modules/kxta-core/dist/journal/distill.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/journal/event-triage.d.ts +12 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/event-triage.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/event-triage.js +190 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/event-triage.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/high-water.d.ts +2 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/high-water.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/journal/high-water.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/journal/index.d.ts +5 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/index.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/journal/index.js +3 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/index.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/journal/intelligence-config.d.ts +10 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/intelligence-config.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/intelligence-config.js +22 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/intelligence-config.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/refactor.js +2 -2
- package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/refactor.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/tagging-pass.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/tagging-pass.js +5 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/tagging-pass.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/tool-classes.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/tool-classes.js +30 -5
- package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/tool-classes.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/journal/pivot.d.ts +21 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/pivot.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/pivot.js +90 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/pivot.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/renderer.d.ts +2 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/renderer.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/journal/renderer.js +17 -5
- package/bundle/standalone/node_modules/kxta-core/dist/journal/renderer.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/journal/strict-mode.js +2 -2
- package/bundle/standalone/node_modules/kxta-core/dist/journal/topic-detector.d.ts +17 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/topic-detector.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/journal/topic-detector.js +77 -9
- package/bundle/standalone/node_modules/kxta-core/dist/journal/topic-detector.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/journal/types.d.ts +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/journal/types.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/mcp-install/tools.generated.js +58 -58
- package/bundle/standalone/node_modules/kxta-core/dist/metadata/index.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/metadata/index.js +10 -1
- package/bundle/standalone/node_modules/kxta-core/dist/metadata/index.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/project-map/index.js +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/arbitrator.d.ts +29 -0
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/arbitrator.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/arbitrator.js +68 -0
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/arbitrator.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/engine.d.ts +57 -0
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/engine.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/engine.js +199 -0
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/engine.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/index.d.ts +7 -0
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/index.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/index.js +8 -0
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/index.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/types.d.ts +50 -0
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/types.d.ts.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/types.js +2 -0
- package/bundle/standalone/node_modules/kxta-core/dist/rerank/types.js.map +1 -0
- package/bundle/standalone/node_modules/kxta-core/dist/types.d.ts +5 -0
- package/bundle/standalone/node_modules/kxta-core/dist/types.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/util/paths.js +1 -1
- package/bundle/standalone/node_modules/kxta-core/package.json +4 -2
- package/bundle/standalone/node_modules/kxta-publish/package.json +3 -3
- package/bundle/standalone/package.json +3 -2
- package/package.json +5 -3
- package/bundle/standalone/apps/web/.next/static/chunks/app/page-df34c386b7c150bb.js +0 -1
- /package/bundle/standalone/apps/web/.next/static/{yyj-uK2RH8Rffeq9wVzjU → 0ZL7PJwYf_7ZTTXE_AM0S}/_buildManifest.js +0 -0
- /package/bundle/standalone/apps/web/.next/static/{yyj-uK2RH8Rffeq9wVzjU → 0ZL7PJwYf_7ZTTXE_AM0S}/_ssgManifest.js +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
import { createFile, readFile, updateFile, deleteFile, listFiles, addTags, removeTags, setFavorite, search, FtsQueryError, registerProject, discoverFiles, refreshIndex, listTags, listProjects, syncBackup, bundleSearch, estimateTokensFromBuffer, clipUrl, ClipError, getHistory, getDiff, getDatabase, findRelated, whatsNew, projectMap, getTagsForFiles, restoreVersion, parseOutline, findSection, replaceSection, listProjectFolders, createFolder, deleteFolder, moveFile, detectAgentContextFiles, assertPathInside, syncAgentRules, checkAgentRulesStatus, RULE_BLOCK_VERSION, gracefulShutdown, startDistillEngine, writeResource, listResources, deleteResource, syncAgentRows, } from "kxta-core";
|
|
5
|
+
import { createFile, readFile, updateFile, deleteFile, listFiles, addTags, removeTags, setFavorite, search, FtsQueryError, registerProject, discoverFiles, refreshIndex, listTags, listProjects, syncBackup, bundleSearch, estimateTokensFromBuffer, clipUrl, ClipError, getHistory, getDiff, getDatabase, findRelated, whatsNew, projectMap, getTagsForFiles, restoreVersion, parseOutline, findSection, replaceSection, listProjectFolders, createFolder, deleteFolder, moveFile, detectAgentContextFiles, assertPathInside, syncAgentRules, checkAgentRulesStatus, RULE_BLOCK_VERSION, gracefulShutdown, startDistillEngine, writeResource, listResources, deleteResource, syncAgentRows, getAllStatuses, rerankCandidates, arbitrateCandidates, setInferenceDevice, setModelCacheDirOverride, rerankEngine, } from "kxta-core";
|
|
6
6
|
import RE2Class from "./re2-compat.js";
|
|
7
7
|
import { isAbsolute, join, relative, resolve, sep, dirname } from "node:path";
|
|
8
8
|
import { statSync, lstatSync, openSync, readSync, closeSync, readFileSync, existsSync, realpathSync } from "node:fs";
|
|
@@ -23,6 +23,44 @@ import { handleGetProfile } from "./profile-tool.js";
|
|
|
23
23
|
import { getDataDir, profileRelPath, getEmptySections, listEvents, findConflicts, getEntity } from "kxta-core";
|
|
24
24
|
const dataDir = getDataDir();
|
|
25
25
|
const PROJECT_TOKEN_WARN_THRESHOLD = Number(process.env.KONTEXTA_PROJECT_TOKEN_WARN ?? 100_000);
|
|
26
|
+
let _kontextaConfigCache = null;
|
|
27
|
+
function readKontextaConfig() {
|
|
28
|
+
const now = Date.now();
|
|
29
|
+
if (_kontextaConfigCache && now - _kontextaConfigCache.ts < 5000) {
|
|
30
|
+
return _kontextaConfigCache.config;
|
|
31
|
+
}
|
|
32
|
+
const paths = [
|
|
33
|
+
`${getDataDir()}/kontexta.json`,
|
|
34
|
+
`${process.cwd()}/kontexta.json`,
|
|
35
|
+
];
|
|
36
|
+
let config = {};
|
|
37
|
+
for (const p of paths) {
|
|
38
|
+
if (existsSync(p)) {
|
|
39
|
+
try {
|
|
40
|
+
config = JSON.parse(readFileSync(p, "utf8"));
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
catch { }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
_kontextaConfigCache = { config, ts: now };
|
|
47
|
+
return config;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Apply system1 device/cache_dir config to the inference runtime.
|
|
51
|
+
* Idempotent: safe to call on every read since the setters are cheap.
|
|
52
|
+
*/
|
|
53
|
+
function applySystem1Config() {
|
|
54
|
+
const cfg = readKontextaConfig();
|
|
55
|
+
const device = cfg.system1?.device;
|
|
56
|
+
if (device) {
|
|
57
|
+
setInferenceDevice(device === "auto" ? null : device);
|
|
58
|
+
}
|
|
59
|
+
const cacheDir = cfg.system1?.cache_dir;
|
|
60
|
+
if (cacheDir) {
|
|
61
|
+
setModelCacheDirOverride(resolve(process.cwd(), cacheDir));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
26
64
|
function getAgentRulesWarning(projectId) {
|
|
27
65
|
try {
|
|
28
66
|
const db = getDatabase();
|
|
@@ -39,9 +77,9 @@ function getAgentRulesWarning(projectId) {
|
|
|
39
77
|
}
|
|
40
78
|
// Projects with zero detected context files have NEVER been onboarded,
|
|
41
79
|
// distinct from "outdated" (a file exists but predates the current
|
|
42
|
-
// rulesVersion). Both need
|
|
80
|
+
// rulesVersion). Both need admin_onboard_agent, so both are surfaced
|
|
43
81
|
// here; without this, a project that skipped its one-shot
|
|
44
|
-
//
|
|
82
|
+
// projects_register nudge would never get flagged again.
|
|
45
83
|
const missingProjects = [];
|
|
46
84
|
const outdatedProjects = [];
|
|
47
85
|
for (const p of projects) {
|
|
@@ -72,7 +110,7 @@ function getAgentRulesWarning(projectId) {
|
|
|
72
110
|
}
|
|
73
111
|
if (sentences.length === 0)
|
|
74
112
|
return null;
|
|
75
|
-
sentences.push("Run
|
|
113
|
+
sentences.push("Run admin_onboard_agent to fix.");
|
|
76
114
|
return sentences.join(" ");
|
|
77
115
|
}
|
|
78
116
|
catch (e) {
|
|
@@ -165,7 +203,7 @@ if (!pkgVersionFound) {
|
|
|
165
203
|
function resolveKindFolder({ destination, folder, kind, format, title }) {
|
|
166
204
|
if (destination !== "knowledge") {
|
|
167
205
|
// HTML reports only make sense in the KB's html/ bucket (see
|
|
168
|
-
//
|
|
206
|
+
// resources_export_report): silently allowing destination='project'
|
|
169
207
|
// here means a report lands inside the user's own repo instead, with
|
|
170
208
|
// no error and no way to find it via the reports UI.
|
|
171
209
|
if (format === "html") {
|
|
@@ -289,10 +327,10 @@ function loadProfileInstructions() {
|
|
|
289
327
|
: `📋 PROFILE\n (not set up yet, nudge the user to fill it in at knowledge/profile.md or the dashboard's profile pane)`;
|
|
290
328
|
const calendarBlock = buildCalendarSection(now);
|
|
291
329
|
const freshness = profileExists ? profileFreshnessNote(path, empty) : "";
|
|
292
|
-
// Recurring nudge:
|
|
330
|
+
// Recurring nudge: projects_register's onboarding prompt fires once, at
|
|
293
331
|
// register time; if the calling agent doesn't relay it in the moment
|
|
294
332
|
// there was previously no second chance to see it. Surfacing it here
|
|
295
|
-
// means it comes back every session until
|
|
333
|
+
// means it comes back every session until admin_onboard_agent is run.
|
|
296
334
|
const rulesWarning = getAgentRulesWarning();
|
|
297
335
|
const rulesBlock = rulesWarning ? `\n⚠️ ${rulesWarning}` : "";
|
|
298
336
|
const hooksNudge = currentHooksBlock(pkgVersion)?.prompt;
|
|
@@ -300,7 +338,7 @@ function loadProfileInstructions() {
|
|
|
300
338
|
return [header, "", profileBlock, "", calendarBlock, freshness, rulesBlock, hooksLine].filter(Boolean).join("\n");
|
|
301
339
|
}
|
|
302
340
|
const server = new McpServer({ name: "kontexta", version: pkgVersion }, { instructions: loadProfileInstructions() });
|
|
303
|
-
server.tool("
|
|
341
|
+
server.tool("admin_refresh_session_context", "Re-read the session context (profile, upcoming events within 7d, conflicts, freshness nudge) as it stands NOW. Call this when the user just edited their profile or added/moved calendar events and you want the current picture instead of the snapshot taken at session start. Read-only; no side effects. Returns the same block Kontexta sent as MCP instructions at session start.", {}, async () => ({
|
|
304
342
|
content: [{ type: "text", text: loadProfileInstructions() ?? "(no session context available)" }],
|
|
305
343
|
}));
|
|
306
344
|
const handsRegistry = new HandsRegistry(server);
|
|
@@ -358,12 +396,12 @@ process.on("SIGTERM", () => { if (!_shutdownInFlight) {
|
|
|
358
396
|
_shutdownInFlight = true;
|
|
359
397
|
void handleShutdownSignal("SIGTERM");
|
|
360
398
|
} });
|
|
361
|
-
// Auto-wrap every tool registration that follows.
|
|
362
|
-
// because the auto-wrap re-enters journal recording, and
|
|
399
|
+
// Auto-wrap every tool registration that follows. journal_write is excluded
|
|
400
|
+
// because the auto-wrap re-enters journal recording, and journal_write itself
|
|
363
401
|
// records journal events: including it would loop.
|
|
364
402
|
const _origServerTool = server.tool.bind(server);
|
|
365
403
|
server.tool = function (name, ...rest) {
|
|
366
|
-
if (name === "
|
|
404
|
+
if (name === "journal_write") {
|
|
367
405
|
return _origServerTool(name, ...rest);
|
|
368
406
|
}
|
|
369
407
|
const handler = rest[rest.length - 1];
|
|
@@ -374,7 +412,7 @@ server.tool = function (name, ...rest) {
|
|
|
374
412
|
};
|
|
375
413
|
// Excluded from wrapHandler (see above) so it does NOT get the
|
|
376
414
|
// journal-backlog envelope injected: it IS the journal write path.
|
|
377
|
-
server.tool("
|
|
415
|
+
server.tool("journal_write", "Write one event to the current project's journal. `kind: 'append'` = timestamped entry in today's daily journal file in the Knowledge Base (creates the file if it doesn't exist; both calls on the same calendar day return the same file_id; returns `{file_id}`). `kind: 'note'` = free-form decision/abandonment/observation, stored as an `agent_note` event in Layer 1 (surfaces in distilled task entries; returns `{ok, recorded_at}`). `kind: 'intent'` = topic/intent pivot, use when the user redirects what you're working on so the distillation step splits task buckets correctly (returns `{ok, recorded_at}`). Required fields depend on `kind`: 'append'/'note' need `text`; 'intent' needs `summary`.", {
|
|
378
416
|
kind: z.enum(["append", "note", "intent"]).describe("Event kind. Selects which body fields are required and how the event is stored."),
|
|
379
417
|
text: z.string().optional().describe("Required for kind='append' or kind='note'. Body of the entry."),
|
|
380
418
|
summary: z.string().optional().describe("Required for kind='intent'. One-line summary of the new intent."),
|
|
@@ -458,7 +496,7 @@ server.tool("journal.write", "Write one event to the current project's journal.
|
|
|
458
496
|
appendVoluntaryEvent(ev);
|
|
459
497
|
return { content: [{ type: "text", text: JSON.stringify({ ok: true, recorded_at: ev.ts }) }] };
|
|
460
498
|
});
|
|
461
|
-
server.tool("
|
|
499
|
+
server.tool("files_create", "Create one or more markdown, mermaid, or HTML files in the knowledge base or project (up to 200 per call). Pass a single-element `files` array for the one-file case. This operation writes each file to disk and adds it to the local SQLite FTS5 index. Destination is 'knowledge' (global KB) or 'kontexta' (internal Kontexta schema file, project_id required). 'project' is REFUSED: nothing created through kxta is written into a project repo. If destination is 'knowledge', 'kind' is strictly required for md files, pick 'dictionary' (authoritative source-of-truth) or 'note' (informational snapshot); see the kind param for the rubric. No external auth required. Rate limits do not apply (local operation). Per-item failures are isolated to `errors[]`, the rest of the batch still commits; a single-item call still reports its failure the same way. Returns `{created_count, error_count, created, errors}`. If a destination directory does not exist, it will be created automatically. To modify an existing file, use 'files_update' instead. Pass format='mmd' on an item to create a Mermaid diagram file (.mmd), for destination='knowledge' it's auto-routed to the KB's `mermaid/` bucket (`kind` ignored, not required); Pass format='html' for an HTML report, `destination` MUST be 'knowledge' (html reports are auto-routed to the KB's `html/` bucket; `kind` is ignored and not required for html). Format defaults to 'md'.", {
|
|
462
500
|
files: z
|
|
463
501
|
.array(z.object({
|
|
464
502
|
title: z.string().describe("Title of the file"),
|
|
@@ -518,22 +556,22 @@ server.tool("files.create", "Create one or more markdown, mermaid, or HTML files
|
|
|
518
556
|
],
|
|
519
557
|
};
|
|
520
558
|
});
|
|
521
|
-
server.tool("
|
|
559
|
+
server.tool("resources_add_report", "Write an image or other binary resource into the shared reports/resources/ folder. Returns { filename, size, src, url }: embed the report's <img>/<a> tags with `src` exactly as given (e.g. `<img src=\"resources/chart.png\">`); it is the only form that resolves correctly both in the dashboard viewer and in PDF/PNG export. Do not use `url` inside report HTML: it only works in the dashboard. Bytes are passed base64-encoded.", {
|
|
522
560
|
filename: z.string().describe("Requested filename with extension"),
|
|
523
561
|
bytes_base64: z.string().describe("Base64-encoded file bytes"),
|
|
524
562
|
}, async ({ filename, bytes_base64 }) => {
|
|
525
563
|
const info = writeResource(dataDir, filename, Buffer.from(bytes_base64, "base64"));
|
|
526
564
|
return { content: [{ type: "text", text: JSON.stringify(info, null, 2) }] };
|
|
527
565
|
});
|
|
528
|
-
server.tool("
|
|
566
|
+
server.tool("resources_list_reports", "List all files currently stored under reports/resources/. Returns filename, size in bytes, and served URL.", {}, async () => {
|
|
529
567
|
const items = listResources(dataDir);
|
|
530
568
|
return { content: [{ type: "text", text: JSON.stringify(items, null, 2) }] };
|
|
531
569
|
});
|
|
532
|
-
server.tool("
|
|
570
|
+
server.tool("resources_delete_report", "Delete a file from reports/resources/. No-op if it doesn't exist.", { filename: z.string().describe("Filename (relative) of the resource to delete from reports/resources/.") }, async ({ filename }) => {
|
|
533
571
|
deleteResource(dataDir, filename);
|
|
534
572
|
return { content: [{ type: "text", text: JSON.stringify({ ok: true, filename }, null, 2) }] };
|
|
535
573
|
});
|
|
536
|
-
server.tool("
|
|
574
|
+
server.tool("resources_export_report", "Export an existing HTML report as PDF or PNG. Returns { url } for the web-served download (requires an authenticated dashboard request) by default. Set inline_bytes=true to render in-process and get { bytes_base64 } instead: only available when running via the full `kontexta` CLI, not the standalone kontexta-mcp package; falls back to { url } with a note if unavailable.", {
|
|
537
575
|
id: z.number().describe("File ID of the HTML report to export."),
|
|
538
576
|
format: z.enum(["pdf", "png"]).default("pdf").describe("Output format: 'pdf' or 'png'."),
|
|
539
577
|
inline_bytes: z.boolean().optional().default(false).describe("If true, render in-process and return raw bytes (base64). Only available in the full kontexta CLI bundle; falls back to {url} otherwise."),
|
|
@@ -556,7 +594,7 @@ server.tool("resources.export_report", "Export an existing HTML report as PDF or
|
|
|
556
594
|
return { content: [{ type: "text", text: JSON.stringify({ url, note: `inline_bytes unavailable in this install: ${e?.message ?? String(e)}` }, null, 2) }] };
|
|
557
595
|
}
|
|
558
596
|
});
|
|
559
|
-
server.tool("
|
|
597
|
+
server.tool("files_read", "Read one or more files, in full or in part. Modes: single-by-id (`id`), single-by-path (`path`, absolute on-disk path, must be exactly as indexed), batch-by-id (`ids`, up to 200), partial-by-heading (`id`+`section`), partial-by-line-range (`id`+`lines`). Exactly one of `id`/`path`/`ids` is required. `section` and `lines` are mutually exclusive and only valid with `id` (not `ids` or `path`). Read-only; no side effects, auth, or rate limits. Response shape: a single file object (with `content`, tags, est_tokens) for `id`/`path`; a partial-content object for `section`/`lines`; `{files, total_est_tokens, error_count, errors}` for `ids` (per-ID failures isolated, batch never partial-throws). Prefer `files_describe` to inspect without paying body tokens.", {
|
|
560
598
|
id: z.number().int().positive().optional().describe("Single file by ID."),
|
|
561
599
|
path: z.string().optional().describe("Single file by absolute on-disk path (must match exactly what Kontexta indexed)."),
|
|
562
600
|
ids: z.array(z.number()).min(1).max(200).optional().describe("Batch mode: multiple file IDs (max 200 per call); returns an array plus aggregate token cost."),
|
|
@@ -653,7 +691,7 @@ server.tool("files.read", "Read one or more files, in full or in part. Modes: si
|
|
|
653
691
|
};
|
|
654
692
|
}
|
|
655
693
|
});
|
|
656
|
-
server.tool("
|
|
694
|
+
server.tool("files_describe", "Return everything ABOUT a file without pulling its content (no token cost from the body). Tags, size, est_tokens, history depth, related-file ids, backlinks, project, folder, last edited. Operates locally with no auth or rate limits. Use this when you'd otherwise chain files_read + tags_list + files_get_history + files_find_related just to decide whether to actually read the file. Parameters: 'id' must be a valid integer file ID.", {
|
|
657
695
|
id: z.number().describe("File ID"),
|
|
658
696
|
}, async ({ id }) => {
|
|
659
697
|
try {
|
|
@@ -773,7 +811,7 @@ server.tool("files.describe", "Return everything ABOUT a file without pulling it
|
|
|
773
811
|
};
|
|
774
812
|
}
|
|
775
813
|
});
|
|
776
|
-
server.tool("
|
|
814
|
+
server.tool("files_regex_search", "Match a JS regex against file bodies. Default mode scans every file in scope (project, KB, or all) and returns per-file hits with line numbers: slower than FTS `files_search` because it reads each file's content; use only when FTS misses substrings, URLs, or code identifiers. Pass `file_id` to instead scan just that one file (catches what FTS misses within a single known file); response shape changes to `{file_id, path, pattern, match_count, truncated, matches}`. Read-only; no side effects, auth, or rate limits. Multi-file mode capped at 500 files / 10 hits per file by default (`files_truncated` reports the cap); single-file mode capped at 100 hits by default, max 500. `project_id`/`kind` are ignored when `file_id` is set. Invalid regex throws.", {
|
|
777
815
|
pattern: z.string().describe("JavaScript RegExp source"),
|
|
778
816
|
file_id: z.number().optional().describe("Scan only this file instead of every file in scope. When set, `project_id`/`kind`/`max_files`/`max_matches_per_file` are ignored in favor of `max_matches`."),
|
|
779
817
|
project_id: z.number().nullable().optional().describe("Scope to one project, null for KB-only, omit for everything. Ignored when `file_id` is set."),
|
|
@@ -887,7 +925,7 @@ server.tool("files.regex_search", "Match a JS regex against file bodies. Default
|
|
|
887
925
|
};
|
|
888
926
|
}
|
|
889
927
|
});
|
|
890
|
-
server.tool("
|
|
928
|
+
server.tool("files_update", "Rewrite a KB file (project-repo files are refused: kxta never writes into a repo). Default = full-body replacement: `content` becomes the entire file, triggering disk write + FTS5 re-index. Pass `section` to instead rewrite ONLY that heading's body (case-insensitive exact-string after trim; the heading line itself is preserved, siblings untouched), saves context budget vs resending the whole file. Throws if `section` is set but the heading doesn't exist (this mode will NOT create a new section, append the section text via a full-body update first). Operates locally with no external auth or rate limits. Returns the updated file metadata including new estimated token counts.", {
|
|
891
929
|
id: z.number().describe("File ID"),
|
|
892
930
|
content: z.string().describe("New content. With `section` set, this replaces just that heading's body; otherwise it becomes the entire file body."),
|
|
893
931
|
section: z.string().optional().describe("Case-insensitive exact-string heading. When set, only this heading's body is rewritten instead of the whole file."),
|
|
@@ -913,7 +951,7 @@ server.tool("files.update", "Rewrite a KB file (project-repo files are refused:
|
|
|
913
951
|
};
|
|
914
952
|
}
|
|
915
953
|
});
|
|
916
|
-
server.tool("
|
|
954
|
+
server.tool("files_delete", "DESTRUCTIVE. Permanently delete one or more files by ID (up to 500 per call). Pass a single-element `ids` array for the one-file case. KB files are unlinked from disk AND removed from the FTS5 index; project reference files only have their index entry removed (the file on disk is left alone so the watcher does not fight your editor). Not idempotent: deleting an unknown ID surfaces as a per-item error. No external auth or rate limits. Per-ID failures are isolated to `errors[]` and the rest of the batch still commits: partial success is the norm, always inspect `error_count`. Returns `{deleted_count, error_count, deleted, errors}`. Use only when the file is truly obsolete; to deprioritise without losing data, untag (`tags_remove`) or unfavorite (`tags_set_favorite`) instead. To preview the set before deleting, run `files_list` with the same filter and confirm the IDs.", {
|
|
917
955
|
ids: z.array(z.number()).min(1).max(500).describe("File IDs to delete. Single-element array = one-file case. Max 500 per call."),
|
|
918
956
|
}, async ({ ids }) => {
|
|
919
957
|
const deleted = [];
|
|
@@ -936,7 +974,7 @@ server.tool("files.delete", "DESTRUCTIVE. Permanently delete one or more files b
|
|
|
936
974
|
],
|
|
937
975
|
};
|
|
938
976
|
});
|
|
939
|
-
server.tool("
|
|
977
|
+
server.tool("files_list", "List file metadata with optional filters (project_id, tag, favorite, folder, untagged, kind) and pagination. Read-only; no side effects, auth, or rate limits. Each row is annotated with tags, est_tokens, size_bytes, and content_class; the response includes `total_est_tokens` so you can budget before reading bodies. `project_id: null` returns ONLY Knowledge Base files; omit the field to span everything; `kind` narrows to one content class. Use to browse known structure; for keyword/content lookup use `files_search`; for a denser whole-vault dump use `projects_map`.", {
|
|
940
978
|
project_id: z.number().nullable().optional().describe("Filter by project ID. Pass null to list ONLY Knowledge Base files (project_id IS NULL)."),
|
|
941
979
|
tag: z.string().optional().describe("Filter by tag name"),
|
|
942
980
|
favorite: z.boolean().optional().describe("Filter by favorite status"),
|
|
@@ -971,7 +1009,7 @@ server.tool("files.list", "List file metadata with optional filters (project_id,
|
|
|
971
1009
|
content: [{ type: "text", text: JSON.stringify({ files: annotated, total_est_tokens }, null, 2) }],
|
|
972
1010
|
};
|
|
973
1011
|
});
|
|
974
|
-
server.tool("
|
|
1012
|
+
server.tool("files_search", "Full-text (SQLite FTS5) keyword search across files. Default mode returns ranked matches with inline match_excerpt and title_highlight (no follow-up `files_read` needed for snippets) plus tags, est_tokens, size_bytes, content_class, and aggregate `total_est_tokens`. Pass `include_bodies: true` to instead get a single prompt-ready bundle: matched bodies concatenated into XML `<document>` blocks or markdown headers + fences (see `format`/`max_tokens`), capped at the token budget, files are added in rank order until the next would exceed it, the rest going to `meta.skipped[]`. Use `include_bodies` instead of `files_search` + N×`files_read` when you need several related files as one context blob. Read-only; no side effects, auth, or rate limits. Ordering: dictionary hits sort above everything else for the same query (dictionary-wins on conflict), then BM25 rank. FTS is tokenised: it WILL miss URLs, hyphenated terms, and partial substrings, fall back to `files_regex_search` for those. `project_id: null` searches only the KB; omit the field to span everything; `tags[]` requires ALL listed tags to match; `kind` narrows to one content class.", {
|
|
975
1013
|
query: z.string().describe("Search query"),
|
|
976
1014
|
project_id: z.number().nullable().optional().describe("Filter by project ID. Pass null to search ONLY Knowledge Base files."),
|
|
977
1015
|
tags: z.array(z.string()).optional().describe("Filter by tags (all must match)"),
|
|
@@ -980,8 +1018,10 @@ server.tool("files.search", "Full-text (SQLite FTS5) keyword search across files
|
|
|
980
1018
|
.describe("Filter by content class. dictionary = authoritative KB (system IDs, mappings, glossaries), note = informational KB, journal = time-log, project = project file. Omit to see all classes with dictionary-first ordering."),
|
|
981
1019
|
include_bodies: z.boolean().optional().describe("If true, return a single prompt-ready bundle of matched bodies instead of a match list. Response shape changes to `{bundle, meta: {included, skipped, ...}}`. Default false."),
|
|
982
1020
|
format: z.enum(["xml", "markdown"]).optional().describe("Bundle format when `include_bodies` is true. xml = Anthropic-recommended <document> tags (default); markdown = ## headers + fenced blocks. Ignored otherwise."),
|
|
983
|
-
max_tokens: z.number().int().positive().optional().describe("Token budget when `include_bodies` is true (default
|
|
984
|
-
|
|
1021
|
+
max_tokens: z.number().int().positive().optional().describe("Token budget when `include_bodies` is true (default 12000). Files added in rank order until the next would exceed; remainder go to `meta.skipped[]`. Ignored otherwise."),
|
|
1022
|
+
rerank: z.boolean().optional().describe("When true, rerank search matches using local cross-encoder neural model and soft content-class arbitration. Defaults to kontexta.json search.rerank.enabled (or true if model available)."),
|
|
1023
|
+
check_sufficiency: z.boolean().optional().describe("When include_bodies is true, evaluate retrieval sufficiency with non-autoregressive decision model. Default true."),
|
|
1024
|
+
}, async ({ query, project_id, tags, favorite, kind, include_bodies, format, max_tokens, rerank, check_sufficiency }) => {
|
|
985
1025
|
const filters = { query };
|
|
986
1026
|
if (project_id !== undefined)
|
|
987
1027
|
filters.project_id = project_id;
|
|
@@ -991,10 +1031,30 @@ server.tool("files.search", "Full-text (SQLite FTS5) keyword search across files
|
|
|
991
1031
|
filters.favorite = favorite;
|
|
992
1032
|
if (kind !== undefined)
|
|
993
1033
|
filters.content_class = kind;
|
|
1034
|
+
const cfg = readKontextaConfig();
|
|
1035
|
+
applySystem1Config();
|
|
1036
|
+
const shouldRerank = rerank ?? cfg.search?.rerank?.enabled ?? true;
|
|
1037
|
+
const shouldCheckSufficiency = check_sufficiency ?? cfg.search?.verdicts?.sufficiency_check ?? true;
|
|
1038
|
+
const candidateLimit = cfg.search?.rerank?.candidate_limit ?? 30;
|
|
1039
|
+
const dictionaryBoost = cfg.search?.rerank?.dictionary_boost;
|
|
1040
|
+
const relevanceFloor = cfg.search?.verdicts?.relevance_floor;
|
|
1041
|
+
const rerankModel = cfg.search?.rerank?.model;
|
|
1042
|
+
const rerankTimeoutMs = cfg.search?.rerank?.timeout_ms;
|
|
994
1043
|
if (include_bodies) {
|
|
995
1044
|
let bundleResult;
|
|
996
1045
|
try {
|
|
997
|
-
bundleResult = await bundleSearch(filters, {
|
|
1046
|
+
bundleResult = await bundleSearch(filters, {
|
|
1047
|
+
format: format ?? "xml",
|
|
1048
|
+
max_tokens: max_tokens ?? 12000,
|
|
1049
|
+
rerank: shouldRerank,
|
|
1050
|
+
check_sufficiency: shouldCheckSufficiency,
|
|
1051
|
+
candidate_limit: candidateLimit,
|
|
1052
|
+
dictionary_boost: dictionaryBoost,
|
|
1053
|
+
relevance_floor: relevanceFloor,
|
|
1054
|
+
intent_routing: cfg.search?.verdicts?.intent_routing,
|
|
1055
|
+
model: rerankModel,
|
|
1056
|
+
timeout_ms: rerankTimeoutMs,
|
|
1057
|
+
});
|
|
998
1058
|
}
|
|
999
1059
|
catch (e) {
|
|
1000
1060
|
if (e instanceof FtsQueryError) {
|
|
@@ -1007,8 +1067,66 @@ server.tool("files.search", "Full-text (SQLite FTS5) keyword search across files
|
|
|
1007
1067
|
};
|
|
1008
1068
|
}
|
|
1009
1069
|
let result;
|
|
1070
|
+
let rerankFallback = false;
|
|
1010
1071
|
try {
|
|
1011
|
-
|
|
1072
|
+
if (shouldRerank) {
|
|
1073
|
+
const rawHits = search({ ...filters, limit: candidateLimit, raw_bm25_order: true });
|
|
1074
|
+
if (rawHits.length > 1) {
|
|
1075
|
+
const candidates = rawHits.map((h) => {
|
|
1076
|
+
let content = "";
|
|
1077
|
+
try {
|
|
1078
|
+
content = readFile(h.id).content;
|
|
1079
|
+
}
|
|
1080
|
+
catch { }
|
|
1081
|
+
return {
|
|
1082
|
+
id: h.id,
|
|
1083
|
+
title: h.title,
|
|
1084
|
+
path: h.path,
|
|
1085
|
+
content,
|
|
1086
|
+
content_class: h.content_class ?? null,
|
|
1087
|
+
project_id: h.project_id ?? null,
|
|
1088
|
+
bm25_rank: h.rank,
|
|
1089
|
+
};
|
|
1090
|
+
});
|
|
1091
|
+
const scored = await rerankCandidates(filters.query, candidates, {
|
|
1092
|
+
model: rerankModel,
|
|
1093
|
+
timeout_ms: rerankTimeoutMs,
|
|
1094
|
+
candidate_limit: candidateLimit,
|
|
1095
|
+
dictionary_boost: dictionaryBoost,
|
|
1096
|
+
});
|
|
1097
|
+
if (scored && scored.length > 0) {
|
|
1098
|
+
let arbitrated = arbitrateCandidates(scored, { dictionary_boost: dictionaryBoost });
|
|
1099
|
+
// Apply the configured relevance floor (default 0.15) to the
|
|
1100
|
+
// reranked list. If the floor prunes everything, keep the full
|
|
1101
|
+
// ranked set rather than returning an empty result for a query
|
|
1102
|
+
// that clearly has matches.
|
|
1103
|
+
if (relevanceFloor !== undefined) {
|
|
1104
|
+
const kept = arbitrated.filter((a) => a.final_score >= relevanceFloor);
|
|
1105
|
+
if (kept.length > 0)
|
|
1106
|
+
arbitrated = kept;
|
|
1107
|
+
}
|
|
1108
|
+
const scoreMap = new Map(arbitrated.map((a) => [a.id, a.final_score]));
|
|
1109
|
+
rawHits.sort((a, b) => (scoreMap.get(b.id) ?? 0) - (scoreMap.get(a.id) ?? 0));
|
|
1110
|
+
result = rawHits.map((h) => ({
|
|
1111
|
+
...h,
|
|
1112
|
+
rerank_score: scoreMap.get(h.id),
|
|
1113
|
+
}));
|
|
1114
|
+
}
|
|
1115
|
+
else {
|
|
1116
|
+
// Reranker unavailable (model missing, timeout, or error):
|
|
1117
|
+
// fall back to the FULL legacy search so recall is not capped
|
|
1118
|
+
// at the candidate pool size.
|
|
1119
|
+
rerankFallback = true;
|
|
1120
|
+
result = search(filters);
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
else {
|
|
1124
|
+
result = rawHits;
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
else {
|
|
1128
|
+
result = search(filters);
|
|
1129
|
+
}
|
|
1012
1130
|
}
|
|
1013
1131
|
catch (e) {
|
|
1014
1132
|
if (e instanceof FtsQueryError) {
|
|
@@ -1019,10 +1137,10 @@ server.tool("files.search", "Full-text (SQLite FTS5) keyword search across files
|
|
|
1019
1137
|
const annotated = attachTags(result.map(annotateTokens));
|
|
1020
1138
|
const total_est_tokens = annotated.reduce((s, f) => s + (f.est_tokens ?? 0), 0);
|
|
1021
1139
|
return {
|
|
1022
|
-
content: [{ type: "text", text: JSON.stringify({ matches: annotated, total_est_tokens }, null, 2) }],
|
|
1140
|
+
content: [{ type: "text", text: JSON.stringify({ matches: annotated, total_est_tokens, ...(rerankFallback ? { rerank_fallback: true, note: "reranker unavailable; results in BM25 order" } : {}) }, null, 2) }],
|
|
1023
1141
|
};
|
|
1024
1142
|
});
|
|
1025
|
-
server.tool("
|
|
1143
|
+
server.tool("tags_add", "Append tags to ONE file. Additive: existing tags are preserved; re-adding an existing tag is a no-op (idempotent per tag). New tag names auto-create rows in the global `tags` table. Persists to local SQLite. No external auth or rate limits. Returns `{success: true}`; throws if file_id is unknown. Use to label a single file. To tag every file matching a query in one call use `tags_search`; to remove tags use `tags_remove`.", {
|
|
1026
1144
|
file_id: z.number().describe("File ID"),
|
|
1027
1145
|
tags: z.array(z.string()).describe("Array of tag names to add"),
|
|
1028
1146
|
}, async ({ file_id, tags }) => {
|
|
@@ -1031,7 +1149,7 @@ server.tool("tags.add", "Append tags to ONE file. Additive: existing tags are pr
|
|
|
1031
1149
|
content: [{ type: "text", text: JSON.stringify({ success: true }, null, 2) }],
|
|
1032
1150
|
};
|
|
1033
1151
|
});
|
|
1034
|
-
server.tool("
|
|
1152
|
+
server.tool("tags_remove", "Detach one or more tag IDs from ONE file. Destructive on the link only: does NOT delete the file or the global tag definition (orphan tags survive in `tags_list`). Idempotent: removing an already-absent tag is a no-op. No external auth or rate limits. Returns `{success: true}`. Note: takes tag IDs (integers), not names, fetch them via `tags_list`. To remove ALL tags from many files via a query, see `tags_search` (additive only), there is no bulk-untag-by-query tool.", {
|
|
1035
1153
|
file_id: z.number().describe("File ID"),
|
|
1036
1154
|
tag_ids: z.array(z.number()).describe("Array of tag IDs to remove"),
|
|
1037
1155
|
}, async ({ file_id, tag_ids }) => {
|
|
@@ -1040,7 +1158,7 @@ server.tool("tags.remove", "Detach one or more tag IDs from ONE file. Destructiv
|
|
|
1040
1158
|
content: [{ type: "text", text: JSON.stringify({ success: true }, null, 2) }],
|
|
1041
1159
|
};
|
|
1042
1160
|
});
|
|
1043
|
-
server.tool("
|
|
1161
|
+
server.tool("tags_set_favorite", "Set or clear the favorite flag on one file (idempotent: re-setting the same value is a no-op; not a toggle, you pass the desired state). Persists to local SQLite. No external auth or rate limits. Returns `{success: true}`. Use to curate quick-access pins; `files_list` / `files_search` accept `favorite: true` to filter to the pinned set.", {
|
|
1044
1162
|
file_id: z.number().describe("File ID"),
|
|
1045
1163
|
favorite: z.boolean().describe("Favorite status"),
|
|
1046
1164
|
}, async ({ file_id, favorite }) => {
|
|
@@ -1049,13 +1167,13 @@ server.tool("tags.set_favorite", "Set or clear the favorite flag on one file (id
|
|
|
1049
1167
|
content: [{ type: "text", text: JSON.stringify({ success: true }, null, 2) }],
|
|
1050
1168
|
};
|
|
1051
1169
|
});
|
|
1052
|
-
server.tool("
|
|
1170
|
+
server.tool("tags_list", "List every tag in the global SQLite database with id, name, and applied count. Read-only; no side effects, auth, or rate limits. Returns the entire taxonomy (not paginated). Use to discover existing labels before tagging (so you reuse rather than fork) or to find tag IDs to feed into `tags_remove`. For tags on a specific file, use `files_describe`.", {}, async () => {
|
|
1053
1171
|
const result = listTags();
|
|
1054
1172
|
return {
|
|
1055
1173
|
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
1056
1174
|
};
|
|
1057
1175
|
});
|
|
1058
|
-
server.tool("
|
|
1176
|
+
server.tool("projects_list", "List every registered project with id, name, absolute path, and a derived `has_hands` flag (true when the path exists on disk AND contains a `kontexta.json`). Read-only; no side effects, auth, or rate limits. Use to find the project_id to pass to scoped tools (`files_search`, `files_list`, `admin_commit_backup`, `projects_refresh_index`, etc.). To register a new project use `projects_register`; to inspect its Hands tools use `hands_list`.", {}, async () => {
|
|
1059
1177
|
const result = listProjects();
|
|
1060
1178
|
const augmented = result.map((p) => {
|
|
1061
1179
|
const has_hands = !!(p.path && existsSync(p.path) && existsSync(`${p.path}/kontexta.json`));
|
|
@@ -1075,7 +1193,7 @@ server.tool("projects.list", "List every registered project with id, name, absol
|
|
|
1075
1193
|
content: [{ type: "text", text: JSON.stringify(augmented, null, 2) }],
|
|
1076
1194
|
};
|
|
1077
1195
|
});
|
|
1078
|
-
server.tool("
|
|
1196
|
+
server.tool("projects_register", `Register a new project and link it to the Kontexta knowledge system.
|
|
1079
1197
|
|
|
1080
1198
|
SIDE EFFECTS: Writes project metadata to disk (persisted in the Kontexta data directory). Scans the project root recursively to discover and index all markdown files into the local database. Registers any kontexta.json-declared Hands tools found in the project root. This operation is idempotent, re-registering an existing project updates its metadata without data loss.
|
|
1081
1199
|
|
|
@@ -1139,7 +1257,7 @@ ERROR CONDITIONS: Returns isError=true if path is missing or unresolvable. Scan
|
|
|
1139
1257
|
recommendationReason =
|
|
1140
1258
|
`Your project's agent instructions file is out of date: it still references kontexta workflow rules from an older release. ` +
|
|
1141
1259
|
`Files needing an update: ${versions}. Latest rules version is v${RULE_BLOCK_VERSION}. ` +
|
|
1142
|
-
`Run
|
|
1260
|
+
`Run admin_onboard_agent to refresh the kontexta rules block in-place (your existing project content is preserved).`;
|
|
1143
1261
|
}
|
|
1144
1262
|
else {
|
|
1145
1263
|
recommendationReason =
|
|
@@ -1151,27 +1269,27 @@ ERROR CONDITIONS: Returns isError=true if path is missing or unresolvable. Scan
|
|
|
1151
1269
|
`No AI agent instructions file (e.g. CLAUDE.md, AGENTS.md, GEMINI.md, ANTIGRAVITY.md, .cursor/rules, .continue/rules, .aider/kontexta.md) was found in this project. ` +
|
|
1152
1270
|
`These files are how coding agents (Claude Code, Codex, Cursor, Gemini, Aider, etc.) load project-specific context at the start of every session. ` +
|
|
1153
1271
|
`Without one, your agent won't know this project is registered with kontexta and will skip the search/read/journal workflow: wasting tokens re-reading files it could have looked up. ` +
|
|
1154
|
-
`Run
|
|
1272
|
+
`Run admin_onboard_agent with target_agent set to your coding tool to scaffold the right file (CLAUDE.md for Claude Code, .aider/kontexta.md for Aider, etc.) pre-populated with kontexta workflow rules.`;
|
|
1155
1273
|
}
|
|
1156
1274
|
const needsOnboarding = outdated.length > 0 || detected.length === 0;
|
|
1157
1275
|
const recommendation = detected.length > 0
|
|
1158
1276
|
? {
|
|
1159
|
-
kind: "
|
|
1277
|
+
kind: "admin_onboard_agent",
|
|
1160
1278
|
mode: "update",
|
|
1161
1279
|
reason: recommendationReason,
|
|
1162
1280
|
target_files: detected,
|
|
1163
|
-
next_tool: "
|
|
1281
|
+
next_tool: "admin_onboard_agent",
|
|
1164
1282
|
next_args: { project_id: project.id },
|
|
1165
1283
|
prompt: outdated.length > 0
|
|
1166
1284
|
? `Update the kontexta rules block in ${detected.join(", ")} to v${RULE_BLOCK_VERSION} now? (Your existing project-specific content above/below the rules block will be left untouched.)`
|
|
1167
1285
|
: null,
|
|
1168
1286
|
}
|
|
1169
1287
|
: {
|
|
1170
|
-
kind: "
|
|
1288
|
+
kind: "admin_onboard_agent",
|
|
1171
1289
|
mode: "create",
|
|
1172
1290
|
reason: recommendationReason,
|
|
1173
1291
|
target_files: [],
|
|
1174
|
-
next_tool: "
|
|
1292
|
+
next_tool: "admin_onboard_agent",
|
|
1175
1293
|
next_args: {
|
|
1176
1294
|
project_id: project.id,
|
|
1177
1295
|
target_agent: "<pass your agent: claude-code | codex | gemini | antigravity | cursor | continue | aider | cline | copilot>",
|
|
@@ -1212,7 +1330,7 @@ ERROR CONDITIONS: Returns isError=true if path is missing or unresolvable. Scan
|
|
|
1212
1330
|
};
|
|
1213
1331
|
}
|
|
1214
1332
|
});
|
|
1215
|
-
server.tool("
|
|
1333
|
+
server.tool("admin_onboard_agent", `Write or update the kontexta workflow rules block in a project's agent context file(s). Idempotent: uses fenced markers + version to skip no-op writes.
|
|
1216
1334
|
|
|
1217
1335
|
MANDATORY: This tool modifies project configuration files. You MUST seek explicit user consent before calling this tool. Set 'confirm: true' only after the user has agreed.
|
|
1218
1336
|
|
|
@@ -1292,7 +1410,7 @@ RETURNS: { written: [{ path, action: created|updated|skipped, version }], skippe
|
|
|
1292
1410
|
};
|
|
1293
1411
|
}
|
|
1294
1412
|
});
|
|
1295
|
-
server.tool("
|
|
1413
|
+
server.tool("admin_transfer_agent_context", `COPY existing agent context files (CLAUDE.md, AGENTS.md, .cursor/rules/*.mdc, etc.) from a project's repo into Kontexta's per-project knowledge base so they're indexed by FTS5 and can be git-synced through Kontexta's own backup engine.
|
|
1296
1414
|
|
|
1297
1415
|
This tool ONLY COPIES. It never deletes or modifies the originals in your repo. After a successful transfer, the response includes the list of source paths so the user can manually remove them if desired. No tool argument, no flag, and no code path in this tool ever calls a destructive filesystem operation against \`project.path\`.
|
|
1298
1416
|
|
|
@@ -1427,7 +1545,7 @@ IDEMPOTENT: re-running with the same files copies nothing if the content is unch
|
|
|
1427
1545
|
};
|
|
1428
1546
|
}
|
|
1429
1547
|
});
|
|
1430
|
-
server.tool("
|
|
1548
|
+
server.tool("admin_commit_backup", "SIDE-EFFECTFUL: TOUCHES THE NETWORK. Sync the project's KB data into its git backup directory, create a commit, and `git push` to `origin`. AUTH: relies on the local user's git credentials (SSH agent, credential helper, etc.), there is no in-server auth. Kontexta does not rate-limit, but the remote may. Idempotent in steady state: a no-op commit is skipped, but the push still runs. Throws if the project has no configured backup repo or if push fails (network, auth, conflict). Returns `{success, copied_files_count, copied_paths}`. Use after a batch of KB writes to get changes off-machine.", {
|
|
1431
1549
|
project_id: z.number().describe("Project ID"),
|
|
1432
1550
|
}, async ({ project_id }) => {
|
|
1433
1551
|
try {
|
|
@@ -1452,7 +1570,7 @@ server.tool("admin.commit_backup", "SIDE-EFFECTFUL: TOUCHES THE NETWORK. Sync th
|
|
|
1452
1570
|
};
|
|
1453
1571
|
}
|
|
1454
1572
|
});
|
|
1455
|
-
server.tool("
|
|
1573
|
+
server.tool("resources_clip_url", "SIDE-EFFECTFUL: fetches an EXTERNAL URL and writes a NEW KB file. Downloads the page, extracts the main article via Readability, converts to markdown, and saves it under `knowledge/urlclips/`. Auto-classified as content_class='dictionary' (clipped external references are treated as authoritative reference material). NOT idempotent / no de-dup: re-clipping the same URL creates a second file. AUTH: anonymous by default; pass `headers` (e.g. `{Cookie: 'session=...'}` or `{Authorization: 'Bearer ...'}`) to clip behind logins. Kontexta does not rate-limit but the upstream may throttle. On auth-required pages returns isError with `code: AUTH_REQUIRED`, optional `login_url`, and a hint to retry with `headers`. Returns `{file_id, path, title, source}`. Use to ingest external docs into the KB.", {
|
|
1456
1574
|
url: z.string().url().describe("The URL to clip"),
|
|
1457
1575
|
title: z.string().optional().describe("Optional title override (defaults to the page's <title>)"),
|
|
1458
1576
|
headers: z
|
|
@@ -1506,7 +1624,7 @@ function repoDirForFile(file) {
|
|
|
1506
1624
|
}
|
|
1507
1625
|
return dataDir;
|
|
1508
1626
|
}
|
|
1509
|
-
server.tool("
|
|
1627
|
+
server.tool("files_get_history", "Return the git commit history for one file (newest first), each entry with hash, message, date, and author. Reads the file's owning repo: the project's git repo for project files, the KB backup repo for KB files. Read-only; no side effects, auth, or rate limits. Returns `{file_id, path, history}`; an empty array means the file has not been committed yet. Use to understand a file's evolution before editing or restoring. Pair with `files_get_diff` to see exact line changes; use `files_restore` to roll back.", {
|
|
1510
1628
|
file_id: z.number().describe("ID of the file"),
|
|
1511
1629
|
}, async ({ file_id }) => {
|
|
1512
1630
|
const file = readFile(file_id);
|
|
@@ -1520,7 +1638,7 @@ server.tool("files.get_history", "Return the git commit history for one file (ne
|
|
|
1520
1638
|
],
|
|
1521
1639
|
};
|
|
1522
1640
|
});
|
|
1523
|
-
server.tool("
|
|
1641
|
+
server.tool("files_get_diff", "Return the unified diff of one file between two commit hashes (typically obtained from `files_get_history` for the same file). Read-only; no side effects, auth, or rate limits. Order matters: `commit_a` is treated as the earlier side; reversing the args inverts the diff. Throws if either hash is unknown to the file's repo. Use after `files_get_history` to see WHAT changed, not just THAT it changed.", {
|
|
1524
1642
|
file_id: z.number().describe("ID of the file"),
|
|
1525
1643
|
commit_a: z.string().describe("Earlier commit hash (from get_history)"),
|
|
1526
1644
|
commit_b: z.string().describe("Later commit hash (from get_history)"),
|
|
@@ -1536,7 +1654,7 @@ server.tool("files.get_diff", "Return the unified diff of one file between two c
|
|
|
1536
1654
|
],
|
|
1537
1655
|
};
|
|
1538
1656
|
});
|
|
1539
|
-
server.tool("
|
|
1657
|
+
server.tool("files_restore", "DESTRUCTIVE. Overwrite a file's current on-disk content with the version recorded at a specific git commit, then re-index FTS. The hash MUST come from `files_get_history` for THIS file (foreign hashes throw). The current uncommitted content is lost unless it was already committed elsewhere. The file watcher may also pick up the change before this returns. No external auth or rate limits. Returns `{file_id, path, hash, success, message}`. Use only to undo accidental edits or recover a known-good version.", {
|
|
1540
1658
|
file_id: z.number().describe("ID of the file"),
|
|
1541
1659
|
hash: z.string().describe("Commit hash to restore from (from get_history)"),
|
|
1542
1660
|
}, async ({ file_id, hash }) => {
|
|
@@ -1568,7 +1686,7 @@ server.tool("files.restore", "DESTRUCTIVE. Overwrite a file's current on-disk co
|
|
|
1568
1686
|
};
|
|
1569
1687
|
}
|
|
1570
1688
|
});
|
|
1571
|
-
server.tool("
|
|
1689
|
+
server.tool("files_read_outline", "Return a flat list of markdown headings for one file (level, text, line, byteStart, byteEnd). Read-only; no side effects, auth, or rate limits. Use as a cheap probe before `files_read({ id, section })` or `files_update({ file_id, section, content })` so you don't spend tokens on the full body just to learn what sections exist. Empty outline means the file has no markdown headings (it may still have content: fall back to `files_read` in full or `files_read({ id, lines })`).", {
|
|
1572
1690
|
file_id: z.number().describe("File ID"),
|
|
1573
1691
|
}, async ({ file_id }) => {
|
|
1574
1692
|
try {
|
|
@@ -1621,7 +1739,7 @@ function validateFolderName(name) {
|
|
|
1621
1739
|
throw new Error("name must not contain '..' segments");
|
|
1622
1740
|
}
|
|
1623
1741
|
}
|
|
1624
|
-
server.tool("
|
|
1742
|
+
server.tool("folders_list", "List folder paths under a project root (or the Knowledge Base when `project_id` is null/omitted). Returns `{folders: string[], base_path}` where `folders` are RELATIVE to `base_path`. Read-only; no side effects, auth, or rate limits. Throws if `project_id` references an unknown project. Use to discover where to drop a new file via `files_create`'s `folder` argument or to navigate vault structure; to actually create one use `folders_create`.", {
|
|
1625
1743
|
project_id: z.number().nullable().optional().describe("Project ID. Pass null or omit to list KB folders."),
|
|
1626
1744
|
}, async ({ project_id }) => {
|
|
1627
1745
|
try {
|
|
@@ -1639,7 +1757,7 @@ server.tool("folders.list", "List folder paths under a project root (or the Know
|
|
|
1639
1757
|
};
|
|
1640
1758
|
}
|
|
1641
1759
|
});
|
|
1642
|
-
server.tool("
|
|
1760
|
+
server.tool("folders_create", "Create a folder in the KB (a `project_id` is refused: kxta never writes into a project repo). Idempotent, creating an existing folder succeeds. Nested paths like `notes/inbox` create intermediates. REJECTS: empty names, null bytes, leading path separators, and any segment equal to `..` (the call returns isError, no folder is touched). Side effect: a directory is mkdir'd on disk; no DB rows are written until a file lands inside. No external auth or rate limits. Returns `{path, base_path}`.", {
|
|
1643
1761
|
project_id: z.number().nullable().optional().describe("Project ID. Pass null or omit to create the folder under the KB."),
|
|
1644
1762
|
name: z.string().describe("Folder name (relative; supports nested paths via '/')"),
|
|
1645
1763
|
}, async ({ project_id, name }) => {
|
|
@@ -1661,7 +1779,7 @@ server.tool("folders.create", "Create a folder in the KB (a `project_id` is refu
|
|
|
1661
1779
|
};
|
|
1662
1780
|
}
|
|
1663
1781
|
});
|
|
1664
|
-
server.tool("
|
|
1782
|
+
server.tool("folders_delete", "DESTRUCTIVE: recursively delete a folder under the KB AND every file inside it (disk + FTS rows). REFUSES (returns isError) when `project_id` is supplied: deleting inside a registered project would race the file watcher and re-ingest the contents, remove project content via your editor instead. Same name validation as `folders_create`. Not recoverable from Kontexta after the call (only the git backup, if configured, retains it). No external auth or rate limits. Returns `{success: true}`.", {
|
|
1665
1783
|
project_id: z.number().nullable().optional().describe("Project ID. Pass null or omit to delete from the KB. Project IDs are rejected."),
|
|
1666
1784
|
name: z.string().describe("Folder name (relative)"),
|
|
1667
1785
|
}, async ({ project_id, name }) => {
|
|
@@ -1680,13 +1798,13 @@ server.tool("folders.delete", "DESTRUCTIVE: recursively delete a folder under th
|
|
|
1680
1798
|
],
|
|
1681
1799
|
};
|
|
1682
1800
|
}
|
|
1683
|
-
// Refuse deleting
|
|
1684
|
-
const KB_BUCKETS_TOP = new Set(["journal", "knowledge", "mermaid", "html"]);
|
|
1801
|
+
// Refuse deleting root knowledge folders: would wipe fixed buckets or the whole KB.
|
|
1685
1802
|
const segments = name.split(/[/\\]/).filter(Boolean);
|
|
1686
|
-
if (segments.length
|
|
1803
|
+
if (segments.length <= 1) {
|
|
1804
|
+
const top = segments[0] || name;
|
|
1687
1805
|
return {
|
|
1688
1806
|
isError: true,
|
|
1689
|
-
content: [{ type: "text", text: JSON.stringify({ error: `Cannot delete
|
|
1807
|
+
content: [{ type: "text", text: JSON.stringify({ error: `Cannot delete root knowledge folder '${top}', part of the fixed KB layout. Delete subfolders inside it instead.` }, null, 2) }],
|
|
1690
1808
|
};
|
|
1691
1809
|
}
|
|
1692
1810
|
const base = resolveFolderBase(null);
|
|
@@ -1702,7 +1820,7 @@ server.tool("folders.delete", "DESTRUCTIVE: recursively delete a folder under th
|
|
|
1702
1820
|
};
|
|
1703
1821
|
}
|
|
1704
1822
|
});
|
|
1705
|
-
server.tool("
|
|
1823
|
+
server.tool("files_move", "Move/rename a KB file (project-repo files are refused). Destination 'new_path' must be absolute and resolve INSIDE the file's owning project or global knowledge directory. Cross-project moves are rejected. Alternative: pass `kind='dictionary'|'note'` (with no `new_path`) to move a KB file into the mirrored path in the other class tree, subfolder path is preserved. Operates locally with no auth or limits.", {
|
|
1706
1824
|
file_id: z.number().describe("File ID"),
|
|
1707
1825
|
new_path: z.string().optional().describe("Absolute destination path"),
|
|
1708
1826
|
kind: z.enum(["dictionary", "note"]).optional()
|
|
@@ -1798,7 +1916,7 @@ server.tool("files.move", "Move/rename a KB file (project-repo files are refused
|
|
|
1798
1916
|
};
|
|
1799
1917
|
}
|
|
1800
1918
|
});
|
|
1801
|
-
server.tool("
|
|
1919
|
+
server.tool("files_find_related", "Find other files sharing tags with the given file, ranked by `shared_tag_count` descending. Read-only; no side effects, auth, or rate limits. Returns annotated file rows with `shared_tag_count` and `shared_tags`. Empty result means the file has no tags or no other file shares them: try `files_search`/`files_regex_search` for content-based discovery, or `tags_suggest` to bootstrap labels first. `kind` narrows to one content class. Default limit 10.", {
|
|
1802
1920
|
file_id: z.number().describe("ID of the file to find relations for"),
|
|
1803
1921
|
limit: z.number().optional().describe("Maximum number of related files to return (default 10)"),
|
|
1804
1922
|
kind: z.enum(["dictionary", "note", "journal", "project"]).optional()
|
|
@@ -1821,7 +1939,7 @@ server.tool("files.find_related", "Find other files sharing tags with the given
|
|
|
1821
1939
|
],
|
|
1822
1940
|
};
|
|
1823
1941
|
});
|
|
1824
|
-
server.tool("
|
|
1942
|
+
server.tool("tags_search", "Bulk-tag: run an FTS `search` and append `add_tags` to every matching file in one call. Side effect: each match gets `addTags` applied (additive, idempotent per tag); the matched files themselves are NOT modified beyond their tag links. Per-file failures isolated to `errors[]`. No external auth or rate limits. There is NO dry-run flag, so ALWAYS run `files_search` with the same query first to verify the match set before tagging. The `tags[]` filter requires existing tags to ALL match (it scopes the search; it does not control which tags get added). Returns `{matched_count, tagged_count, tags_applied, tagged_ids, errors}`.", {
|
|
1825
1943
|
query: z.string().describe("Full-text search query"),
|
|
1826
1944
|
add_tags: z.array(z.string()).min(1).describe("Tags to add to every matching file"),
|
|
1827
1945
|
project_id: z.number().nullable().optional().describe("Scope search to a specific project. Pass null for KB-only results."),
|
|
@@ -1871,7 +1989,7 @@ server.tool("tags.search", "Bulk-tag: run an FTS `search` and append `add_tags`
|
|
|
1871
1989
|
],
|
|
1872
1990
|
};
|
|
1873
1991
|
});
|
|
1874
|
-
server.tool("
|
|
1992
|
+
server.tool("admin_overview", "Vault-state snapshot. `mode: 'stats'` = aggregate counts for a scope: `file_count`, `untagged_count`, `favorite_count`, `top_tags`. With `project_id` omitted (everything), also returns `by_project` breakdown. `include_token_total: true` stat()s every matching file on disk to compute a body-size estimate, measurably slower on large vaults; default false. `mode: 'whats_new'` = list files created or modified since a checkpoint (`since`, REQUIRED for this mode, ISO-8601 like `2025-01-15T00:00:00Z` or relative durations like `1h`/`7d`/`2w`; invalid formats throw); CAVEAT: hard-deleted files are NOT surfaced, only mtime-driven changes. Both modes: `project_id: null` = KB only; omit = everything. Read-only; no side effects, auth, or rate limits. Use `stats` as a cheap dashboard or to spot untagged content for cleanup (for live disk-vs-index drift use `files_diff_against_disk`); use `whats_new` at session start to catch up.", {
|
|
1875
1993
|
mode: z.enum(["stats", "whats_new"]).describe("Which snapshot to return. 'whats_new' requires `since`."),
|
|
1876
1994
|
project_id: z.number().nullable().optional().describe("Filter to a single project. Pass null for KB-only. Omit for everything."),
|
|
1877
1995
|
top_tags: z.number().int().positive().max(100).optional().describe("mode='stats' only: how many top tags to return (default 10)"),
|
|
@@ -1990,6 +2108,16 @@ server.tool("admin.overview", "Vault-state snapshot. `mode: 'stats'` = aggregate
|
|
|
1990
2108
|
...(byProject ? { by_project: byProject } : {}),
|
|
1991
2109
|
...(totalEstTokens !== null ? { total_est_tokens: totalEstTokens } : {}),
|
|
1992
2110
|
rules_warning: getAgentRulesWarning(project_id),
|
|
2111
|
+
system1: (() => {
|
|
2112
|
+
const st = rerankEngine.getStatus();
|
|
2113
|
+
return {
|
|
2114
|
+
ready: st.loaded,
|
|
2115
|
+
device: st.device,
|
|
2116
|
+
model: st.model,
|
|
2117
|
+
cache_dir: st.cache_dir,
|
|
2118
|
+
loaded_models: getAllStatuses().map((s) => s.modelId),
|
|
2119
|
+
};
|
|
2120
|
+
})(),
|
|
1993
2121
|
}, null, 2),
|
|
1994
2122
|
},
|
|
1995
2123
|
],
|
|
@@ -2002,7 +2130,7 @@ server.tool("admin.overview", "Vault-state snapshot. `mode: 'stats'` = aggregate
|
|
|
2002
2130
|
};
|
|
2003
2131
|
}
|
|
2004
2132
|
});
|
|
2005
|
-
server.tool("
|
|
2133
|
+
server.tool("tags_suggest", "Propose tags for a file by mining the existing tag corpus via FTS: picks distinctive terms from the file (≥4 chars, stopword-filtered) and returns tags applied to other files that score high on those terms. No LLM, no network. Already-applied tags are excluded so the suggestions are net-new. Read-only; no side effects, auth, or rate limits. Returns `{file_id, path, existing_tags, suggestions: [{tag, score, sources}]}`. Empty suggestions = no distinctive terms or no overlap with the existing taxonomy yet, bootstrap with `tags_add` first. Default limit 10, max 50. Suggestions are NOT auto-applied.", {
|
|
2006
2134
|
file_id: z.number().describe("File ID to suggest tags for"),
|
|
2007
2135
|
limit: z.number().int().positive().max(50).optional().describe("Max suggestions to return (default 10)"),
|
|
2008
2136
|
}, async ({ file_id, limit }) => {
|
|
@@ -2082,7 +2210,7 @@ server.tool("tags.suggest", "Propose tags for a file by mining the existing tag
|
|
|
2082
2210
|
};
|
|
2083
2211
|
}
|
|
2084
2212
|
});
|
|
2085
|
-
server.tool("
|
|
2213
|
+
server.tool("files_diff_against_disk", "Diagnose drift between one file's disk content and its FTS index. Status is one of `in_sync`, `diverged`, `disk_unreadable`, or `no_index_row`. On divergence returns sizes, line counts, the first divergent line number, and the disk vs index sample for that line: NOT a full diff (use `files_get_diff` for full diffs between commits). Read-only; no side effects, auth, or rate limits. Use when search results look stale; if status is `diverged` or `no_index_row`, run `projects_refresh_index` to fix.", {
|
|
2086
2214
|
file_id: z.number().describe("File ID"),
|
|
2087
2215
|
}, async ({ file_id }) => {
|
|
2088
2216
|
try {
|
|
@@ -2189,7 +2317,7 @@ server.tool("files.diff_against_disk", "Diagnose drift between one file's disk c
|
|
|
2189
2317
|
};
|
|
2190
2318
|
}
|
|
2191
2319
|
});
|
|
2192
|
-
server.tool("
|
|
2320
|
+
server.tool("projects_refresh_index", "Reconcile the FTS index against disk. For a project (`project_id` set), re-runs `discoverFiles`. For the KB (`project_id` null/omitted), walks `knowledge/`, ingests new .md files, reindexes any whose content hash drifted, and PRUNES rows for files no longer on disk. SIDE-EFFECTFUL: writes/updates/deletes file and FTS rows (the prune is destructive on stale index rows but never deletes files from disk). Idempotent, running twice is a near no-op. Skips files >5MB and standard junk dirs (`node_modules`, `.git`, `dist`, `build`, etc.). No external auth or rate limits. Returns `{scope, newly_indexed, refreshed, pruned}`. Use after editing files outside Kontexta, or when `files_diff_against_disk` reports drift.", {
|
|
2193
2321
|
project_id: z.number().nullable().optional().describe("Project ID. Pass null or omit to reindex the Knowledge Base."),
|
|
2194
2322
|
}, async ({ project_id }) => {
|
|
2195
2323
|
try {
|
|
@@ -2210,7 +2338,7 @@ server.tool("projects.refresh_index", "Reconcile the FTS index against disk. For
|
|
|
2210
2338
|
};
|
|
2211
2339
|
}
|
|
2212
2340
|
});
|
|
2213
|
-
server.tool("
|
|
2341
|
+
server.tool("projects_map", "Return a compact indented outline of folders, file titles, tags, and IDs in a single dense block: substantially fewer tokens than the equivalent `files_list` JSON for the same scope. Read-only; no side effects, auth, or rate limits. Capped at `max_lines` (default 5000); the response reports `est_tokens` and emits a `warning` field if it exceeds `KONTEXTA_PROJECT_TOKEN_WARN`. `project_id: null` = KB only; omit = everything. Defaults: include_tags=true, show_titles=true. Use to orient yourself in an unfamiliar vault or project; for keyword lookup use `files_search`.", {
|
|
2214
2342
|
project_id: z.number().nullable().optional().describe("Restrict to a single project. Pass null for knowledge-base-only files. Omit for everything."),
|
|
2215
2343
|
include_tags: z.boolean().optional().describe("Append #tags inline. Default true. Set false to shrink the outline."),
|
|
2216
2344
|
show_titles: z.boolean().optional().describe("Show file titles instead of filenames. Default true."),
|
|
@@ -2289,7 +2417,7 @@ server.resource("File Content", new ResourceTemplate("kontexta://files/{id}", {
|
|
|
2289
2417
|
],
|
|
2290
2418
|
};
|
|
2291
2419
|
});
|
|
2292
|
-
server.tool("
|
|
2420
|
+
server.tool("hands_list", "List every Hands command tool currently registered, with project scope, tool name, danger level, confirmation flag, and description. Hands tools come from per-project `kontexta.json` files loaded at register time. Pass `schema: true` to instead get the complete `kontexta.json` authoring reference (JSON schema, validation rules, security guarantees, limitations, annotated example), a static document, unrelated to any specific registered hand. Read-only; no side effects, auth, or rate limits. Use the default list mode to discover what side-effectful project commands the agent is permitted to run; use `schema: true` when helping a user write or fix a `kontexta.json`; reload after editing one with `hands_reload`.", {
|
|
2293
2421
|
schema: z.boolean().optional().describe("If true, return the kontexta.json authoring reference document instead of the registered-hands list. Default false."),
|
|
2294
2422
|
}, async ({ schema }) => {
|
|
2295
2423
|
if (schema) {
|
|
@@ -2298,14 +2426,14 @@ server.tool("hands.list", "List every Hands command tool currently registered, w
|
|
|
2298
2426
|
const items = handsRegistry.list();
|
|
2299
2427
|
return { content: [{ type: "text", text: JSON.stringify({ hands: items }, null, 2) }] };
|
|
2300
2428
|
});
|
|
2301
|
-
server.tool("
|
|
2429
|
+
server.tool("hands_reload", "Re-scan every registered project's `kontexta.json` and rebuild the live Hands tool registry: newly-declared tools become callable immediately, removed tools disappear from `tools/list`. SIDE EFFECT is on the running MCP session's tool inventory only (no disk writes). Idempotent. No external auth or rate limits. Takes no parameters. Returns per-project load results (counts of registered/disabled tools and any validation warnings). Use after editing a `kontexta.json` mid-session; for the schema see `hands_list({ schema: true })`.", {}, async () => {
|
|
2302
2430
|
const projects = listProjects()
|
|
2303
2431
|
.filter((p) => p.path && existsSync(p.path))
|
|
2304
2432
|
.map((p) => ({ name: p.name, root: p.path }));
|
|
2305
2433
|
const r = handsRegistry.reloadAll(projects);
|
|
2306
2434
|
return { content: [{ type: "text", text: JSON.stringify(r, null, 2) }] };
|
|
2307
2435
|
});
|
|
2308
|
-
server.tool("
|
|
2436
|
+
server.tool("hands_confirm", "Approve and EXECUTE a previously-issued Hands invocation by its single-use approval token. The token is returned by any confirm-required Hands tool; tokens expire after 60 seconds and CANNOT be reused. Side effect equals whatever the underlying Hand does: this can be highly destructive (running arbitrary shell commands, modifying files, etc.), so only call when the user has authorised the pending action. The token IS the auth (no external auth, no rate limits). Invalid, expired, or already-consumed tokens return an inert text response, NOT an error.", { token: z.string().describe("The approval token from the pending response") }, async ({ token }) => {
|
|
2309
2437
|
const pending = handsRegistry.getConfirmStore().consume(token);
|
|
2310
2438
|
if (!pending) {
|
|
2311
2439
|
return { content: [{ type: "text", text: "Token invalid, expired, or already consumed." }] };
|
|
@@ -2318,7 +2446,7 @@ server.tool("hands.confirm", "Approve and EXECUTE a previously-issued Hands invo
|
|
|
2318
2446
|
return { content: [{ type: "text", text: `Execution failed after approval: ${e?.message ?? e}` }] };
|
|
2319
2447
|
}
|
|
2320
2448
|
});
|
|
2321
|
-
server.tool("
|
|
2449
|
+
server.tool("admin_get_profile", "Return the user profile stored in the Knowledge Base. The profile helps AI agents understand the user's context, role, preferences, and goals. Read-only; no side effects, auth, or rate limits. Returns existence status, full content, list of missing required sections, and a hint for new users. Use at session start to understand who you're working with.", {}, async () => {
|
|
2322
2450
|
const result = handleGetProfile(dataDir);
|
|
2323
2451
|
return {
|
|
2324
2452
|
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|