@pcircle/footprint 1.3.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +215 -137
- package/SKILL.md +77 -33
- package/bin/footprint.js +16 -0
- package/dist/src/adapters/claude.d.ts +2 -0
- package/dist/src/adapters/claude.d.ts.map +1 -0
- package/dist/src/adapters/claude.js +7 -0
- package/dist/src/adapters/claude.js.map +1 -0
- package/dist/src/adapters/codex.d.ts +2 -0
- package/dist/src/adapters/codex.d.ts.map +1 -0
- package/dist/src/adapters/codex.js +7 -0
- package/dist/src/adapters/codex.js.map +1 -0
- package/dist/src/adapters/gemini.d.ts +2 -0
- package/dist/src/adapters/gemini.d.ts.map +1 -0
- package/dist/src/adapters/gemini.js +7 -0
- package/dist/src/adapters/gemini.js.map +1 -0
- package/dist/src/adapters/index.d.ts +5 -0
- package/dist/src/adapters/index.d.ts.map +1 -0
- package/dist/src/adapters/index.js +12 -0
- package/dist/src/adapters/index.js.map +1 -0
- package/dist/src/adapters/structured-prefix.d.ts +10 -0
- package/dist/src/adapters/structured-prefix.d.ts.map +1 -0
- package/dist/src/adapters/structured-prefix.js +59 -0
- package/dist/src/adapters/structured-prefix.js.map +1 -0
- package/dist/src/adapters/types.d.ts +32 -0
- package/dist/src/adapters/types.d.ts.map +1 -0
- package/dist/src/adapters/types.js +2 -0
- package/dist/src/adapters/types.js.map +1 -0
- package/dist/src/analyzers/content-analyzer.d.ts.map +1 -1
- package/dist/src/analyzers/content-analyzer.js +20 -4
- package/dist/src/analyzers/content-analyzer.js.map +1 -1
- package/dist/src/cli/context-flow.d.ts +92 -0
- package/dist/src/cli/context-flow.d.ts.map +1 -0
- package/dist/src/cli/context-flow.js +724 -0
- package/dist/src/cli/context-flow.js.map +1 -0
- package/dist/src/cli/history-display.d.ts +27 -0
- package/dist/src/cli/history-display.d.ts.map +1 -0
- package/dist/src/cli/history-display.js +167 -0
- package/dist/src/cli/history-display.js.map +1 -0
- package/dist/src/cli/index.js +924 -0
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/cli/launch-spec.d.ts +31 -0
- package/dist/src/cli/launch-spec.d.ts.map +1 -0
- package/dist/src/cli/launch-spec.js +182 -0
- package/dist/src/cli/launch-spec.js.map +1 -0
- package/dist/src/cli/live-demo.d.ts +34 -0
- package/dist/src/cli/live-demo.d.ts.map +1 -0
- package/dist/src/cli/live-demo.js +254 -0
- package/dist/src/cli/live-demo.js.map +1 -0
- package/dist/src/cli/pty-transcript.d.ts +34 -0
- package/dist/src/cli/pty-transcript.d.ts.map +1 -0
- package/dist/src/cli/pty-transcript.js +174 -0
- package/dist/src/cli/pty-transcript.js.map +1 -0
- package/dist/src/cli/session-display.d.ts +74 -0
- package/dist/src/cli/session-display.d.ts.map +1 -0
- package/dist/src/cli/session-display.js +922 -0
- package/dist/src/cli/session-display.js.map +1 -0
- package/dist/src/cli/session-execution.d.ts +55 -0
- package/dist/src/cli/session-execution.d.ts.map +1 -0
- package/dist/src/cli/session-execution.js +817 -0
- package/dist/src/cli/session-execution.js.map +1 -0
- package/dist/src/cli/session-runtime.d.ts +5 -0
- package/dist/src/cli/session-runtime.d.ts.map +1 -0
- package/dist/src/cli/session-runtime.js +11 -0
- package/dist/src/cli/session-runtime.js.map +1 -0
- package/dist/src/cli/setup.d.ts.map +1 -1
- package/dist/src/cli/setup.js +36 -12
- package/dist/src/cli/setup.js.map +1 -1
- package/dist/src/cli/utils/env.d.ts +7 -2
- package/dist/src/cli/utils/env.d.ts.map +1 -1
- package/dist/src/cli/utils/env.js +37 -6
- package/dist/src/cli/utils/env.js.map +1 -1
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +187 -33
- package/dist/src/index.js.map +1 -1
- package/dist/src/ingestion/deterministic.d.ts +3 -0
- package/dist/src/ingestion/deterministic.d.ts.map +1 -0
- package/dist/src/ingestion/deterministic.js +862 -0
- package/dist/src/ingestion/deterministic.js.map +1 -0
- package/dist/src/ingestion/index.d.ts +5 -0
- package/dist/src/ingestion/index.d.ts.map +1 -0
- package/dist/src/ingestion/index.js +27 -0
- package/dist/src/ingestion/index.js.map +1 -0
- package/dist/src/ingestion/semantic.d.ts +6 -0
- package/dist/src/ingestion/semantic.d.ts.map +1 -0
- package/dist/src/ingestion/semantic.js +627 -0
- package/dist/src/ingestion/semantic.js.map +1 -0
- package/dist/src/ingestion/types.d.ts +10 -0
- package/dist/src/ingestion/types.d.ts.map +1 -0
- package/dist/src/ingestion/types.js +2 -0
- package/dist/src/ingestion/types.js.map +1 -0
- package/dist/src/lib/context-memory.d.ts +140 -0
- package/dist/src/lib/context-memory.d.ts.map +1 -0
- package/dist/src/lib/context-memory.js +974 -0
- package/dist/src/lib/context-memory.js.map +1 -0
- package/dist/src/lib/crypto/decrypt.d.ts.map +1 -1
- package/dist/src/lib/crypto/decrypt.js +12 -8
- package/dist/src/lib/crypto/decrypt.js.map +1 -1
- package/dist/src/lib/crypto/encrypt.d.ts.map +1 -1
- package/dist/src/lib/crypto/encrypt.js +6 -3
- package/dist/src/lib/crypto/encrypt.js.map +1 -1
- package/dist/src/lib/crypto/key-derivation.d.ts +1 -1
- package/dist/src/lib/crypto/key-derivation.d.ts.map +1 -1
- package/dist/src/lib/crypto/key-derivation.js +11 -11
- package/dist/src/lib/crypto/key-derivation.js.map +1 -1
- package/dist/src/lib/history-handoff.d.ts +43 -0
- package/dist/src/lib/history-handoff.d.ts.map +1 -0
- package/dist/src/lib/history-handoff.js +179 -0
- package/dist/src/lib/history-handoff.js.map +1 -0
- package/dist/src/lib/observability.d.ts +3 -0
- package/dist/src/lib/observability.d.ts.map +1 -0
- package/dist/src/lib/observability.js +63 -0
- package/dist/src/lib/observability.js.map +1 -0
- package/dist/src/lib/session-artifacts.d.ts +51 -0
- package/dist/src/lib/session-artifacts.d.ts.map +1 -0
- package/dist/src/lib/session-artifacts.js +132 -0
- package/dist/src/lib/session-artifacts.js.map +1 -0
- package/dist/src/lib/session-filters.d.ts +11 -0
- package/dist/src/lib/session-filters.d.ts.map +1 -0
- package/dist/src/lib/session-filters.js +16 -0
- package/dist/src/lib/session-filters.js.map +1 -0
- package/dist/src/lib/session-history.d.ts +50 -0
- package/dist/src/lib/session-history.d.ts.map +1 -0
- package/dist/src/lib/session-history.js +73 -0
- package/dist/src/lib/session-history.js.map +1 -0
- package/dist/src/lib/session-trends.d.ts +129 -0
- package/dist/src/lib/session-trends.d.ts.map +1 -0
- package/dist/src/lib/session-trends.js +361 -0
- package/dist/src/lib/session-trends.js.map +1 -0
- package/dist/src/lib/storage/database.d.ts +257 -3
- package/dist/src/lib/storage/database.d.ts.map +1 -1
- package/dist/src/lib/storage/database.js +1836 -161
- package/dist/src/lib/storage/database.js.map +1 -1
- package/dist/src/lib/storage/export-sessions.d.ts +33 -0
- package/dist/src/lib/storage/export-sessions.d.ts.map +1 -0
- package/dist/src/lib/storage/export-sessions.js +525 -0
- package/dist/src/lib/storage/export-sessions.js.map +1 -0
- package/dist/src/lib/storage/export.d.ts +1 -2
- package/dist/src/lib/storage/export.d.ts.map +1 -1
- package/dist/src/lib/storage/export.js +46 -33
- package/dist/src/lib/storage/export.js.map +1 -1
- package/dist/src/lib/storage/index.d.ts +7 -6
- package/dist/src/lib/storage/index.d.ts.map +1 -1
- package/dist/src/lib/storage/index.js +6 -5
- package/dist/src/lib/storage/index.js.map +1 -1
- package/dist/src/lib/storage/salt-storage.d.ts +1 -1
- package/dist/src/lib/storage/salt-storage.d.ts.map +1 -1
- package/dist/src/lib/storage/salt-storage.js +26 -18
- package/dist/src/lib/storage/salt-storage.js.map +1 -1
- package/dist/src/lib/storage/schema.d.ts +7 -2
- package/dist/src/lib/storage/schema.d.ts.map +1 -1
- package/dist/src/lib/storage/schema.js +357 -40
- package/dist/src/lib/storage/schema.js.map +1 -1
- package/dist/src/lib/storage/types.d.ts +122 -0
- package/dist/src/lib/storage/types.d.ts.map +1 -1
- package/dist/src/lib/tool-wrapper.d.ts.map +1 -1
- package/dist/src/lib/tool-wrapper.js +2 -2
- package/dist/src/lib/tool-wrapper.js.map +1 -1
- package/dist/src/prompts/skill-prompt.d.ts +6 -0
- package/dist/src/prompts/skill-prompt.d.ts.map +1 -0
- package/dist/src/prompts/skill-prompt.js +138 -0
- package/dist/src/prompts/skill-prompt.js.map +1 -0
- package/dist/src/tools/capture-footprint.d.ts +2 -2
- package/dist/src/tools/capture-footprint.d.ts.map +1 -1
- package/dist/src/tools/capture-footprint.js +52 -11
- package/dist/src/tools/capture-footprint.js.map +1 -1
- package/dist/src/tools/confirm-context-link.d.ts +62 -0
- package/dist/src/tools/confirm-context-link.d.ts.map +1 -0
- package/dist/src/tools/confirm-context-link.js +36 -0
- package/dist/src/tools/confirm-context-link.js.map +1 -0
- package/dist/src/tools/context-schemas.d.ts +694 -0
- package/dist/src/tools/context-schemas.d.ts.map +1 -0
- package/dist/src/tools/context-schemas.js +171 -0
- package/dist/src/tools/context-schemas.js.map +1 -0
- package/dist/src/tools/delete-footprints.d.ts +18 -1
- package/dist/src/tools/delete-footprints.d.ts.map +1 -1
- package/dist/src/tools/delete-footprints.js +53 -5
- package/dist/src/tools/delete-footprints.js.map +1 -1
- package/dist/src/tools/export-footprints.d.ts +11 -3
- package/dist/src/tools/export-footprints.d.ts.map +1 -1
- package/dist/src/tools/export-footprints.js +48 -9
- package/dist/src/tools/export-footprints.js.map +1 -1
- package/dist/src/tools/export-sessions.d.ts +111 -0
- package/dist/src/tools/export-sessions.d.ts.map +1 -0
- package/dist/src/tools/export-sessions.js +136 -0
- package/dist/src/tools/export-sessions.js.map +1 -0
- package/dist/src/tools/get-context.d.ts +208 -0
- package/dist/src/tools/get-context.d.ts.map +1 -0
- package/dist/src/tools/get-context.js +27 -0
- package/dist/src/tools/get-context.js.map +1 -0
- package/dist/src/tools/get-footprint.d.ts +1 -7
- package/dist/src/tools/get-footprint.d.ts.map +1 -1
- package/dist/src/tools/get-footprint.js +7 -3
- package/dist/src/tools/get-footprint.js.map +1 -1
- package/dist/src/tools/get-history-handoff.d.ts +109 -0
- package/dist/src/tools/get-history-handoff.d.ts.map +1 -0
- package/dist/src/tools/get-history-handoff.js +85 -0
- package/dist/src/tools/get-history-handoff.js.map +1 -0
- package/dist/src/tools/get-history-trends.d.ts +155 -0
- package/dist/src/tools/get-history-trends.d.ts.map +1 -0
- package/dist/src/tools/get-history-trends.js +123 -0
- package/dist/src/tools/get-history-trends.js.map +1 -0
- package/dist/src/tools/get-session-artifacts.d.ts +151 -0
- package/dist/src/tools/get-session-artifacts.d.ts.map +1 -0
- package/dist/src/tools/get-session-artifacts.js +184 -0
- package/dist/src/tools/get-session-artifacts.js.map +1 -0
- package/dist/src/tools/get-session-decisions.d.ts +69 -0
- package/dist/src/tools/get-session-decisions.d.ts.map +1 -0
- package/dist/src/tools/get-session-decisions.js +99 -0
- package/dist/src/tools/get-session-decisions.js.map +1 -0
- package/dist/src/tools/get-session-messages.d.ts +55 -0
- package/dist/src/tools/get-session-messages.d.ts.map +1 -0
- package/dist/src/tools/get-session-messages.js +89 -0
- package/dist/src/tools/get-session-messages.js.map +1 -0
- package/dist/src/tools/get-session-narrative.d.ts +72 -0
- package/dist/src/tools/get-session-narrative.d.ts.map +1 -0
- package/dist/src/tools/get-session-narrative.js +106 -0
- package/dist/src/tools/get-session-narrative.js.map +1 -0
- package/dist/src/tools/get-session-timeline.d.ts +55 -0
- package/dist/src/tools/get-session-timeline.d.ts.map +1 -0
- package/dist/src/tools/get-session-timeline.js +93 -0
- package/dist/src/tools/get-session-timeline.js.map +1 -0
- package/dist/src/tools/get-session-trends.d.ts +108 -0
- package/dist/src/tools/get-session-trends.d.ts.map +1 -0
- package/dist/src/tools/get-session-trends.js +130 -0
- package/dist/src/tools/get-session-trends.js.map +1 -0
- package/dist/src/tools/get-session.d.ts +251 -0
- package/dist/src/tools/get-session.d.ts.map +1 -0
- package/dist/src/tools/get-session.js +290 -0
- package/dist/src/tools/get-session.js.map +1 -0
- package/dist/src/tools/index.d.ts +23 -3
- package/dist/src/tools/index.d.ts.map +1 -1
- package/dist/src/tools/index.js +23 -3
- package/dist/src/tools/index.js.map +1 -1
- package/dist/src/tools/list-contexts.d.ts +50 -0
- package/dist/src/tools/list-contexts.d.ts.map +1 -0
- package/dist/src/tools/list-contexts.js +28 -0
- package/dist/src/tools/list-contexts.js.map +1 -0
- package/dist/src/tools/list-footprints.d.ts +1 -15
- package/dist/src/tools/list-footprints.d.ts.map +1 -1
- package/dist/src/tools/list-footprints.js +17 -6
- package/dist/src/tools/list-footprints.js.map +1 -1
- package/dist/src/tools/list-sessions.d.ts +86 -0
- package/dist/src/tools/list-sessions.d.ts.map +1 -0
- package/dist/src/tools/list-sessions.js +97 -0
- package/dist/src/tools/list-sessions.js.map +1 -0
- package/dist/src/tools/manage-tags.d.ts +47 -0
- package/dist/src/tools/manage-tags.d.ts.map +1 -0
- package/dist/src/tools/manage-tags.js +109 -0
- package/dist/src/tools/manage-tags.js.map +1 -0
- package/dist/src/tools/merge-contexts.d.ts +58 -0
- package/dist/src/tools/merge-contexts.d.ts.map +1 -0
- package/dist/src/tools/merge-contexts.js +27 -0
- package/dist/src/tools/merge-contexts.js.map +1 -0
- package/dist/src/tools/move-session-context.d.ts +62 -0
- package/dist/src/tools/move-session-context.d.ts.map +1 -0
- package/dist/src/tools/move-session-context.js +33 -0
- package/dist/src/tools/move-session-context.js.map +1 -0
- package/dist/src/tools/reingest-session.d.ts +31 -0
- package/dist/src/tools/reingest-session.d.ts.map +1 -0
- package/dist/src/tools/reingest-session.js +43 -0
- package/dist/src/tools/reingest-session.js.map +1 -0
- package/dist/src/tools/reject-context-link.d.ts +58 -0
- package/dist/src/tools/reject-context-link.d.ts.map +1 -0
- package/dist/src/tools/reject-context-link.js +26 -0
- package/dist/src/tools/reject-context-link.js.map +1 -0
- package/dist/src/tools/resolve-context.d.ts +287 -0
- package/dist/src/tools/resolve-context.d.ts.map +1 -0
- package/dist/src/tools/resolve-context.js +35 -0
- package/dist/src/tools/resolve-context.js.map +1 -0
- package/dist/src/tools/search-footprints.d.ts +2 -16
- package/dist/src/tools/search-footprints.d.ts.map +1 -1
- package/dist/src/tools/search-footprints.js +23 -7
- package/dist/src/tools/search-footprints.js.map +1 -1
- package/dist/src/tools/search-history.d.ts +86 -0
- package/dist/src/tools/search-history.d.ts.map +1 -0
- package/dist/src/tools/search-history.js +103 -0
- package/dist/src/tools/search-history.js.map +1 -0
- package/dist/src/tools/session-ui-metadata.d.ts +15 -0
- package/dist/src/tools/session-ui-metadata.d.ts.map +1 -0
- package/dist/src/tools/session-ui-metadata.js +15 -0
- package/dist/src/tools/session-ui-metadata.js.map +1 -0
- package/dist/src/tools/set-active-context.d.ts +58 -0
- package/dist/src/tools/set-active-context.d.ts.map +1 -0
- package/dist/src/tools/set-active-context.js +26 -0
- package/dist/src/tools/set-active-context.js.map +1 -0
- package/dist/src/tools/split-context.d.ts +62 -0
- package/dist/src/tools/split-context.d.ts.map +1 -0
- package/dist/src/tools/split-context.js +36 -0
- package/dist/src/tools/split-context.js.map +1 -0
- package/dist/src/tools/suggest-capture.d.ts +1 -1
- package/dist/src/tools/suggest-capture.d.ts.map +1 -1
- package/dist/src/tools/suggest-capture.js +6 -2
- package/dist/src/tools/suggest-capture.js.map +1 -1
- package/dist/src/tools/verify-footprint.d.ts +7 -54
- package/dist/src/tools/verify-footprint.d.ts.map +1 -1
- package/dist/src/tools/verify-footprint.js +11 -8
- package/dist/src/tools/verify-footprint.js.map +1 -1
- package/dist/src/types.d.ts +6 -4
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/ui/register.d.ts +6 -1
- package/dist/src/ui/register.d.ts.map +1 -1
- package/dist/src/ui/register.js +60 -16
- package/dist/src/ui/register.js.map +1 -1
- package/dist/ui/dashboard.html +259 -875
- package/dist/ui/detail.html +124 -252
- package/dist/ui/export.html +133 -303
- package/dist/ui/session-dashboard-live.html +264 -0
- package/dist/ui/session-dashboard.html +329 -0
- package/dist/ui/session-detail-live.html +336 -0
- package/dist/ui/session-detail.html +355 -0
- package/package.json +61 -16
- package/dist/src/lib/errors/base-error.d.ts +0 -15
- package/dist/src/lib/errors/base-error.d.ts.map +0 -1
- package/dist/src/lib/errors/base-error.js +0 -34
- package/dist/src/lib/errors/base-error.js.map +0 -1
- package/dist/src/lib/errors/crypto-error.d.ts +0 -29
- package/dist/src/lib/errors/crypto-error.d.ts.map +0 -1
- package/dist/src/lib/errors/crypto-error.js +0 -43
- package/dist/src/lib/errors/crypto-error.js.map +0 -1
- package/dist/src/lib/errors/index.d.ts +0 -26
- package/dist/src/lib/errors/index.d.ts.map +0 -1
- package/dist/src/lib/errors/index.js +0 -26
- package/dist/src/lib/errors/index.js.map +0 -1
- package/dist/src/lib/errors/storage-error.d.ts +0 -25
- package/dist/src/lib/errors/storage-error.d.ts.map +0 -1
- package/dist/src/lib/errors/storage-error.js +0 -38
- package/dist/src/lib/errors/storage-error.js.map +0 -1
- package/dist/src/lib/errors/validation-error.d.ts +0 -21
- package/dist/src/lib/errors/validation-error.d.ts.map +0 -1
- package/dist/src/lib/errors/validation-error.js +0 -29
- package/dist/src/lib/errors/validation-error.js.map +0 -1
- package/dist/src/test-helpers.d.ts +0 -33
- package/dist/src/test-helpers.d.ts.map +0 -1
- package/dist/src/test-helpers.js +0 -108
- package/dist/src/test-helpers.js.map +0 -1
- package/dist/src/tools/get-tag-stats.d.ts +0 -30
- package/dist/src/tools/get-tag-stats.d.ts.map +0 -1
- package/dist/src/tools/get-tag-stats.js +0 -33
- package/dist/src/tools/get-tag-stats.js.map +0 -1
- package/dist/src/tools/remove-tag.d.ts +0 -22
- package/dist/src/tools/remove-tag.d.ts.map +0 -1
- package/dist/src/tools/remove-tag.js +0 -30
- package/dist/src/tools/remove-tag.js.map +0 -1
- package/dist/src/tools/rename-tag.d.ts +0 -24
- package/dist/src/tools/rename-tag.d.ts.map +0 -1
- package/dist/src/tools/rename-tag.js +0 -34
- package/dist/src/tools/rename-tag.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-prompt.d.ts","sourceRoot":"","sources":["../../../src/prompts/skill-prompt.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA8DzE;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAyF5D"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { fileURLToPath } from "url";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import * as fs from "fs";
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path.dirname(__filename);
|
|
7
|
+
/**
|
|
8
|
+
* Resolve SKILL.md from the package root.
|
|
9
|
+
* Handles both dev (src/prompts/) and built (dist/prompts/) paths.
|
|
10
|
+
*/
|
|
11
|
+
function findSkillMd() {
|
|
12
|
+
const candidates = [
|
|
13
|
+
path.resolve(__dirname, "../../SKILL.md"), // from dist/prompts/ or src/prompts/
|
|
14
|
+
path.resolve(__dirname, "../../../SKILL.md"), // fallback
|
|
15
|
+
];
|
|
16
|
+
for (const p of candidates) {
|
|
17
|
+
if (fs.existsSync(p))
|
|
18
|
+
return fs.readFileSync(p, "utf-8");
|
|
19
|
+
}
|
|
20
|
+
throw new Error("SKILL.md not found");
|
|
21
|
+
}
|
|
22
|
+
const QUICK_REFERENCE = `# Footprint Quick Reference
|
|
23
|
+
|
|
24
|
+
## Decision Tree
|
|
25
|
+
Should I capture this conversation?
|
|
26
|
+
\u251C\u2500 User explicitly asked \u2192 YES (capture immediately)
|
|
27
|
+
\u251C\u2500 High-value content (IP/Legal/Business/Research/Compliance) \u2192 SUGGEST to user
|
|
28
|
+
\u251C\u2500 Casual chat/small talk \u2192 NO
|
|
29
|
+
\u2514\u2500 Uncertain \u2192 ASK user
|
|
30
|
+
|
|
31
|
+
Should I reuse prior work context?
|
|
32
|
+
\u251C\u2500 Continuing or resuming work \u2192 resolve-context first
|
|
33
|
+
\u251C\u2500 resolve-context says confirmationRequired \u2192 ASK user
|
|
34
|
+
\u251C\u2500 In interactive CLI, use context prepare / run --prepare-context to ask before recording
|
|
35
|
+
\u251C\u2500 No strong candidate \u2192 create or confirm a new context
|
|
36
|
+
\u2514\u2500 User corrected the context before \u2192 trust confirmed context, not guesswork
|
|
37
|
+
|
|
38
|
+
## Tool Selection
|
|
39
|
+
- Save conversation \u2192 capture-footprint
|
|
40
|
+
- Browse/overview \u2192 list-footprints
|
|
41
|
+
- Full content retrieval \u2192 get-footprint
|
|
42
|
+
- Find by query/tags/dates \u2192 search-footprints
|
|
43
|
+
- Legal/audit export \u2192 export-footprints
|
|
44
|
+
- Session browse/detail \u2192 list-sessions / get-session
|
|
45
|
+
- Session handoff export \u2192 export-sessions
|
|
46
|
+
- Resolve likely work context \u2192 resolve-context
|
|
47
|
+
- Inspect confirmed context briefing \u2192 list-contexts / get-context
|
|
48
|
+
- Confirm or correct session-to-context links \u2192 confirm-context-link / reject-context-link / move-session-context
|
|
49
|
+
- Reorganize contexts \u2192 merge-contexts / split-context / set-active-context
|
|
50
|
+
- Verify integrity \u2192 verify-footprint
|
|
51
|
+
- Tag management \u2192 manage-tags (stats/rename/remove)
|
|
52
|
+
- Keyword pre-filter \u2192 suggest-capture
|
|
53
|
+
- Semantic assessment \u2192 Use footprint-should-capture prompt
|
|
54
|
+
|
|
55
|
+
## Tag Conventions
|
|
56
|
+
Format: 3-6 tags, comma-separated
|
|
57
|
+
Types: decision, milestone, research, review, approval
|
|
58
|
+
Domains: api, ui, database, security, legal, business
|
|
59
|
+
Status: draft, finalized, approved, rejected
|
|
60
|
+
|
|
61
|
+
## conversationId Format
|
|
62
|
+
{topic-type}-{descriptive-name}-{YYYY-MM-DD}`;
|
|
63
|
+
/**
|
|
64
|
+
* Register all Footprint MCP prompts on the server.
|
|
65
|
+
*/
|
|
66
|
+
export function registerSkillPrompts(server) {
|
|
67
|
+
const skillContent = findSkillMd();
|
|
68
|
+
// Full SKILL.md content
|
|
69
|
+
server.registerPrompt("footprint-skill", {
|
|
70
|
+
description: "Complete Footprint agent skill guide — decision tree, tool reference, best practices, error recovery, and workflow examples",
|
|
71
|
+
}, async () => ({
|
|
72
|
+
messages: [
|
|
73
|
+
{
|
|
74
|
+
role: "user",
|
|
75
|
+
content: { type: "text", text: skillContent },
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
}));
|
|
79
|
+
// Condensed quick reference
|
|
80
|
+
server.registerPrompt("footprint-quick-ref", {
|
|
81
|
+
description: "Condensed quick reference for Footprint — decision tree, tool selection, tag conventions",
|
|
82
|
+
}, async () => ({
|
|
83
|
+
messages: [
|
|
84
|
+
{
|
|
85
|
+
role: "user",
|
|
86
|
+
content: { type: "text", text: QUICK_REFERENCE },
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
}));
|
|
90
|
+
// Semantic capture decision framework
|
|
91
|
+
server.registerPrompt("footprint-should-capture", {
|
|
92
|
+
description: "Semantic decision framework for whether to capture a conversation as evidence. Provides structured criteria for the AI to assess, unlike suggest-capture which uses keyword matching.",
|
|
93
|
+
argsSchema: {
|
|
94
|
+
conversationSummary: z
|
|
95
|
+
.string()
|
|
96
|
+
.min(1, "Conversation summary cannot be empty")
|
|
97
|
+
.max(10000, "Conversation summary too long (max 10000 characters)")
|
|
98
|
+
.describe("Brief summary of the conversation content to evaluate"),
|
|
99
|
+
},
|
|
100
|
+
}, async ({ conversationSummary }) => ({
|
|
101
|
+
messages: [
|
|
102
|
+
{
|
|
103
|
+
role: "user",
|
|
104
|
+
content: {
|
|
105
|
+
type: "text",
|
|
106
|
+
text: `Evaluate whether this conversation should be captured as evidence using Footprint.
|
|
107
|
+
|
|
108
|
+
## Conversation Summary
|
|
109
|
+
${conversationSummary}
|
|
110
|
+
|
|
111
|
+
## Decision Criteria
|
|
112
|
+
Rate each category 0-3 (0=none, 1=low, 2=medium, 3=high):
|
|
113
|
+
|
|
114
|
+
1. **Intellectual Property Value**: Does it contain inventions, algorithms, novel approaches, patents, trade secrets?
|
|
115
|
+
2. **Legal Significance**: Does it involve contracts, agreements, licenses, legal obligations, regulatory requirements?
|
|
116
|
+
3. **Business Decision Impact**: Does it record decisions, approvals, milestones, deliverables, strategic direction?
|
|
117
|
+
4. **Research Value**: Does it contain hypotheses, findings, experimental results, data analysis, methodology?
|
|
118
|
+
5. **Compliance/Audit Need**: Does it need to be documented for audit trails, regulatory compliance, evidence preservation?
|
|
119
|
+
|
|
120
|
+
## Decision Rules
|
|
121
|
+
- Any category >= 2 \u2192 RECOMMEND CAPTURE
|
|
122
|
+
- Multiple categories >= 1 \u2192 RECOMMEND CAPTURE
|
|
123
|
+
- All categories = 0 \u2192 DO NOT CAPTURE
|
|
124
|
+
- Uncertain \u2192 ASK USER
|
|
125
|
+
|
|
126
|
+
## Response Format
|
|
127
|
+
Respond with:
|
|
128
|
+
- **Capture**: yes/no/ask
|
|
129
|
+
- **Confidence**: 0.0-1.0
|
|
130
|
+
- **Primary Reason**: One sentence
|
|
131
|
+
- **Suggested Tags**: comma-separated
|
|
132
|
+
- **Suggested conversationId**: {topic}-{descriptor}-{YYYY-MM-DD} format`,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=skill-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-prompt.js","sourceRoot":"","sources":["../../../src/prompts/skill-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,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C,CACH,CAAC;IAEF,sCAAsC;IACtC,MAAM,CAAC,cAAc,CACnB,0BAA0B,EAC1B;QACE,WAAW,EACT,uLAAuL;QACzL,UAAU,EAAE;YACV,mBAAmB,EAAE,CAAC;iBACnB,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,EAAE,sCAAsC,CAAC;iBAC9C,GAAG,CAAC,KAAK,EAAE,sDAAsD,CAAC;iBAClE,QAAQ,CAAC,uDAAuD,CAAC;SACrE;KACF,EACD,KAAK,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE,CAAC,CAAC;QAClC,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAe;gBACrB,OAAO,EAAE;oBACP,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE;;;EAGhB,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;yEAuBoD;iBAC9D;aACF;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -4,9 +4,9 @@ import type { CaptureEvidenceParams } from "../types.js";
|
|
|
4
4
|
export declare const captureFootprintSchema: {
|
|
5
5
|
inputSchema: {
|
|
6
6
|
conversationId: z.ZodString;
|
|
7
|
-
llmProvider: z.ZodString
|
|
7
|
+
llmProvider: z.ZodDefault<z.ZodString>;
|
|
8
8
|
content: z.ZodString;
|
|
9
|
-
messageCount: z.ZodNumber
|
|
9
|
+
messageCount: z.ZodOptional<z.ZodNumber>;
|
|
10
10
|
tags: z.ZodOptional<z.ZodString>;
|
|
11
11
|
};
|
|
12
12
|
outputSchema: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture-footprint.d.ts","sourceRoot":"","sources":["../../../src/tools/capture-footprint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAKzB,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"capture-footprint.d.ts","sourceRoot":"","sources":["../../../src/tools/capture-footprint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAKzB,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;CAyClC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAIpC,CAAC;AAEF,wBAAgB,6BAA6B,CAC3C,EAAE,EAAE,gBAAgB,EACpB,aAAa,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC;;;;;IAyHzC"}
|
|
@@ -6,15 +6,28 @@ import { encrypt } from "../lib/crypto/index.js";
|
|
|
6
6
|
import { getCurrentCommit, } from "../lib/storage/index.js";
|
|
7
7
|
export const captureFootprintSchema = {
|
|
8
8
|
inputSchema: {
|
|
9
|
-
conversationId: z
|
|
9
|
+
conversationId: z
|
|
10
|
+
.string()
|
|
11
|
+
.max(500, "Conversation ID too long (max 500 chars)")
|
|
12
|
+
.describe("Unique conversation identifier. Recommended format: {topic}-{descriptor}-{YYYY-MM-DD} (e.g., api-auth-decision-2026-01-28)"),
|
|
10
13
|
llmProvider: z
|
|
11
14
|
.string()
|
|
12
|
-
.
|
|
15
|
+
.default("unknown")
|
|
16
|
+
.describe("LLM provider name (e.g., Claude Sonnet 4.5). Defaults to 'unknown' if not specified."),
|
|
13
17
|
content: z
|
|
14
18
|
.string()
|
|
15
|
-
.
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
.max(10 * 1024 * 1024, "Content exceeds 10MB limit")
|
|
20
|
+
.describe("Full conversation text including both human and assistant messages. Include complete message history for accurate evidence preservation."),
|
|
21
|
+
messageCount: z
|
|
22
|
+
.number()
|
|
23
|
+
.int()
|
|
24
|
+
.positive()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("Number of messages in the conversation. If omitted, auto-calculated by counting conversation turn markers (Human:/Assistant:/User:/AI:/System:)."),
|
|
27
|
+
tags: z
|
|
28
|
+
.string()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("Comma-separated tags for categorization (e.g., 'ip,patent,decision'). Use 3-6 tags. Common types: decision, milestone, research, legal, compliance."),
|
|
18
31
|
},
|
|
19
32
|
outputSchema: {
|
|
20
33
|
id: z.string(),
|
|
@@ -25,7 +38,7 @@ export const captureFootprintSchema = {
|
|
|
25
38
|
};
|
|
26
39
|
export const captureFootprintMetadata = {
|
|
27
40
|
title: "Capture Footprint",
|
|
28
|
-
description: "Capture and encrypt LLM conversation as footprint",
|
|
41
|
+
description: "Capture and encrypt an LLM conversation as a tamper-evident footprint. Use when: user explicitly asks to save, or high-value content detected (IP, legal, business, research, compliance). Creates encrypted record with SHA-256 hash and Git timestamp anchor.",
|
|
29
42
|
};
|
|
30
43
|
export function createCaptureFootprintHandler(db, getDerivedKey) {
|
|
31
44
|
return wrapToolHandler("capture-footprint", "Check content is not empty, messageCount is positive, and tags format is valid.", async (params) => {
|
|
@@ -33,7 +46,14 @@ export function createCaptureFootprintHandler(db, getDerivedKey) {
|
|
|
33
46
|
if (!params.content || params.content.trim().length === 0) {
|
|
34
47
|
throw new Error("Content cannot be empty");
|
|
35
48
|
}
|
|
36
|
-
|
|
49
|
+
const MAX_CONTENT_LENGTH = 10 * 1024 * 1024; // 10MB
|
|
50
|
+
if (params.content.length > MAX_CONTENT_LENGTH) {
|
|
51
|
+
throw new Error(`Content too large (${(params.content.length / (1024 * 1024)).toFixed(1)}MB). Maximum 10MB allowed.`);
|
|
52
|
+
}
|
|
53
|
+
if (params.conversationId.length > 500) {
|
|
54
|
+
throw new Error("Conversation ID too long (max 500 chars)");
|
|
55
|
+
}
|
|
56
|
+
if (params.messageCount !== undefined && params.messageCount <= 0) {
|
|
37
57
|
throw new Error("Message count must be positive");
|
|
38
58
|
}
|
|
39
59
|
// eslint-disable-next-line no-control-regex
|
|
@@ -42,6 +62,8 @@ export function createCaptureFootprintHandler(db, getDerivedKey) {
|
|
|
42
62
|
}
|
|
43
63
|
// Validate and sanitize tags if provided
|
|
44
64
|
if (params.tags) {
|
|
65
|
+
const MAX_TAG_LENGTH = 100;
|
|
66
|
+
const MAX_TAGS_COUNT = 20;
|
|
45
67
|
const tags = params.tags
|
|
46
68
|
.split(",")
|
|
47
69
|
.map((t) => t.trim())
|
|
@@ -49,14 +71,33 @@ export function createCaptureFootprintHandler(db, getDerivedKey) {
|
|
|
49
71
|
if (tags.length === 0) {
|
|
50
72
|
throw new Error("All provided tags are empty or whitespace");
|
|
51
73
|
}
|
|
74
|
+
if (tags.length > MAX_TAGS_COUNT) {
|
|
75
|
+
throw new Error(`Too many tags (${tags.length}). Maximum ${MAX_TAGS_COUNT} tags allowed.`);
|
|
76
|
+
}
|
|
52
77
|
for (const tag of tags) {
|
|
78
|
+
if (tag.length > MAX_TAG_LENGTH) {
|
|
79
|
+
throw new Error(`Tag too long (${tag.length} chars). Maximum ${MAX_TAG_LENGTH} characters per tag.`);
|
|
80
|
+
}
|
|
53
81
|
// eslint-disable-next-line no-control-regex
|
|
54
82
|
if (/[\x00\n\r,]/.test(tag)) {
|
|
55
83
|
throw new Error(`Invalid tag format: "${tag}". Tags cannot contain null bytes, newlines, or commas.`);
|
|
56
84
|
}
|
|
57
85
|
}
|
|
58
|
-
|
|
86
|
+
// Use sanitized tags without mutating original params
|
|
87
|
+
params = { ...params, tags: tags.join(",") };
|
|
88
|
+
}
|
|
89
|
+
// Auto-calculate messageCount if not provided
|
|
90
|
+
let messageCount = params.messageCount;
|
|
91
|
+
if (!messageCount) {
|
|
92
|
+
const turnPattern = /^(Human|Assistant|User|System|AI):/im;
|
|
93
|
+
const lines = params.content.split("\n");
|
|
94
|
+
messageCount = lines.filter((line) => turnPattern.test(line.trim())).length;
|
|
95
|
+
if (messageCount === 0)
|
|
96
|
+
messageCount = 1; // Default to 1 if no turns detected
|
|
59
97
|
}
|
|
98
|
+
// Apply runtime defaults for parameters with Zod schema defaults
|
|
99
|
+
// (Zod defaults only apply through MCP SDK transport layer)
|
|
100
|
+
const llmProvider = params.llmProvider || "unknown";
|
|
60
101
|
// Encrypt and capture
|
|
61
102
|
const key = await getDerivedKey();
|
|
62
103
|
const encrypted = await encrypt(params.content, key);
|
|
@@ -69,11 +110,11 @@ export function createCaptureFootprintHandler(db, getDerivedKey) {
|
|
|
69
110
|
const id = db.create({
|
|
70
111
|
timestamp,
|
|
71
112
|
conversationId: params.conversationId,
|
|
72
|
-
llmProvider
|
|
113
|
+
llmProvider,
|
|
73
114
|
encryptedContent: encrypted.ciphertext,
|
|
74
115
|
nonce: encrypted.nonce,
|
|
75
116
|
contentHash,
|
|
76
|
-
messageCount
|
|
117
|
+
messageCount,
|
|
77
118
|
gitCommitHash: gitInfo?.commitHash || null,
|
|
78
119
|
gitTimestamp: gitInfo?.timestamp || null,
|
|
79
120
|
tags: params.tags || null,
|
|
@@ -82,7 +123,7 @@ export function createCaptureFootprintHandler(db, getDerivedKey) {
|
|
|
82
123
|
ID: id,
|
|
83
124
|
Timestamp: timestamp,
|
|
84
125
|
"Git Commit": gitInfo?.commitHash || "N/A",
|
|
85
|
-
"Message Count":
|
|
126
|
+
"Message Count": messageCount,
|
|
86
127
|
}, {
|
|
87
128
|
id,
|
|
88
129
|
timestamp,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture-footprint.js","sourceRoot":"","sources":["../../../src/tools/capture-footprint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"capture-footprint.js","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N,SAAS,EAAE,SAAS;YACpB,YAAY,EAAE,OAAO,EAAE,UAAU,IAAI,KAAK;YAC1C,eAAe,EAAE,YAAY;SAC9B,EACD;YACE,EAAE;YACF,SAAS;YACT,aAAa,EAAE,OAAO,EAAE,UAAU,IAAI,IAAI;YAC1C,OAAO,EAAE,IAAI;SACd,CACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import type { EvidenceDatabase } from "../lib/storage/index.js";
|
|
3
|
+
export declare const confirmContextLinkSchema: {
|
|
4
|
+
inputSchema: {
|
|
5
|
+
sessionIds: z.ZodArray<z.ZodString>;
|
|
6
|
+
contextId: z.ZodOptional<z.ZodString>;
|
|
7
|
+
label: z.ZodOptional<z.ZodString>;
|
|
8
|
+
setPreferred: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
};
|
|
10
|
+
outputSchema: {
|
|
11
|
+
action: z.ZodEnum<{
|
|
12
|
+
rejected: "rejected";
|
|
13
|
+
merged: "merged";
|
|
14
|
+
confirmed: "confirmed";
|
|
15
|
+
moved: "moved";
|
|
16
|
+
split: "split";
|
|
17
|
+
preferred: "preferred";
|
|
18
|
+
}>;
|
|
19
|
+
context: z.ZodNullable<z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
label: z.ZodString;
|
|
22
|
+
workspaceKey: z.ZodString;
|
|
23
|
+
latestSessionId: z.ZodString;
|
|
24
|
+
latestSessionLabel: z.ZodString;
|
|
25
|
+
latestStartedAt: z.ZodString;
|
|
26
|
+
latestEndedAt: z.ZodNullable<z.ZodString>;
|
|
27
|
+
sessionCount: z.ZodNumber;
|
|
28
|
+
hosts: z.ZodArray<z.ZodEnum<{
|
|
29
|
+
claude: "claude";
|
|
30
|
+
gemini: "gemini";
|
|
31
|
+
codex: "codex";
|
|
32
|
+
}>>;
|
|
33
|
+
statuses: z.ZodArray<z.ZodEnum<{
|
|
34
|
+
running: "running";
|
|
35
|
+
completed: "completed";
|
|
36
|
+
failed: "failed";
|
|
37
|
+
interrupted: "interrupted";
|
|
38
|
+
}>>;
|
|
39
|
+
confidence: z.ZodEnum<{
|
|
40
|
+
high: "high";
|
|
41
|
+
medium: "medium";
|
|
42
|
+
low: "low";
|
|
43
|
+
}>;
|
|
44
|
+
confidenceScore: z.ZodNumber;
|
|
45
|
+
signals: z.ZodArray<z.ZodString>;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
affectedSessionIds: z.ZodArray<z.ZodString>;
|
|
48
|
+
contextId: z.ZodNullable<z.ZodString>;
|
|
49
|
+
mergedFromContextId: z.ZodNullable<z.ZodString>;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export declare const confirmContextLinkMetadata: {
|
|
53
|
+
title: string;
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
export declare function createConfirmContextLinkHandler(db: EvidenceDatabase): (params: {
|
|
57
|
+
sessionIds: string[];
|
|
58
|
+
contextId?: string;
|
|
59
|
+
label?: string;
|
|
60
|
+
setPreferred?: boolean;
|
|
61
|
+
}) => Promise<import("../lib/tool-response.js").ToolResponse<import("../lib/context-memory.js").ContextLinkMutationResult>>;
|
|
62
|
+
//# sourceMappingURL=confirm-context-link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm-context-link.d.ts","sourceRoot":"","sources":["../../../src/tools/confirm-context-link.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUpC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;CAItC,CAAC;AAEF,wBAAgB,+BAA+B,CAAC,EAAE,EAAE,gBAAgB;gBAKlD,MAAM,EAAE;gBACR,MAAM;YACV,MAAM;mBACC,OAAO;4HAoB3B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { confirmContextLink } from "../lib/context-memory.js";
|
|
3
|
+
import { formatSuccessResponse } from "../lib/tool-response.js";
|
|
4
|
+
import { wrapToolHandler } from "../lib/tool-wrapper.js";
|
|
5
|
+
import { contextMutationSchema } from "./context-schemas.js";
|
|
6
|
+
export const confirmContextLinkSchema = {
|
|
7
|
+
inputSchema: {
|
|
8
|
+
sessionIds: z
|
|
9
|
+
.array(z.string().min(1))
|
|
10
|
+
.min(1, "At least one sessionId is required"),
|
|
11
|
+
contextId: z.string().optional(),
|
|
12
|
+
label: z.string().optional(),
|
|
13
|
+
setPreferred: z.boolean().optional(),
|
|
14
|
+
},
|
|
15
|
+
outputSchema: contextMutationSchema.shape,
|
|
16
|
+
};
|
|
17
|
+
export const confirmContextLinkMetadata = {
|
|
18
|
+
title: "Confirm Context Link",
|
|
19
|
+
description: "Confirm one or more sessions into an existing or new canonical context. This is the mutation step after resolve-context suggested candidates.",
|
|
20
|
+
};
|
|
21
|
+
export function createConfirmContextLinkHandler(db) {
|
|
22
|
+
return wrapToolHandler("confirm-context-link", "Confirm one or more sessions into an existing context or create a new context with label.", async (params) => {
|
|
23
|
+
const result = confirmContextLink(db, {
|
|
24
|
+
sessionIds: params.sessionIds,
|
|
25
|
+
contextId: params.contextId?.trim() || undefined,
|
|
26
|
+
label: params.label?.trim() || undefined,
|
|
27
|
+
setPreferred: params.setPreferred,
|
|
28
|
+
});
|
|
29
|
+
return formatSuccessResponse("Context link confirmed successfully", {
|
|
30
|
+
Action: result.action,
|
|
31
|
+
Context: result.context?.label ?? result.contextId ?? "created",
|
|
32
|
+
Sessions: result.affectedSessionIds.length,
|
|
33
|
+
}, result);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=confirm-context-link.js.map
|
|
@@ -0,0 +1 @@
|
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