kontexta 7.4.1 → 7.4.3
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 +16 -0
- package/bundle/standalone/apps/web/.next/BUILD_ID +1 -1
- package/bundle/standalone/apps/web/.next/app-build-manifest.json +117 -117
- package/bundle/standalone/apps/web/.next/app-path-routes-manifest.json +10 -10
- package/bundle/standalone/apps/web/.next/build-manifest.json +5 -5
- package/bundle/standalone/apps/web/.next/prerender-manifest.json +3 -3
- package/bundle/standalone/apps/web/.next/react-loadable-manifest.json +84 -0
- 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 +2 -2
- 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 +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 +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 +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 +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 +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_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/auth/setup/route.js +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 +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 +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/brain/machines/[machineId]/route.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/brain/machines/[machineId]/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/brain/route.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/brain/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/brain/share/route.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/brain/share/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/calendar/conflicts/route.js +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 +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 +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 +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 +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 +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 +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 +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 +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/conflicts/[gid]/route.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/conflicts/[gid]/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/conflicts/route.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/conflicts/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/docker-config/route.js +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 +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 +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 +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 +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 +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 +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 +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 +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 +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 +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 +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_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/graph/route.js +7 -3
- package/bundle/standalone/apps/web/.next/server/app/api/graph/route_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/health/route.js +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/hygiene/resolve/route.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/hygiene/resolve/route_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/hygiene/route.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/api/hygiene/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_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_client-reference-manifest.js +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 +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 +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 +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 +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 +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 +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/onboard/route.js +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 +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_client-reference-manifest.js +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 +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 +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 +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 +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 +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_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/brain/page_client-reference-manifest.js +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/conflicts/page_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/graph/page.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/graph/page_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/hygiene/page.js +6 -6
- package/bundle/standalone/apps/web/.next/server/app/hygiene/page_client-reference-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/app/login/page.js +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 +5 -5
- 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_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 +2 -2
- package/bundle/standalone/apps/web/.next/server/app-paths-manifest.json +10 -10
- package/bundle/standalone/apps/web/.next/server/chunks/2302.js +1 -0
- package/bundle/standalone/apps/web/.next/server/chunks/5998.js +1 -0
- package/bundle/standalone/apps/web/.next/server/chunks/6409.js +1 -0
- package/bundle/standalone/apps/web/.next/server/chunks/7775.js +1 -0
- package/bundle/standalone/apps/web/.next/server/chunks/7887.js +1 -1
- package/bundle/standalone/apps/web/.next/server/chunks/8571.js +1 -0
- package/bundle/standalone/apps/web/.next/server/middleware-build-manifest.js +1 -1
- package/bundle/standalone/apps/web/.next/server/middleware-react-loadable-manifest.js +1 -1
- 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/server-reference-manifest.json +1 -1
- package/bundle/standalone/apps/web/.next/static/chunks/1108.60fb822c3e3fdaf3.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/2205.68bae400481d0a3a.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/2443.9d9dd31cc33fc741.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/245.3ed04e1f16f90b31.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/2966.2216b92e18a0bb66.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/3259.585f965f16cd7406.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/3518.5a080b5b9172e9ab.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/{2704-e7fd9aeb7f653736.js → 3617-ed93ee6af5ece2f3.js} +1 -1
- package/bundle/standalone/apps/web/.next/static/chunks/3685.1e1d7cc834bf67db.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/3987.07ce2f3afff6c9a1.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/4283.524bc904dbdd2417.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/5858.cff8810734332b7e.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/807.5bf32ba308aae89a.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/8693.7e10450df289d6a0.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/9699.8e15c2b743d792a3.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/app/graph/page-df6cef9d4646adff.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/app/hygiene/page-ae4a438701ce8b97.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/app/page-88470b8cd166cf75.js +1 -0
- package/bundle/standalone/apps/web/.next/static/chunks/webpack-357e2269171845c0.js +1 -0
- package/bundle/standalone/apps/web/.next/static/css/def7c93f9fc92d12.css +3 -0
- package/bundle/standalone/apps/web/package.json +4 -12
- package/bundle/standalone/apps/web/src/lib/mcp-tools.json +2 -2
- package/bundle/standalone/node_modules/kontexta-mcp/dist/index.js +1 -1
- package/bundle/standalone/node_modules/kontexta-mcp/dist/index.js.map +1 -1
- package/bundle/standalone/node_modules/kontexta-mcp/package.json +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/db/index.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/db/index.js +3 -0
- package/bundle/standalone/node_modules/kxta-core/dist/db/index.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/files/index.d.ts +1 -0
- 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 +12 -2
- package/bundle/standalone/node_modules/kxta-core/dist/files/index.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/index.d.ts +2 -2
- package/bundle/standalone/node_modules/kxta-core/dist/index.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/index.js +2 -2
- package/bundle/standalone/node_modules/kxta-core/dist/index.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/retrieval/hybrid.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/retrieval/hybrid.js +76 -18
- package/bundle/standalone/node_modules/kxta-core/dist/retrieval/hybrid.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/retrieval/hygiene.d.ts +8 -0
- package/bundle/standalone/node_modules/kxta-core/dist/retrieval/hygiene.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/retrieval/hygiene.js +40 -3
- package/bundle/standalone/node_modules/kxta-core/dist/retrieval/hygiene.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/retrieval/index.d.ts +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/retrieval/index.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/retrieval/index.js.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/dist/types.d.ts +6 -0
- package/bundle/standalone/node_modules/kxta-core/dist/types.d.ts.map +1 -1
- package/bundle/standalone/node_modules/kxta-core/package.json +1 -1
- package/bundle/standalone/node_modules/kxta-publish/package.json +2 -2
- package/bundle/standalone/package.json +1 -1
- package/package.json +1 -9
- package/bundle/standalone/apps/web/.next/static/chunks/app/graph/page-5d0a8bd3e169157d.js +0 -1
- package/bundle/standalone/apps/web/.next/static/chunks/app/hygiene/page-9eeba0198c64ada1.js +0 -1
- package/bundle/standalone/apps/web/.next/static/chunks/app/page-ba7c52071b1f0d30.js +0 -1
- package/bundle/standalone/apps/web/.next/static/chunks/webpack-b1697c3befeaf792.js +0 -1
- package/bundle/standalone/apps/web/.next/static/css/86c76614a890326f.css +0 -3
- /package/bundle/standalone/apps/web/.next/static/{oxgEqVUQDtvOMFMm42Vl2 → idjbcSJE8hK49A4CJHc8Z}/_buildManifest.js +0 -0
- /package/bundle/standalone/apps/web/.next/static/{oxgEqVUQDtvOMFMm42Vl2 → idjbcSJE8hK49A4CJHc8Z}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=2224,a.ids=[2224],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4751:()=>{},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14978:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>F,patchFetch:()=>E,routeModule:()=>A,serverHooks:()=>D,workAsyncStorage:()=>B,workUnitAsyncStorage:()=>C});var d={};c.r(d),c.d(d,{GET:()=>z});var e=c(20584),f=c(18093),g=c(84892),h=c(17262),i=c(55572),j=c(261),k=c(26370),l=c(97824),m=c(92768),n=c(98611),o=c(52333),p=c(67359),q=c(5601),r=c(92710),s=c(86439),t=c(79596),u=c(16040),v=c(36865);let w=JSON.parse('{"r":"2026-11-29T01:02:40.894Z","Y":[{"name":"admin_refresh_session_context","description":"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.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{}},"execution":{"taskSupport":"forbidden"}},{"name":"journal_write","description":"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`.","inputSchema":{"type":"object","properties":{"kind":{"type":"string","enum":["append","note","intent"],"description":"Event kind. Selects which body fields are required and how the event is stored."},"text":{"type":"string","description":"Required for kind=\'append\' or kind=\'note\'. Body of the entry."},"summary":{"type":"string","description":"Required for kind=\'intent\'. One-line summary of the new intent."},"tags":{"type":"array","items":{"type":"string"},"description":"Optional for kind=\'note\'. Tags for the note."},"project_id":{"type":"number","description":"Optional for kind=\'append\'. Project ID context."}},"required":["kind"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_create","description":"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\'.","inputSchema":{"type":"object","properties":{"files":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","description":"Title of the file"},"content":{"type":"string","description":"Content of the file"},"destination":{"type":"string","enum":["knowledge","project","kontexta"],"description":"Destination type"},"project_id":{"type":"number","description":"Project ID (required for project/kontexta destinations)"},"folder":{"type":"string","description":"Optional folder path"},"tags":{"type":"array","items":{"type":"string"},"description":"Optional array of tags"},"format":{"type":"string","enum":["md","mmd","html"],"description":"File extension to write. Defaults to \'md\'. Use \'html\' for HTML reports."},"kind":{"type":"string","enum":["dictionary","note"],"description":"REQUIRED for destination=\'knowledge\'. \'dictionary\' = source of truth (mappings, glossaries, runbooks, PR templates). \'note\' = snapshot (meeting notes, sprint reviews, PR findings, post-mortems). Test: if this file disagreed with the code, who wins? File wins → dictionary; file loses → note. Ignored for destination=\'project\' or \'kontexta\'."}},"required":["title","content","destination"],"additionalProperties":false},"minItems":1,"maxItems":200,"description":"Files to create. Single-element array = one-file case. Max 200 per call."}},"required":["files"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"resources_add_report","description":"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.","inputSchema":{"type":"object","properties":{"filename":{"type":"string","description":"Requested filename with extension"},"bytes_base64":{"type":"string","description":"Base64-encoded file bytes"}},"required":["filename","bytes_base64"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"resources_list_reports","description":"List all files currently stored under reports/resources/. Returns filename, size in bytes, and served URL.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{}},"execution":{"taskSupport":"forbidden"}},{"name":"resources_delete_report","description":"Delete a file from reports/resources/. No-op if it doesn\'t exist.","inputSchema":{"type":"object","properties":{"filename":{"type":"string","description":"Filename (relative) of the resource to delete from reports/resources/."}},"required":["filename"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"resources_export_report","description":"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.","inputSchema":{"type":"object","properties":{"id":{"type":"number","description":"File ID of the HTML report to export."},"format":{"type":"string","enum":["pdf","png"],"default":"pdf","description":"Output format: \'pdf\' or \'png\'."},"inline_bytes":{"type":"boolean","default":false,"description":"If true, render in-process and return raw bytes (base64). Only available in the full kontexta CLI bundle; falls back to {url} otherwise."}},"required":["id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_read","description":"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.","inputSchema":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":0,"description":"Single file by ID."},"path":{"type":"string","description":"Single file by absolute on-disk path (must match exactly what Kontexta indexed)."},"ids":{"type":"array","items":{"type":"number"},"minItems":1,"maxItems":200,"description":"Batch mode: multiple file IDs (max 200 per call); returns an array plus aggregate token cost."},"section":{"type":"string","description":"Partial read: return only this heading\'s body (case-insensitive exact-string after trim). Requires `id`; mutually exclusive with `lines`."},"lines":{"type":"object","properties":{"from":{"type":"integer","exclusiveMinimum":0,"description":"First line (1-indexed, inclusive)"},"to":{"type":"integer","exclusiveMinimum":0,"description":"Last line (1-indexed, inclusive)"}},"required":["from","to"],"additionalProperties":false,"description":"Partial read: 1-indexed inclusive line range. Requires `id`; mutually exclusive with `section`."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_describe","description":"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.","inputSchema":{"type":"object","properties":{"id":{"type":"number","description":"File ID"}},"required":["id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_regex_search","description":"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.","inputSchema":{"type":"object","properties":{"pattern":{"type":"string","description":"JavaScript RegExp source"},"file_id":{"type":"number","description":"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`."},"project_id":{"type":["number","null"],"description":"Scope to one project, null for KB-only, omit for everything. Ignored when `file_id` is set."},"case_insensitive":{"type":"boolean","description":"If true, match pattern case-insensitively (RegExp \'i\' flag). Default false."},"max_files":{"type":"integer","exclusiveMinimum":0,"maximum":2000,"description":"Cap on files scanned (default 500). Ignored when `file_id` is set."},"max_matches_per_file":{"type":"integer","exclusiveMinimum":0,"maximum":100,"description":"Per-file hit cap in multi-file mode (default 10). Ignored when `file_id` is set."},"max_matches":{"type":"integer","exclusiveMinimum":0,"maximum":500,"description":"Cap on returned hits in single-file mode (default 100). Only used when `file_id` is set."},"kind":{"type":"string","enum":["dictionary","note","journal","project"],"description":"Filter by content class before scanning. Ignored when `file_id` is set."}},"required":["pattern"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_update","description":"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.","inputSchema":{"type":"object","properties":{"id":{"type":"number","description":"File ID"},"content":{"type":"string","description":"New content. With `section` set, this replaces just that heading\'s body; otherwise it becomes the entire file body."},"section":{"type":"string","description":"Case-insensitive exact-string heading. When set, only this heading\'s body is rewritten instead of the whole file."}},"required":["id","content"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_delete","description":"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.","inputSchema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"number"},"minItems":1,"maxItems":500,"description":"File IDs to delete. Single-element array = one-file case. Max 500 per call."}},"required":["ids"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_list","description":"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`.","inputSchema":{"type":"object","properties":{"project_id":{"type":["number","null"],"description":"Filter by project ID. Pass null to list ONLY Knowledge Base files (project_id IS NULL)."},"tag":{"type":"string","description":"Filter by tag name"},"favorite":{"type":"boolean","description":"Filter by favorite status"},"folder":{"type":"string","description":"Filter by folder path"},"untagged":{"type":"boolean","description":"If true, return only files that have no tags. Useful for bulk-tagging workflows."},"limit":{"type":"number","description":"Maximum number of results"},"offset":{"type":"number","description":"Offset for pagination"},"kind":{"type":"string","enum":["dictionary","note","journal","project"],"description":"Filter by content class. dictionary = authoritative KB, note = informational KB, journal = time-log, project = project file."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_search","description":"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\xd7`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.","inputSchema":{"type":"object","properties":{"query":{"type":"string","description":"Search query"},"project_id":{"type":["number","null"],"description":"Filter by project ID. Pass null to search ONLY Knowledge Base files."},"tags":{"type":"array","items":{"type":"string"},"description":"Filter by tags (all must match)"},"favorite":{"type":"boolean","description":"Filter by favorite status"},"kind":{"type":"string","enum":["dictionary","note","journal","project"],"description":"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."},"include_bodies":{"type":"boolean","description":"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."},"format":{"type":"string","enum":["xml","markdown"],"description":"Bundle format when `include_bodies` is true. xml = Anthropic-recommended <document> tags (default); markdown = ## headers + fenced blocks. Ignored otherwise."},"max_tokens":{"type":"integer","exclusiveMinimum":0,"description":"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."},"rerank":{"type":"boolean","description":"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)."},"check_sufficiency":{"type":"boolean","description":"When include_bodies is true, evaluate retrieval sufficiency with non-autoregressive decision model. Default true."},"hybrid":{"type":"boolean","description":"When true (default), combine FTS5 BM25 with local semantic vector search via RRF (falls back cleanly to BM25 if embeddings are unavailable)."},"chunk_level":{"type":"boolean","description":"When include_bodies is true, pack only the most relevant heading-aware sections instead of full files to save tokens. Default false."}},"required":["query"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"tags_add","description":"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`.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"File ID"},"tags":{"type":"array","items":{"type":"string"},"description":"Array of tag names to add"}},"required":["file_id","tags"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"tags_remove","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"File ID"},"tag_ids":{"type":"array","items":{"type":"number"},"description":"Array of tag IDs to remove"}},"required":["file_id","tag_ids"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"tags_set_favorite","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"File ID"},"favorite":{"type":"boolean","description":"Favorite status"}},"required":["file_id","favorite"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"tags_list","description":"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`.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{}},"execution":{"taskSupport":"forbidden"}},{"name":"projects_list","description":"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`, `projects_refresh_index`, etc.). To register a new project use `projects_register`; to inspect its Hands tools use `hands_list`.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{}},"execution":{"taskSupport":"forbidden"}},{"name":"projects_register","description":"Register a new project and link it to the Kontexta knowledge system.\\n\\nSIDE 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.\\n\\nAUTH / RATE LIMITS: None. Operates entirely on the local file system.\\n\\nPARAMETERS:\\n- name: Human-readable project name.\\n- path: Absolute path to the project root. Required. DO NOT guess or assume the path based on the active editor workspace unless the user explicitly asks to register the \\"current\\" or \\"open\\" project. If the user provides a project name but no path, ask them for the absolute path before calling this tool. Fails with a descriptive error if the path does not exist or is inaccessible.\\n- description: Optional free-text description stored with the project metadata.\\n\\nRETURNS: A JSON object containing:\\n- project: { id, name, path, description, created_at }\\n- discovered_files_count: number of markdown files indexed\\n- discovered_files: array of { path, est_tokens, size_bytes } for each file\\n- total_est_tokens: estimated total token cost of all discovered files\\n- hands: { found, tools_registered, tools_disabled, warnings }\\n- warnings: array of non-fatal issues (e.g. scan failures, token budget exceeded)\\n\\nERROR CONDITIONS: Returns isError=true if path is missing or unresolvable. Scan failures are non-fatal and reported in warnings rather than as errors.","inputSchema":{"type":"object","properties":{"name":{"type":"string","description":"Project name"},"path":{"type":"string","description":"Absolute path to the project root. Required. DO NOT guess from the active workspace unless asked. Ask the user if unsure."},"description":{"type":"string","description":"Optional project description"}},"required":["name","path"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"admin_onboard_agent","description":"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.\\n\\nMANDATORY: 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.\\n\\nPARAMETERS:\\n- project_id: number, required.\\n- confirm: boolean, required. Must be true to proceed.\\n- files: string[], optional. Paths relative to project root. For update mode, defaults to recommendation.target_files. Ignored when files is empty AND target_agent is provided (create mode).\\n- target_agent: enum claude-code | codex | gemini | antigravity | cursor | windsurf | opencode | continue | aider | cline | copilot | generic. Required when files is empty AND no context file currently exists. Picks the canonical filename and the starter scaffold (\'generic\', \'codex\', \'windsurf\', and \'opencode\' scaffold AGENTS.md).\\n\\n- hooks: boolean, optional. With target_agent set, also enables that agent and installs its conversation-capture hooks (npx/source installs) or returns the host docker command (Docker). Ask the user before setting it.\\n\\nRETURNS: { written: [{ path, action: created|updated|skipped, version }], skipped: [{ path, reason }], hooks_install?: { agent, mode, enabled, outcome?, docker_command?, note?, error? }, hooks?: { install_mode, alerts, prompt } }","inputSchema":{"type":"object","properties":{"project_id":{"type":"number","description":"Project ID returned from register_project"},"confirm":{"type":"boolean","description":"MANDATORY: Set to true only after obtaining explicit user consent to modify context files."},"files":{"type":"array","items":{"type":"string"},"description":"Project-relative paths to update; defaults to detected context files"},"target_agent":{"type":"string","enum":["claude-code","codex","gemini","antigravity","cursor","windsurf","opencode","continue","aider","cline","copilot","generic"],"description":"Required when files is empty AND no context file exists. Picks the canonical filename + scaffold."},"hooks":{"type":"boolean","description":"With target_agent, also enable that agent and install its conversation-capture hooks (npx/source) or return the host docker command. Ask the user first."}},"required":["project_id","confirm"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"admin_transfer_agent_context","description":"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.\\n\\nThis 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`.\\n\\nMANDATORY: This tool writes new files into Kontexta\'s data dir. You MUST seek explicit user consent before calling. Set \'confirm: true\' only after the user has agreed.\\n\\nPARAMETERS:\\n- project_id: number, required. Project ID returned from register_project.\\n- confirm: boolean, required. Must be true.\\n- files: string[], optional. Project-relative paths to transfer. Omit or pass [] to transfer all detected agent context files (uses the same detection list as register_project / onboard_agent).\\n\\nRETURNS: { transferred: [{ source_path, kb_id, kb_path, est_tokens }], skipped: [{ source_path, reason }], next_action }\\nSkip reasons: \\"missing\\" | \\"symlink\\" | \\"outside_project\\" | \\"already_transferred_same_content\\" | \\"read_error\\" | \\"write_error\\".\\n\\nIDEMPOTENT: re-running with the same files copies nothing if the content is unchanged, duplicate transfers are detected via SHA-256 hash comparison against existing project KB rows.","inputSchema":{"type":"object","properties":{"project_id":{"type":"number","description":"Project ID returned from register_project"},"confirm":{"type":"boolean","description":"MANDATORY: Set to true only after obtaining explicit user consent."},"files":{"type":"array","items":{"type":"string"},"description":"Project-relative paths to transfer. Omit to transfer all detected context files."}},"required":["project_id","confirm"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"resources_clip_url","description":"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.","inputSchema":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"The URL to clip"},"title":{"type":"string","description":"Optional title override (defaults to the page\'s <title>)"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Optional HTTP headers to forward with the fetch (e.g. {\\"Cookie\\": \\"session=...\\"} or {\\"Authorization\\": \\"Bearer ...\\"}). Use to clip pages behind auth walls after AUTH_REQUIRED."}},"required":["url"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_get_history","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"ID of the file"}},"required":["file_id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_get_diff","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"ID of the file"},"commit_a":{"type":"string","description":"Earlier commit hash (from get_history)"},"commit_b":{"type":"string","description":"Later commit hash (from get_history)"}},"required":["file_id","commit_a","commit_b"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_restore","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"ID of the file"},"hash":{"type":"string","description":"Commit hash to restore from (from get_history)"}},"required":["file_id","hash"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_read_outline","description":"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 })`).","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"File ID"}},"required":["file_id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"folders_list","description":"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`.","inputSchema":{"type":"object","properties":{"project_id":{"type":["number","null"],"description":"Project ID. Pass null or omit to list KB folders."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"folders_create","description":"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}`.","inputSchema":{"type":"object","properties":{"project_id":{"type":["number","null"],"description":"Project ID. Pass null or omit to create the folder under the KB."},"name":{"type":"string","description":"Folder name (relative; supports nested paths via \'/\')"}},"required":["name"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"folders_delete","description":"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}`.","inputSchema":{"type":"object","properties":{"project_id":{"type":["number","null"],"description":"Project ID. Pass null or omit to delete from the KB. Project IDs are rejected."},"name":{"type":"string","description":"Folder name (relative)"}},"required":["name"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_move","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"File ID"},"new_path":{"type":"string","description":"Absolute destination path"},"kind":{"type":"string","enum":["dictionary","note"],"description":"Move the file to the mirrored path in the other class tree. Subfolder path is preserved: knowledge/dictionary/slt/ids.md ↔ knowledge/notes/slt/ids.md. Ignored if `new_path` is also provided."}},"required":["file_id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_find_related","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"ID of the file to find relations for"},"limit":{"type":"number","description":"Maximum number of related files to return (default 10)"},"kind":{"type":"string","enum":["dictionary","note","journal","project"],"description":"Filter related results to a single content class."}},"required":["file_id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"tags_search","description":"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}`.","inputSchema":{"type":"object","properties":{"query":{"type":"string","description":"Full-text search query"},"add_tags":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Tags to add to every matching file"},"project_id":{"type":["number","null"],"description":"Scope search to a specific project. Pass null for KB-only results."},"tags":{"type":"array","items":{"type":"string"},"description":"Filter, only matches that already carry ALL of these tags"},"favorite":{"type":"boolean","description":"If true, restrict to favorited files only."}},"required":["query","add_tags"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"admin_overview","description":"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. `mode: \'hygiene\'` = scan Knowledge Base files (`project_id IS NULL`, never physical repo files) for near-duplicate files, note-vs-dictionary semantic overlaps, and stale project-file references inside KB docs (plus chunk/embedding coverage stats). Both modes: `project_id: null` = KB only; omit = everything. Read-only unless `backfill_embeddings: true` in hygiene mode.","inputSchema":{"type":"object","properties":{"mode":{"type":"string","enum":["stats","whats_new","hygiene"],"description":"Which snapshot to return. \'whats_new\' requires `since`; \'hygiene\' inspects duplicates, dictionary overlaps, and stale project refs."},"project_id":{"type":["number","null"],"description":"Filter to a single project. Pass null for KB-only. Omit for everything."},"top_tags":{"type":"integer","exclusiveMinimum":0,"maximum":100,"description":"mode=\'stats\' only: how many top tags to return (default 10)"},"include_token_total":{"type":"boolean","description":"mode=\'stats\' only: if true, stat every matching file on disk to compute total est_tokens. Default false (cheap)."},"since":{"type":"string","description":"REQUIRED for mode=\'whats_new\'. ISO 8601 timestamp or relative duration (e.g. \\"1h\\", \\"7d\\", \\"2w\\")."},"include_tags":{"type":"boolean","description":"mode=\'whats_new\' only: attach tags[] to each file. Default true."},"limit":{"type":"number","description":"mode=\'whats_new\' or \'hygiene\': max items returned."},"duplicate_threshold":{"type":"number","minimum":0.5,"maximum":1,"description":"mode=\'hygiene\' only: cosine similarity threshold for near-duplicates (default 0.86)."},"overlap_threshold":{"type":"number","minimum":0.5,"maximum":1,"description":"mode=\'hygiene\' only: cosine similarity threshold for note-vs-dictionary overlaps (default 0.78)."},"include_journal":{"type":"boolean","description":"mode=\'hygiene\' only: include journal files in hygiene checks (default false)."},"include_dismissed":{"type":"boolean","description":"mode=\'hygiene\' only: include dismissed findings (default false)."},"backfill_embeddings":{"type":"boolean","description":"mode=\'hygiene\' only: lazily chunk and embed unindexed files before scanning (default false)."}},"required":["mode"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"tags_suggest","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"File ID to suggest tags for"},"limit":{"type":"integer","exclusiveMinimum":0,"maximum":50,"description":"Max suggestions to return (default 10)"}},"required":["file_id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_diff_against_disk","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"File ID"}},"required":["file_id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"projects_refresh_index","description":"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.","inputSchema":{"type":"object","properties":{"project_id":{"type":["number","null"],"description":"Project ID. Pass null or omit to reindex the Knowledge Base."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"projects_map","description":"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`.","inputSchema":{"type":"object","properties":{"project_id":{"type":["number","null"],"description":"Restrict to a single project. Pass null for knowledge-base-only files. Omit for everything."},"include_tags":{"type":"boolean","description":"Append #tags inline. Default true. Set false to shrink the outline."},"show_titles":{"type":"boolean","description":"Show file titles instead of filenames. Default true."},"max_lines":{"type":"number","description":"Hard cap on output lines (each line ≈ one folder or file). Default 5000."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"hands_list","description":"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`.","inputSchema":{"type":"object","properties":{"schema":{"type":"boolean","description":"If true, return the kontexta.json authoring reference document instead of the registered-hands list. Default false."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"hands_reload","description":"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 })`.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{}},"execution":{"taskSupport":"forbidden"}},{"name":"hands_confirm","description":"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.","inputSchema":{"type":"object","properties":{"token":{"type":"string","description":"The approval token from the pending response"}},"required":["token"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"admin_get_profile","description":"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.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{}},"execution":{"taskSupport":"forbidden"}},{"name":"admin_set_machine_label","description":"Set this machine\'s human-readable label (settings.machine_label). The label is how OTHER machines name conflict copies created from this one (\'<filename> (from <label>).ext\'), so pick something short and distinctive per machine (e.g. the machine\'s name or the user\'s workstation). Pass an empty string to clear it. Affects only conflict-copy naming; it does NOT change the stable machine_id that GIDs are keyed on. Returns the previous and new label.","inputSchema":{"type":"object","properties":{"label":{"type":"string","maxLength":100,"description":"The new label for this machine. Max 100 chars. Empty string clears the label."}},"required":["label"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"admin_list_clients","description":"List every machine that has ever connected to this vault (the sync group), most-recently-seen first. Each entry has machine_id, hostname, first_seen_at, last_seen_at, and is_local (true for the machine this MCP server runs on). Read-only; no side effects, auth, or rate limits. Use to see which machines are part of the sync group or to check that a new machine registered on startup.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{}},"execution":{"taskSupport":"forbidden"}},{"name":"conflicts_list","description":"List sync conflicts in the local conflict registry (Phase 5 Conflict Manager). A conflict is recorded when the storage server delivers an operation for a file that was modified locally since the last sync (base_version drift); the canonical file is preserved and the remote version is forked to a \'<filename> (from <machine_label>).<ext>\' copy. Defaults to unresolved conflicts, newest first. Pass status=\'all\' to include resolved, status=\'resolved\' for the resolved history, and `limit` to cap the page. Returns {conflicts, count, unresolved}: `count` is the length of the returned list, `unresolved` is the global unresolved total (use it to decide whether there is anything to act on). Each conflict carries gid, file_path, conflict_path, origin, origin_label, base_version, server_seq, local_content, remote_content, diff, additions, deletions, status, resolution, resolved_at, created_at. Read-only; no side effects, auth, or rate limits. To inspect a single conflict use conflicts_get; to fix one use conflicts_resolve.","inputSchema":{"type":"object","properties":{"status":{"type":"string","enum":["unresolved","resolved","all"],"description":"Filter by resolution state. Defaults to \'unresolved\'."},"limit":{"type":"integer","exclusiveMinimum":0,"description":"Optional page size. Positive integer; omit for no cap."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"conflicts_get","description":"Fetch one sync conflict by its global ID (gid), for the Conflict Manager. Returns the full ConflictRecord including both content snapshots (local_content, the canonical file as it is on THIS machine, and remote_content, the version that arrived from the other machine), the unified line diff, addition/deletion counts, and the conflict copy\'s on-disk path. If there is no unresolved conflict for the gid it returns the most recent resolved one; returns an error if no conflict exists at all. gid is \'<local_id>@<machine_id>\' as reported by conflicts_list. Read-only; no side effects, auth, or rate limits. After reviewing the diff, resolve with conflicts_resolve.","inputSchema":{"type":"object","properties":{"gid":{"type":"string","description":"Global ID of the conflict, e.g. \'104@4f9e1a8b3c7d2e0f\' (as returned by conflicts_list)."}},"required":["gid"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"conflicts_resolve","description":"Resolve one sync conflict using one of 4 deterministic strategies (spec 1.7). `strategy`: \'keep-server\' = accept the remote version, overwrite the canonical file, delete the conflict copy. \'keep-mine\' = keep the local version, re-assert it to the server (version bump + outbox op), delete the conflict copy. \'keep-both\' = keep the canonical file AND permanently retain the conflict copy as its own newly-tracked file (no outbox op is dropped; the copy is registered with a fresh gid). \'merged\' = use your own `mergedContent` (REQUIRED for this strategy) as the new canonical content, push it, delete the conflict copy. Only acts on an UNRESOLVED conflict for the gid; if none exists it is an error. Returns {success, gid, strategy, resolvedAt, outboxOpId?, newFileGid?}. This is a write operation: it mutates the local file and may enqueue an outbound op for sync.","inputSchema":{"type":"object","properties":{"gid":{"type":"string","description":"Global ID of the conflict to resolve, e.g. \'104@4f9e1a8b3c7d2e0f\' (as returned by conflicts_list)."},"strategy":{"type":"string","enum":["keep-server","keep-mine","keep-both","merged"],"description":"Resolution strategy. See tool description for each behavior."},"mergedContent":{"type":"string","description":"REQUIRED when strategy=\'merged\': the full merged file content to write as the new canonical version. Ignored for all other strategies."}},"required":["gid","strategy"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"journal_distill","description":"Run the distillation pipeline: read raw events since the high-water mark, group by topic, write mechanical markdown entries, advance high-water. Idempotent. Auto-provisions a project row for orphan slugs (e.g. `default`) that have no registered project yet.","inputSchema":{"type":"object","properties":{"project_slug":{"type":"string","description":"Project slug to distill. Defaults to the current active project."},"max_events":{"type":"integer","exclusiveMinimum":0,"maximum":2000,"description":"Maximum raw events to process per run (default 200, max 2000)."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"journal_status","description":"Report the journal backlog and high-water mark for a project.","inputSchema":{"type":"object","properties":{"project_slug":{"type":"string","description":"Project slug to check. Defaults to the current active project."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"journal_commit_upgrades","description":"After dispatching subagents to upgrade mechanical journal entries to LLM-narrative, call this with the affected task slugs. Updates journal_meta.status_latest to mark the entries as upgraded.","inputSchema":{"type":"object","properties":{"task_slugs":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Task slugs whose entries were upgraded by subagents."}},"required":["task_slugs"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"journal_housekeep","description":"Run journal retention/archival for a project. Idempotent. Prunes old raw .jsonl files and archives cold tasks per the configured retention policy.","inputSchema":{"type":"object","properties":{"project_slug":{"type":"string","description":"Project slug to housekeep. Defaults to the current active project."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_entities_add","description":"SIDE-EFFECTFUL. Create a new tracked entity: any named thing you schedule events against (a server, a delivery van, a store location, a piece of equipment, a room, etc.). Not idempotent: a duplicate name (case-insensitive) throws. Returns `{entity}`. Use `calendar_entities_link` afterwards to record dependencies for conflict detection.","inputSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"Unique display name for the entity (case-insensitive)."},"kind":{"type":"string","description":"Freeform category, e.g. \'server\', \'vehicle\', \'location\', \'equipment\'."},"notes":{"type":"string","description":"Freeform notes."},"timezone":{"type":"string","description":"Optional IANA timezone (e.g. \'Europe/Berlin\') for display only, does not affect stored event times."}},"required":["name"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_entities_update","description":"SIDE-EFFECTFUL. Patch an existing entity\'s fields, including `active` (set false to soft-retire it without losing its history). Idempotent per patch. Returns `{entity}`. For a hard delete see `calendar_entities_delete`.","inputSchema":{"type":"object","properties":{"id":{"type":"integer","description":"Entity id (from `calendar_entities_add` or `calendar_entities_list`)."},"name":{"type":"string","minLength":1,"description":"New display name for the entity."},"kind":{"type":["string","null"],"description":"Freeform category, e.g. \'server\', \'vehicle\', \'location\'."},"notes":{"type":["string","null"],"description":"Freeform notes."},"timezone":{"type":["string","null"],"description":"IANA timezone for display purposes (e.g. \'Europe/Berlin\')."},"active":{"type":"boolean","description":"Set false to soft-retire the entity without losing history."}},"required":["id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_entities_delete","description":"DESTRUCTIVE. Permanently delete an entity AND cascade-delete every event and link attached to it. Not idempotent: deleting an unknown id throws. Returns `{success, deleted_events, deleted_links}`. To deactivate without losing history, use `calendar_entities_update` with `active: false` instead.","inputSchema":{"type":"object","properties":{"id":{"type":"integer","description":"Entity id to delete."}},"required":["id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_entities_list","description":"Read-only; no side effects, auth, or rate limits. List tracked entities, each annotated with its outgoing and incoming dependency links. Returns `{entities, count}`.","inputSchema":{"type":"object","properties":{"active_only":{"type":"boolean","description":"If true, exclude retired (active=false) entities."},"kind":{"type":"string","description":"Filter to entities with this exact `kind`."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_entities_link","description":"SIDE-EFFECTFUL. Create or update a directed dependency edge between two entities (e.g. \\"A feeds B\\"), or remove one with `remove: true`. Idempotent, upserts the label on repeat calls; removing an absent link is a no-op. Used by `calendar_events_conflicts`/`calendar_events_list` to flag overlaps across connected entities (one hop, either direction). Returns `{link}` or `{removed}`.","inputSchema":{"type":"object","properties":{"from":{"type":"string","description":"Source entity, name (case-insensitive) or numeric id."},"to":{"type":"string","description":"Target entity, name (case-insensitive) or numeric id."},"label":{"type":"string","description":"Freeform label for the relationship, e.g. \'feeds\', \'depends on\'."},"remove":{"type":"boolean","description":"If true, remove the link instead of creating/updating it."}},"required":["from","to"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_events_add","description":"SIDE-EFFECTFUL. Add a one-off time window (downtime, maintenance, a delivery, a shift, an inspection, etc.) to an entity. NOT idempotent: calling this twice creates two events. `starts_at`/`ends_at` must be ISO 8601 with an explicit timezone (`Z` or `\xb1HH:MM`), naive timestamps are rejected because their meaning would be ambiguous once stored as UTC. Returns `{event}`. Follow up with `calendar_events_conflicts` to check for overlaps.","inputSchema":{"type":"object","properties":{"entity":{"type":"string","description":"Entity the event applies to, name (case-insensitive) or numeric id."},"type":{"type":"string","minLength":1,"description":"Freeform event type, e.g. \'downtime\', \'maintenance\', \'delivery\', \'shift\'."},"title":{"type":"string","minLength":1,"description":"Short title for the event."},"starts_at":{"type":"string","description":"ISO 8601 timestamp with explicit timezone, e.g. \'2026-08-03T02:00:00+05:30\'."},"ends_at":{"type":"string","description":"ISO 8601 timestamp with explicit timezone; must be after starts_at."},"notes":{"type":"string","description":"Optional free-text notes about the event."},"original_timezone":{"type":"string","description":"IANA timezone the window was originally communicated in, for display."},"source":{"type":"string","description":"Freeform provenance, e.g. \'email from ops team\'."}},"required":["entity","type","title","starts_at","ends_at"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_events_update","description":"SIDE-EFFECTFUL. Patch an existing event (move it, retitle it, re-home it to a different entity, etc.). The merged result is re-validated: shrinking `ends_at` below `starts_at` throws. Returns `{event}`.","inputSchema":{"type":"object","properties":{"id":{"type":"integer","description":"Event id."},"entity":{"type":"string","description":"Move the event to a different entity, name or numeric id."},"type":{"type":"string","minLength":1,"description":"Freeform event type, e.g. \'downtime\', \'maintenance\', \'delivery\'."},"title":{"type":"string","minLength":1,"description":"Short title for the event."},"starts_at":{"type":"string","description":"ISO 8601 timestamp with explicit timezone."},"ends_at":{"type":"string","description":"ISO 8601 timestamp with explicit timezone."},"notes":{"type":["string","null"],"description":"Optional free-text notes."},"original_timezone":{"type":["string","null"],"description":"IANA timezone the window was originally communicated in, for display."},"source":{"type":["string","null"],"description":"Freeform provenance, e.g. \'email from ops team\'."}},"required":["id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_events_delete","description":"DESTRUCTIVE. Delete one event by id. Idempotent: deleting an already-absent id is a no-op. Returns `{success, existed}`.","inputSchema":{"type":"object","properties":{"id":{"type":"integer","description":"Event id to delete."}},"required":["id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_events_list","description":"Read-only; no side effects, auth, or rate limits. List events overlapping a window (half-open: an event ending exactly at `from` is excluded), optionally filtered by entity/type. Set `include_conflicts` to also run conflict detection over the same window and attach it. Returns `{events, count, conflicts?}`. For conflicts alone, prefer `calendar_events_conflicts`.","inputSchema":{"type":"object","properties":{"from":{"type":"string","description":"Window start, ISO 8601 with explicit timezone."},"to":{"type":"string","description":"Window end, ISO 8601 with explicit timezone."},"entity":{"type":"string","description":"Filter to one entity, name or numeric id."},"type":{"type":"string","description":"Filter to an exact event type."},"limit":{"type":"integer","exclusiveMinimum":0,"description":"Max rows (default 500)."},"include_conflicts":{"type":"boolean","description":"If true, also compute conflicts for `from`..`to` (both required when set) and include them in the response."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_events_conflicts","description":"Read-only; no side effects, auth, or rate limits. Report scheduling conflicts in a window: overlaps on the same entity (`overlap`), overlaps between linked entities one hop apart (`linked_overlap`), and gaps smaller than a minimum buffer (`insufficient_buffer`). Computed on demand, nothing is persisted. Buffer defaults to the `calendar.min_buffer_minutes` setting (0 = off); pass `buffer_minutes` to override for this call. Returns `{conflicts, count, buffer_minutes, events_considered}`. See also `calendar_events_list` with `include_conflicts`.","inputSchema":{"type":"object","properties":{"from":{"type":"string","description":"Window start, ISO 8601 with explicit timezone."},"to":{"type":"string","description":"Window end, ISO 8601 with explicit timezone."},"entity":{"type":"string","description":"Scope to one entity (and its linked neighbors), name or numeric id."},"buffer_minutes":{"type":"integer","minimum":0,"description":"Override the configured minimum gap between events, in minutes. 0 disables buffer checks."}},"required":["from","to"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_export_ics","description":"Read-only; no side effects, auth, or rate limits. Export events in a window as an RFC 5545 ICS calendar (UTC times, no VTIMEZONE needed) for import into Outlook/Calendar apps. Returns `{ics, event_count}` with the calendar text as a JSON string field.","inputSchema":{"type":"object","properties":{"from":{"type":"string","description":"Window start, ISO 8601 with explicit timezone."},"to":{"type":"string","description":"Window end, ISO 8601 with explicit timezone."},"entity":{"type":"string","description":"Filter to one entity, name or numeric id."},"calendar_name":{"type":"string","description":"Calendar display name (X-WR-CALNAME). Defaults to \'Kontexta Calendar\'."}},"required":["from","to"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}}]}'),x=["Read","Write","Search","Tags & Favorites","Folders & Projects","Versioning","Discovery","Calendar","Hands","Admin"],y={files_read:"Read",files_read_outline:"Read",files_describe:"Read",files_list:"Read",admin_get_profile:"Read",admin_refresh_session_context:"Read",folders_list:"Folders & Projects",projects_list:"Folders & Projects",tags_list:"Tags & Favorites",files_create:"Write",files_update:"Write",files_delete:"Write",files_move:"Write",folders_create:"Folders & Projects",folders_delete:"Folders & Projects",projects_register:"Folders & Projects",admin_onboard_agent:"Folders & Projects",admin_transfer_agent_context:"Folders & Projects",journal_write:"Write",journal_distill:"Write",journal_status:"Discovery",journal_housekeep:"Write",journal_commit_upgrades:"Write",resources_clip_url:"Write",resources_add_report:"Write",resources_delete_report:"Write",resources_list_reports:"Read",resources_export_report:"Discovery",files_search:"Search",files_regex_search:"Search",files_find_related:"Search",tags_add:"Tags & Favorites",tags_remove:"Tags & Favorites",tags_set_favorite:"Tags & Favorites",tags_search:"Tags & Favorites",tags_suggest:"Tags & Favorites",files_get_history:"Versioning",files_get_diff:"Versioning",files_restore:"Versioning",admin_overview:"Discovery",projects_map:"Discovery",files_diff_against_disk:"Discovery",projects_refresh_index:"Discovery",calendar_entities_add:"Calendar",calendar_entities_update:"Calendar",calendar_entities_delete:"Calendar",calendar_entities_list:"Calendar",calendar_entities_link:"Calendar",calendar_events_add:"Calendar",calendar_events_update:"Calendar",calendar_events_delete:"Calendar",calendar_events_list:"Calendar",calendar_events_conflicts:"Calendar",calendar_export_ics:"Calendar",hands_list:"Hands",hands_reload:"Hands",hands_confirm:"Hands",admin_set_machine_label:"Admin",admin_list_clients:"Admin",conflicts_list:"Admin",conflicts_get:"Admin",conflicts_resolve:"Admin"};async function z(a){if(!(0,u.T5)(a))return new v.NextResponse("Unauthorized",{status:401});let b=w.Y.map(a=>({...a,category:y[a.name]??"Discovery"})).sort((a,b)=>a.name.localeCompare(b.name));return v.NextResponse.json({generatedAt:w.r,categoryOrder:x,tools:b})}let A=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/mcp-tools/route",pathname:"/api/mcp-tools",filename:"route",bundlePath:"app/api/mcp-tools/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/kontexta/kontexta/apps/web/src/app/api/mcp-tools/route.ts",nextConfigOutput:"standalone",userland:d}),{workAsyncStorage:B,workUnitAsyncStorage:C,serverHooks:D}=A;function E(){return(0,g.patchFetch)({workAsyncStorage:B,workUnitAsyncStorage:C})}async function F(a,b,c){var d;let e="/api/mcp-tools/route";"/index"===e&&(e="/");let g=await A.prepare(a,b,{srcPage:e,multiZoneDraftMode:!1});if(!g)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:u,params:v,nextConfig:w,isDraftMode:x,prerenderManifest:y,routerServerContext:z,isOnDemandRevalidate:B,revalidateOnlyGenerated:C,resolvedPathname:D}=g,E=(0,j.normalizeAppPath)(e),F=!!(y.dynamicRoutes[E]||y.routes[D]);if(F&&!x){let a=!!y.routes[D],b=y.dynamicRoutes[E];if(b&&!1===b.fallback&&!a)throw new s.NoFallbackError}let G=null;!F||A.isDev||x||(G="/index"===(G=D)?"/":G);let H=!0===A.isDev||!F,I=F&&!H,J=a.method||"GET",K=(0,i.getTracer)(),L=K.getActiveScopeSpan(),M={params:v,prerenderManifest:y,renderOpts:{experimental:{cacheComponents:!!w.experimental.cacheComponents,authInterrupts:!!w.experimental.authInterrupts},supportsDynamicResponse:H,incrementalCache:(0,h.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:null==(d=w.experimental)?void 0:d.cacheLife,isRevalidate:I,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d)=>A.onRequestError(a,b,d,z)},sharedContext:{buildId:u}},N=new k.NodeNextRequest(a),O=new k.NodeNextResponse(b),P=l.NextRequestAdapter.fromNodeNextRequest(N,(0,l.signalFromNodeResponse)(b));try{let d=async c=>A.handle(P,M).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let d=K.getRootSpanAttributes();if(!d)return;if(d.get("next.span_type")!==m.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${d.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=d.get("next.route");if(e){let a=`${J} ${e}`;c.setAttributes({"next.route":e,"http.route":e,"next.span_name":a}),c.updateName(a)}else c.updateName(`${J} ${a.url}`)}),g=async g=>{var i,j;let k=async({previousCacheEntry:f})=>{try{if(!(0,h.getRequestMeta)(a,"minimalMode")&&B&&C&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let e=await d(g);a.fetchMetrics=M.renderOpts.fetchMetrics;let i=M.renderOpts.pendingWaitUntil;i&&c.waitUntil&&(c.waitUntil(i),i=void 0);let j=M.renderOpts.collectedTags;if(!F)return await (0,o.I)(N,O,e,M.renderOpts.pendingWaitUntil),null;{let a=await e.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(e.headers);j&&(b[r.NEXT_CACHE_TAGS_HEADER]=j),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==M.renderOpts.collectedRevalidate&&!(M.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&M.renderOpts.collectedRevalidate,d=void 0===M.renderOpts.collectedExpire||M.renderOpts.collectedExpire>=r.INFINITE_CACHE?void 0:M.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:e.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:d}}}}catch(b){throw(null==f?void 0:f.isStale)&&await A.onRequestError(a,b,{routerKind:"App Router",routePath:e,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:I,isOnDemandRevalidate:B})},z),b}},l=await A.handleResponse({req:a,nextConfig:w,cacheKey:G,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:y,isRoutePPREnabled:!1,isOnDemandRevalidate:B,revalidateOnlyGenerated:C,responseGenerator:k,waitUntil:c.waitUntil});if(!F)return null;if((null==l||null==(i=l.value)?void 0:i.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==l||null==(j=l.value)?void 0:j.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});(0,h.getRequestMeta)(a,"minimalMode")||b.setHeader("x-nextjs-cache",B?"REVALIDATED":l.isMiss?"MISS":l.isStale?"STALE":"HIT"),x&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,p.fromNodeOutgoingHttpHeaders)(l.value.headers);return(0,h.getRequestMeta)(a,"minimalMode")&&F||m.delete(r.NEXT_CACHE_TAGS_HEADER),!l.cacheControl||b.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,q.getCacheControlHeader)(l.cacheControl)),await (0,o.I)(N,O,new Response(l.value.body,{headers:m,status:l.value.status||200})),null};L?await g(L):await K.withPropagatedContext(a.headers,()=>K.trace(m.BaseServerSpan.handleRequest,{spanName:`${J} ${a.url}`,kind:i.SpanKind.SERVER,attributes:{"http.method":J,"http.target":a.url}},g))}catch(b){if(b instanceof s.NoFallbackError||await A.onRequestError(a,b,{routerKind:"App Router",routePath:E,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:I,isOnDemandRevalidate:B})}),F)throw b;return await (0,o.I)(N,O,new Response(null,{status:500})),null}}},16040:(a,b,c)=>{"use strict";c.d(b,{BE:()=>i,Er:()=>h,Sg:()=>j,T1:()=>k,T5:()=>l});var d=c(77598),e=c.n(d),f=c(28684);function g(){if(globalThis.__kontextaSessionSecret)return globalThis.__kontextaSessionSecret;let a=null;try{a=(0,f.getSetting)("auth_session_secret")}catch{return globalThis.__kontextaTmpSessionSecret??(globalThis.__kontextaTmpSessionSecret=e().randomBytes(32).toString("hex"))}return a||(a=e().randomBytes(32).toString("hex"),(0,f.setSetting)("auth_session_secret",a)),globalThis.__kontextaSessionSecret=a,a}function h(a){let b=e().randomBytes(32).toString("hex");return{hash:e().scryptSync(a,b,64).toString("hex"),salt:b}}function i(a,b,c){let d=e().scryptSync(a,c,64).toString("hex");return e().timingSafeEqual(Buffer.from(b,"hex"),Buffer.from(d,"hex"))}function j(a){let b=g(),c=Buffer.from(JSON.stringify(a)).toString("base64"),d=e().createHmac("sha256",b).update(c).digest("hex");return`${c}.${d}`}function k(a){let b=!1;try{b="true"===(0,f.getSetting)("auth_trust_proxy_headers")}catch{b=!1}if(!b)return"direct";let c=a.headers.get("x-forwarded-for");if(c){let a=c.split(",")[0].trim();if(a)return a}let d=a.headers.get("x-real-ip");return d?d.trim():"direct"}function l(a){let b=null;try{b=(0,f.getSetting)("auth_password_hash")}catch{return!0}if(!b)return!0;let c=!1;try{c="true"===(0,f.getSetting)("auth_trust_proxy_headers")}catch{c=!1}let d=c?a.headers.get("x-forwarded-for")?.split(",")[0].trim()??a.headers.get("x-real-ip")??void 0:void 0,h=!1;if("cookies"in a&&"function"==typeof a.cookies.get)h=!!a.cookies.get("kontexta_locked")?.value;else{let b=a.headers.get("cookie");b&&(h=/(?:^|;\s*)kontexta_locked=1/.test(b))}if(!h&&function(a){let b=null;try{b=(0,f.getSetting)("auth_bypass_ips")}catch{return!1}if(!b)return!1;let c=b.split(",").map(a=>a.trim());return!!(a&&c.includes(a)||(c.includes("127.0.0.1")||c.includes("localhost")||c.includes("*"))&&("127.0.0.1"===a||"::1"===a||"localhost"===a))}(d))return!0;let i=null;if("cookies"in a&&"function"==typeof a.cookies.get)i=a.cookies.get("kontexta_session")?.value;else{let b=a.headers.get("cookie");if(b){let a=b.match(/(?:^|;\s*)kontexta_session=([^;]+)/);if(a)try{i=decodeURIComponent(a[1])}catch{i=a[1]}}}return!!(i&&function(a){try{let[b,c]=a.split(".");if(!b||!c)return null;let d=g(),f=e().createHmac("sha256",d).update(b).digest("hex"),h=Buffer.from(c,"hex"),i=Buffer.from(f,"hex");if(h.length!==i.length||!e().timingSafeEqual(h,i))return null;let j=JSON.parse(Buffer.from(b,"base64").toString("utf-8"));if("number"!=typeof j?.t||Date.now()-j.t>2592e6)return null;return j}catch{return null}}(i))}},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},28684:a=>{"use strict";a.exports=require("kxta-core")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},76727:()=>{},77598:a=>{"use strict";a.exports=require("node:crypto")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[2923,9372],()=>b(b.s=14978));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=2224,a.ids=[2224],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4751:()=>{},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14978:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>F,patchFetch:()=>E,routeModule:()=>A,serverHooks:()=>D,workAsyncStorage:()=>B,workUnitAsyncStorage:()=>C});var d={};c.r(d),c.d(d,{GET:()=>z});var e=c(20584),f=c(18093),g=c(84892),h=c(17262),i=c(55572),j=c(261),k=c(26370),l=c(97824),m=c(92768),n=c(98611),o=c(52333),p=c(67359),q=c(5601),r=c(92710),s=c(86439),t=c(79596),u=c(16040),v=c(36865);let w=JSON.parse('{"r":"2026-11-29T14:59:58.405Z","Y":[{"name":"admin_refresh_session_context","description":"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.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{}},"execution":{"taskSupport":"forbidden"}},{"name":"journal_write","description":"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`.","inputSchema":{"type":"object","properties":{"kind":{"type":"string","enum":["append","note","intent"],"description":"Event kind. Selects which body fields are required and how the event is stored."},"text":{"type":"string","description":"Required for kind=\'append\' or kind=\'note\'. Body of the entry."},"summary":{"type":"string","description":"Required for kind=\'intent\'. One-line summary of the new intent."},"tags":{"type":"array","items":{"type":"string"},"description":"Optional for kind=\'note\'. Tags for the note."},"project_id":{"type":"number","description":"Optional for kind=\'append\'. Project ID context."}},"required":["kind"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_create","description":"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\'.","inputSchema":{"type":"object","properties":{"files":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","description":"Title of the file"},"content":{"type":"string","description":"Content of the file"},"destination":{"type":"string","enum":["knowledge","project","kontexta"],"description":"Destination type"},"project_id":{"type":"number","description":"Project ID (required for project/kontexta destinations)"},"folder":{"type":"string","description":"Optional folder path"},"tags":{"type":"array","items":{"type":"string"},"description":"Optional array of tags"},"format":{"type":"string","enum":["md","mmd","html"],"description":"File extension to write. Defaults to \'md\'. Use \'html\' for HTML reports."},"kind":{"type":"string","enum":["dictionary","note"],"description":"REQUIRED for destination=\'knowledge\'. \'dictionary\' = source of truth (mappings, glossaries, runbooks, PR templates). \'note\' = snapshot (meeting notes, sprint reviews, PR findings, post-mortems). Test: if this file disagreed with the code, who wins? File wins → dictionary; file loses → note. Ignored for destination=\'project\' or \'kontexta\'."}},"required":["title","content","destination"],"additionalProperties":false},"minItems":1,"maxItems":200,"description":"Files to create. Single-element array = one-file case. Max 200 per call."}},"required":["files"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"resources_add_report","description":"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.","inputSchema":{"type":"object","properties":{"filename":{"type":"string","description":"Requested filename with extension"},"bytes_base64":{"type":"string","description":"Base64-encoded file bytes"}},"required":["filename","bytes_base64"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"resources_list_reports","description":"List all files currently stored under reports/resources/. Returns filename, size in bytes, and served URL.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{}},"execution":{"taskSupport":"forbidden"}},{"name":"resources_delete_report","description":"Delete a file from reports/resources/. No-op if it doesn\'t exist.","inputSchema":{"type":"object","properties":{"filename":{"type":"string","description":"Filename (relative) of the resource to delete from reports/resources/."}},"required":["filename"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"resources_export_report","description":"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.","inputSchema":{"type":"object","properties":{"id":{"type":"number","description":"File ID of the HTML report to export."},"format":{"type":"string","enum":["pdf","png"],"default":"pdf","description":"Output format: \'pdf\' or \'png\'."},"inline_bytes":{"type":"boolean","default":false,"description":"If true, render in-process and return raw bytes (base64). Only available in the full kontexta CLI bundle; falls back to {url} otherwise."}},"required":["id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_read","description":"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.","inputSchema":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":0,"description":"Single file by ID."},"path":{"type":"string","description":"Single file by absolute on-disk path (must match exactly what Kontexta indexed)."},"ids":{"type":"array","items":{"type":"number"},"minItems":1,"maxItems":200,"description":"Batch mode: multiple file IDs (max 200 per call); returns an array plus aggregate token cost."},"section":{"type":"string","description":"Partial read: return only this heading\'s body (case-insensitive exact-string after trim). Requires `id`; mutually exclusive with `lines`."},"lines":{"type":"object","properties":{"from":{"type":"integer","exclusiveMinimum":0,"description":"First line (1-indexed, inclusive)"},"to":{"type":"integer","exclusiveMinimum":0,"description":"Last line (1-indexed, inclusive)"}},"required":["from","to"],"additionalProperties":false,"description":"Partial read: 1-indexed inclusive line range. Requires `id`; mutually exclusive with `section`."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_describe","description":"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.","inputSchema":{"type":"object","properties":{"id":{"type":"number","description":"File ID"}},"required":["id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_regex_search","description":"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.","inputSchema":{"type":"object","properties":{"pattern":{"type":"string","description":"JavaScript RegExp source"},"file_id":{"type":"number","description":"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`."},"project_id":{"type":["number","null"],"description":"Scope to one project, null for KB-only, omit for everything. Ignored when `file_id` is set."},"case_insensitive":{"type":"boolean","description":"If true, match pattern case-insensitively (RegExp \'i\' flag). Default false."},"max_files":{"type":"integer","exclusiveMinimum":0,"maximum":2000,"description":"Cap on files scanned (default 500). Ignored when `file_id` is set."},"max_matches_per_file":{"type":"integer","exclusiveMinimum":0,"maximum":100,"description":"Per-file hit cap in multi-file mode (default 10). Ignored when `file_id` is set."},"max_matches":{"type":"integer","exclusiveMinimum":0,"maximum":500,"description":"Cap on returned hits in single-file mode (default 100). Only used when `file_id` is set."},"kind":{"type":"string","enum":["dictionary","note","journal","project"],"description":"Filter by content class before scanning. Ignored when `file_id` is set."}},"required":["pattern"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_update","description":"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.","inputSchema":{"type":"object","properties":{"id":{"type":"number","description":"File ID"},"content":{"type":"string","description":"New content. With `section` set, this replaces just that heading\'s body; otherwise it becomes the entire file body."},"section":{"type":"string","description":"Case-insensitive exact-string heading. When set, only this heading\'s body is rewritten instead of the whole file."}},"required":["id","content"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_delete","description":"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.","inputSchema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"number"},"minItems":1,"maxItems":500,"description":"File IDs to delete. Single-element array = one-file case. Max 500 per call."}},"required":["ids"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_list","description":"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`.","inputSchema":{"type":"object","properties":{"project_id":{"type":["number","null"],"description":"Filter by project ID. Pass null to list ONLY Knowledge Base files (project_id IS NULL)."},"tag":{"type":"string","description":"Filter by tag name"},"favorite":{"type":"boolean","description":"Filter by favorite status"},"folder":{"type":"string","description":"Filter by folder path"},"untagged":{"type":"boolean","description":"If true, return only files that have no tags. Useful for bulk-tagging workflows."},"limit":{"type":"number","description":"Maximum number of results"},"offset":{"type":"number","description":"Offset for pagination"},"kind":{"type":"string","enum":["dictionary","note","journal","project"],"description":"Filter by content class. dictionary = authoritative KB, note = informational KB, journal = time-log, project = project file."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_search","description":"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\xd7`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.","inputSchema":{"type":"object","properties":{"query":{"type":"string","description":"Search query"},"project_id":{"type":["number","null"],"description":"Filter by project ID. Pass null to search ONLY Knowledge Base files."},"tags":{"type":"array","items":{"type":"string"},"description":"Filter by tags (all must match)"},"favorite":{"type":"boolean","description":"Filter by favorite status"},"kind":{"type":"string","enum":["dictionary","note","journal","project"],"description":"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."},"include_bodies":{"type":"boolean","description":"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."},"format":{"type":"string","enum":["xml","markdown"],"description":"Bundle format when `include_bodies` is true. xml = Anthropic-recommended <document> tags (default); markdown = ## headers + fenced blocks. Ignored otherwise."},"max_tokens":{"type":"integer","exclusiveMinimum":0,"description":"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."},"rerank":{"type":"boolean","description":"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)."},"check_sufficiency":{"type":"boolean","description":"When include_bodies is true, evaluate retrieval sufficiency with non-autoregressive decision model. Default true."},"hybrid":{"type":"boolean","description":"When true (default), combine FTS5 BM25 with local semantic vector search via RRF (falls back cleanly to BM25 if embeddings are unavailable)."},"chunk_level":{"type":"boolean","description":"When include_bodies is true, pack only the most relevant heading-aware sections instead of full files to save tokens. Default false."}},"required":["query"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"tags_add","description":"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`.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"File ID"},"tags":{"type":"array","items":{"type":"string"},"description":"Array of tag names to add"}},"required":["file_id","tags"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"tags_remove","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"File ID"},"tag_ids":{"type":"array","items":{"type":"number"},"description":"Array of tag IDs to remove"}},"required":["file_id","tag_ids"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"tags_set_favorite","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"File ID"},"favorite":{"type":"boolean","description":"Favorite status"}},"required":["file_id","favorite"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"tags_list","description":"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`.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{}},"execution":{"taskSupport":"forbidden"}},{"name":"projects_list","description":"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`, `projects_refresh_index`, etc.). To register a new project use `projects_register`; to inspect its Hands tools use `hands_list`.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{}},"execution":{"taskSupport":"forbidden"}},{"name":"projects_register","description":"Register a new project and link it to the Kontexta knowledge system.\\n\\nSIDE 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.\\n\\nAUTH / RATE LIMITS: None. Operates entirely on the local file system.\\n\\nPARAMETERS:\\n- name: Human-readable project name.\\n- path: Absolute path to the project root. Required. DO NOT guess or assume the path based on the active editor workspace unless the user explicitly asks to register the \\"current\\" or \\"open\\" project. If the user provides a project name but no path, ask them for the absolute path before calling this tool. Fails with a descriptive error if the path does not exist or is inaccessible.\\n- description: Optional free-text description stored with the project metadata.\\n\\nRETURNS: A JSON object containing:\\n- project: { id, name, path, description, created_at }\\n- discovered_files_count: number of markdown files indexed\\n- discovered_files: array of { path, est_tokens, size_bytes } for each file\\n- total_est_tokens: estimated total token cost of all discovered files\\n- hands: { found, tools_registered, tools_disabled, warnings }\\n- warnings: array of non-fatal issues (e.g. scan failures, token budget exceeded)\\n\\nERROR CONDITIONS: Returns isError=true if path is missing or unresolvable. Scan failures are non-fatal and reported in warnings rather than as errors.","inputSchema":{"type":"object","properties":{"name":{"type":"string","description":"Project name"},"path":{"type":"string","description":"Absolute path to the project root. Required. DO NOT guess from the active workspace unless asked. Ask the user if unsure."},"description":{"type":"string","description":"Optional project description"}},"required":["name","path"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"admin_onboard_agent","description":"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.\\n\\nMANDATORY: 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.\\n\\nPARAMETERS:\\n- project_id: number, required.\\n- confirm: boolean, required. Must be true to proceed.\\n- files: string[], optional. Paths relative to project root. For update mode, defaults to recommendation.target_files. Ignored when files is empty AND target_agent is provided (create mode).\\n- target_agent: enum claude-code | codex | gemini | antigravity | cursor | windsurf | opencode | continue | aider | cline | copilot | generic. Required when files is empty AND no context file currently exists. Picks the canonical filename and the starter scaffold (\'generic\', \'codex\', \'windsurf\', and \'opencode\' scaffold AGENTS.md).\\n\\n- hooks: boolean, optional. With target_agent set, also enables that agent and installs its conversation-capture hooks (npx/source installs) or returns the host docker command (Docker). Ask the user before setting it.\\n\\nRETURNS: { written: [{ path, action: created|updated|skipped, version }], skipped: [{ path, reason }], hooks_install?: { agent, mode, enabled, outcome?, docker_command?, note?, error? }, hooks?: { install_mode, alerts, prompt } }","inputSchema":{"type":"object","properties":{"project_id":{"type":"number","description":"Project ID returned from register_project"},"confirm":{"type":"boolean","description":"MANDATORY: Set to true only after obtaining explicit user consent to modify context files."},"files":{"type":"array","items":{"type":"string"},"description":"Project-relative paths to update; defaults to detected context files"},"target_agent":{"type":"string","enum":["claude-code","codex","gemini","antigravity","cursor","windsurf","opencode","continue","aider","cline","copilot","generic"],"description":"Required when files is empty AND no context file exists. Picks the canonical filename + scaffold."},"hooks":{"type":"boolean","description":"With target_agent, also enable that agent and install its conversation-capture hooks (npx/source) or return the host docker command. Ask the user first."}},"required":["project_id","confirm"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"admin_transfer_agent_context","description":"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.\\n\\nThis 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`.\\n\\nMANDATORY: This tool writes new files into Kontexta\'s data dir. You MUST seek explicit user consent before calling. Set \'confirm: true\' only after the user has agreed.\\n\\nPARAMETERS:\\n- project_id: number, required. Project ID returned from register_project.\\n- confirm: boolean, required. Must be true.\\n- files: string[], optional. Project-relative paths to transfer. Omit or pass [] to transfer all detected agent context files (uses the same detection list as register_project / onboard_agent).\\n\\nRETURNS: { transferred: [{ source_path, kb_id, kb_path, est_tokens }], skipped: [{ source_path, reason }], next_action }\\nSkip reasons: \\"missing\\" | \\"symlink\\" | \\"outside_project\\" | \\"already_transferred_same_content\\" | \\"read_error\\" | \\"write_error\\".\\n\\nIDEMPOTENT: re-running with the same files copies nothing if the content is unchanged, duplicate transfers are detected via SHA-256 hash comparison against existing project KB rows.","inputSchema":{"type":"object","properties":{"project_id":{"type":"number","description":"Project ID returned from register_project"},"confirm":{"type":"boolean","description":"MANDATORY: Set to true only after obtaining explicit user consent."},"files":{"type":"array","items":{"type":"string"},"description":"Project-relative paths to transfer. Omit to transfer all detected context files."}},"required":["project_id","confirm"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"resources_clip_url","description":"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.","inputSchema":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"The URL to clip"},"title":{"type":"string","description":"Optional title override (defaults to the page\'s <title>)"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Optional HTTP headers to forward with the fetch (e.g. {\\"Cookie\\": \\"session=...\\"} or {\\"Authorization\\": \\"Bearer ...\\"}). Use to clip pages behind auth walls after AUTH_REQUIRED."}},"required":["url"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_get_history","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"ID of the file"}},"required":["file_id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_get_diff","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"ID of the file"},"commit_a":{"type":"string","description":"Earlier commit hash (from get_history)"},"commit_b":{"type":"string","description":"Later commit hash (from get_history)"}},"required":["file_id","commit_a","commit_b"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_restore","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"ID of the file"},"hash":{"type":"string","description":"Commit hash to restore from (from get_history)"}},"required":["file_id","hash"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_read_outline","description":"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 })`).","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"File ID"}},"required":["file_id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"folders_list","description":"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`.","inputSchema":{"type":"object","properties":{"project_id":{"type":["number","null"],"description":"Project ID. Pass null or omit to list KB folders."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"folders_create","description":"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}`.","inputSchema":{"type":"object","properties":{"project_id":{"type":["number","null"],"description":"Project ID. Pass null or omit to create the folder under the KB."},"name":{"type":"string","description":"Folder name (relative; supports nested paths via \'/\')"}},"required":["name"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"folders_delete","description":"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}`.","inputSchema":{"type":"object","properties":{"project_id":{"type":["number","null"],"description":"Project ID. Pass null or omit to delete from the KB. Project IDs are rejected."},"name":{"type":"string","description":"Folder name (relative)"}},"required":["name"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_move","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"File ID"},"new_path":{"type":"string","description":"Absolute destination path"},"kind":{"type":"string","enum":["dictionary","note"],"description":"Move the file to the mirrored path in the other class tree. Subfolder path is preserved: knowledge/dictionary/slt/ids.md ↔ knowledge/notes/slt/ids.md. Ignored if `new_path` is also provided."}},"required":["file_id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_find_related","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"ID of the file to find relations for"},"limit":{"type":"number","description":"Maximum number of related files to return (default 10)"},"kind":{"type":"string","enum":["dictionary","note","journal","project"],"description":"Filter related results to a single content class."}},"required":["file_id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"tags_search","description":"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}`.","inputSchema":{"type":"object","properties":{"query":{"type":"string","description":"Full-text search query"},"add_tags":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Tags to add to every matching file"},"project_id":{"type":["number","null"],"description":"Scope search to a specific project. Pass null for KB-only results."},"tags":{"type":"array","items":{"type":"string"},"description":"Filter, only matches that already carry ALL of these tags"},"favorite":{"type":"boolean","description":"If true, restrict to favorited files only."}},"required":["query","add_tags"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"admin_overview","description":"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. `mode: \'hygiene\'` = scan Knowledge Base files (`project_id IS NULL`, never physical repo files) for near-duplicate files, note-vs-dictionary semantic overlaps, and stale project-file references inside KB docs (plus chunk/embedding coverage stats). Note: stale-reference checks inspect each project\'s currently checked-out working tree / active git branch, which may diverge from `main` or other branches. Both modes: `project_id: null` = KB only; omit = everything. Read-only unless `backfill_embeddings: true` in hygiene mode.","inputSchema":{"type":"object","properties":{"mode":{"type":"string","enum":["stats","whats_new","hygiene"],"description":"Which snapshot to return. \'whats_new\' requires `since`; \'hygiene\' inspects duplicates, dictionary overlaps, and stale project refs."},"project_id":{"type":["number","null"],"description":"Filter to a single project. Pass null for KB-only. Omit for everything."},"top_tags":{"type":"integer","exclusiveMinimum":0,"maximum":100,"description":"mode=\'stats\' only: how many top tags to return (default 10)"},"include_token_total":{"type":"boolean","description":"mode=\'stats\' only: if true, stat every matching file on disk to compute total est_tokens. Default false (cheap)."},"since":{"type":"string","description":"REQUIRED for mode=\'whats_new\'. ISO 8601 timestamp or relative duration (e.g. \\"1h\\", \\"7d\\", \\"2w\\")."},"include_tags":{"type":"boolean","description":"mode=\'whats_new\' only: attach tags[] to each file. Default true."},"limit":{"type":"number","description":"mode=\'whats_new\' or \'hygiene\': max items returned."},"duplicate_threshold":{"type":"number","minimum":0.5,"maximum":1,"description":"mode=\'hygiene\' only: cosine similarity threshold for near-duplicates (default 0.86)."},"overlap_threshold":{"type":"number","minimum":0.5,"maximum":1,"description":"mode=\'hygiene\' only: cosine similarity threshold for note-vs-dictionary overlaps (default 0.78)."},"include_journal":{"type":"boolean","description":"mode=\'hygiene\' only: include journal files in hygiene checks (default false)."},"include_dismissed":{"type":"boolean","description":"mode=\'hygiene\' only: include dismissed findings (default false)."},"backfill_embeddings":{"type":"boolean","description":"mode=\'hygiene\' only: lazily chunk and embed unindexed files before scanning (default false)."}},"required":["mode"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"tags_suggest","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"File ID to suggest tags for"},"limit":{"type":"integer","exclusiveMinimum":0,"maximum":50,"description":"Max suggestions to return (default 10)"}},"required":["file_id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"files_diff_against_disk","description":"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.","inputSchema":{"type":"object","properties":{"file_id":{"type":"number","description":"File ID"}},"required":["file_id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"projects_refresh_index","description":"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.","inputSchema":{"type":"object","properties":{"project_id":{"type":["number","null"],"description":"Project ID. Pass null or omit to reindex the Knowledge Base."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"projects_map","description":"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`.","inputSchema":{"type":"object","properties":{"project_id":{"type":["number","null"],"description":"Restrict to a single project. Pass null for knowledge-base-only files. Omit for everything."},"include_tags":{"type":"boolean","description":"Append #tags inline. Default true. Set false to shrink the outline."},"show_titles":{"type":"boolean","description":"Show file titles instead of filenames. Default true."},"max_lines":{"type":"number","description":"Hard cap on output lines (each line ≈ one folder or file). Default 5000."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"hands_list","description":"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`.","inputSchema":{"type":"object","properties":{"schema":{"type":"boolean","description":"If true, return the kontexta.json authoring reference document instead of the registered-hands list. Default false."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"hands_reload","description":"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 })`.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{}},"execution":{"taskSupport":"forbidden"}},{"name":"hands_confirm","description":"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.","inputSchema":{"type":"object","properties":{"token":{"type":"string","description":"The approval token from the pending response"}},"required":["token"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"admin_get_profile","description":"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.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{}},"execution":{"taskSupport":"forbidden"}},{"name":"admin_set_machine_label","description":"Set this machine\'s human-readable label (settings.machine_label). The label is how OTHER machines name conflict copies created from this one (\'<filename> (from <label>).ext\'), so pick something short and distinctive per machine (e.g. the machine\'s name or the user\'s workstation). Pass an empty string to clear it. Affects only conflict-copy naming; it does NOT change the stable machine_id that GIDs are keyed on. Returns the previous and new label.","inputSchema":{"type":"object","properties":{"label":{"type":"string","maxLength":100,"description":"The new label for this machine. Max 100 chars. Empty string clears the label."}},"required":["label"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"admin_list_clients","description":"List every machine that has ever connected to this vault (the sync group), most-recently-seen first. Each entry has machine_id, hostname, first_seen_at, last_seen_at, and is_local (true for the machine this MCP server runs on). Read-only; no side effects, auth, or rate limits. Use to see which machines are part of the sync group or to check that a new machine registered on startup.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{}},"execution":{"taskSupport":"forbidden"}},{"name":"conflicts_list","description":"List sync conflicts in the local conflict registry (Phase 5 Conflict Manager). A conflict is recorded when the storage server delivers an operation for a file that was modified locally since the last sync (base_version drift); the canonical file is preserved and the remote version is forked to a \'<filename> (from <machine_label>).<ext>\' copy. Defaults to unresolved conflicts, newest first. Pass status=\'all\' to include resolved, status=\'resolved\' for the resolved history, and `limit` to cap the page. Returns {conflicts, count, unresolved}: `count` is the length of the returned list, `unresolved` is the global unresolved total (use it to decide whether there is anything to act on). Each conflict carries gid, file_path, conflict_path, origin, origin_label, base_version, server_seq, local_content, remote_content, diff, additions, deletions, status, resolution, resolved_at, created_at. Read-only; no side effects, auth, or rate limits. To inspect a single conflict use conflicts_get; to fix one use conflicts_resolve.","inputSchema":{"type":"object","properties":{"status":{"type":"string","enum":["unresolved","resolved","all"],"description":"Filter by resolution state. Defaults to \'unresolved\'."},"limit":{"type":"integer","exclusiveMinimum":0,"description":"Optional page size. Positive integer; omit for no cap."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"conflicts_get","description":"Fetch one sync conflict by its global ID (gid), for the Conflict Manager. Returns the full ConflictRecord including both content snapshots (local_content, the canonical file as it is on THIS machine, and remote_content, the version that arrived from the other machine), the unified line diff, addition/deletion counts, and the conflict copy\'s on-disk path. If there is no unresolved conflict for the gid it returns the most recent resolved one; returns an error if no conflict exists at all. gid is \'<local_id>@<machine_id>\' as reported by conflicts_list. Read-only; no side effects, auth, or rate limits. After reviewing the diff, resolve with conflicts_resolve.","inputSchema":{"type":"object","properties":{"gid":{"type":"string","description":"Global ID of the conflict, e.g. \'104@4f9e1a8b3c7d2e0f\' (as returned by conflicts_list)."}},"required":["gid"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"conflicts_resolve","description":"Resolve one sync conflict using one of 4 deterministic strategies (spec 1.7). `strategy`: \'keep-server\' = accept the remote version, overwrite the canonical file, delete the conflict copy. \'keep-mine\' = keep the local version, re-assert it to the server (version bump + outbox op), delete the conflict copy. \'keep-both\' = keep the canonical file AND permanently retain the conflict copy as its own newly-tracked file (no outbox op is dropped; the copy is registered with a fresh gid). \'merged\' = use your own `mergedContent` (REQUIRED for this strategy) as the new canonical content, push it, delete the conflict copy. Only acts on an UNRESOLVED conflict for the gid; if none exists it is an error. Returns {success, gid, strategy, resolvedAt, outboxOpId?, newFileGid?}. This is a write operation: it mutates the local file and may enqueue an outbound op for sync.","inputSchema":{"type":"object","properties":{"gid":{"type":"string","description":"Global ID of the conflict to resolve, e.g. \'104@4f9e1a8b3c7d2e0f\' (as returned by conflicts_list)."},"strategy":{"type":"string","enum":["keep-server","keep-mine","keep-both","merged"],"description":"Resolution strategy. See tool description for each behavior."},"mergedContent":{"type":"string","description":"REQUIRED when strategy=\'merged\': the full merged file content to write as the new canonical version. Ignored for all other strategies."}},"required":["gid","strategy"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"journal_distill","description":"Run the distillation pipeline: read raw events since the high-water mark, group by topic, write mechanical markdown entries, advance high-water. Idempotent. Auto-provisions a project row for orphan slugs (e.g. `default`) that have no registered project yet.","inputSchema":{"type":"object","properties":{"project_slug":{"type":"string","description":"Project slug to distill. Defaults to the current active project."},"max_events":{"type":"integer","exclusiveMinimum":0,"maximum":2000,"description":"Maximum raw events to process per run (default 200, max 2000)."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"journal_status","description":"Report the journal backlog and high-water mark for a project.","inputSchema":{"type":"object","properties":{"project_slug":{"type":"string","description":"Project slug to check. Defaults to the current active project."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"journal_commit_upgrades","description":"After dispatching subagents to upgrade mechanical journal entries to LLM-narrative, call this with the affected task slugs. Updates journal_meta.status_latest to mark the entries as upgraded.","inputSchema":{"type":"object","properties":{"task_slugs":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Task slugs whose entries were upgraded by subagents."}},"required":["task_slugs"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"journal_housekeep","description":"Run journal retention/archival for a project. Idempotent. Prunes old raw .jsonl files and archives cold tasks per the configured retention policy.","inputSchema":{"type":"object","properties":{"project_slug":{"type":"string","description":"Project slug to housekeep. Defaults to the current active project."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_entities_add","description":"SIDE-EFFECTFUL. Create a new tracked entity: any named thing you schedule events against (a server, a delivery van, a store location, a piece of equipment, a room, etc.). Not idempotent: a duplicate name (case-insensitive) throws. Returns `{entity}`. Use `calendar_entities_link` afterwards to record dependencies for conflict detection.","inputSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"Unique display name for the entity (case-insensitive)."},"kind":{"type":"string","description":"Freeform category, e.g. \'server\', \'vehicle\', \'location\', \'equipment\'."},"notes":{"type":"string","description":"Freeform notes."},"timezone":{"type":"string","description":"Optional IANA timezone (e.g. \'Europe/Berlin\') for display only, does not affect stored event times."}},"required":["name"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_entities_update","description":"SIDE-EFFECTFUL. Patch an existing entity\'s fields, including `active` (set false to soft-retire it without losing its history). Idempotent per patch. Returns `{entity}`. For a hard delete see `calendar_entities_delete`.","inputSchema":{"type":"object","properties":{"id":{"type":"integer","description":"Entity id (from `calendar_entities_add` or `calendar_entities_list`)."},"name":{"type":"string","minLength":1,"description":"New display name for the entity."},"kind":{"type":["string","null"],"description":"Freeform category, e.g. \'server\', \'vehicle\', \'location\'."},"notes":{"type":["string","null"],"description":"Freeform notes."},"timezone":{"type":["string","null"],"description":"IANA timezone for display purposes (e.g. \'Europe/Berlin\')."},"active":{"type":"boolean","description":"Set false to soft-retire the entity without losing history."}},"required":["id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_entities_delete","description":"DESTRUCTIVE. Permanently delete an entity AND cascade-delete every event and link attached to it. Not idempotent: deleting an unknown id throws. Returns `{success, deleted_events, deleted_links}`. To deactivate without losing history, use `calendar_entities_update` with `active: false` instead.","inputSchema":{"type":"object","properties":{"id":{"type":"integer","description":"Entity id to delete."}},"required":["id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_entities_list","description":"Read-only; no side effects, auth, or rate limits. List tracked entities, each annotated with its outgoing and incoming dependency links. Returns `{entities, count}`.","inputSchema":{"type":"object","properties":{"active_only":{"type":"boolean","description":"If true, exclude retired (active=false) entities."},"kind":{"type":"string","description":"Filter to entities with this exact `kind`."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_entities_link","description":"SIDE-EFFECTFUL. Create or update a directed dependency edge between two entities (e.g. \\"A feeds B\\"), or remove one with `remove: true`. Idempotent, upserts the label on repeat calls; removing an absent link is a no-op. Used by `calendar_events_conflicts`/`calendar_events_list` to flag overlaps across connected entities (one hop, either direction). Returns `{link}` or `{removed}`.","inputSchema":{"type":"object","properties":{"from":{"type":"string","description":"Source entity, name (case-insensitive) or numeric id."},"to":{"type":"string","description":"Target entity, name (case-insensitive) or numeric id."},"label":{"type":"string","description":"Freeform label for the relationship, e.g. \'feeds\', \'depends on\'."},"remove":{"type":"boolean","description":"If true, remove the link instead of creating/updating it."}},"required":["from","to"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_events_add","description":"SIDE-EFFECTFUL. Add a one-off time window (downtime, maintenance, a delivery, a shift, an inspection, etc.) to an entity. NOT idempotent: calling this twice creates two events. `starts_at`/`ends_at` must be ISO 8601 with an explicit timezone (`Z` or `\xb1HH:MM`), naive timestamps are rejected because their meaning would be ambiguous once stored as UTC. Returns `{event}`. Follow up with `calendar_events_conflicts` to check for overlaps.","inputSchema":{"type":"object","properties":{"entity":{"type":"string","description":"Entity the event applies to, name (case-insensitive) or numeric id."},"type":{"type":"string","minLength":1,"description":"Freeform event type, e.g. \'downtime\', \'maintenance\', \'delivery\', \'shift\'."},"title":{"type":"string","minLength":1,"description":"Short title for the event."},"starts_at":{"type":"string","description":"ISO 8601 timestamp with explicit timezone, e.g. \'2026-08-03T02:00:00+05:30\'."},"ends_at":{"type":"string","description":"ISO 8601 timestamp with explicit timezone; must be after starts_at."},"notes":{"type":"string","description":"Optional free-text notes about the event."},"original_timezone":{"type":"string","description":"IANA timezone the window was originally communicated in, for display."},"source":{"type":"string","description":"Freeform provenance, e.g. \'email from ops team\'."}},"required":["entity","type","title","starts_at","ends_at"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_events_update","description":"SIDE-EFFECTFUL. Patch an existing event (move it, retitle it, re-home it to a different entity, etc.). The merged result is re-validated: shrinking `ends_at` below `starts_at` throws. Returns `{event}`.","inputSchema":{"type":"object","properties":{"id":{"type":"integer","description":"Event id."},"entity":{"type":"string","description":"Move the event to a different entity, name or numeric id."},"type":{"type":"string","minLength":1,"description":"Freeform event type, e.g. \'downtime\', \'maintenance\', \'delivery\'."},"title":{"type":"string","minLength":1,"description":"Short title for the event."},"starts_at":{"type":"string","description":"ISO 8601 timestamp with explicit timezone."},"ends_at":{"type":"string","description":"ISO 8601 timestamp with explicit timezone."},"notes":{"type":["string","null"],"description":"Optional free-text notes."},"original_timezone":{"type":["string","null"],"description":"IANA timezone the window was originally communicated in, for display."},"source":{"type":["string","null"],"description":"Freeform provenance, e.g. \'email from ops team\'."}},"required":["id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_events_delete","description":"DESTRUCTIVE. Delete one event by id. Idempotent: deleting an already-absent id is a no-op. Returns `{success, existed}`.","inputSchema":{"type":"object","properties":{"id":{"type":"integer","description":"Event id to delete."}},"required":["id"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_events_list","description":"Read-only; no side effects, auth, or rate limits. List events overlapping a window (half-open: an event ending exactly at `from` is excluded), optionally filtered by entity/type. Set `include_conflicts` to also run conflict detection over the same window and attach it. Returns `{events, count, conflicts?}`. For conflicts alone, prefer `calendar_events_conflicts`.","inputSchema":{"type":"object","properties":{"from":{"type":"string","description":"Window start, ISO 8601 with explicit timezone."},"to":{"type":"string","description":"Window end, ISO 8601 with explicit timezone."},"entity":{"type":"string","description":"Filter to one entity, name or numeric id."},"type":{"type":"string","description":"Filter to an exact event type."},"limit":{"type":"integer","exclusiveMinimum":0,"description":"Max rows (default 500)."},"include_conflicts":{"type":"boolean","description":"If true, also compute conflicts for `from`..`to` (both required when set) and include them in the response."}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_events_conflicts","description":"Read-only; no side effects, auth, or rate limits. Report scheduling conflicts in a window: overlaps on the same entity (`overlap`), overlaps between linked entities one hop apart (`linked_overlap`), and gaps smaller than a minimum buffer (`insufficient_buffer`). Computed on demand, nothing is persisted. Buffer defaults to the `calendar.min_buffer_minutes` setting (0 = off); pass `buffer_minutes` to override for this call. Returns `{conflicts, count, buffer_minutes, events_considered}`. See also `calendar_events_list` with `include_conflicts`.","inputSchema":{"type":"object","properties":{"from":{"type":"string","description":"Window start, ISO 8601 with explicit timezone."},"to":{"type":"string","description":"Window end, ISO 8601 with explicit timezone."},"entity":{"type":"string","description":"Scope to one entity (and its linked neighbors), name or numeric id."},"buffer_minutes":{"type":"integer","minimum":0,"description":"Override the configured minimum gap between events, in minutes. 0 disables buffer checks."}},"required":["from","to"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}},{"name":"calendar_export_ics","description":"Read-only; no side effects, auth, or rate limits. Export events in a window as an RFC 5545 ICS calendar (UTC times, no VTIMEZONE needed) for import into Outlook/Calendar apps. Returns `{ics, event_count}` with the calendar text as a JSON string field.","inputSchema":{"type":"object","properties":{"from":{"type":"string","description":"Window start, ISO 8601 with explicit timezone."},"to":{"type":"string","description":"Window end, ISO 8601 with explicit timezone."},"entity":{"type":"string","description":"Filter to one entity, name or numeric id."},"calendar_name":{"type":"string","description":"Calendar display name (X-WR-CALNAME). Defaults to \'Kontexta Calendar\'."}},"required":["from","to"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"},"execution":{"taskSupport":"forbidden"}}]}'),x=["Read","Write","Search","Tags & Favorites","Folders & Projects","Versioning","Discovery","Calendar","Hands","Admin"],y={files_read:"Read",files_read_outline:"Read",files_describe:"Read",files_list:"Read",admin_get_profile:"Read",admin_refresh_session_context:"Read",folders_list:"Folders & Projects",projects_list:"Folders & Projects",tags_list:"Tags & Favorites",files_create:"Write",files_update:"Write",files_delete:"Write",files_move:"Write",folders_create:"Folders & Projects",folders_delete:"Folders & Projects",projects_register:"Folders & Projects",admin_onboard_agent:"Folders & Projects",admin_transfer_agent_context:"Folders & Projects",journal_write:"Write",journal_distill:"Write",journal_status:"Discovery",journal_housekeep:"Write",journal_commit_upgrades:"Write",resources_clip_url:"Write",resources_add_report:"Write",resources_delete_report:"Write",resources_list_reports:"Read",resources_export_report:"Discovery",files_search:"Search",files_regex_search:"Search",files_find_related:"Search",tags_add:"Tags & Favorites",tags_remove:"Tags & Favorites",tags_set_favorite:"Tags & Favorites",tags_search:"Tags & Favorites",tags_suggest:"Tags & Favorites",files_get_history:"Versioning",files_get_diff:"Versioning",files_restore:"Versioning",admin_overview:"Discovery",projects_map:"Discovery",files_diff_against_disk:"Discovery",projects_refresh_index:"Discovery",calendar_entities_add:"Calendar",calendar_entities_update:"Calendar",calendar_entities_delete:"Calendar",calendar_entities_list:"Calendar",calendar_entities_link:"Calendar",calendar_events_add:"Calendar",calendar_events_update:"Calendar",calendar_events_delete:"Calendar",calendar_events_list:"Calendar",calendar_events_conflicts:"Calendar",calendar_export_ics:"Calendar",hands_list:"Hands",hands_reload:"Hands",hands_confirm:"Hands",admin_set_machine_label:"Admin",admin_list_clients:"Admin",conflicts_list:"Admin",conflicts_get:"Admin",conflicts_resolve:"Admin"};async function z(a){if(!(0,u.T5)(a))return new v.NextResponse("Unauthorized",{status:401});let b=w.Y.map(a=>({...a,category:y[a.name]??"Discovery"})).sort((a,b)=>a.name.localeCompare(b.name));return v.NextResponse.json({generatedAt:w.r,categoryOrder:x,tools:b})}let A=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/mcp-tools/route",pathname:"/api/mcp-tools",filename:"route",bundlePath:"app/api/mcp-tools/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/runner/work/kontexta/kontexta/apps/web/src/app/api/mcp-tools/route.ts",nextConfigOutput:"standalone",userland:d}),{workAsyncStorage:B,workUnitAsyncStorage:C,serverHooks:D}=A;function E(){return(0,g.patchFetch)({workAsyncStorage:B,workUnitAsyncStorage:C})}async function F(a,b,c){var d;let e="/api/mcp-tools/route";"/index"===e&&(e="/");let g=await A.prepare(a,b,{srcPage:e,multiZoneDraftMode:!1});if(!g)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:u,params:v,nextConfig:w,isDraftMode:x,prerenderManifest:y,routerServerContext:z,isOnDemandRevalidate:B,revalidateOnlyGenerated:C,resolvedPathname:D}=g,E=(0,j.normalizeAppPath)(e),F=!!(y.dynamicRoutes[E]||y.routes[D]);if(F&&!x){let a=!!y.routes[D],b=y.dynamicRoutes[E];if(b&&!1===b.fallback&&!a)throw new s.NoFallbackError}let G=null;!F||A.isDev||x||(G="/index"===(G=D)?"/":G);let H=!0===A.isDev||!F,I=F&&!H,J=a.method||"GET",K=(0,i.getTracer)(),L=K.getActiveScopeSpan(),M={params:v,prerenderManifest:y,renderOpts:{experimental:{cacheComponents:!!w.experimental.cacheComponents,authInterrupts:!!w.experimental.authInterrupts},supportsDynamicResponse:H,incrementalCache:(0,h.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:null==(d=w.experimental)?void 0:d.cacheLife,isRevalidate:I,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d)=>A.onRequestError(a,b,d,z)},sharedContext:{buildId:u}},N=new k.NodeNextRequest(a),O=new k.NodeNextResponse(b),P=l.NextRequestAdapter.fromNodeNextRequest(N,(0,l.signalFromNodeResponse)(b));try{let d=async c=>A.handle(P,M).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let d=K.getRootSpanAttributes();if(!d)return;if(d.get("next.span_type")!==m.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${d.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=d.get("next.route");if(e){let a=`${J} ${e}`;c.setAttributes({"next.route":e,"http.route":e,"next.span_name":a}),c.updateName(a)}else c.updateName(`${J} ${a.url}`)}),g=async g=>{var i,j;let k=async({previousCacheEntry:f})=>{try{if(!(0,h.getRequestMeta)(a,"minimalMode")&&B&&C&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let e=await d(g);a.fetchMetrics=M.renderOpts.fetchMetrics;let i=M.renderOpts.pendingWaitUntil;i&&c.waitUntil&&(c.waitUntil(i),i=void 0);let j=M.renderOpts.collectedTags;if(!F)return await (0,o.I)(N,O,e,M.renderOpts.pendingWaitUntil),null;{let a=await e.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(e.headers);j&&(b[r.NEXT_CACHE_TAGS_HEADER]=j),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==M.renderOpts.collectedRevalidate&&!(M.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&M.renderOpts.collectedRevalidate,d=void 0===M.renderOpts.collectedExpire||M.renderOpts.collectedExpire>=r.INFINITE_CACHE?void 0:M.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:e.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:d}}}}catch(b){throw(null==f?void 0:f.isStale)&&await A.onRequestError(a,b,{routerKind:"App Router",routePath:e,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:I,isOnDemandRevalidate:B})},z),b}},l=await A.handleResponse({req:a,nextConfig:w,cacheKey:G,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:y,isRoutePPREnabled:!1,isOnDemandRevalidate:B,revalidateOnlyGenerated:C,responseGenerator:k,waitUntil:c.waitUntil});if(!F)return null;if((null==l||null==(i=l.value)?void 0:i.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==l||null==(j=l.value)?void 0:j.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});(0,h.getRequestMeta)(a,"minimalMode")||b.setHeader("x-nextjs-cache",B?"REVALIDATED":l.isMiss?"MISS":l.isStale?"STALE":"HIT"),x&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,p.fromNodeOutgoingHttpHeaders)(l.value.headers);return(0,h.getRequestMeta)(a,"minimalMode")&&F||m.delete(r.NEXT_CACHE_TAGS_HEADER),!l.cacheControl||b.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,q.getCacheControlHeader)(l.cacheControl)),await (0,o.I)(N,O,new Response(l.value.body,{headers:m,status:l.value.status||200})),null};L?await g(L):await K.withPropagatedContext(a.headers,()=>K.trace(m.BaseServerSpan.handleRequest,{spanName:`${J} ${a.url}`,kind:i.SpanKind.SERVER,attributes:{"http.method":J,"http.target":a.url}},g))}catch(b){if(b instanceof s.NoFallbackError||await A.onRequestError(a,b,{routerKind:"App Router",routePath:E,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:I,isOnDemandRevalidate:B})}),F)throw b;return await (0,o.I)(N,O,new Response(null,{status:500})),null}}},16040:(a,b,c)=>{"use strict";c.d(b,{BE:()=>i,Er:()=>h,Sg:()=>j,T1:()=>k,T5:()=>l});var d=c(77598),e=c.n(d),f=c(28684);function g(){if(globalThis.__kontextaSessionSecret)return globalThis.__kontextaSessionSecret;let a=null;try{a=(0,f.getSetting)("auth_session_secret")}catch{return globalThis.__kontextaTmpSessionSecret??(globalThis.__kontextaTmpSessionSecret=e().randomBytes(32).toString("hex"))}return a||(a=e().randomBytes(32).toString("hex"),(0,f.setSetting)("auth_session_secret",a)),globalThis.__kontextaSessionSecret=a,a}function h(a){let b=e().randomBytes(32).toString("hex");return{hash:e().scryptSync(a,b,64).toString("hex"),salt:b}}function i(a,b,c){let d=e().scryptSync(a,c,64).toString("hex");return e().timingSafeEqual(Buffer.from(b,"hex"),Buffer.from(d,"hex"))}function j(a){let b=g(),c=Buffer.from(JSON.stringify(a)).toString("base64"),d=e().createHmac("sha256",b).update(c).digest("hex");return`${c}.${d}`}function k(a){let b=!1;try{b="true"===(0,f.getSetting)("auth_trust_proxy_headers")}catch{b=!1}if(!b)return"direct";let c=a.headers.get("x-forwarded-for");if(c){let a=c.split(",")[0].trim();if(a)return a}let d=a.headers.get("x-real-ip");return d?d.trim():"direct"}function l(a){let b=null;try{b=(0,f.getSetting)("auth_password_hash")}catch{return!0}if(!b)return!0;let c=!1;try{c="true"===(0,f.getSetting)("auth_trust_proxy_headers")}catch{c=!1}let d=c?a.headers.get("x-forwarded-for")?.split(",")[0].trim()??a.headers.get("x-real-ip")??void 0:void 0,h=!1;if("cookies"in a&&"function"==typeof a.cookies.get)h=!!a.cookies.get("kontexta_locked")?.value;else{let b=a.headers.get("cookie");b&&(h=/(?:^|;\s*)kontexta_locked=1/.test(b))}if(!h&&function(a){let b=null;try{b=(0,f.getSetting)("auth_bypass_ips")}catch{return!1}if(!b)return!1;let c=b.split(",").map(a=>a.trim());return!!(a&&c.includes(a)||(c.includes("127.0.0.1")||c.includes("localhost")||c.includes("*"))&&("127.0.0.1"===a||"::1"===a||"localhost"===a))}(d))return!0;let i=null;if("cookies"in a&&"function"==typeof a.cookies.get)i=a.cookies.get("kontexta_session")?.value;else{let b=a.headers.get("cookie");if(b){let a=b.match(/(?:^|;\s*)kontexta_session=([^;]+)/);if(a)try{i=decodeURIComponent(a[1])}catch{i=a[1]}}}return!!(i&&function(a){try{let[b,c]=a.split(".");if(!b||!c)return null;let d=g(),f=e().createHmac("sha256",d).update(b).digest("hex"),h=Buffer.from(c,"hex"),i=Buffer.from(f,"hex");if(h.length!==i.length||!e().timingSafeEqual(h,i))return null;let j=JSON.parse(Buffer.from(b,"base64").toString("utf-8"));if("number"!=typeof j?.t||Date.now()-j.t>2592e6)return null;return j}catch{return null}}(i))}},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},28684:a=>{"use strict";a.exports=require("kxta-core")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},76727:()=>{},77598:a=>{"use strict";a.exports=require("node:crypto")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[2923,9372],()=>b(b.s=14978));module.exports=c})();
|