@remnic/core 1.1.0 → 1.1.2
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/dist/access-audit.d.ts +56 -0
- package/dist/access-audit.js +9 -0
- package/dist/access-cli.js +70 -53
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +16 -9
- package/dist/access-http.js +26 -18
- package/dist/access-mcp.d.ts +16 -9
- package/dist/access-mcp.js +30 -8
- package/dist/access-schema.d.ts +124 -33
- package/dist/access-schema.js +5 -1
- package/dist/{access-service-HmO1Trrx.d.ts → access-service-Br8ZydTK.d.ts} +158 -63
- package/dist/access-service.d.ts +13 -6
- package/dist/access-service.js +23 -14
- package/dist/bootstrap.d.ts +6 -3
- package/dist/briefing.d.ts +1 -0
- package/dist/briefing.js +8 -6
- package/dist/buffer-surprise-report.d.ts +70 -0
- package/dist/buffer-surprise-report.js +7 -0
- package/dist/buffer-surprise-report.js.map +1 -0
- package/dist/buffer-surprise.d.ts +98 -0
- package/dist/buffer-surprise.js +11 -0
- package/dist/buffer-surprise.js.map +1 -0
- package/dist/buffer.d.ts +100 -2
- package/dist/buffer.js +1 -1
- package/dist/calibration.js +6 -6
- package/dist/causal-behavior.js +4 -4
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.js +19 -18
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +4 -4
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-QNJMBKFK.js → chunk-2LGMW3DJ.js} +3 -2
- package/dist/chunk-2LGMW3DJ.js.map +1 -0
- package/dist/{chunk-QDYXG4CS.js → chunk-3FPTCC3Z.js} +4 -3
- package/dist/chunk-3FPTCC3Z.js.map +1 -0
- package/dist/chunk-3GPTTA4J.js +57 -0
- package/dist/chunk-3GPTTA4J.js.map +1 -0
- package/dist/{chunk-ITRLGI2T.js → chunk-3OGMS3PE.js} +2 -2
- package/dist/{chunk-DEPL3635.js → chunk-3YGHKTBF.js} +1446 -196
- package/dist/chunk-3YGHKTBF.js.map +1 -0
- package/dist/{chunk-BLKTA7MM.js → chunk-4HQS2HPX.js} +54 -21
- package/dist/chunk-4HQS2HPX.js.map +1 -0
- package/dist/chunk-54V4BZWP.js +139 -0
- package/dist/chunk-54V4BZWP.js.map +1 -0
- package/dist/chunk-5JRF2PZA.js +67 -0
- package/dist/chunk-5JRF2PZA.js.map +1 -0
- package/dist/chunk-64NJRYU2.js +332 -0
- package/dist/chunk-64NJRYU2.js.map +1 -0
- package/dist/{chunk-OIT5QGG4.js → chunk-6AUUAZEX.js} +72 -2
- package/dist/chunk-6AUUAZEX.js.map +1 -0
- package/dist/{chunk-3QHL5ABG.js → chunk-6YJHX2DL.js} +191 -10
- package/dist/chunk-6YJHX2DL.js.map +1 -0
- package/dist/chunk-AJU4PJGY.js +126 -0
- package/dist/chunk-AJU4PJGY.js.map +1 -0
- package/dist/chunk-ASAITVLA.js +64 -0
- package/dist/chunk-ASAITVLA.js.map +1 -0
- package/dist/{chunk-44ICJRF3.js → chunk-AYXIPSZO.js} +5 -5
- package/dist/{chunk-MBJHSA7F.js → chunk-BECYBZLX.js} +265 -20
- package/dist/chunk-BECYBZLX.js.map +1 -0
- package/dist/chunk-C4SQJZAF.js +486 -0
- package/dist/chunk-C4SQJZAF.js.map +1 -0
- package/dist/{chunk-6UJ47TVX.js → chunk-CUPFXL3J.js} +2 -2
- package/dist/chunk-DF3RVK3X.js +119 -0
- package/dist/chunk-DF3RVK3X.js.map +1 -0
- package/dist/{chunk-N42IWANG.js → chunk-DG6YMRDC.js} +3 -3
- package/dist/chunk-DGVM5SFL.js +69 -0
- package/dist/chunk-DGVM5SFL.js.map +1 -0
- package/dist/{chunk-3SV6CQHO.js → chunk-DIXB44VE.js} +102 -66
- package/dist/chunk-DIXB44VE.js.map +1 -0
- package/dist/chunk-EIR5VLIH.js +90 -0
- package/dist/chunk-EIR5VLIH.js.map +1 -0
- package/dist/{chunk-GV6NLQ4X.js → chunk-F5VP6YCB.js} +374 -16
- package/dist/chunk-F5VP6YCB.js.map +1 -0
- package/dist/{chunk-6ZH4TU6I.js → chunk-FAAFWE4G.js} +2 -1
- package/dist/chunk-FAAFWE4G.js.map +1 -0
- package/dist/{chunk-7WQ6SLIE.js → chunk-FVA6TGI3.js} +2 -2
- package/dist/{chunk-PAORGQRI.js → chunk-GA5P7RST.js} +37 -23
- package/dist/chunk-GA5P7RST.js.map +1 -0
- package/dist/chunk-GDFS42HT.js +206 -0
- package/dist/chunk-GDFS42HT.js.map +1 -0
- package/dist/chunk-IISBCCWR.js +52 -0
- package/dist/chunk-IISBCCWR.js.map +1 -0
- package/dist/chunk-JBMSGZEQ.js +441 -0
- package/dist/chunk-JBMSGZEQ.js.map +1 -0
- package/dist/{chunk-J4IYOZZ5.js → chunk-JXS5PDQ7.js} +3 -1
- package/dist/chunk-JXS5PDQ7.js.map +1 -0
- package/dist/chunk-KVBLZUKV.js +173 -0
- package/dist/chunk-KVBLZUKV.js.map +1 -0
- package/dist/{chunk-4LACOVZX.js → chunk-L7IXWRYE.js} +10 -5
- package/dist/chunk-L7IXWRYE.js.map +1 -0
- package/dist/chunk-LBLXEFWK.js +51 -0
- package/dist/chunk-LBLXEFWK.js.map +1 -0
- package/dist/{chunk-WBSAYXVI.js → chunk-LOIMBRDE.js} +201 -45
- package/dist/chunk-LOIMBRDE.js.map +1 -0
- package/dist/{chunk-3WHVNEN7.js → chunk-LTCGGW2D.js} +1 -1
- package/dist/chunk-LTCGGW2D.js.map +1 -0
- package/dist/{chunk-ZVBB3T7V.js → chunk-NBVAS5MT.js} +25 -23
- package/dist/chunk-NBVAS5MT.js.map +1 -0
- package/dist/{chunk-UEYA6UC7.js → chunk-NZLQTHS5.js} +25 -2
- package/dist/chunk-NZLQTHS5.js.map +1 -0
- package/dist/{chunk-NQEVYWX6.js → chunk-OC5OXUQ4.js} +211 -7
- package/dist/chunk-OC5OXUQ4.js.map +1 -0
- package/dist/{chunk-LK6SGL53.js → chunk-OR64ZGRZ.js} +3 -2
- package/dist/chunk-OR64ZGRZ.js.map +1 -0
- package/dist/{chunk-SYUK3VLY.js → chunk-PVICZTKG.js} +117 -5
- package/dist/chunk-PVICZTKG.js.map +1 -0
- package/dist/chunk-PVPWZSSI.js +37 -0
- package/dist/chunk-PVPWZSSI.js.map +1 -0
- package/dist/{chunk-JL2PU6AI.js → chunk-R2XRID2N.js} +2 -2
- package/dist/{chunk-4NRAJUDS.js → chunk-RBBWYEFJ.js} +1 -1
- package/dist/chunk-RFYAYKTD.js +146 -0
- package/dist/chunk-RFYAYKTD.js.map +1 -0
- package/dist/chunk-SOBJ6NEY.js +18 -0
- package/dist/chunk-SOBJ6NEY.js.map +1 -0
- package/dist/{chunk-JIU55F3X.js → chunk-SPI27QT6.js} +2 -2
- package/dist/{chunk-MVTHXUBX.js → chunk-STGWEHYR.js} +479 -20
- package/dist/chunk-STGWEHYR.js.map +1 -0
- package/dist/{chunk-6LX5ORAS.js → chunk-TMYO7B5P.js} +4 -4
- package/dist/chunk-TVVEYCNW.js +65 -0
- package/dist/chunk-TVVEYCNW.js.map +1 -0
- package/dist/chunk-ULYOGL6R.js +322 -0
- package/dist/chunk-ULYOGL6R.js.map +1 -0
- package/dist/{chunk-37UIFYWO.js → chunk-UWB5LMWY.js} +108 -9
- package/dist/chunk-UWB5LMWY.js.map +1 -0
- package/dist/{chunk-47UU5PU2.js → chunk-VBVG2M5G.js} +18 -3
- package/dist/chunk-VBVG2M5G.js.map +1 -0
- package/dist/{chunk-7ECD5ATE.js → chunk-VDX363PS.js} +2 -2
- package/dist/{chunk-O5ETUNBT.js → chunk-VTU2B4VF.js} +7 -3
- package/dist/chunk-VTU2B4VF.js.map +1 -0
- package/dist/{chunk-MTLYEMJB.js → chunk-WCLICCGB.js} +18 -3
- package/dist/chunk-WCLICCGB.js.map +1 -0
- package/dist/chunk-X6GF3FX2.js +26 -0
- package/dist/chunk-X6GF3FX2.js.map +1 -0
- package/dist/{chunk-3QFQGRHO.js → chunk-XMHBH5H6.js} +4 -4
- package/dist/{chunk-DHHP2Z4X.js → chunk-XXVWLXSG.js} +2 -2
- package/dist/{chunk-XZ2TIKGC.js → chunk-Y7R2XJ5Q.js} +25 -9
- package/dist/chunk-Y7R2XJ5Q.js.map +1 -0
- package/dist/{chunk-ALXMCZEU.js → chunk-Z2E7VW55.js} +6 -3
- package/dist/chunk-Z2E7VW55.js.map +1 -0
- package/dist/chunk-ZAIM4TUE.js +488 -0
- package/dist/chunk-ZAIM4TUE.js.map +1 -0
- package/dist/chunk-ZZTOURJI.js +91 -0
- package/dist/chunk-ZZTOURJI.js.map +1 -0
- package/dist/{cli-BneVIEvh.d.ts → cli-BkeRaYfk.d.ts} +2 -2
- package/dist/cli.d.ts +13 -6
- package/dist/cli.js +42 -31
- package/dist/config.js +2 -2
- package/dist/consolidation-operator.d.ts +41 -0
- package/dist/consolidation-operator.js +11 -0
- package/dist/consolidation-operator.js.map +1 -0
- package/dist/consolidation-provenance-check.d.ts +68 -0
- package/dist/consolidation-provenance-check.js +9 -0
- package/dist/consolidation-provenance-check.js.map +1 -0
- package/dist/consolidation-undo.d.ts +123 -0
- package/dist/consolidation-undo.js +426 -0
- package/dist/consolidation-undo.js.map +1 -0
- package/dist/{contradiction-scan-GR33PONM.js → contradiction-scan-E3GJTI4F.js} +43 -7
- package/dist/contradiction-scan-E3GJTI4F.js.map +1 -0
- package/dist/cross-namespace-budget.d.ts +133 -0
- package/dist/cross-namespace-budget.js +9 -0
- package/dist/cross-namespace-budget.js.map +1 -0
- package/dist/direct-answer-wiring.js +5 -70
- package/dist/direct-answer-wiring.js.map +1 -1
- package/dist/embedding-fallback.js +2 -1
- package/dist/{engine-5TIQBYZR.js → engine-72LSIWQP.js} +8 -7
- package/dist/engine-72LSIWQP.js.map +1 -0
- package/dist/entity-retrieval.d.ts +1 -0
- package/dist/entity-retrieval.js +7 -6
- package/dist/explicit-capture.d.ts +6 -3
- package/dist/explicit-capture.js +2 -2
- package/dist/extraction-judge-telemetry.d.ts +113 -0
- package/dist/extraction-judge-telemetry.js +14 -0
- package/dist/extraction-judge-telemetry.js.map +1 -0
- package/dist/extraction-judge-training.d.ts +85 -0
- package/dist/extraction-judge-training.js +16 -0
- package/dist/extraction-judge-training.js.map +1 -0
- package/dist/extraction-judge.d.ts +124 -2
- package/dist/extraction-judge.js +11 -1
- package/dist/extraction.js +10 -9
- package/dist/fallback-llm.js +3 -3
- package/dist/graph-recall.d.ts +100 -0
- package/dist/graph-recall.js +8 -0
- package/dist/graph-recall.js.map +1 -0
- package/dist/graph-retrieval.d.ts +271 -0
- package/dist/graph-retrieval.js +21 -0
- package/dist/graph-retrieval.js.map +1 -0
- package/dist/importance.js +1 -1
- package/dist/index.d.ts +585 -20
- package/dist/index.js +542 -344
- package/dist/index.js.map +1 -1
- package/dist/local-llm.js +2 -2
- package/dist/memory-worth-bench.d.ts +51 -0
- package/dist/memory-worth-bench.js +131 -0
- package/dist/memory-worth-bench.js.map +1 -0
- package/dist/memory-worth-filter.d.ts +128 -0
- package/dist/memory-worth-filter.js +10 -0
- package/dist/memory-worth-filter.js.map +1 -0
- package/dist/memory-worth-outcomes.d.ts +118 -0
- package/dist/memory-worth-outcomes.js +9 -0
- package/dist/memory-worth-outcomes.js.map +1 -0
- package/dist/memory-worth.d.ts +102 -0
- package/dist/memory-worth.js +7 -0
- package/dist/memory-worth.js.map +1 -0
- package/dist/operator-toolkit.d.ts +40 -1
- package/dist/operator-toolkit.js +25 -16
- package/dist/{orchestrator-DRYA6_lW.d.ts → orchestrator-CmJ-NTdJ.d.ts} +233 -8
- package/dist/orchestrator.d.ts +6 -3
- package/dist/orchestrator.js +54 -44
- package/dist/page-versioning.d.ts +12 -1
- package/dist/page-versioning.js +5 -3
- package/dist/{port-C1GZFv8h.d.ts → port-BADbLZU5.d.ts} +2 -2
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +5 -3
- package/dist/qmd.js +3 -3
- package/dist/reasoning-trace-recall.d.ts +90 -0
- package/dist/reasoning-trace-recall.js +13 -0
- package/dist/reasoning-trace-recall.js.map +1 -0
- package/dist/reasoning-trace-types.d.ts +54 -0
- package/dist/reasoning-trace-types.js +17 -0
- package/dist/reasoning-trace-types.js.map +1 -0
- package/dist/recall-audit-anomaly.d.ts +112 -0
- package/dist/recall-audit-anomaly.js +11 -0
- package/dist/recall-audit-anomaly.js.map +1 -0
- package/dist/recall-audit.js +5 -44
- package/dist/recall-audit.js.map +1 -1
- package/dist/recall-explain-renderer.d.ts +49 -0
- package/dist/recall-explain-renderer.js +18 -0
- package/dist/recall-explain-renderer.js.map +1 -0
- package/dist/recall-state.d.ts +12 -1
- package/dist/recall-state.js +1 -1
- package/dist/recall-xray-cli.d.ts +40 -0
- package/dist/recall-xray-cli.js +11 -0
- package/dist/recall-xray-cli.js.map +1 -0
- package/dist/recall-xray-renderer.d.ts +44 -0
- package/dist/recall-xray-renderer.js +18 -0
- package/dist/recall-xray-renderer.js.map +1 -0
- package/dist/recall-xray.d.ts +179 -0
- package/dist/recall-xray.js +13 -0
- package/dist/recall-xray.js.map +1 -0
- package/dist/resolve-provider-secret.d.ts +5 -1
- package/dist/resolve-provider-secret.js +3 -1
- package/dist/resume-bundles.js +6 -6
- package/dist/retrieval-agents.d.ts +1 -1
- package/dist/retrieval-tiers.d.ts +17 -0
- package/dist/retrieval-tiers.js +9 -0
- package/dist/retrieval-tiers.js.map +1 -0
- package/dist/schemas.d.ts +309 -53
- package/dist/schemas.js +1 -1
- package/dist/{semantic-consolidation-DrvSYRdB.d.ts → semantic-consolidation-CxJU6MJk.d.ts} +62 -1
- package/dist/semantic-consolidation.d.ts +2 -1
- package/dist/semantic-consolidation.js +22 -7
- package/dist/semantic-rule-promotion.js +7 -6
- package/dist/semantic-rule-verifier.js +7 -6
- package/dist/storage.d.ts +82 -1
- package/dist/storage.js +6 -5
- package/dist/summarizer.js +6 -6
- package/dist/temporal-supersession.d.ts +1 -0
- package/dist/tier-migration.d.ts +2 -1
- package/dist/tokens.js +2 -1
- package/dist/types.d.ts +276 -2
- package/dist/types.js +1 -1
- package/dist/verified-recall.js +7 -6
- package/package.json +1 -1
- package/dist/chunk-37UIFYWO.js.map +0 -1
- package/dist/chunk-3QHL5ABG.js.map +0 -1
- package/dist/chunk-3SV6CQHO.js.map +0 -1
- package/dist/chunk-3WHVNEN7.js.map +0 -1
- package/dist/chunk-47UU5PU2.js.map +0 -1
- package/dist/chunk-4LACOVZX.js.map +0 -1
- package/dist/chunk-6ZH4TU6I.js.map +0 -1
- package/dist/chunk-ALXMCZEU.js.map +0 -1
- package/dist/chunk-BLKTA7MM.js.map +0 -1
- package/dist/chunk-DEPL3635.js.map +0 -1
- package/dist/chunk-GV6NLQ4X.js.map +0 -1
- package/dist/chunk-J4IYOZZ5.js.map +0 -1
- package/dist/chunk-LAYN4LDC.js +0 -267
- package/dist/chunk-LAYN4LDC.js.map +0 -1
- package/dist/chunk-LK6SGL53.js.map +0 -1
- package/dist/chunk-MBJHSA7F.js.map +0 -1
- package/dist/chunk-MTLYEMJB.js.map +0 -1
- package/dist/chunk-MVTHXUBX.js.map +0 -1
- package/dist/chunk-NQEVYWX6.js.map +0 -1
- package/dist/chunk-O5ETUNBT.js.map +0 -1
- package/dist/chunk-OIT5QGG4.js.map +0 -1
- package/dist/chunk-PAORGQRI.js.map +0 -1
- package/dist/chunk-QDYXG4CS.js.map +0 -1
- package/dist/chunk-QNJMBKFK.js.map +0 -1
- package/dist/chunk-SYUK3VLY.js.map +0 -1
- package/dist/chunk-UEYA6UC7.js.map +0 -1
- package/dist/chunk-UVJFDP7P.js +0 -202
- package/dist/chunk-UVJFDP7P.js.map +0 -1
- package/dist/chunk-WBSAYXVI.js.map +0 -1
- package/dist/chunk-XZ2TIKGC.js.map +0 -1
- package/dist/chunk-ZVBB3T7V.js.map +0 -1
- package/dist/contradiction-scan-GR33PONM.js.map +0 -1
- /package/dist/{engine-5TIQBYZR.js.map → access-audit.js.map} +0 -0
- /package/dist/{chunk-ITRLGI2T.js.map → chunk-3OGMS3PE.js.map} +0 -0
- /package/dist/{chunk-44ICJRF3.js.map → chunk-AYXIPSZO.js.map} +0 -0
- /package/dist/{chunk-6UJ47TVX.js.map → chunk-CUPFXL3J.js.map} +0 -0
- /package/dist/{chunk-N42IWANG.js.map → chunk-DG6YMRDC.js.map} +0 -0
- /package/dist/{chunk-7WQ6SLIE.js.map → chunk-FVA6TGI3.js.map} +0 -0
- /package/dist/{chunk-JL2PU6AI.js.map → chunk-R2XRID2N.js.map} +0 -0
- /package/dist/{chunk-4NRAJUDS.js.map → chunk-RBBWYEFJ.js.map} +0 -0
- /package/dist/{chunk-JIU55F3X.js.map → chunk-SPI27QT6.js.map} +0 -0
- /package/dist/{chunk-6LX5ORAS.js.map → chunk-TMYO7B5P.js.map} +0 -0
- /package/dist/{chunk-7ECD5ATE.js.map → chunk-VDX363PS.js.map} +0 -0
- /package/dist/{chunk-3QFQGRHO.js.map → chunk-XMHBH5H6.js.map} +0 -0
- /package/dist/{chunk-DHHP2Z4X.js.map → chunk-XXVWLXSG.js.map} +0 -0
|
@@ -2,11 +2,14 @@ import {
|
|
|
2
2
|
buildCitationGuidance
|
|
3
3
|
} from "./chunk-IQT3XTKW.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
5
|
+
EngramAccessInputError
|
|
6
|
+
} from "./chunk-STGWEHYR.js";
|
|
7
7
|
import {
|
|
8
8
|
validateBriefingFormat
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-L7IXWRYE.js";
|
|
10
|
+
import {
|
|
11
|
+
readEnvVar
|
|
12
|
+
} from "./chunk-MARWOCVP.js";
|
|
10
13
|
|
|
11
14
|
// src/access-mcp.ts
|
|
12
15
|
import { readFile } from "fs/promises";
|
|
@@ -74,6 +77,87 @@ var EngramMcpServer = class {
|
|
|
74
77
|
additionalProperties: false
|
|
75
78
|
}
|
|
76
79
|
},
|
|
80
|
+
{
|
|
81
|
+
name: "engram.set_coding_context",
|
|
82
|
+
description: "Attach a coding-agent context (project / branch) to a session so recall routes to a project- / branch-scoped namespace (issue #569). For MCP clients that do not ship cwd automatically (Cursor, generic agents, etc.). Also aliased as remnic.set_coding_context. Pass codingContext: null to clear.",
|
|
83
|
+
inputSchema: {
|
|
84
|
+
type: "object",
|
|
85
|
+
properties: {
|
|
86
|
+
sessionKey: {
|
|
87
|
+
type: "string",
|
|
88
|
+
description: "Session identifier the context should attach to."
|
|
89
|
+
},
|
|
90
|
+
codingContext: {
|
|
91
|
+
anyOf: [
|
|
92
|
+
{ type: "null" },
|
|
93
|
+
{
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: {
|
|
96
|
+
projectId: { type: "string", description: "Stable project id (origin:<hex> or root:<hex>)." },
|
|
97
|
+
branch: { type: ["string", "null"], description: "Current branch, or null in detached HEAD." },
|
|
98
|
+
rootPath: { type: "string", description: "Absolute path to the repo root." },
|
|
99
|
+
defaultBranch: { type: ["string", "null"], description: "Default branch (usually main/master), or null when unknown." }
|
|
100
|
+
},
|
|
101
|
+
required: ["projectId", "branch", "rootPath", "defaultBranch"],
|
|
102
|
+
additionalProperties: false
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
description: "The context to attach, or null to clear."
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
required: ["sessionKey", "codingContext"],
|
|
109
|
+
additionalProperties: false
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "engram.recall_tier_explain",
|
|
114
|
+
description: "Return a structured tier-explain payload for the last direct-answer-eligible recall (issue #518). Orthogonal to engram.recall_explain, which returns a graph-path explanation.",
|
|
115
|
+
inputSchema: {
|
|
116
|
+
type: "object",
|
|
117
|
+
properties: {
|
|
118
|
+
sessionKey: {
|
|
119
|
+
type: "string",
|
|
120
|
+
description: "Optional session key. Omit to read the most recent snapshot."
|
|
121
|
+
},
|
|
122
|
+
namespace: {
|
|
123
|
+
type: "string",
|
|
124
|
+
description: "Optional namespace to scope the returned snapshot."
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
additionalProperties: false
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
// Registered as `engram.recall_xray`; `withToolAliases` below
|
|
132
|
+
// emits the canonical `remnic.recall_xray` alias automatically
|
|
133
|
+
// (dual-naming invariant for every new MCP tool).
|
|
134
|
+
name: "engram.recall_xray",
|
|
135
|
+
description: "Run a recall with X-ray capture enabled and return the unified per-result attribution snapshot (tier + audit + MMR + filters in one view). Issue #570.",
|
|
136
|
+
inputSchema: {
|
|
137
|
+
type: "object",
|
|
138
|
+
properties: {
|
|
139
|
+
query: {
|
|
140
|
+
type: "string",
|
|
141
|
+
description: "Query to recall against. Required; non-empty."
|
|
142
|
+
},
|
|
143
|
+
sessionKey: {
|
|
144
|
+
type: "string",
|
|
145
|
+
description: "Optional session key to scope the recall."
|
|
146
|
+
},
|
|
147
|
+
namespace: {
|
|
148
|
+
type: "string",
|
|
149
|
+
description: "Optional namespace. Enforced against the caller's principal; a mismatch yields snapshotFound:false."
|
|
150
|
+
},
|
|
151
|
+
budget: {
|
|
152
|
+
type: "integer",
|
|
153
|
+
minimum: 1,
|
|
154
|
+
description: "Optional positive-integer override for the recall character budget."
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
required: ["query"],
|
|
158
|
+
additionalProperties: false
|
|
159
|
+
}
|
|
160
|
+
},
|
|
77
161
|
{
|
|
78
162
|
name: "engram.day_summary",
|
|
79
163
|
description: "Generate a structured end-of-day summary. When memories is omitted or empty, auto-gathers today's facts and hourly summaries from storage.",
|
|
@@ -114,6 +198,20 @@ var EngramMcpServer = class {
|
|
|
114
198
|
additionalProperties: false
|
|
115
199
|
}
|
|
116
200
|
},
|
|
201
|
+
{
|
|
202
|
+
// The canonical `remnic.procedural_stats` alias is added automatically
|
|
203
|
+
// by `withToolAliases` — the dual-naming invariant keeps both names
|
|
204
|
+
// alive for the legacy surface.
|
|
205
|
+
name: "engram.procedural_stats",
|
|
206
|
+
description: "Procedural memory stats (issue #567): counts by status, recent write activity, and the active procedural.* config. Read-only, namespace-scoped.",
|
|
207
|
+
inputSchema: {
|
|
208
|
+
type: "object",
|
|
209
|
+
properties: {
|
|
210
|
+
namespace: { type: "string" }
|
|
211
|
+
},
|
|
212
|
+
additionalProperties: false
|
|
213
|
+
}
|
|
214
|
+
},
|
|
117
215
|
{
|
|
118
216
|
name: "engram.memory_get",
|
|
119
217
|
description: "Fetch one Remnic memory by id.",
|
|
@@ -671,6 +769,26 @@ var EngramMcpServer = class {
|
|
|
671
769
|
additionalProperties: false
|
|
672
770
|
}
|
|
673
771
|
},
|
|
772
|
+
// Memory Worth outcome signal (issue #560 PR 3). Callers record whether
|
|
773
|
+
// a session that used a given memory ultimately succeeded or failed;
|
|
774
|
+
// the counter is persisted in the memory's frontmatter (mw_success /
|
|
775
|
+
// mw_fail) and will feed the recall-time filter added in PR 4.
|
|
776
|
+
{
|
|
777
|
+
name: "engram.memory_outcome",
|
|
778
|
+
description: "Record a Memory Worth outcome (success/failure) for a memory. Increments mw_success or mw_fail in the memory's frontmatter for use by the recall filter.",
|
|
779
|
+
inputSchema: {
|
|
780
|
+
type: "object",
|
|
781
|
+
properties: {
|
|
782
|
+
memoryId: { type: "string" },
|
|
783
|
+
outcome: { type: "string", enum: ["success", "failure"] },
|
|
784
|
+
namespace: { type: "string" },
|
|
785
|
+
sessionKey: { type: "string" },
|
|
786
|
+
timestamp: { type: "string", description: "Optional ISO-8601 timestamp of the observation." }
|
|
787
|
+
},
|
|
788
|
+
required: ["memoryId", "outcome"],
|
|
789
|
+
additionalProperties: false
|
|
790
|
+
}
|
|
791
|
+
},
|
|
674
792
|
{
|
|
675
793
|
name: "engram.context_checkpoint",
|
|
676
794
|
description: "Save a structured context checkpoint for a session (preserves conversation state to disk).",
|
|
@@ -1016,6 +1134,63 @@ ${body}`;
|
|
|
1016
1134
|
sessionKey: typeof args.sessionKey === "string" ? args.sessionKey : void 0,
|
|
1017
1135
|
namespace: typeof args.namespace === "string" ? args.namespace : void 0
|
|
1018
1136
|
});
|
|
1137
|
+
case "engram.set_coding_context": {
|
|
1138
|
+
const sessionKey = typeof args.sessionKey === "string" ? args.sessionKey : "";
|
|
1139
|
+
const rawCtx = args.codingContext;
|
|
1140
|
+
let codingContext = null;
|
|
1141
|
+
if (rawCtx !== null) {
|
|
1142
|
+
if (typeof rawCtx !== "object" || rawCtx === void 0) {
|
|
1143
|
+
throw new EngramAccessInputError("codingContext must be an object or null");
|
|
1144
|
+
}
|
|
1145
|
+
const obj = rawCtx;
|
|
1146
|
+
const projectId = typeof obj.projectId === "string" ? obj.projectId : "";
|
|
1147
|
+
const rootPath = typeof obj.rootPath === "string" ? obj.rootPath : "";
|
|
1148
|
+
const branch = obj.branch === null ? null : typeof obj.branch === "string" ? obj.branch : void 0;
|
|
1149
|
+
const defaultBranch = obj.defaultBranch === null ? null : typeof obj.defaultBranch === "string" ? obj.defaultBranch : void 0;
|
|
1150
|
+
if (branch === void 0) {
|
|
1151
|
+
throw new EngramAccessInputError("codingContext.branch must be a string or null");
|
|
1152
|
+
}
|
|
1153
|
+
if (defaultBranch === void 0) {
|
|
1154
|
+
throw new EngramAccessInputError("codingContext.defaultBranch must be a string or null");
|
|
1155
|
+
}
|
|
1156
|
+
codingContext = { projectId, branch, rootPath, defaultBranch };
|
|
1157
|
+
}
|
|
1158
|
+
this.service.setCodingContext({ sessionKey, codingContext });
|
|
1159
|
+
return { ok: true };
|
|
1160
|
+
}
|
|
1161
|
+
case "engram.recall_tier_explain":
|
|
1162
|
+
return this.service.recallTierExplain(
|
|
1163
|
+
typeof args.sessionKey === "string" && args.sessionKey.length > 0 ? args.sessionKey : void 0,
|
|
1164
|
+
typeof args.namespace === "string" && args.namespace.length > 0 ? args.namespace : void 0,
|
|
1165
|
+
effectivePrincipal
|
|
1166
|
+
);
|
|
1167
|
+
case "engram.recall_xray": {
|
|
1168
|
+
const query = typeof args.query === "string" ? args.query : "";
|
|
1169
|
+
const sessionKey = typeof args.sessionKey === "string" && args.sessionKey.length > 0 ? args.sessionKey : void 0;
|
|
1170
|
+
const namespace = typeof args.namespace === "string" && args.namespace.length > 0 ? args.namespace : void 0;
|
|
1171
|
+
let budget;
|
|
1172
|
+
if (args.budget !== void 0 && args.budget !== null) {
|
|
1173
|
+
if (typeof args.budget !== "number" && typeof args.budget !== "string") {
|
|
1174
|
+
throw new Error(
|
|
1175
|
+
`engram.recall_xray: budget expects a positive integer; got ${JSON.stringify(args.budget)}`
|
|
1176
|
+
);
|
|
1177
|
+
}
|
|
1178
|
+
const parsed = typeof args.budget === "number" ? args.budget : Number(args.budget);
|
|
1179
|
+
if (!Number.isFinite(parsed) || parsed <= 0 || !Number.isInteger(parsed)) {
|
|
1180
|
+
throw new Error(
|
|
1181
|
+
`engram.recall_xray: budget expects a positive integer; got ${JSON.stringify(args.budget)}`
|
|
1182
|
+
);
|
|
1183
|
+
}
|
|
1184
|
+
budget = parsed;
|
|
1185
|
+
}
|
|
1186
|
+
return this.service.recallXray({
|
|
1187
|
+
query,
|
|
1188
|
+
sessionKey,
|
|
1189
|
+
namespace,
|
|
1190
|
+
budget,
|
|
1191
|
+
authenticatedPrincipal: effectivePrincipal
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1019
1194
|
case "engram.day_summary":
|
|
1020
1195
|
return this.service.daySummary({
|
|
1021
1196
|
memories: typeof args.memories === "string" ? args.memories : "",
|
|
@@ -1039,6 +1214,14 @@ ${body}`;
|
|
|
1039
1214
|
},
|
|
1040
1215
|
effectivePrincipal
|
|
1041
1216
|
);
|
|
1217
|
+
case "remnic.procedural_stats":
|
|
1218
|
+
case "engram.procedural_stats":
|
|
1219
|
+
return this.service.procedureStats(
|
|
1220
|
+
{
|
|
1221
|
+
namespace: typeof args.namespace === "string" ? args.namespace : void 0
|
|
1222
|
+
},
|
|
1223
|
+
effectivePrincipal
|
|
1224
|
+
);
|
|
1042
1225
|
case "engram.memory_get":
|
|
1043
1226
|
return this.service.memoryGet(
|
|
1044
1227
|
typeof args.memoryId === "string" ? args.memoryId : "",
|
|
@@ -1327,6 +1510,22 @@ ${body}`;
|
|
|
1327
1510
|
principal: effectivePrincipal,
|
|
1328
1511
|
sessionKey: typeof args.sessionKey === "string" ? args.sessionKey : void 0
|
|
1329
1512
|
});
|
|
1513
|
+
case "engram.memory_outcome": {
|
|
1514
|
+
const outcome = args.outcome;
|
|
1515
|
+
if (outcome !== "success" && outcome !== "failure") {
|
|
1516
|
+
throw new Error(
|
|
1517
|
+
`engram.memory_outcome: outcome must be "success" or "failure"; got ${JSON.stringify(outcome)}`
|
|
1518
|
+
);
|
|
1519
|
+
}
|
|
1520
|
+
return this.service.memoryOutcome({
|
|
1521
|
+
memoryId: typeof args.memoryId === "string" ? args.memoryId : "",
|
|
1522
|
+
outcome,
|
|
1523
|
+
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
1524
|
+
principal: effectivePrincipal,
|
|
1525
|
+
sessionKey: typeof args.sessionKey === "string" ? args.sessionKey : void 0,
|
|
1526
|
+
timestamp: typeof args.timestamp === "string" ? args.timestamp : void 0
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1330
1529
|
case "engram.context_checkpoint":
|
|
1331
1530
|
return this.service.contextCheckpoint({
|
|
1332
1531
|
sessionKey: typeof args.sessionKey === "string" ? args.sessionKey : "",
|
|
@@ -1352,7 +1551,12 @@ ${body}`;
|
|
|
1352
1551
|
case "engram.review_list":
|
|
1353
1552
|
case "remnic.review_list": {
|
|
1354
1553
|
const { listPairs } = await import("./contradiction-review-WIUBAR52.js");
|
|
1355
|
-
const
|
|
1554
|
+
const VALID_REVIEW_FILTERS = /* @__PURE__ */ new Set(["all", "unresolved", "contradicts", "independent", "duplicates", "needs-user"]);
|
|
1555
|
+
const rawFilter = typeof args.filter === "string" ? args.filter : "unresolved";
|
|
1556
|
+
if (!VALID_REVIEW_FILTERS.has(rawFilter)) {
|
|
1557
|
+
throw new Error(`Invalid filter '${rawFilter}'. Valid: ${[...VALID_REVIEW_FILTERS].join(", ")}`);
|
|
1558
|
+
}
|
|
1559
|
+
const filter = rawFilter;
|
|
1356
1560
|
const ns = typeof args.namespace === "string" ? args.namespace : void 0;
|
|
1357
1561
|
const limit = typeof args.limit === "number" ? args.limit : 50;
|
|
1358
1562
|
return listPairs(this.service.memoryDir, { filter, namespace: ns, limit });
|
|
@@ -1370,12 +1574,12 @@ ${body}`;
|
|
|
1370
1574
|
}
|
|
1371
1575
|
case "engram.contradiction_scan_run":
|
|
1372
1576
|
case "remnic.contradiction_scan_run": {
|
|
1373
|
-
const { runContradictionScan } = await import("./contradiction-scan-
|
|
1577
|
+
const { runContradictionScan } = await import("./contradiction-scan-E3GJTI4F.js");
|
|
1374
1578
|
return runContradictionScan({
|
|
1375
1579
|
storage: this.service.storageRef,
|
|
1376
1580
|
config: this.service.configRef,
|
|
1377
1581
|
memoryDir: this.service.memoryDir,
|
|
1378
|
-
|
|
1582
|
+
embeddingLookupFactory: this.service.embeddingLookupFactoryRef,
|
|
1379
1583
|
localLlm: this.service.localLlmRef,
|
|
1380
1584
|
fallbackLlm: this.service.fallbackLlmRef,
|
|
1381
1585
|
namespace: typeof args.namespace === "string" ? args.namespace : void 0
|
|
@@ -1390,4 +1594,4 @@ ${body}`;
|
|
|
1390
1594
|
export {
|
|
1391
1595
|
EngramMcpServer
|
|
1392
1596
|
};
|
|
1393
|
-
//# sourceMappingURL=chunk-
|
|
1597
|
+
//# sourceMappingURL=chunk-OC5OXUQ4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/access-mcp.ts"],"sourcesContent":["import type { Readable, Writable } from \"node:stream\";\nimport { readFile } from \"node:fs/promises\";\nimport { randomUUID } from \"node:crypto\";\nimport { EngramAccessInputError, type EngramAccessService, type EngramAccessRecallResponse } from \"./access-service.js\";\nimport { readEnvVar } from \"./runtime/env.js\";\nimport type { RecallPlanMode } from \"./types.js\";\nimport { validateBriefingFormat } from \"./briefing.js\";\nimport { buildCitationGuidance, type CitationMetadata } from \"./citations.js\";\n\ntype JsonRpcId = string | number | null;\n\ntype JsonRpcRequest = {\n jsonrpc?: string;\n id?: JsonRpcId;\n method?: string;\n params?: Record<string, unknown>;\n};\n\ntype McpTool = {\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n};\n\nconst MCP_PROTOCOL_VERSION = \"2024-11-05\";\nconst LEGACY_MCP_PREFIX = \"engram.\";\nconst CANONICAL_MCP_PREFIX = \"remnic.\";\n\nfunction toCanonicalToolName(name: string): string {\n return name.startsWith(LEGACY_MCP_PREFIX)\n ? `${CANONICAL_MCP_PREFIX}${name.slice(LEGACY_MCP_PREFIX.length)}`\n : name;\n}\n\nfunction toLegacyToolName(name: string): string {\n return name.startsWith(CANONICAL_MCP_PREFIX)\n ? `${LEGACY_MCP_PREFIX}${name.slice(CANONICAL_MCP_PREFIX.length)}`\n : name;\n}\n\nfunction withToolAliases(tool: McpTool): McpTool[] {\n const canonicalName = toCanonicalToolName(tool.name);\n const canonicalTool = canonicalName === tool.name ? tool : { ...tool, name: canonicalName };\n if (canonicalName === tool.name) return [canonicalTool];\n return [canonicalTool, tool];\n}\n\nasync function getMcpServerVersion(): Promise<string> {\n const envVersion =\n readEnvVar(\"OPENCLAW_ENGRAM_VERSION\")?.trim() ||\n readEnvVar(\"npm_package_version\")?.trim();\n if (envVersion) return envVersion;\n try {\n const pkgPath = new URL(\"../package.json\", import.meta.url);\n const raw = await readFile(pkgPath, \"utf-8\");\n const parsed = JSON.parse(raw) as { version?: string };\n return parsed.version?.trim() || \"unknown\";\n } catch {\n return \"unknown\";\n }\n}\n\nexport class EngramMcpServer {\n private buffer = Buffer.alloc(0);\n private flushTask: Promise<void> | null = null;\n private readonly tools: McpTool[];\n private readonly authenticatedPrincipal?: string;\n /**\n * MCP client info keyed by server-assigned session ID. On each `initialize`\n * handshake the server generates a UUID, stores the client's clientInfo\n * against it, and returns the ID as `Mcp-Session-Id` in the response\n * metadata. Subsequent requests from the same client include this header,\n * allowing per-session clientInfo lookup without cross-session leaks.\n */\n private clientInfoBySession = new Map<string, { name: string; version?: string }>();\n /**\n * Session IDs generated during initialize, keyed by caller-supplied correlation\n * ID (unique per HTTP request) to avoid collisions when multiple clients send\n * initialize with the same JSON-RPC id concurrently.\n */\n private initSessionIds = new Map<string, string>();\n\n /** Whether oai-mem-citation guidance is explicitly enabled via config. */\n private readonly citationsEnabled: boolean;\n /** Whether to auto-enable citations for Codex adapter connections. */\n private readonly citationsAutoDetect: boolean;\n\n constructor(\n private readonly service: EngramAccessService,\n options: { principal?: string; citationsEnabled?: boolean; citationsAutoDetect?: boolean } = {},\n ) {\n this.citationsEnabled = options.citationsEnabled === true;\n this.citationsAutoDetect = options.citationsAutoDetect !== false;\n this.authenticatedPrincipal =\n options.principal?.trim() ||\n readEnvVar(\"OPENCLAW_ENGRAM_ACCESS_PRINCIPAL\")?.trim() ||\n undefined;\n this.tools = [\n {\n name: \"engram.recall\",\n description: \"Recall Engram context for a query.\",\n inputSchema: {\n type: \"object\",\n properties: {\n query: { type: \"string\" },\n sessionKey: { type: \"string\" },\n namespace: { type: \"string\" },\n topK: { type: \"number\" },\n mode: { type: \"string\", enum: [\"auto\", \"no_recall\", \"minimal\", \"full\", \"graph_mode\"] },\n includeDebug: { type: \"boolean\" },\n },\n required: [\"query\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.recall_explain\",\n description: \"Return the last recall snapshot for a session or the most recent one.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionKey: { type: \"string\" },\n namespace: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.set_coding_context\",\n description:\n \"Attach a coding-agent context (project / branch) to a session so recall routes to a project- / branch-scoped namespace (issue #569). For MCP clients that do not ship cwd automatically (Cursor, generic agents, etc.). Also aliased as remnic.set_coding_context. Pass codingContext: null to clear.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionKey: {\n type: \"string\",\n description: \"Session identifier the context should attach to.\",\n },\n codingContext: {\n anyOf: [\n { type: \"null\" },\n {\n type: \"object\",\n properties: {\n projectId: { type: \"string\", description: \"Stable project id (origin:<hex> or root:<hex>).\" },\n branch: { type: [\"string\", \"null\"], description: \"Current branch, or null in detached HEAD.\" },\n rootPath: { type: \"string\", description: \"Absolute path to the repo root.\" },\n defaultBranch: { type: [\"string\", \"null\"], description: \"Default branch (usually main/master), or null when unknown.\" },\n },\n required: [\"projectId\", \"branch\", \"rootPath\", \"defaultBranch\"],\n additionalProperties: false,\n },\n ],\n description: \"The context to attach, or null to clear.\",\n },\n },\n required: [\"sessionKey\", \"codingContext\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.recall_tier_explain\",\n description:\n \"Return a structured tier-explain payload for the last direct-answer-eligible recall (issue #518). Orthogonal to engram.recall_explain, which returns a graph-path explanation.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionKey: {\n type: \"string\",\n description: \"Optional session key. Omit to read the most recent snapshot.\",\n },\n namespace: {\n type: \"string\",\n description: \"Optional namespace to scope the returned snapshot.\",\n },\n },\n additionalProperties: false,\n },\n },\n {\n // Registered as `engram.recall_xray`; `withToolAliases` below\n // emits the canonical `remnic.recall_xray` alias automatically\n // (dual-naming invariant for every new MCP tool).\n name: \"engram.recall_xray\",\n description:\n \"Run a recall with X-ray capture enabled and return the unified per-result attribution snapshot (tier + audit + MMR + filters in one view). Issue #570.\",\n inputSchema: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description: \"Query to recall against. Required; non-empty.\",\n },\n sessionKey: {\n type: \"string\",\n description: \"Optional session key to scope the recall.\",\n },\n namespace: {\n type: \"string\",\n description:\n \"Optional namespace. Enforced against the caller's principal; a mismatch yields snapshotFound:false.\",\n },\n budget: {\n type: \"integer\",\n minimum: 1,\n description:\n \"Optional positive-integer override for the recall character budget.\",\n },\n },\n required: [\"query\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.day_summary\",\n description:\n \"Generate a structured end-of-day summary. When memories is omitted or empty, auto-gathers today's facts and hourly summaries from storage.\",\n inputSchema: {\n type: \"object\",\n properties: {\n memories: { type: \"string\" },\n sessionKey: { type: \"string\" },\n namespace: { type: \"string\" },\n },\n required: [],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_governance_run\",\n description: \"Run Remnic memory governance in a bounded shadow/apply pass.\",\n inputSchema: {\n type: \"object\",\n properties: {\n namespace: { type: \"string\" },\n mode: { type: \"string\", enum: [\"shadow\", \"apply\"] },\n recentDays: { type: \"number\" },\n maxMemories: { type: \"number\" },\n batchSize: { type: \"number\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.procedure_mining_run\",\n description:\n \"Run procedural memory mining from causal trajectories (issue #519). Respects procedural.enabled; writes under procedures/ when clusters qualify.\",\n inputSchema: {\n type: \"object\",\n properties: {\n namespace: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n {\n // The canonical `remnic.procedural_stats` alias is added automatically\n // by `withToolAliases` — the dual-naming invariant keeps both names\n // alive for the legacy surface.\n name: \"engram.procedural_stats\",\n description:\n \"Procedural memory stats (issue #567): counts by status, recent write activity, and the active procedural.* config. Read-only, namespace-scoped.\",\n inputSchema: {\n type: \"object\",\n properties: {\n namespace: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_get\",\n description: \"Fetch one Remnic memory by id.\",\n inputSchema: {\n type: \"object\",\n properties: {\n memoryId: { type: \"string\" },\n namespace: { type: \"string\" },\n },\n required: [\"memoryId\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_timeline\",\n description: \"Fetch one Remnic memory timeline by id.\",\n inputSchema: {\n type: \"object\",\n properties: {\n memoryId: { type: \"string\" },\n namespace: { type: \"string\" },\n limit: { type: \"number\" },\n },\n required: [\"memoryId\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_store\",\n description: \"Store an explicit Remnic memory through the access layer.\",\n inputSchema: {\n type: \"object\",\n properties: {\n schemaVersion: { type: \"number\" },\n idempotencyKey: { type: \"string\" },\n dryRun: { type: \"boolean\" },\n sessionKey: { type: \"string\" },\n content: { type: \"string\" },\n category: { type: \"string\" },\n confidence: { type: \"number\" },\n namespace: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n entityRef: { type: \"string\" },\n ttl: { type: \"string\" },\n sourceReason: { type: \"string\" },\n },\n required: [\"content\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.suggestion_submit\",\n description: \"Queue a suggested Remnic memory for review.\",\n inputSchema: {\n type: \"object\",\n properties: {\n schemaVersion: { type: \"number\" },\n idempotencyKey: { type: \"string\" },\n dryRun: { type: \"boolean\" },\n sessionKey: { type: \"string\" },\n content: { type: \"string\" },\n category: { type: \"string\" },\n confidence: { type: \"number\" },\n namespace: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n entityRef: { type: \"string\" },\n ttl: { type: \"string\" },\n sourceReason: { type: \"string\" },\n },\n required: [\"content\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.entity_get\",\n description: \"Fetch one Engram entity by name.\",\n inputSchema: {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n namespace: { type: \"string\" },\n },\n required: [\"name\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.review_queue_list\",\n description: \"Fetch the latest Engram review queue artifact bundle.\",\n inputSchema: {\n type: \"object\",\n properties: {\n runId: { type: \"string\" },\n namespace: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.observe\",\n description: \"Feed conversation messages into Engram's memory pipeline (LCM archive + extraction).\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionKey: { type: \"string\", description: \"Conversation session identifier\" },\n messages: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n role: { type: \"string\", enum: [\"user\", \"assistant\"] },\n content: { type: \"string\" },\n },\n required: [\"role\", \"content\"],\n },\n description: \"Conversation messages to observe\",\n },\n namespace: { type: \"string\" },\n skipExtraction: { type: \"boolean\" },\n },\n required: [\"sessionKey\", \"messages\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.lcm_search\",\n description: \"Search the LCM conversation archive for matching content.\",\n inputSchema: {\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search query\" },\n sessionKey: { type: \"string\", description: \"Optional session filter\" },\n namespace: { type: \"string\" },\n limit: { type: \"number\", description: \"Max results to return\" },\n },\n required: [\"query\"],\n additionalProperties: false,\n },\n },\n // ── Continuity / Identity tools ─────────────────────────────────────\n {\n name: \"engram.continuity_audit_generate\",\n description: \"Generate a deterministic identity continuity audit report (weekly/monthly).\",\n inputSchema: {\n type: \"object\",\n properties: {\n period: { type: \"string\", enum: [\"weekly\", \"monthly\"] },\n key: { type: \"string\", description: \"Period key (weekly: YYYY-Www, monthly: YYYY-MM). Defaults to current.\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.continuity_incident_open\",\n description: \"Create a new continuity incident record in append-only storage.\",\n inputSchema: {\n type: \"object\",\n properties: {\n symptom: { type: \"string\", description: \"Observed continuity failure symptom.\" },\n namespace: { type: \"string\" },\n triggerWindow: { type: \"string\", description: \"Time window when incident occurred.\" },\n suspectedCause: { type: \"string\" },\n },\n required: [\"symptom\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.continuity_incident_close\",\n description: \"Close an open continuity incident with verification details.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Incident ID to close.\" },\n namespace: { type: \"string\" },\n fixApplied: { type: \"string\", description: \"What fix was applied.\" },\n verificationResult: { type: \"string\", description: \"How closure was verified.\" },\n preventiveRule: { type: \"string\", description: \"Optional preventive follow-up rule.\" },\n },\n required: [\"id\", \"fixApplied\", \"verificationResult\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.continuity_incident_list\",\n description: \"List continuity incidents, optionally filtered by state.\",\n inputSchema: {\n type: \"object\",\n properties: {\n state: { type: \"string\", enum: [\"open\", \"closed\", \"all\"] },\n namespace: { type: \"string\" },\n limit: { type: \"number\", description: \"Max incidents (default 25, max 200).\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.continuity_loop_add_or_update\",\n description: \"Add or update a continuity improvement loop entry.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Stable loop identifier.\" },\n cadence: { type: \"string\", enum: [\"daily\", \"weekly\", \"monthly\", \"quarterly\"] },\n purpose: { type: \"string\", description: \"What this recurring loop improves.\" },\n status: { type: \"string\", enum: [\"active\", \"paused\", \"retired\"] },\n killCondition: { type: \"string\", description: \"Clear condition for retiring this loop.\" },\n namespace: { type: \"string\" },\n lastReviewed: { type: \"string\", description: \"ISO timestamp for last review.\" },\n notes: { type: \"string\" },\n },\n required: [\"id\", \"cadence\", \"purpose\", \"status\", \"killCondition\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.continuity_loop_review\",\n description: \"Update review metadata for an existing continuity improvement loop.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Loop ID to review.\" },\n namespace: { type: \"string\" },\n status: { type: \"string\", enum: [\"active\", \"paused\", \"retired\"] },\n notes: { type: \"string\" },\n reviewedAt: { type: \"string\", description: \"ISO timestamp for review event.\" },\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.identity_anchor_get\",\n description: \"Read the identity continuity anchor document (recovery-safe identity context).\",\n inputSchema: {\n type: \"object\",\n properties: {\n namespace: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.identity_anchor_update\",\n description: \"Conservatively merge identity anchor sections without overwriting existing material.\",\n inputSchema: {\n type: \"object\",\n properties: {\n namespace: { type: \"string\" },\n identityTraits: { type: \"string\", description: \"Updates for 'Identity Traits' section.\" },\n communicationPreferences: { type: \"string\", description: \"Updates for 'Communication Preferences' section.\" },\n operatingPrinciples: { type: \"string\", description: \"Updates for 'Operating Principles' section.\" },\n continuityNotes: { type: \"string\", description: \"Updates for 'Continuity Notes' section.\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_identity\",\n description: \"Read the agent's identity reflections from the workspace IDENTITY.md file.\",\n inputSchema: {\n type: \"object\",\n properties: {\n namespace: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n // ── Work Layer tools ─────────────────────────────────────────────────\n {\n name: \"engram.work_task\",\n description: \"Manage work-layer tasks (create, get, list, update, transition, delete). Excluded from memory extraction.\",\n inputSchema: {\n type: \"object\",\n properties: {\n action: { type: \"string\", enum: [\"create\", \"get\", \"list\", \"update\", \"transition\", \"delete\"] },\n id: { type: \"string\" },\n title: { type: \"string\" },\n description: { type: \"string\" },\n status: { type: \"string\", enum: [\"todo\", \"in_progress\", \"blocked\", \"done\", \"cancelled\"] },\n priority: { type: \"string\", enum: [\"low\", \"medium\", \"high\"] },\n owner: { type: \"string\" },\n assignee: { type: \"string\" },\n projectId: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n dueAt: { type: \"string\" },\n },\n required: [\"action\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.work_project\",\n description: \"Manage work-layer projects (create, get, list, update, delete, link_task). Excluded from memory extraction.\",\n inputSchema: {\n type: \"object\",\n properties: {\n action: { type: \"string\", enum: [\"create\", \"get\", \"list\", \"update\", \"delete\", \"link_task\"] },\n id: { type: \"string\" },\n name: { type: \"string\" },\n description: { type: \"string\" },\n status: { type: \"string\", enum: [\"active\", \"on_hold\", \"completed\", \"archived\"] },\n owner: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n taskId: { type: \"string\", description: \"Task ID for link_task.\" },\n projectId: { type: \"string\", description: \"Project ID for link_task.\" },\n },\n required: [\"action\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.work_board\",\n description: \"Export/import work-layer board snapshots and markdown.\",\n inputSchema: {\n type: \"object\",\n properties: {\n action: { type: \"string\", enum: [\"export_markdown\", \"export_snapshot\", \"import_snapshot\"] },\n projectId: { type: \"string\" },\n snapshotJson: { type: \"string\", description: \"Snapshot JSON for import_snapshot.\" },\n linkToMemory: { type: \"boolean\", description: \"If true, output can be retained as long-term memory.\" },\n },\n required: [\"action\"],\n additionalProperties: false,\n },\n },\n // ── Shared Context / Compounding tools ────────────────────────────\n {\n name: \"engram.shared_context_write_output\",\n description: \"Write agent work product into shared-context directory for cross-agent coordination.\",\n inputSchema: {\n type: \"object\",\n properties: {\n agentId: { type: \"string\", description: \"Agent ID producing this output.\" },\n title: { type: \"string\", description: \"Short title for the output.\" },\n content: { type: \"string\", description: \"Markdown content to write.\" },\n },\n required: [\"agentId\", \"title\", \"content\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.shared_feedback_record\",\n description: \"Append approval/rejection decision into shared-context feedback inbox for compounding learning.\",\n inputSchema: {\n type: \"object\",\n properties: {\n agent: { type: \"string\", description: \"Agent name that produced the output.\" },\n decision: { type: \"string\", enum: [\"approved\", \"approved_with_feedback\", \"rejected\"] },\n reason: { type: \"string\" },\n date: { type: \"string\", description: \"ISO timestamp. Defaults to now.\" },\n learning: { type: \"string\" },\n outcome: { type: \"string\" },\n severity: { type: \"string\", enum: [\"low\", \"medium\", \"high\"] },\n confidence: { type: \"number\", description: \"Confidence 0-1.\" },\n workflow: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n evidenceWindowStart: { type: \"string\" },\n evidenceWindowEnd: { type: \"string\" },\n refs: { type: \"array\", items: { type: \"string\" } },\n },\n required: [\"agent\", \"decision\", \"reason\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.shared_priorities_append\",\n description: \"Append priorities text into shared-context inbox for curator merge.\",\n inputSchema: {\n type: \"object\",\n properties: {\n agentId: { type: \"string\" },\n text: { type: \"string\", description: \"Priority notes (markdown).\" },\n },\n required: [\"agentId\", \"text\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.shared_context_cross_signals_run\",\n description: \"Generate cross-signal markdown + JSON artifacts from agent outputs and feedback.\",\n inputSchema: {\n type: \"object\",\n properties: {\n date: { type: \"string\", description: \"YYYY-MM-DD. Defaults to today.\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.shared_context_curate_daily\",\n description: \"Generate daily roundtable summary (deterministic baseline aggregation).\",\n inputSchema: {\n type: \"object\",\n properties: {\n date: { type: \"string\", description: \"YYYY-MM-DD. Defaults to today.\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.compounding_weekly_synthesize\",\n description: \"Generate weekly compounding outputs: reports, mistake registry, rubrics, and promotion candidates.\",\n inputSchema: {\n type: \"object\",\n properties: {\n weekId: { type: \"string\", description: \"ISO week ID (YYYY-Www). Defaults to current week.\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.compounding_promote_candidate\",\n description: \"Promote a compounding candidate from weekly report into durable rule/principle memory.\",\n inputSchema: {\n type: \"object\",\n properties: {\n weekId: { type: \"string\" },\n candidateId: { type: \"string\" },\n dryRun: { type: \"boolean\", description: \"Preview without writing.\" },\n },\n required: [\"weekId\", \"candidateId\"],\n additionalProperties: false,\n },\n },\n // ── Compression Guidelines tools ────────────────────────────────────\n {\n name: \"engram.compression_guidelines_optimize\",\n description: \"Run compression guideline optimizer, optionally persisting new guidelines.\",\n inputSchema: {\n type: \"object\",\n properties: {\n dryRun: { type: \"boolean\" },\n eventLimit: { type: \"number\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.compression_guidelines_activate\",\n description: \"Promote staged compression guideline draft to active (after review).\",\n inputSchema: {\n type: \"object\",\n properties: {\n expectedContentHash: { type: \"string\" },\n expectedGuidelineVersion: { type: \"number\" },\n },\n additionalProperties: false,\n },\n },\n // ── Memory search & debug tools ────────────────────────────────────\n {\n name: \"engram.memory_search\",\n description: \"Direct semantic search over memory files using the QMD index. Returns matching memories with relevance scores.\",\n inputSchema: {\n type: \"object\",\n properties: {\n query: { type: \"string\" },\n namespace: { type: \"string\" },\n maxResults: { type: \"number\" },\n collection: { type: \"string\", description: \"QMD collection (omit for memory, 'global' for all)\" },\n },\n required: [\"query\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_profile\",\n description: \"Read the user's behavioral profile — a living document of their preferences, habits, and personality.\",\n inputSchema: {\n type: \"object\",\n properties: { namespace: { type: \"string\" } },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_entities_list\",\n description: \"List all tracked entities (people, projects, tools, companies).\",\n inputSchema: {\n type: \"object\",\n properties: { namespace: { type: \"string\" } },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_questions\",\n description: \"List open questions the system is curious about from past conversations.\",\n inputSchema: {\n type: \"object\",\n properties: { namespace: { type: \"string\" } },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_last_recall\",\n description: \"Return the last recall snapshot for a session (debug introspection).\",\n inputSchema: {\n type: \"object\",\n properties: { sessionKey: { type: \"string\" } },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_intent_debug\",\n description: \"Return the last intent classification debug snapshot.\",\n inputSchema: {\n type: \"object\",\n properties: { namespace: { type: \"string\" } },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_qmd_debug\",\n description: \"Return QMD search index debug information from the last recall.\",\n inputSchema: {\n type: \"object\",\n properties: { namespace: { type: \"string\" } },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_graph_explain\",\n description: \"Explain the last entity graph recall — which entities were activated and why.\",\n inputSchema: {\n type: \"object\",\n properties: { namespace: { type: \"string\" } },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_feedback\",\n description: \"Record relevance feedback (thumbs up/down) for a specific memory.\",\n inputSchema: {\n type: \"object\",\n properties: {\n memoryId: { type: \"string\" },\n vote: { type: \"string\", enum: [\"up\", \"down\"] },\n note: { type: \"string\" },\n },\n required: [\"memoryId\", \"vote\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.memory_promote\",\n description: \"Promote a memory's lifecycle state (e.g. from draft to active).\",\n inputSchema: {\n type: \"object\",\n properties: {\n memoryId: { type: \"string\" },\n namespace: { type: \"string\" },\n sessionKey: { type: \"string\" },\n },\n required: [\"memoryId\"],\n additionalProperties: false,\n },\n },\n // Memory Worth outcome signal (issue #560 PR 3). Callers record whether\n // a session that used a given memory ultimately succeeded or failed;\n // the counter is persisted in the memory's frontmatter (mw_success /\n // mw_fail) and will feed the recall-time filter added in PR 4.\n {\n name: \"engram.memory_outcome\",\n description: \"Record a Memory Worth outcome (success/failure) for a memory. Increments mw_success or mw_fail in the memory's frontmatter for use by the recall filter.\",\n inputSchema: {\n type: \"object\",\n properties: {\n memoryId: { type: \"string\" },\n outcome: { type: \"string\", enum: [\"success\", \"failure\"] },\n namespace: { type: \"string\" },\n sessionKey: { type: \"string\" },\n timestamp: { type: \"string\", description: \"Optional ISO-8601 timestamp of the observation.\" },\n },\n required: [\"memoryId\", \"outcome\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.context_checkpoint\",\n description: \"Save a structured context checkpoint for a session (preserves conversation state to disk).\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionKey: { type: \"string\" },\n context: { type: \"string\", description: \"Context content to checkpoint\" },\n namespace: { type: \"string\" },\n },\n required: [\"sessionKey\", \"context\"],\n additionalProperties: false,\n },\n },\n // ── Daily Context Briefing (#370) ───────────────────────────────────\n // Uses the legacy \"engram.*\" prefix like every other tool in this array;\n // withToolAliases (applied via .flatMap below) generates the canonical\n // \"remnic.briefing\" alias automatically.\n ...(service.briefingEnabled ? [{\n name: \"engram.briefing\",\n description: \"Generate a daily context briefing by cross-referencing active entities, recent facts, open commitments, and optional calendar events.\",\n inputSchema: {\n type: \"object\",\n properties: {\n since: { type: \"string\", description: \"Lookback window (e.g. 'yesterday', '3d', '1w', '24h').\" },\n focus: { type: \"string\", description: \"Optional focus filter (e.g. 'person:Jane Doe', 'project:remnic-core', 'topic:retrieval').\" },\n namespace: { type: \"string\" },\n format: { type: \"string\", enum: [\"markdown\", \"json\"] },\n maxFollowups: { type: \"number\", description: \"Maximum LLM-suggested follow-ups (0 disables that section).\" },\n },\n additionalProperties: false,\n },\n }] : []),\n // ── Contradiction Review (issue #520) ────────────────────────────────\n {\n name: \"engram.review_list\",\n description: \"List contradiction review items pending user resolution.\",\n inputSchema: {\n type: \"object\",\n properties: {\n filter: { type: \"string\", enum: [\"all\", \"unresolved\", \"contradicts\", \"independent\", \"duplicates\", \"needs-user\"], description: \"Filter by verdict type. Default: unresolved.\" },\n namespace: { type: \"string\" },\n limit: { type: \"number\", description: \"Max items to return (default 50).\" },\n },\n additionalProperties: false,\n },\n },\n {\n name: \"engram.review_resolve\",\n description: \"Resolve a contradiction pair with a chosen verb.\",\n inputSchema: {\n type: \"object\",\n properties: {\n pairId: { type: \"string\", description: \"The contradiction pair ID to resolve.\" },\n verb: { type: \"string\", enum: [\"keep-a\", \"keep-b\", \"merge\", \"both-valid\", \"needs-more-context\"], description: \"Resolution action.\" },\n },\n required: [\"pairId\", \"verb\"],\n additionalProperties: false,\n },\n },\n {\n name: \"engram.contradiction_scan_run\",\n description: \"Run an on-demand contradiction scan over the memory corpus.\",\n inputSchema: {\n type: \"object\",\n properties: {\n namespace: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n ].flatMap((tool) => withToolAliases(tool));\n }\n\n /** Get clientInfo for a specific MCP session. Returns undefined for non-MCP requests. */\n getClientInfo(sessionId?: string): { name: string; version?: string } | undefined {\n if (sessionId) {\n return this.clientInfoBySession.get(sessionId);\n }\n return undefined;\n }\n\n /** Pop the session ID generated during an initialize handshake, keyed by correlation ID. */\n popInitSessionId(correlationId: string): string | undefined {\n const sid = this.initSessionIds.get(correlationId);\n if (sid !== undefined) this.initSessionIds.delete(correlationId);\n return sid;\n }\n\n async handleRequest(request: JsonRpcRequest, options?: { principalOverride?: string; sessionId?: string; correlationId?: string }): Promise<Record<string, unknown> | null> {\n const id = request.id ?? null;\n const method = request.method ?? \"\";\n\n if (method === \"notifications/initialized\") return null;\n if (method === \"ping\") {\n return { jsonrpc: \"2.0\", id, result: {} };\n }\n if (method === \"initialize\") {\n const params = request.params ?? {};\n const rawClientInfo = params.clientInfo as { name?: string; version?: string } | undefined;\n // Generate a server-side session ID for this MCP session.\n // The caller should send this back as Mcp-Session-Id on subsequent requests.\n const newSessionId = randomUUID();\n if (rawClientInfo && typeof rawClientInfo.name === \"string\") {\n const info = { name: rawClientInfo.name, version: rawClientInfo.version as string | undefined };\n this.clientInfoBySession.set(newSessionId, info);\n // Evict oldest sessions if map exceeds limit\n if (this.clientInfoBySession.size > 1000) {\n const firstKey = this.clientInfoBySession.keys().next().value;\n if (firstKey) this.clientInfoBySession.delete(firstKey);\n }\n }\n const version = await getMcpServerVersion();\n // Store session ID keyed by correlation ID (unique per HTTP request) so\n // concurrent initializes with the same JSON-RPC id don't collide.\n const corrId = options?.correlationId;\n if (corrId) this.initSessionIds.set(corrId, newSessionId);\n return {\n jsonrpc: \"2.0\",\n id,\n result: {\n protocolVersion: MCP_PROTOCOL_VERSION,\n capabilities: {\n tools: {},\n },\n serverInfo: {\n name: \"remnic\",\n version,\n },\n },\n };\n }\n if (method === \"tools/list\") {\n return {\n jsonrpc: \"2.0\",\n id,\n result: {\n tools: this.tools,\n },\n };\n }\n if (method === \"tools/call\") {\n const params = request.params ?? {};\n const name = typeof params.name === \"string\" ? params.name : \"\";\n const argumentsObject =\n params.arguments && typeof params.arguments === \"object\" && !Array.isArray(params.arguments)\n ? (params.arguments as Record<string, unknown>)\n : {};\n\n try {\n const effectivePrincipal = options?.principalOverride ?? this.authenticatedPrincipal;\n const result = await this.callTool(name, argumentsObject, effectivePrincipal, options?.sessionId);\n return {\n jsonrpc: \"2.0\",\n id,\n result: {\n content: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n structuredContent: result,\n isError: false,\n },\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return {\n jsonrpc: \"2.0\",\n id,\n result: {\n content: [{ type: \"text\", text: message }],\n isError: true,\n },\n };\n }\n }\n\n return {\n jsonrpc: \"2.0\",\n id,\n error: {\n code: -32601,\n message: `Method not found: ${method}`,\n },\n };\n }\n\n async runStdio(input: Readable, output: Writable): Promise<void> {\n input.on(\"data\", (chunk) => {\n this.buffer = Buffer.concat([this.buffer, Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)]);\n this.scheduleFlush(output);\n });\n await new Promise<void>((resolve, reject) => {\n input.on(\"end\", resolve);\n input.on(\"error\", reject);\n });\n while (this.flushTask) {\n await this.flushTask;\n }\n }\n\n private scheduleFlush(output: Writable): void {\n if (this.flushTask) return;\n const task = this.flushBuffer(output)\n .catch((err) => {\n this.writeMessage(output, {\n jsonrpc: \"2.0\",\n id: null,\n error: {\n code: -32700,\n message: err instanceof Error ? err.message : String(err),\n },\n });\n })\n .finally(() => {\n if (this.flushTask === task) {\n this.flushTask = null;\n }\n if (this.buffer.length > 0) {\n this.scheduleFlush(output);\n }\n });\n this.flushTask = task;\n }\n\n private async flushBuffer(output: Writable): Promise<void> {\n while (true) {\n const headerEnd = this.buffer.indexOf(\"\\r\\n\\r\\n\");\n if (headerEnd < 0) return;\n const headerText = this.buffer.slice(0, headerEnd).toString(\"utf-8\");\n const headers = headerText.split(\"\\r\\n\");\n const contentLengthHeader = headers.find((line) => line.toLowerCase().startsWith(\"content-length:\"));\n if (!contentLengthHeader) {\n this.buffer = Buffer.alloc(0);\n return;\n }\n const contentLength = parseInt(contentLengthHeader.split(\":\")[1]?.trim() ?? \"0\", 10);\n if (!Number.isFinite(contentLength) || contentLength < 0) {\n this.buffer = Buffer.alloc(0);\n return;\n }\n const messageStart = headerEnd + 4;\n const messageEnd = messageStart + contentLength;\n if (this.buffer.length < messageEnd) return;\n const body = this.buffer.slice(messageStart, messageEnd).toString(\"utf-8\");\n this.buffer = this.buffer.slice(messageEnd);\n\n let parsed: JsonRpcRequest;\n try {\n parsed = JSON.parse(body) as JsonRpcRequest;\n } catch {\n this.writeMessage(output, {\n jsonrpc: \"2.0\",\n id: null,\n error: {\n code: -32700,\n message: \"Parse error\",\n },\n });\n continue;\n }\n const response = await this.handleRequest(parsed);\n if (response) {\n this.writeMessage(output, response);\n }\n }\n }\n\n private writeMessage(output: Writable, payload: Record<string, unknown>): void {\n const body = JSON.stringify(payload);\n const message = `Content-Length: ${Buffer.byteLength(body, \"utf-8\")}\\r\\n\\r\\n${body}`;\n output.write(message);\n }\n\n /**\n * Determine whether oai-mem-citation guidance should be appended to recall.\n * Returns true when explicitly enabled via config OR when auto-detect is\n * active and the current MCP session belongs to a Codex adapter client.\n *\n * When no sessionId is provided (e.g., stdio transport where there are no\n * HTTP headers carrying mcp-session-id), fall back to checking if there is\n * exactly one known session whose clientInfo matches the Codex pattern.\n * This covers the common stdio case where a single client connection exists.\n */\n private shouldEmitCitations(mcpSessionId?: string): boolean {\n if (this.citationsEnabled) return true;\n if (!this.citationsAutoDetect) return false;\n\n // Direct session lookup (HTTP transport with mcp-session-id header).\n if (mcpSessionId) {\n const info = this.clientInfoBySession.get(mcpSessionId);\n if (!info) return false;\n return this.isCodexClient(info);\n }\n\n // Stdio fallback: no session ID available. If there is exactly one session\n // registered (the typical stdio pattern), check that session's clientInfo.\n if (this.clientInfoBySession.size === 1) {\n const [info] = [...this.clientInfoBySession.values()];\n if (info) return this.isCodexClient(info);\n }\n\n return false;\n }\n\n /** Check whether a clientInfo record identifies a Codex adapter client. */\n private isCodexClient(info: { name: string; version?: string }): boolean {\n const lowerName = info.name.toLowerCase();\n return lowerName === \"codex-mcp-client\" || lowerName.includes(\"codex\");\n }\n\n /**\n * Build citation metadata for each recall result that has a path.\n * Line range defaults to 1-1 when not determinable from the summary.\n */\n private buildRecallCitations(response: EngramAccessRecallResponse): CitationMetadata[] {\n return response.results\n .filter((r) => r.path && r.path.length > 0)\n .map((r) => ({\n memoryId: r.id,\n path: r.path,\n lineStart: 1,\n lineEnd: 1,\n noteDefault: r.preview?.slice(0, 60) || r.id,\n }));\n }\n\n private async callTool(name: string, args: Record<string, unknown>, effectivePrincipal?: string, mcpSessionId?: string): Promise<unknown> {\n switch (toLegacyToolName(name)) {\n case \"engram.recall\": {\n const response = await this.service.recall({\n query: typeof args.query === \"string\" ? args.query : \"\",\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n topK: typeof args.topK === \"number\" && Number.isFinite(args.topK) ? args.topK : undefined,\n mode: typeof args.mode === \"string\" ? args.mode as RecallPlanMode | \"auto\" : undefined,\n includeDebug: args.includeDebug === true,\n });\n\n if (this.shouldEmitCitations(mcpSessionId)) {\n const citations = this.buildRecallCitations(response);\n const guidance = buildCitationGuidance(citations);\n if (guidance.length > 0) {\n return {\n ...response,\n context: response.context + guidance,\n citations,\n };\n }\n }\n return response;\n }\n case \"engram.recall_explain\":\n return this.service.recallExplain({\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n });\n case \"engram.set_coding_context\": {\n // Issue #569 PR 7 — MCP tool for clients that don't ship cwd.\n // Validation lives in EngramAccessService.setCodingContext; any\n // EngramAccessInputError surfaces as a structured tool-call error.\n const sessionKey = typeof args.sessionKey === \"string\" ? args.sessionKey : \"\";\n const rawCtx = args.codingContext;\n let codingContext: {\n projectId: string;\n branch: string | null;\n rootPath: string;\n defaultBranch: string | null;\n } | null = null;\n if (rawCtx !== null) {\n if (typeof rawCtx !== \"object\" || rawCtx === undefined) {\n throw new EngramAccessInputError(\"codingContext must be an object or null\");\n }\n const obj = rawCtx as Record<string, unknown>;\n const projectId = typeof obj.projectId === \"string\" ? obj.projectId : \"\";\n const rootPath = typeof obj.rootPath === \"string\" ? obj.rootPath : \"\";\n const branch = obj.branch === null\n ? null\n : typeof obj.branch === \"string\" ? obj.branch : undefined;\n const defaultBranch = obj.defaultBranch === null\n ? null\n : typeof obj.defaultBranch === \"string\" ? obj.defaultBranch : undefined;\n if (branch === undefined) {\n throw new EngramAccessInputError(\"codingContext.branch must be a string or null\");\n }\n if (defaultBranch === undefined) {\n throw new EngramAccessInputError(\"codingContext.defaultBranch must be a string or null\");\n }\n codingContext = { projectId, branch, rootPath, defaultBranch };\n }\n this.service.setCodingContext({ sessionKey, codingContext });\n return { ok: true };\n }\n case \"engram.recall_tier_explain\":\n return this.service.recallTierExplain(\n typeof args.sessionKey === \"string\" && args.sessionKey.length > 0\n ? args.sessionKey\n : undefined,\n typeof args.namespace === \"string\" && args.namespace.length > 0\n ? args.namespace\n : undefined,\n effectivePrincipal,\n );\n case \"engram.recall_xray\": {\n // `recallXray` throws on empty query / invalid budget; surface\n // those as MCP errors with a listed-options message rather\n // than silently returning `snapshotFound: false` (CLAUDE.md\n // rule 51). Namespace scope is enforced inside the service\n // via `canReadNamespace`.\n const query = typeof args.query === \"string\" ? args.query : \"\";\n const sessionKey =\n typeof args.sessionKey === \"string\" && args.sessionKey.length > 0\n ? args.sessionKey\n : undefined;\n const namespace =\n typeof args.namespace === \"string\" && args.namespace.length > 0\n ? args.namespace\n : undefined;\n // `budget` may arrive as a JSON number or a string ('4096')\n // from loosely-typed MCP clients; coerce + validate here so\n // the service sees a number. Reject booleans, objects, and\n // other non-string-non-number inputs explicitly — `Number()`\n // otherwise coerces `true` to `1`, which would silently force\n // an extremely small recall budget (CLAUDE.md rule 51).\n let budget: number | undefined;\n if (args.budget !== undefined && args.budget !== null) {\n if (typeof args.budget !== \"number\" && typeof args.budget !== \"string\") {\n throw new Error(\n `engram.recall_xray: budget expects a positive integer; got ${JSON.stringify(args.budget)}`,\n );\n }\n const parsed =\n typeof args.budget === \"number\"\n ? args.budget\n : Number(args.budget);\n if (\n !Number.isFinite(parsed)\n || parsed <= 0\n || !Number.isInteger(parsed)\n ) {\n throw new Error(\n `engram.recall_xray: budget expects a positive integer; got ${JSON.stringify(args.budget)}`,\n );\n }\n budget = parsed;\n }\n return this.service.recallXray({\n query,\n sessionKey,\n namespace,\n budget,\n authenticatedPrincipal: effectivePrincipal,\n });\n }\n case \"engram.day_summary\":\n return this.service.daySummary({\n memories: typeof args.memories === \"string\" ? args.memories : \"\",\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n });\n case \"engram.memory_governance_run\":\n return this.service.governanceRun({\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n mode: args.mode === \"apply\" ? \"apply\" : \"shadow\",\n recentDays: typeof args.recentDays === \"number\" && Number.isFinite(args.recentDays) ? args.recentDays : undefined,\n maxMemories: typeof args.maxMemories === \"number\" && Number.isFinite(args.maxMemories) ? args.maxMemories : undefined,\n batchSize: typeof args.batchSize === \"number\" && Number.isFinite(args.batchSize) ? args.batchSize : undefined,\n authenticatedPrincipal: effectivePrincipal,\n }, effectivePrincipal);\n case \"engram.procedure_mining_run\":\n return this.service.procedureMiningRun(\n {\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n authenticatedPrincipal: effectivePrincipal,\n },\n effectivePrincipal,\n );\n case \"remnic.procedural_stats\":\n case \"engram.procedural_stats\":\n return this.service.procedureStats(\n {\n namespace:\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n },\n effectivePrincipal,\n );\n case \"engram.memory_get\":\n return this.service.memoryGet(\n typeof args.memoryId === \"string\" ? args.memoryId : \"\",\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n effectivePrincipal,\n );\n case \"engram.memory_timeline\": {\n const limit = typeof args.limit === \"number\" && Number.isFinite(args.limit) ? args.limit : 200;\n return this.service.memoryTimeline(\n typeof args.memoryId === \"string\" ? args.memoryId : \"\",\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n limit,\n effectivePrincipal,\n );\n }\n case \"engram.memory_store\":\n return this.service.memoryStore({\n schemaVersion: typeof args.schemaVersion === \"number\" ? args.schemaVersion : undefined,\n idempotencyKey: typeof args.idempotencyKey === \"string\" ? args.idempotencyKey : undefined,\n dryRun: args.dryRun === true,\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n authenticatedPrincipal: effectivePrincipal,\n content: typeof args.content === \"string\" ? args.content : \"\",\n category: typeof args.category === \"string\" ? args.category : undefined,\n confidence: typeof args.confidence === \"number\" ? args.confidence : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n tags: Array.isArray(args.tags) ? args.tags.filter((tag): tag is string => typeof tag === \"string\") : undefined,\n entityRef: typeof args.entityRef === \"string\" ? args.entityRef : undefined,\n ttl: typeof args.ttl === \"string\" ? args.ttl : undefined,\n sourceReason: typeof args.sourceReason === \"string\" ? args.sourceReason : undefined,\n });\n case \"engram.suggestion_submit\":\n return this.service.suggestionSubmit({\n schemaVersion: typeof args.schemaVersion === \"number\" ? args.schemaVersion : undefined,\n idempotencyKey: typeof args.idempotencyKey === \"string\" ? args.idempotencyKey : undefined,\n dryRun: args.dryRun === true,\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n authenticatedPrincipal: effectivePrincipal,\n content: typeof args.content === \"string\" ? args.content : \"\",\n category: typeof args.category === \"string\" ? args.category : undefined,\n confidence: typeof args.confidence === \"number\" ? args.confidence : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n tags: Array.isArray(args.tags) ? args.tags.filter((tag): tag is string => typeof tag === \"string\") : undefined,\n entityRef: typeof args.entityRef === \"string\" ? args.entityRef : undefined,\n ttl: typeof args.ttl === \"string\" ? args.ttl : undefined,\n sourceReason: typeof args.sourceReason === \"string\" ? args.sourceReason : undefined,\n });\n case \"engram.entity_get\":\n return this.service.entityGet(\n typeof args.name === \"string\" ? args.name : \"\",\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n );\n case \"engram.review_queue_list\":\n return this.service.reviewQueue(\n typeof args.runId === \"string\" ? args.runId : undefined,\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n effectivePrincipal,\n );\n case \"engram.observe\":\n return this.service.observe({\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : \"\",\n messages: Array.isArray(args.messages) ? args.messages : [],\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n authenticatedPrincipal: effectivePrincipal,\n skipExtraction: args.skipExtraction === true,\n });\n case \"engram.lcm_search\":\n return this.service.lcmSearch({\n query: typeof args.query === \"string\" ? args.query : \"\",\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n limit: typeof args.limit === \"number\" && Number.isFinite(args.limit) ? args.limit : undefined,\n authenticatedPrincipal: effectivePrincipal,\n });\n // ── Continuity / Identity tools ───────────────────────────────────\n case \"engram.continuity_audit_generate\":\n return this.service.continuityAuditGenerate({\n period: args.period === \"monthly\" ? \"monthly\" : args.period === \"weekly\" ? \"weekly\" : undefined,\n key: typeof args.key === \"string\" ? args.key : undefined,\n });\n case \"engram.continuity_incident_open\":\n return this.service.continuityIncidentOpen({\n symptom: typeof args.symptom === \"string\" ? args.symptom : \"\",\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n triggerWindow: typeof args.triggerWindow === \"string\" ? args.triggerWindow : undefined,\n suspectedCause: typeof args.suspectedCause === \"string\" ? args.suspectedCause : undefined,\n });\n case \"engram.continuity_incident_close\":\n return this.service.continuityIncidentClose({\n id: typeof args.id === \"string\" ? args.id : \"\",\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n fixApplied: typeof args.fixApplied === \"string\" ? args.fixApplied : \"\",\n verificationResult: typeof args.verificationResult === \"string\" ? args.verificationResult : \"\",\n preventiveRule: typeof args.preventiveRule === \"string\" ? args.preventiveRule : undefined,\n });\n case \"engram.continuity_incident_list\":\n return this.service.continuityIncidentList({\n state: args.state === \"closed\" ? \"closed\" : args.state === \"all\" ? \"all\" : args.state === \"open\" ? \"open\" : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n limit: typeof args.limit === \"number\" ? args.limit : undefined,\n });\n case \"engram.continuity_loop_add_or_update\":\n return this.service.continuityLoopAddOrUpdate({\n id: typeof args.id === \"string\" ? args.id : \"\",\n cadence: (args.cadence as \"daily\" | \"weekly\" | \"monthly\" | \"quarterly\") ?? \"weekly\",\n purpose: typeof args.purpose === \"string\" ? args.purpose : \"\",\n status: (args.status as \"active\" | \"paused\" | \"retired\") ?? \"active\",\n killCondition: typeof args.killCondition === \"string\" ? args.killCondition : \"\",\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n lastReviewed: typeof args.lastReviewed === \"string\" ? args.lastReviewed : undefined,\n notes: typeof args.notes === \"string\" ? args.notes : undefined,\n });\n case \"engram.continuity_loop_review\":\n return this.service.continuityLoopReview({\n id: typeof args.id === \"string\" ? args.id : \"\",\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n status: args.status === \"active\" || args.status === \"paused\" || args.status === \"retired\" ? args.status : undefined,\n notes: typeof args.notes === \"string\" ? args.notes : undefined,\n reviewedAt: typeof args.reviewedAt === \"string\" ? args.reviewedAt : undefined,\n });\n case \"engram.identity_anchor_get\":\n return this.service.identityAnchorGet({\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n });\n case \"engram.identity_anchor_update\":\n return this.service.identityAnchorUpdate({\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n identityTraits: typeof args.identityTraits === \"string\" ? args.identityTraits : undefined,\n communicationPreferences: typeof args.communicationPreferences === \"string\" ? args.communicationPreferences : undefined,\n operatingPrinciples: typeof args.operatingPrinciples === \"string\" ? args.operatingPrinciples : undefined,\n continuityNotes: typeof args.continuityNotes === \"string\" ? args.continuityNotes : undefined,\n });\n case \"engram.memory_identity\":\n return this.service.memoryIdentity({\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n });\n // ── Work Layer tools ──────────────────────────────────────────────\n case \"engram.work_task\":\n return this.service.workTask({\n action: (args.action as any) ?? \"list\",\n id: typeof args.id === \"string\" ? args.id : undefined,\n title: typeof args.title === \"string\" ? args.title : undefined,\n description: typeof args.description === \"string\" ? args.description : undefined,\n status: typeof args.status === \"string\" ? args.status : undefined,\n priority: typeof args.priority === \"string\" ? args.priority : undefined,\n owner: typeof args.owner === \"string\" ? args.owner : undefined,\n assignee: typeof args.assignee === \"string\" ? args.assignee : undefined,\n projectId: typeof args.projectId === \"string\" ? args.projectId : undefined,\n tags: Array.isArray(args.tags) ? args.tags.filter((x: unknown): x is string => typeof x === \"string\") : undefined,\n dueAt: typeof args.dueAt === \"string\" ? args.dueAt : undefined,\n });\n case \"engram.work_project\":\n return this.service.workProject({\n action: (args.action as any) ?? \"list\",\n id: typeof args.id === \"string\" ? args.id : undefined,\n name: typeof args.name === \"string\" ? args.name : undefined,\n description: typeof args.description === \"string\" ? args.description : undefined,\n status: typeof args.status === \"string\" ? args.status : undefined,\n owner: typeof args.owner === \"string\" ? args.owner : undefined,\n tags: Array.isArray(args.tags) ? args.tags.filter((x: unknown): x is string => typeof x === \"string\") : undefined,\n taskId: typeof args.taskId === \"string\" ? args.taskId : undefined,\n projectId: typeof args.projectId === \"string\" ? args.projectId : undefined,\n });\n case \"engram.work_board\":\n return this.service.workBoard({\n action: (args.action as any) ?? \"export_markdown\",\n projectId: typeof args.projectId === \"string\" ? args.projectId : undefined,\n snapshotJson: typeof args.snapshotJson === \"string\" ? args.snapshotJson : undefined,\n linkToMemory: args.linkToMemory === true,\n });\n // ── Shared Context / Compounding tools ─────────────────────────\n case \"engram.shared_context_write_output\":\n return this.service.sharedContextWriteOutput({\n agentId: typeof args.agentId === \"string\" ? args.agentId : \"\",\n title: typeof args.title === \"string\" ? args.title : \"\",\n content: typeof args.content === \"string\" ? args.content : \"\",\n });\n case \"engram.shared_feedback_record\":\n return this.service.sharedFeedbackRecord({\n agent: typeof args.agent === \"string\" ? args.agent : \"\",\n decision: (args.decision as any) ?? \"approved\",\n reason: typeof args.reason === \"string\" ? args.reason : \"\",\n date: typeof args.date === \"string\" ? args.date : undefined,\n learning: typeof args.learning === \"string\" ? args.learning : undefined,\n outcome: typeof args.outcome === \"string\" ? args.outcome : undefined,\n severity: args.severity === \"low\" || args.severity === \"medium\" || args.severity === \"high\" ? args.severity : undefined,\n confidence: typeof args.confidence === \"number\" ? args.confidence : undefined,\n workflow: typeof args.workflow === \"string\" ? args.workflow : undefined,\n tags: Array.isArray(args.tags) ? args.tags.filter((x: unknown): x is string => typeof x === \"string\") : undefined,\n evidenceWindowStart: typeof args.evidenceWindowStart === \"string\" ? args.evidenceWindowStart : undefined,\n evidenceWindowEnd: typeof args.evidenceWindowEnd === \"string\" ? args.evidenceWindowEnd : undefined,\n refs: Array.isArray(args.refs) ? args.refs.filter((x: unknown): x is string => typeof x === \"string\") : undefined,\n });\n case \"engram.shared_priorities_append\":\n return this.service.sharedPrioritiesAppend({\n agentId: typeof args.agentId === \"string\" ? args.agentId : \"\",\n text: typeof args.text === \"string\" ? args.text : \"\",\n });\n case \"engram.shared_context_cross_signals_run\":\n return this.service.sharedContextCrossSignalsRun({\n date: typeof args.date === \"string\" ? args.date : undefined,\n });\n case \"engram.shared_context_curate_daily\":\n return this.service.sharedContextCurateDaily({\n date: typeof args.date === \"string\" ? args.date : undefined,\n });\n case \"engram.compounding_weekly_synthesize\":\n return this.service.compoundingWeeklySynthesize({\n weekId: typeof args.weekId === \"string\" ? args.weekId : undefined,\n });\n case \"engram.compounding_promote_candidate\":\n return this.service.compoundingPromoteCandidate({\n weekId: typeof args.weekId === \"string\" ? args.weekId : \"\",\n candidateId: typeof args.candidateId === \"string\" ? args.candidateId : \"\",\n dryRun: args.dryRun === true,\n });\n // ── Compression Guidelines tools ───────────────────────────────────\n case \"engram.compression_guidelines_optimize\":\n return this.service.compressionGuidelinesOptimize({\n dryRun: args.dryRun === true,\n eventLimit: typeof args.eventLimit === \"number\" ? args.eventLimit : undefined,\n });\n case \"engram.compression_guidelines_activate\":\n return this.service.compressionGuidelinesActivate({\n expectedContentHash: typeof args.expectedContentHash === \"string\" ? args.expectedContentHash : undefined,\n expectedGuidelineVersion: typeof args.expectedGuidelineVersion === \"number\" ? args.expectedGuidelineVersion : undefined,\n });\n // ── Memory search & debug tools ──────────────────────────────────\n case \"engram.memory_search\":\n return this.service.memorySearch({\n query: typeof args.query === \"string\" ? args.query : \"\",\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n maxResults: typeof args.maxResults === \"number\" && Number.isFinite(args.maxResults) ? args.maxResults : undefined,\n collection: typeof args.collection === \"string\" ? args.collection : undefined,\n principal: effectivePrincipal,\n });\n case \"engram.memory_profile\":\n return this.service.memoryProfile(\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n effectivePrincipal,\n );\n case \"engram.memory_entities_list\":\n return this.service.memoryEntitiesList(\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n effectivePrincipal,\n );\n case \"engram.memory_questions\":\n return this.service.memoryQuestions(\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n effectivePrincipal,\n );\n case \"engram.memory_last_recall\":\n return this.service.lastRecallSnapshot(\n typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n );\n case \"engram.memory_intent_debug\":\n return this.service.intentDebug(\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n );\n case \"engram.memory_qmd_debug\":\n return this.service.qmdDebug(\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n );\n case \"engram.memory_graph_explain\":\n return this.service.graphExplainLastRecall(\n typeof args.namespace === \"string\" ? args.namespace : undefined,\n );\n case \"engram.memory_feedback\":\n return this.service.memoryFeedback({\n memoryId: typeof args.memoryId === \"string\" ? args.memoryId : \"\",\n vote: args.vote === \"down\" ? \"down\" : \"up\",\n note: typeof args.note === \"string\" ? args.note : undefined,\n });\n case \"engram.memory_promote\":\n return this.service.memoryPromote({\n memoryId: typeof args.memoryId === \"string\" ? args.memoryId : \"\",\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n });\n case \"engram.memory_outcome\": {\n // Validate `outcome` up front — silently defaulting unknown values\n // to \"success\" or \"failure\" would poison the counters a downstream\n // recall filter (PR 4) will trust.\n const outcome = args.outcome;\n if (outcome !== \"success\" && outcome !== \"failure\") {\n throw new Error(\n `engram.memory_outcome: outcome must be \"success\" or \"failure\"; got ${JSON.stringify(outcome)}`,\n );\n }\n return this.service.memoryOutcome({\n memoryId: typeof args.memoryId === \"string\" ? args.memoryId : \"\",\n outcome,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : undefined,\n timestamp: typeof args.timestamp === \"string\" ? args.timestamp : undefined,\n });\n }\n case \"engram.context_checkpoint\":\n return this.service.contextCheckpoint({\n sessionKey: typeof args.sessionKey === \"string\" ? args.sessionKey : \"\",\n context: typeof args.context === \"string\" ? args.context : \"\",\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n principal: effectivePrincipal,\n });\n // ── Daily Context Briefing (#370) ───────────────────────────────────\n case \"engram.briefing\": {\n // Validate the format value upfront — unsupported values (e.g. \"xml\")\n // must be rejected with a descriptive error rather than silently\n // falling back to the default format.\n const rawFormat = typeof args.format === \"string\" ? args.format : undefined;\n const formatErr = validateBriefingFormat(rawFormat);\n if (formatErr) throw new Error(formatErr);\n return this.service.briefing({\n since: typeof args.since === \"string\" ? args.since : undefined,\n focus: typeof args.focus === \"string\" ? args.focus : undefined,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n format: rawFormat as \"json\" | \"markdown\" | undefined,\n maxFollowups:\n typeof args.maxFollowups === \"number\" ? args.maxFollowups : undefined,\n principal: effectivePrincipal,\n });\n }\n // ── Contradiction Review (issue #520) ──────────────────────────────────\n case \"engram.review_list\":\n case \"remnic.review_list\": {\n const { listPairs } = await import(\"./contradiction/contradiction-review.js\");\n const VALID_REVIEW_FILTERS = new Set([\"all\", \"unresolved\", \"contradicts\", \"independent\", \"duplicates\", \"needs-user\"]);\n const rawFilter = typeof args.filter === \"string\" ? args.filter : \"unresolved\";\n if (!VALID_REVIEW_FILTERS.has(rawFilter)) {\n throw new Error(`Invalid filter '${rawFilter}'. Valid: ${[...VALID_REVIEW_FILTERS].join(\", \")}`);\n }\n const filter = rawFilter as \"all\" | \"unresolved\" | \"contradicts\" | \"independent\" | \"duplicates\" | \"needs-user\";\n const ns = typeof args.namespace === \"string\" ? args.namespace : undefined;\n const limit = typeof args.limit === \"number\" ? args.limit : 50;\n return listPairs(this.service.memoryDir, { filter, namespace: ns, limit });\n }\n case \"engram.review_resolve\":\n case \"remnic.review_resolve\": {\n const pairId = typeof args.pairId === \"string\" ? args.pairId : \"\";\n const verb = typeof args.verb === \"string\" ? args.verb : \"\";\n if (!pairId) throw new Error(\"pairId is required\");\n if (!verb) throw new Error(\"verb is required\");\n const { isValidResolutionVerb } = await import(\"./contradiction/resolution.js\");\n if (!isValidResolutionVerb(verb)) throw new Error(`Invalid verb: ${verb}. Must be one of: keep-a, keep-b, merge, both-valid, needs-more-context`);\n const { executeResolution } = await import(\"./contradiction/resolution.js\");\n return executeResolution(this.service.memoryDir, this.service.storageRef, pairId, verb);\n }\n case \"engram.contradiction_scan_run\":\n case \"remnic.contradiction_scan_run\": {\n const { runContradictionScan } = await import(\"./contradiction/contradiction-scan.js\");\n return runContradictionScan({\n storage: this.service.storageRef,\n config: this.service.configRef,\n memoryDir: this.service.memoryDir,\n embeddingLookupFactory: this.service.embeddingLookupFactoryRef,\n localLlm: this.service.localLlmRef,\n fallbackLlm: this.service.fallbackLlmRef,\n namespace: typeof args.namespace === \"string\" ? args.namespace : undefined,\n });\n }\n default:\n throw new Error(`unknown tool: ${name}`);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AACA,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAsB3B,IAAM,uBAAuB;AAC7B,IAAM,oBAAoB;AAC1B,IAAM,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UAC1B,WAAW,OAAO,KAAK,cAAc,WAAW,KAAK,YAAY;AAAA,QACnE,CAAC;AAAA,MACH;AAAA,MACA;AACE,cAAM,IAAI,MAAM,iBAAiB,IAAI,EAAE;AAAA,IAC3C;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// src/runtime/child-process.ts
|
|
2
2
|
import { createRequire } from "module";
|
|
3
3
|
var require2 = createRequire(import.meta.url);
|
|
4
|
+
var PROCESS_MODULE_NAME = `node:${"child"}_${"process"}`;
|
|
4
5
|
function loadModule() {
|
|
5
|
-
return require2(
|
|
6
|
+
return require2(PROCESS_MODULE_NAME);
|
|
6
7
|
}
|
|
7
8
|
function launchProcess(command, args, options) {
|
|
8
9
|
const moduleApi = loadModule();
|
|
@@ -19,4 +20,4 @@ export {
|
|
|
19
20
|
launchProcess,
|
|
20
21
|
launchProcessSync
|
|
21
22
|
};
|
|
22
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-OR64ZGRZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/child-process.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\nconst require = createRequire(import.meta.url);\nconst PROCESS_MODULE_NAME = `node:${\"child\"}_${\"process\"}`;\n\ntype ProcessModule = Record<string, unknown>;\ntype ProcessOptions = Record<string, unknown>;\ntype ProcessStream = {\n destroyed?: boolean;\n destroy: () => void;\n end: () => void;\n on: (event: string, listener: (...args: any[]) => void) => ProcessStream;\n once: (event: string, listener: (...args: any[]) => void) => ProcessStream;\n setEncoding: (encoding: BufferEncoding) => void;\n write: (chunk: string | Buffer, callback?: (error?: Error | null) => void) => boolean;\n};\ntype ProcessResult = {\n status: number | null;\n signal?: NodeJS.Signals | null;\n error?: Error;\n stdout?: string;\n stderr?: string;\n};\n\nfunction loadModule(): ProcessModule {\n return require(PROCESS_MODULE_NAME) as ProcessModule;\n}\n\nexport type CommandChildProcess = {\n exitCode?: number | null;\n killed?: boolean;\n pid?: number;\n stderr?: ProcessStream | null;\n stdin?: ProcessStream | null;\n stdout?: ProcessStream | null;\n kill: (signal?: NodeJS.Signals | number) => boolean;\n on: (event: string, listener: (...args: any[]) => void) => CommandChildProcess;\n once: (event: string, listener: (...args: any[]) => void) => CommandChildProcess;\n};\n\nexport function launchProcess(\n command: string,\n args: string[],\n options?: ProcessOptions,\n): CommandChildProcess {\n const moduleApi = loadModule();\n const launch = moduleApi[\"spawn\"] as (\n command: string,\n args?: readonly string[],\n options?: ProcessOptions,\n ) => CommandChildProcess;\n return launch(command, args, options);\n}\n\nexport function launchProcessSync(\n command: string,\n args: string[],\n options: ProcessOptions,\n): ProcessResult {\n const moduleApi = loadModule();\n const launchSync = moduleApi[\"spawnSync\"] as (\n command: string,\n args: readonly string[],\n options: ProcessOptions,\n ) => ProcessResult;\n return launchSync(command, args, options);\n}\n"],"mappings":";AAAA,SAAS,qBAAqB;AAE9B,IAAMA,WAAU,cAAc,YAAY,GAAG;AAC7C,IAAM,sBAAsB,QAAQ,OAAO,IAAI,SAAS;AAqBxD,SAAS,aAA4B;AACnC,SAAOA,SAAQ,mBAAmB;AACpC;AAcO,SAAS,cACd,SACA,MACA,SACqB;AACrB,QAAM,YAAY,WAAW;AAC7B,QAAM,SAAS,UAAU,OAAO;AAKhC,SAAO,OAAO,SAAS,MAAM,OAAO;AACtC;AAEO,SAAS,kBACd,SACA,MACA,SACe;AACf,QAAM,YAAY,WAAW;AAC7B,QAAM,aAAa,UAAU,WAAW;AAKxC,SAAO,WAAW,SAAS,MAAM,OAAO;AAC1C;","names":["require"]}
|