@remnic/core 9.3.723 → 9.3.724
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-boundary.d.ts +6 -11
- package/dist/access-boundary.js +9 -9
- package/dist/access-cli.js +29 -23
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +5 -5
- package/dist/access-http.js +19 -14
- package/dist/access-mcp.d.ts +5 -5
- package/dist/access-mcp.js +18 -13
- package/dist/access-operations-batch.js +16 -10
- package/dist/access-operations.d.ts +5 -5
- package/dist/access-operations.js +17 -11
- package/dist/{access-service-Dj3I-VBS.d.ts → access-service-B2PlPtxh.d.ts} +3 -3
- package/dist/access-service.d.ts +5 -5
- package/dist/access-service.js +8 -8
- package/dist/access-surface-catalog.d.ts +5 -5
- package/dist/access-surface-catalog.js +82 -82
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-recall.d.ts +1 -1
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +4 -4
- package/dist/briefing.d.ts +1 -1
- package/dist/briefing.js +3 -3
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer.d.ts +1 -1
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +1 -1
- package/dist/{catalog-F-OEVbRQ.d.ts → catalog-CzUb-GyD.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +4 -4
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/{chunk-EVPNWN7Z.js → chunk-4R3CGCI5.js} +2 -2
- package/dist/{chunk-UO5ZHIIH.js → chunk-4WZ3J7M6.js} +2 -2
- package/dist/{chunk-PD42EYQN.js → chunk-5OPYYPJN.js} +2 -2
- package/dist/{chunk-EEJMD2L2.js → chunk-6CWGS2LY.js} +2 -2
- package/dist/{chunk-7CTNUVHZ.js → chunk-6SQQOJ4U.js} +2 -2
- package/dist/{chunk-ILFSEIRT.js → chunk-7AG54AF3.js} +1 -1
- package/dist/{chunk-ILFSEIRT.js.map → chunk-7AG54AF3.js.map} +1 -1
- package/dist/{chunk-UIXXE6NI.js → chunk-C6BWLYW5.js} +24 -15
- package/dist/chunk-C6BWLYW5.js.map +1 -0
- package/dist/{chunk-A5XNBK2D.js → chunk-DF3I6JGP.js} +6 -6
- package/dist/{chunk-GJSL4WG2.js → chunk-F3XZN24Z.js} +2 -2
- package/dist/{chunk-J3JPB7ZI.js → chunk-FACTVMXQ.js} +2 -2
- package/dist/{chunk-B7WISIAJ.js → chunk-FN6QP7JQ.js} +154 -1067
- package/dist/chunk-FN6QP7JQ.js.map +1 -0
- package/dist/{chunk-EBDA5TYA.js → chunk-FXCIOLRB.js} +2 -2
- package/dist/{chunk-TXQCG6SE.js → chunk-H7HUQIY7.js} +3 -3
- package/dist/{chunk-QD6QP5P6.js → chunk-I2HL5M6T.js} +17 -17
- package/dist/{chunk-M7R5R6OJ.js → chunk-IAIPNEHD.js} +20 -2
- package/dist/{chunk-M7R5R6OJ.js.map → chunk-IAIPNEHD.js.map} +1 -1
- package/dist/{chunk-Z4RU5VPM.js → chunk-J334N6QV.js} +2 -2
- package/dist/{chunk-NXRUUDUF.js → chunk-JJJCVCCQ.js} +2 -2
- package/dist/{chunk-GDUOCHCD.js → chunk-KGZF2VO3.js} +10 -10
- package/dist/{chunk-LA3HZKES.js → chunk-KLFYKC3K.js} +448 -49
- package/dist/chunk-KLFYKC3K.js.map +1 -0
- package/dist/{chunk-LLUGAZ3B.js → chunk-NT36GU6X.js} +30 -4
- package/dist/chunk-NT36GU6X.js.map +1 -0
- package/dist/{chunk-OHTOPFRF.js → chunk-SC2YAWRF.js} +2 -2
- package/dist/{chunk-YEE5KJQQ.js → chunk-T55EGZSJ.js} +2 -2
- package/dist/{chunk-N77ELJ2D.js → chunk-TT5U3UDO.js} +4 -4
- package/dist/{chunk-6FAMMBQ3.js → chunk-UBHVAGO7.js} +2 -2
- package/dist/chunk-VI5SGGXB.js +420 -0
- package/dist/chunk-VI5SGGXB.js.map +1 -0
- package/dist/{chunk-EDOQM4E4.js → chunk-WAFDHKES.js} +2 -2
- package/dist/{chunk-EXUCUPV2.js → chunk-WM7DNKBD.js} +2 -2
- package/dist/{dreams-ledger-3WSCI5V4.js → chunk-YF6FMLBT.js} +5 -6
- package/dist/{dreams-ledger-3WSCI5V4.js.map → chunk-YF6FMLBT.js.map} +1 -1
- package/dist/{chunk-WQYSDPMA.js → chunk-YQMPUYHE.js} +2 -2
- package/dist/{chunk-5O42UKXI.js → chunk-YUYPWJD3.js} +2 -2
- package/dist/{chunk-VCLGUIFM.js → chunk-Z3FGC3QE.js} +2 -2
- package/dist/{chunk-A7TJZLPK.js → chunk-ZK2L72VN.js} +2 -2
- package/dist/{chunk-BXEOHV7K.js → chunk-ZOHMPFOB.js} +3 -3
- package/dist/{graph-edge-decay-QPRJQ7DL.js → chunk-ZQNCHPTZ.js} +4 -5
- package/dist/{graph-edge-decay-QPRJQ7DL.js.map → chunk-ZQNCHPTZ.js.map} +1 -1
- package/dist/{cli-P_GaYcCY.d.ts → cli-IOlDHSBT.d.ts} +3 -3
- package/dist/cli.d.ts +6 -6
- package/dist/cli.js +31 -26
- package/dist/compounding/engine.d.ts +1 -1
- package/dist/compounding/engine.js +3 -3
- package/dist/compounding/preference-consolidator.d.ts +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +3 -3
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +3 -3
- package/dist/consolidation-provenance-check.d.ts +1 -1
- package/dist/consolidation-undo.d.ts +1 -1
- package/dist/contradiction/index.d.ts +1 -1
- package/dist/conversation-index/backend.d.ts +1 -1
- package/dist/conversation-index/chunker.d.ts +1 -1
- package/dist/conversation-index/faiss-adapter.d.ts +1 -1
- package/dist/conversation-index/indexer.d.ts +1 -1
- package/dist/conversation-index/search.d.ts +1 -1
- package/dist/day-summary.d.ts +1 -1
- package/dist/delinearize.d.ts +1 -1
- package/dist/direct-answer-wiring.d.ts +1 -1
- package/dist/direct-answer.d.ts +1 -1
- package/dist/dreams-ledger-6UODQOX6.js +22 -0
- package/dist/dreams-ledger-6UODQOX6.js.map +1 -0
- package/dist/embedding-fallback.d.ts +1 -1
- package/dist/enrichment/index.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +1 -1
- package/dist/entity-retrieval.js +3 -3
- package/dist/entity-schema.d.ts +1 -1
- package/dist/event-time.d.ts +33 -1
- package/dist/event-time.js +3 -1
- package/dist/explicit-capture.d.ts +4 -4
- package/dist/extraction-faithfulness.d.ts +1 -1
- package/dist/extraction-judge-telemetry.d.ts +1 -1
- package/dist/extraction-judge-training.d.ts +1 -1
- package/dist/extraction-judge.d.ts +1 -1
- package/dist/extraction.d.ts +1 -1
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/graph-dashboard-diff.d.ts +1 -1
- package/dist/graph-dashboard-key.d.ts +1 -1
- package/dist/graph-dashboard-parser.d.ts +1 -1
- package/dist/graph-edge-decay-RXUCJIN4.js +22 -0
- package/dist/graph-edge-decay-RXUCJIN4.js.map +1 -0
- package/dist/graph-edge-reinforcement.d.ts +1 -1
- package/dist/graph-snapshot.d.ts +1 -1
- package/dist/graph.d.ts +1 -1
- package/dist/identity-continuity.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +58 -56
- package/dist/index.js.map +1 -1
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/tools.d.ts +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/local-llm.d.ts +1 -1
- package/dist/local-model-endpoint.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +3 -3
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
- package/dist/maintenance/rebuild-memory-projection.js +4 -4
- package/dist/mcp-memory-inspector-app.d.ts +5 -5
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-cache.d.ts +1 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
- package/dist/memory-projection-store.d.ts +1 -1
- package/dist/memory-provenance.d.ts +1 -1
- package/dist/memory-worth-outcomes.d.ts +1 -1
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +2 -2
- package/dist/namespaces/migrate.js +4 -4
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/storage.d.ts +2 -2
- package/dist/namespaces/storage.js +3 -3
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +1 -1
- package/dist/operator-toolkit.js +8 -8
- package/dist/orchestration/maintenance.d.ts +2 -2
- package/dist/orchestration/maintenance.js +5 -5
- package/dist/{orchestrator-f5xv19kp.d.ts → orchestrator-C_OMSIMZ.d.ts} +34 -3
- package/dist/orchestrator.d.ts +4 -4
- package/dist/orchestrator.js +17 -17
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/provenance.d.ts +1 -1
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +1 -1
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +1 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-planner-llm.d.ts +1 -1
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-tag-filter.d.ts +1 -1
- package/dist/recall-xray-cli.d.ts +1 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +1 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +1 -1
- package/dist/recall-xray.js +2 -2
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/retrieval-agents.d.ts +1 -1
- package/dist/retrieval-tiers.d.ts +1 -1
- package/dist/routing/engine.d.ts +1 -1
- package/dist/routing/store.d.ts +1 -1
- package/dist/schemas.d.ts +22 -22
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/index.d.ts +1 -1
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/port.d.ts +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/{semantic-consolidation-BQm1e1Pn.d.ts → semantic-consolidation-B8LiYtvx.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +4 -4
- package/dist/semantic-rule-promotion.js +3 -3
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +3 -3
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/shared-context/manager.d.ts +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +2 -2
- package/dist/summarizer.d.ts +1 -1
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/temporal-supersession.d.ts +1 -1
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +1 -1
- package/dist/tier-migration.d.ts +1 -1
- package/dist/tier-routing.d.ts +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/types.d.ts +12 -12
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-DwO1Ot4n.d.ts → types-DmTaqob2.d.ts} +14 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +3 -3
- package/package.json +2 -2
- package/src/access-boundary.ts +36 -2
- package/src/access-http.ts +17 -8
- package/src/access-mcp.ts +149 -1189
- package/src/access-operations-batch.ts +227 -1439
- package/src/access-surface-catalog.test.ts +4 -15
- package/src/access-surface-catalog.ts +82 -82
- package/src/bitemporal-dedup-backfill.test.ts +169 -0
- package/src/event-time.ts +57 -0
- package/src/extraction-eventtime-wiring.test.ts +101 -1
- package/src/orchestrator.ts +238 -43
- package/src/recall/archive-scoring.ts +526 -0
- package/src/types.ts +14 -0
- package/dist/chunk-B7WISIAJ.js.map +0 -1
- package/dist/chunk-EM2LDXJ2.js +0 -1315
- package/dist/chunk-EM2LDXJ2.js.map +0 -1
- package/dist/chunk-LA3HZKES.js.map +0 -1
- package/dist/chunk-LLUGAZ3B.js.map +0 -1
- package/dist/chunk-UIXXE6NI.js.map +0 -1
- /package/dist/{chunk-EVPNWN7Z.js.map → chunk-4R3CGCI5.js.map} +0 -0
- /package/dist/{chunk-UO5ZHIIH.js.map → chunk-4WZ3J7M6.js.map} +0 -0
- /package/dist/{chunk-PD42EYQN.js.map → chunk-5OPYYPJN.js.map} +0 -0
- /package/dist/{chunk-EEJMD2L2.js.map → chunk-6CWGS2LY.js.map} +0 -0
- /package/dist/{chunk-7CTNUVHZ.js.map → chunk-6SQQOJ4U.js.map} +0 -0
- /package/dist/{chunk-A5XNBK2D.js.map → chunk-DF3I6JGP.js.map} +0 -0
- /package/dist/{chunk-GJSL4WG2.js.map → chunk-F3XZN24Z.js.map} +0 -0
- /package/dist/{chunk-J3JPB7ZI.js.map → chunk-FACTVMXQ.js.map} +0 -0
- /package/dist/{chunk-EBDA5TYA.js.map → chunk-FXCIOLRB.js.map} +0 -0
- /package/dist/{chunk-TXQCG6SE.js.map → chunk-H7HUQIY7.js.map} +0 -0
- /package/dist/{chunk-QD6QP5P6.js.map → chunk-I2HL5M6T.js.map} +0 -0
- /package/dist/{chunk-Z4RU5VPM.js.map → chunk-J334N6QV.js.map} +0 -0
- /package/dist/{chunk-NXRUUDUF.js.map → chunk-JJJCVCCQ.js.map} +0 -0
- /package/dist/{chunk-GDUOCHCD.js.map → chunk-KGZF2VO3.js.map} +0 -0
- /package/dist/{chunk-OHTOPFRF.js.map → chunk-SC2YAWRF.js.map} +0 -0
- /package/dist/{chunk-YEE5KJQQ.js.map → chunk-T55EGZSJ.js.map} +0 -0
- /package/dist/{chunk-N77ELJ2D.js.map → chunk-TT5U3UDO.js.map} +0 -0
- /package/dist/{chunk-6FAMMBQ3.js.map → chunk-UBHVAGO7.js.map} +0 -0
- /package/dist/{chunk-EDOQM4E4.js.map → chunk-WAFDHKES.js.map} +0 -0
- /package/dist/{chunk-EXUCUPV2.js.map → chunk-WM7DNKBD.js.map} +0 -0
- /package/dist/{chunk-WQYSDPMA.js.map → chunk-YQMPUYHE.js.map} +0 -0
- /package/dist/{chunk-5O42UKXI.js.map → chunk-YUYPWJD3.js.map} +0 -0
- /package/dist/{chunk-VCLGUIFM.js.map → chunk-Z3FGC3QE.js.map} +0 -0
- /package/dist/{chunk-A7TJZLPK.js.map → chunk-ZK2L72VN.js.map} +0 -0
- /package/dist/{chunk-BXEOHV7K.js.map → chunk-ZOHMPFOB.js.map} +0 -0
|
@@ -1,35 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildCitationGuidance
|
|
3
|
+
} from "./chunk-D24OXEPB.js";
|
|
1
4
|
import {
|
|
2
5
|
REMNIC_CHATGPT_MEMORY_INSPECTOR_MIME_TYPE,
|
|
3
6
|
REMNIC_CHATGPT_MEMORY_INSPECTOR_TOOL,
|
|
4
7
|
REMNIC_CHATGPT_MEMORY_INSPECTOR_WIDGET_HTML,
|
|
5
|
-
REMNIC_CHATGPT_MEMORY_INSPECTOR_WIDGET_URI
|
|
6
|
-
buildChatGptMemoryInspectorActionRequest,
|
|
7
|
-
buildChatGptMemoryInspectorResult
|
|
8
|
+
REMNIC_CHATGPT_MEMORY_INSPECTOR_WIDGET_URI
|
|
8
9
|
} from "./chunk-T4WDJPEZ.js";
|
|
9
|
-
import {
|
|
10
|
-
buildCitationGuidance
|
|
11
|
-
} from "./chunk-D24OXEPB.js";
|
|
12
10
|
import {
|
|
13
11
|
validateRequest
|
|
14
12
|
} from "./chunk-FVZ2ISIX.js";
|
|
15
13
|
import {
|
|
16
14
|
getOperation
|
|
17
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-NT36GU6X.js";
|
|
18
16
|
import {
|
|
19
17
|
EngramAccessInputError
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import {
|
|
22
|
-
projectTagProjectId
|
|
23
|
-
} from "./chunk-J6BH2OBA.js";
|
|
24
|
-
import {
|
|
25
|
-
validateBriefingFormat
|
|
26
|
-
} from "./chunk-UO5ZHIIH.js";
|
|
27
|
-
import {
|
|
28
|
-
resolvePrincipal
|
|
29
|
-
} from "./chunk-UZYLX7M6.js";
|
|
30
|
-
import {
|
|
31
|
-
expandTildePath
|
|
32
|
-
} from "./chunk-EYIEWJNI.js";
|
|
18
|
+
} from "./chunk-KGZF2VO3.js";
|
|
33
19
|
import {
|
|
34
20
|
readEnvVar
|
|
35
21
|
} from "./chunk-JUC24CTX.js";
|
|
@@ -1080,13 +1066,90 @@ var MCP_MIGRATED_OPERATIONS = {
|
|
|
1080
1066
|
"engram.coding_delta": "coding_delta",
|
|
1081
1067
|
// Correction Contract (issue #1580) — one plan/apply pipeline.
|
|
1082
1068
|
"engram.memory_correct_plan": "memory_correct_plan",
|
|
1083
|
-
"engram.memory_correct_apply": "memory_correct_apply"
|
|
1069
|
+
"engram.memory_correct_apply": "memory_correct_apply",
|
|
1070
|
+
// Fully migrated through the strict-schema boundary (#1668).
|
|
1071
|
+
"engram.recall": "recall",
|
|
1072
|
+
"engram.recall_explain": "recall_explain",
|
|
1073
|
+
"engram.set_coding_context": "set_coding_context",
|
|
1074
|
+
"engram.recall_tier_explain": "recall_tier_explain",
|
|
1075
|
+
"engram.recall_xray": "recall_xray",
|
|
1076
|
+
"engram.wearables_status": "wearables_status",
|
|
1077
|
+
"engram.wearables_sync": "wearables_sync",
|
|
1078
|
+
"engram.transcript_day": "transcript_day",
|
|
1079
|
+
"engram.transcript_search": "transcript_search",
|
|
1080
|
+
"engram.transcript_memories": "transcript_memories",
|
|
1081
|
+
"engram.action_confidence": "action_confidence",
|
|
1082
|
+
"engram.chatgpt_memory_inspector": "chatgpt_memory_inspector",
|
|
1083
|
+
"engram.day_summary": "day_summary",
|
|
1084
|
+
"engram.capsule_export": "capsule_export",
|
|
1085
|
+
"engram.capsule_import": "capsule_import",
|
|
1086
|
+
"engram.capsule_list": "capsule_list",
|
|
1087
|
+
"engram.memory_governance_run": "memory_governance_run",
|
|
1088
|
+
"engram.procedure_mining_run": "procedure_mining_run",
|
|
1089
|
+
"engram.pattern_reinforcement_run": "pattern_reinforcement_run",
|
|
1090
|
+
"engram.procedural_stats": "procedural_stats",
|
|
1091
|
+
"engram.memory_timeline": "memory_timeline",
|
|
1092
|
+
"engram.suggestion_submit": "suggestion_submit",
|
|
1093
|
+
"engram.entity_get": "entity_get",
|
|
1094
|
+
"engram.review_queue_list": "review_queue_list",
|
|
1095
|
+
"engram.observe": "observe",
|
|
1096
|
+
"engram.lcm_search": "lcm_search",
|
|
1097
|
+
"engram.lcm_compaction_flush": "lcm_compaction_flush",
|
|
1098
|
+
"engram.lcm_compaction_record": "lcm_compaction_record",
|
|
1099
|
+
"engram.continuity_audit_generate": "continuity_audit_generate",
|
|
1100
|
+
"engram.continuity_incident_open": "continuity_incident_open",
|
|
1101
|
+
"engram.continuity_incident_close": "continuity_incident_close",
|
|
1102
|
+
"engram.continuity_incident_list": "continuity_incident_list",
|
|
1103
|
+
"engram.continuity_loop_add_or_update": "continuity_loop_add_or_update",
|
|
1104
|
+
"engram.continuity_loop_review": "continuity_loop_review",
|
|
1105
|
+
"engram.identity_anchor_get": "identity_anchor_get",
|
|
1106
|
+
"engram.identity_anchor_update": "identity_anchor_update",
|
|
1107
|
+
"engram.memory_identity": "memory_identity",
|
|
1108
|
+
"engram.work_task": "work_task",
|
|
1109
|
+
"engram.work_project": "work_project",
|
|
1110
|
+
"engram.work_board": "work_board",
|
|
1111
|
+
"engram.shared_context_write_output": "shared_context_write_output",
|
|
1112
|
+
"engram.shared_feedback_record": "shared_feedback_record",
|
|
1113
|
+
"engram.shared_priorities_append": "shared_priorities_append",
|
|
1114
|
+
"engram.shared_context_cross_signals_run": "shared_context_cross_signals_run",
|
|
1115
|
+
"engram.shared_context_curate_daily": "shared_context_curate_daily",
|
|
1116
|
+
"engram.compounding_weekly_synthesize": "compounding_weekly_synthesize",
|
|
1117
|
+
"engram.compounding_promote_candidate": "compounding_promote_candidate",
|
|
1118
|
+
"engram.compression_guidelines_optimize": "compression_guidelines_optimize",
|
|
1119
|
+
"engram.compression_guidelines_activate": "compression_guidelines_activate",
|
|
1120
|
+
"engram.memory_profile": "memory_profile",
|
|
1121
|
+
"engram.memory_entities_list": "memory_entities_list",
|
|
1122
|
+
"engram.memory_questions": "memory_questions",
|
|
1123
|
+
"engram.memory_last_recall": "memory_last_recall",
|
|
1124
|
+
"engram.memory_intent_debug": "memory_intent_debug",
|
|
1125
|
+
"engram.memory_qmd_debug": "memory_qmd_debug",
|
|
1126
|
+
"engram.memory_graph_explain": "memory_graph_explain",
|
|
1127
|
+
"engram.graph_snapshot": "graph_snapshot",
|
|
1128
|
+
"engram.memory_feedback": "memory_feedback",
|
|
1129
|
+
"engram.memory_promote": "memory_promote",
|
|
1130
|
+
"engram.memory_outcome": "memory_outcome",
|
|
1131
|
+
"engram.memory_action_apply": "memory_action_apply",
|
|
1132
|
+
"engram.context_checkpoint": "context_checkpoint",
|
|
1133
|
+
"engram.briefing": "briefing",
|
|
1134
|
+
"engram.review_list": "review_list",
|
|
1135
|
+
"engram.review_resolve": "review_resolve",
|
|
1136
|
+
"engram.contradiction_scan_run": "contradiction_scan_run",
|
|
1137
|
+
"engram.memory_summarize_hourly": "memory_summarize_hourly",
|
|
1138
|
+
"engram.conversation_index_update": "conversation_index_update",
|
|
1139
|
+
"engram.profiling_report": "profiling_report",
|
|
1140
|
+
"engram.graph_edge_decay_run": "graph_edge_decay_run",
|
|
1141
|
+
"engram.live_connectors_run": "live_connectors_run",
|
|
1142
|
+
"engram.peer_list": "peer_list",
|
|
1143
|
+
"engram.peer_get": "peer_get",
|
|
1144
|
+
"engram.peer_set": "peer_set",
|
|
1145
|
+
"engram.peer_delete": "peer_delete",
|
|
1146
|
+
"engram.peer_profile_get": "peer_profile_get",
|
|
1147
|
+
"engram.peer_forget": "peer_forget",
|
|
1148
|
+
"engram.console_state": "console_state",
|
|
1149
|
+
"engram.dreams_status": "dreams_status",
|
|
1150
|
+
"engram.dreams_run": "dreams_run",
|
|
1151
|
+
"engram.memory_chat": "chat_message"
|
|
1084
1152
|
};
|
|
1085
|
-
function resolveChatGptInspectorRecallSessionKey(explicitSessionKey, authenticatedPrincipal) {
|
|
1086
|
-
if (explicitSessionKey) return explicitSessionKey;
|
|
1087
|
-
if (!authenticatedPrincipal) return void 0;
|
|
1088
|
-
return `remnic:chatgpt-memory-inspector:${randomUUID2()}`;
|
|
1089
|
-
}
|
|
1090
1153
|
var STRICT_MCP_SCHEMA_KEYS = {
|
|
1091
1154
|
daySummary: [
|
|
1092
1155
|
"memories",
|
|
@@ -1180,24 +1243,6 @@ function parseMcpRequest(schemaName, args) {
|
|
|
1180
1243
|
details.length > 0 ? `${validation.error.error}: ${details}` : validation.error.error
|
|
1181
1244
|
);
|
|
1182
1245
|
}
|
|
1183
|
-
function optionalNonEmptyString(value, label) {
|
|
1184
|
-
if (value === void 0 || value === null || value === "") return void 0;
|
|
1185
|
-
if (typeof value !== "string") {
|
|
1186
|
-
throw new Error(`${label} expects a string; got ${JSON.stringify(value)}`);
|
|
1187
|
-
}
|
|
1188
|
-
return value;
|
|
1189
|
-
}
|
|
1190
|
-
function optionalPositiveInteger(value, label) {
|
|
1191
|
-
if (value === void 0 || value === null || value === "") return void 0;
|
|
1192
|
-
if (typeof value !== "number" && typeof value !== "string") {
|
|
1193
|
-
throw new Error(`${label} expects a positive integer; got ${JSON.stringify(value)}`);
|
|
1194
|
-
}
|
|
1195
|
-
const parsed = typeof value === "number" ? value : Number(value);
|
|
1196
|
-
if (!Number.isFinite(parsed) || parsed <= 0 || !Number.isInteger(parsed)) {
|
|
1197
|
-
throw new Error(`${label} expects a positive integer; got ${JSON.stringify(value)}`);
|
|
1198
|
-
}
|
|
1199
|
-
return parsed;
|
|
1200
|
-
}
|
|
1201
1246
|
function getObjectProperties(value) {
|
|
1202
1247
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
1203
1248
|
}
|
|
@@ -3396,1034 +3441,76 @@ ${body}`;
|
|
|
3396
3441
|
}
|
|
3397
3442
|
async callTool(name, args, effectivePrincipal, mcpSessionId, scope, enforceWriteQuota) {
|
|
3398
3443
|
const migrated = MCP_MIGRATED_OPERATIONS[toLegacyToolName(name)];
|
|
3399
|
-
if (migrated) {
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3444
|
+
if (!migrated) {
|
|
3445
|
+
throw new Error("unknown tool: " + name);
|
|
3446
|
+
}
|
|
3447
|
+
const op = getOperation(migrated);
|
|
3448
|
+
if (!op) {
|
|
3449
|
+
throw new EngramAccessInputError("access-boundary: operation not registered: " + migrated);
|
|
3450
|
+
}
|
|
3451
|
+
let envelope;
|
|
3452
|
+
if (migrated === "memory_store") {
|
|
3453
|
+
envelope = parseMcpRequest("memoryStore", args);
|
|
3454
|
+
} else if (migrated === "suggestion_submit") {
|
|
3455
|
+
envelope = parseMcpRequest("suggestionSubmit", args);
|
|
3456
|
+
} else if (migrated === "action_confidence") {
|
|
3457
|
+
envelope = parseMcpRequest("actionConfidence", args);
|
|
3458
|
+
} else if (migrated === "day_summary") {
|
|
3459
|
+
envelope = parseMcpRequest("daySummary", args);
|
|
3460
|
+
} else if (migrated === "capsule_export") {
|
|
3461
|
+
envelope = parseMcpRequest("capsuleExport", args);
|
|
3462
|
+
} else if (migrated === "capsule_import") {
|
|
3463
|
+
envelope = parseMcpRequest("capsuleImport", args);
|
|
3464
|
+
} else if (migrated === "capsule_list") {
|
|
3465
|
+
envelope = parseMcpRequest("capsuleList", args);
|
|
3466
|
+
} else if (migrated === "observe") {
|
|
3467
|
+
envelope = parseMcpRequest("observe", args);
|
|
3468
|
+
} else if (migrated === "lcm_compaction_flush") {
|
|
3469
|
+
envelope = parseMcpRequest("lcmCompactionFlush", args);
|
|
3470
|
+
} else if (migrated === "lcm_compaction_record") {
|
|
3471
|
+
envelope = parseMcpRequest("lcmCompactionRecord", args);
|
|
3472
|
+
} else if (migrated.startsWith("codegraph_")) {
|
|
3473
|
+
envelope = { ...args, tool: migrated.slice("codegraph_".length) };
|
|
3474
|
+
} else if (migrated === "chat_message") {
|
|
3475
|
+
const message = typeof args.message === "string" ? args.message : "";
|
|
3476
|
+
if (!message) throw new EngramAccessInputError("message is required");
|
|
3477
|
+
const chatSessionId = typeof args.chatSessionId === "string" ? args.chatSessionId : void 0;
|
|
3478
|
+
const chatResult = await processChatMessage({
|
|
3413
3479
|
service: this.service,
|
|
3414
|
-
|
|
3480
|
+
config: this.service.configRef?.chat,
|
|
3481
|
+
memoryDir: this.service.memoryDir,
|
|
3482
|
+
message,
|
|
3483
|
+
...chatSessionId ? { chatSessionId } : {},
|
|
3484
|
+
...effectivePrincipal ? { principal: effectivePrincipal } : {},
|
|
3485
|
+
...scope?.namespace ? { namespace: scope.namespace } : {},
|
|
3486
|
+
...scope?.sessionKey ? { sessionKey: scope.sessionKey } : {}
|
|
3415
3487
|
});
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
case "engram.recall": {
|
|
3420
|
-
let disclosure;
|
|
3421
|
-
if ("disclosure" in args && args.disclosure !== void 0 && args.disclosure !== null) {
|
|
3422
|
-
if (typeof args.disclosure !== "string") {
|
|
3423
|
-
throw new EngramAccessInputError(
|
|
3424
|
-
"disclosure must be a string (one of: chunk, section, raw)"
|
|
3425
|
-
);
|
|
3426
|
-
}
|
|
3427
|
-
disclosure = args.disclosure;
|
|
3428
|
-
}
|
|
3429
|
-
if ("cwd" in args && args.cwd !== void 0 && args.cwd !== null && typeof args.cwd !== "string") {
|
|
3430
|
-
throw new EngramAccessInputError("cwd must be a string");
|
|
3431
|
-
}
|
|
3432
|
-
if ("projectTag" in args && args.projectTag !== void 0 && args.projectTag !== null && typeof args.projectTag !== "string") {
|
|
3433
|
-
throw new EngramAccessInputError("projectTag must be a string");
|
|
3434
|
-
}
|
|
3435
|
-
if ("asOf" in args && args.asOf !== void 0 && args.asOf !== null && typeof args.asOf !== "string") {
|
|
3436
|
-
throw new EngramAccessInputError("asOf must be a string (ISO 8601 timestamp)");
|
|
3437
|
-
}
|
|
3438
|
-
let tags;
|
|
3439
|
-
if ("tags" in args && args.tags !== void 0 && args.tags !== null) {
|
|
3440
|
-
if (!Array.isArray(args.tags) || !args.tags.every((t) => typeof t === "string")) {
|
|
3441
|
-
throw new EngramAccessInputError("tags must be an array of strings");
|
|
3442
|
-
}
|
|
3443
|
-
tags = args.tags;
|
|
3444
|
-
}
|
|
3445
|
-
let tagMatch;
|
|
3446
|
-
if ("tagMatch" in args && args.tagMatch !== void 0 && args.tagMatch !== null) {
|
|
3447
|
-
if (typeof args.tagMatch !== "string" || args.tagMatch !== "any" && args.tagMatch !== "all") {
|
|
3448
|
-
throw new EngramAccessInputError(
|
|
3449
|
-
`tagMatch must be one of: any, all (got: ${String(args.tagMatch)})`
|
|
3450
|
-
);
|
|
3451
|
-
}
|
|
3452
|
-
tagMatch = args.tagMatch;
|
|
3453
|
-
}
|
|
3454
|
-
const response = await this.service.recall({
|
|
3455
|
-
query: typeof args.query === "string" ? args.query : "",
|
|
3456
|
-
sessionKey: typeof args.sessionKey === "string" ? args.sessionKey : void 0,
|
|
3457
|
-
authenticatedPrincipal: effectivePrincipal,
|
|
3458
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3459
|
-
topK: typeof args.topK === "number" && Number.isFinite(args.topK) ? args.topK : void 0,
|
|
3460
|
-
mode: typeof args.mode === "string" ? args.mode : void 0,
|
|
3461
|
-
includeDebug: args.includeDebug === true,
|
|
3462
|
-
disclosure,
|
|
3463
|
-
cwd: typeof args.cwd === "string" ? args.cwd : void 0,
|
|
3464
|
-
projectTag: typeof args.projectTag === "string" ? args.projectTag : void 0,
|
|
3465
|
-
asOf: typeof args.asOf === "string" ? args.asOf : void 0,
|
|
3466
|
-
...tags !== void 0 ? { tags } : {},
|
|
3467
|
-
...tagMatch !== void 0 ? { tagMatch } : {}
|
|
3468
|
-
});
|
|
3469
|
-
if (this.shouldEmitCitations(mcpSessionId)) {
|
|
3470
|
-
const citations = this.buildRecallCitations(response);
|
|
3471
|
-
const guidance = buildCitationGuidance(citations);
|
|
3472
|
-
if (guidance.length > 0) {
|
|
3473
|
-
return {
|
|
3474
|
-
...response,
|
|
3475
|
-
context: response.context + guidance,
|
|
3476
|
-
citations
|
|
3477
|
-
};
|
|
3478
|
-
}
|
|
3479
|
-
}
|
|
3480
|
-
return response;
|
|
3481
|
-
}
|
|
3482
|
-
case "engram.recall_explain":
|
|
3483
|
-
return this.service.recallExplain({
|
|
3484
|
-
sessionKey: typeof args.sessionKey === "string" ? args.sessionKey : void 0,
|
|
3485
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3486
|
-
authenticatedPrincipal: effectivePrincipal
|
|
3487
|
-
});
|
|
3488
|
-
case "engram.set_coding_context": {
|
|
3489
|
-
const sessionKey = typeof args.sessionKey === "string" ? args.sessionKey : "";
|
|
3490
|
-
const hasProjectTag = typeof args.projectTag === "string" && args.projectTag.trim().length > 0;
|
|
3491
|
-
const hasCodingContext = "codingContext" in args;
|
|
3492
|
-
if (!hasCodingContext && hasProjectTag) {
|
|
3493
|
-
const tag = args.projectTag.trim();
|
|
3494
|
-
const projectId = projectTagProjectId(tag);
|
|
3495
|
-
this.service.setCodingContext({
|
|
3496
|
-
sessionKey,
|
|
3497
|
-
codingContext: {
|
|
3498
|
-
projectId,
|
|
3499
|
-
branch: null,
|
|
3500
|
-
rootPath: projectId,
|
|
3501
|
-
defaultBranch: null
|
|
3502
|
-
}
|
|
3503
|
-
});
|
|
3504
|
-
return { ok: true };
|
|
3505
|
-
}
|
|
3506
|
-
if (!hasCodingContext && !hasProjectTag) {
|
|
3507
|
-
throw new EngramAccessInputError(
|
|
3508
|
-
"set_coding_context requires either codingContext or projectTag"
|
|
3509
|
-
);
|
|
3510
|
-
}
|
|
3511
|
-
const rawCtx = args.codingContext;
|
|
3512
|
-
let codingContext = null;
|
|
3513
|
-
if (rawCtx !== null) {
|
|
3514
|
-
if (typeof rawCtx !== "object" || rawCtx === void 0) {
|
|
3515
|
-
throw new EngramAccessInputError("codingContext must be an object or null");
|
|
3516
|
-
}
|
|
3517
|
-
const obj = rawCtx;
|
|
3518
|
-
const projectId = typeof obj.projectId === "string" ? obj.projectId : "";
|
|
3519
|
-
const rootPath = typeof obj.rootPath === "string" ? obj.rootPath : "";
|
|
3520
|
-
const branch = obj.branch === null ? null : typeof obj.branch === "string" ? obj.branch : void 0;
|
|
3521
|
-
const defaultBranch = obj.defaultBranch === null ? null : typeof obj.defaultBranch === "string" ? obj.defaultBranch : void 0;
|
|
3522
|
-
if (branch === void 0) {
|
|
3523
|
-
throw new EngramAccessInputError("codingContext.branch must be a string or null");
|
|
3524
|
-
}
|
|
3525
|
-
if (defaultBranch === void 0) {
|
|
3526
|
-
throw new EngramAccessInputError("codingContext.defaultBranch must be a string or null");
|
|
3527
|
-
}
|
|
3528
|
-
codingContext = { projectId, branch, rootPath, defaultBranch };
|
|
3529
|
-
}
|
|
3530
|
-
this.service.setCodingContext({ sessionKey, codingContext });
|
|
3531
|
-
return { ok: true };
|
|
3532
|
-
}
|
|
3533
|
-
case "engram.recall_tier_explain":
|
|
3534
|
-
return this.service.recallTierExplain(
|
|
3535
|
-
typeof args.sessionKey === "string" && args.sessionKey.length > 0 ? args.sessionKey : void 0,
|
|
3536
|
-
typeof args.namespace === "string" && args.namespace.length > 0 ? args.namespace : void 0,
|
|
3537
|
-
effectivePrincipal
|
|
3538
|
-
);
|
|
3539
|
-
case "engram.recall_xray": {
|
|
3540
|
-
const query = typeof args.query === "string" ? args.query : "";
|
|
3541
|
-
const sessionKey = typeof args.sessionKey === "string" && args.sessionKey.length > 0 ? args.sessionKey : void 0;
|
|
3542
|
-
const namespace = typeof args.namespace === "string" && args.namespace.length > 0 ? args.namespace : void 0;
|
|
3543
|
-
let budget;
|
|
3544
|
-
if (args.budget !== void 0 && args.budget !== null) {
|
|
3545
|
-
if (typeof args.budget !== "number" && typeof args.budget !== "string") {
|
|
3546
|
-
throw new Error(
|
|
3547
|
-
`engram.recall_xray: budget expects a positive integer; got ${JSON.stringify(args.budget)}`
|
|
3548
|
-
);
|
|
3549
|
-
}
|
|
3550
|
-
const parsed = typeof args.budget === "number" ? args.budget : Number(args.budget);
|
|
3551
|
-
if (!Number.isFinite(parsed) || parsed <= 0 || !Number.isInteger(parsed)) {
|
|
3552
|
-
throw new Error(
|
|
3553
|
-
`engram.recall_xray: budget expects a positive integer; got ${JSON.stringify(args.budget)}`
|
|
3554
|
-
);
|
|
3555
|
-
}
|
|
3556
|
-
budget = parsed;
|
|
3557
|
-
}
|
|
3558
|
-
let disclosure;
|
|
3559
|
-
if ("disclosure" in args && args.disclosure !== void 0 && args.disclosure !== null && args.disclosure !== "") {
|
|
3560
|
-
if (typeof args.disclosure !== "string") {
|
|
3561
|
-
throw new Error(
|
|
3562
|
-
"engram.recall_xray: disclosure must be a string (one of: chunk, section, raw)"
|
|
3563
|
-
);
|
|
3564
|
-
}
|
|
3565
|
-
disclosure = args.disclosure;
|
|
3566
|
-
}
|
|
3567
|
-
return this.service.recallXray({
|
|
3568
|
-
query,
|
|
3569
|
-
sessionKey,
|
|
3570
|
-
namespace,
|
|
3571
|
-
budget,
|
|
3572
|
-
authenticatedPrincipal: effectivePrincipal,
|
|
3573
|
-
...disclosure !== void 0 ? { disclosure } : {}
|
|
3574
|
-
});
|
|
3575
|
-
}
|
|
3576
|
-
case "engram.wearables_status":
|
|
3577
|
-
return this.service.wearablesStatus();
|
|
3578
|
-
case "engram.wearables_sync": {
|
|
3579
|
-
const source = optionalNonEmptyString(args.source, "engram.wearables_sync: source");
|
|
3580
|
-
const date = optionalNonEmptyString(args.date, "engram.wearables_sync: date");
|
|
3581
|
-
const days = optionalPositiveInteger(args.days, "engram.wearables_sync: days");
|
|
3582
|
-
let forceMemories;
|
|
3583
|
-
if (args.forceMemories !== void 0 && args.forceMemories !== null) {
|
|
3584
|
-
if (typeof args.forceMemories !== "boolean") {
|
|
3585
|
-
throw new Error(
|
|
3586
|
-
`engram.wearables_sync: forceMemories expects a boolean; got ${JSON.stringify(args.forceMemories)}`
|
|
3587
|
-
);
|
|
3588
|
-
}
|
|
3589
|
-
forceMemories = args.forceMemories;
|
|
3590
|
-
}
|
|
3591
|
-
return this.service.wearablesSync({ source, date, days, forceMemories });
|
|
3592
|
-
}
|
|
3593
|
-
case "engram.transcript_day": {
|
|
3594
|
-
const date = typeof args.date === "string" ? args.date : "";
|
|
3595
|
-
if (date.trim().length === 0) {
|
|
3596
|
-
throw new Error(
|
|
3597
|
-
"engram.transcript_day: date is required and must be YYYY-MM-DD"
|
|
3598
|
-
);
|
|
3599
|
-
}
|
|
3600
|
-
const source = optionalNonEmptyString(args.source, "engram.transcript_day: source");
|
|
3601
|
-
return this.service.wearablesTranscriptDay({ date, source });
|
|
3602
|
-
}
|
|
3603
|
-
case "engram.transcript_search": {
|
|
3604
|
-
const query = typeof args.query === "string" ? args.query : "";
|
|
3605
|
-
if (query.trim().length === 0) {
|
|
3606
|
-
throw new Error(
|
|
3607
|
-
"engram.transcript_search: query is required and must be non-empty"
|
|
3608
|
-
);
|
|
3609
|
-
}
|
|
3610
|
-
return this.service.wearablesTranscriptSearch({
|
|
3611
|
-
query,
|
|
3612
|
-
source: optionalNonEmptyString(args.source, "engram.transcript_search: source"),
|
|
3613
|
-
from: optionalNonEmptyString(args.from, "engram.transcript_search: from"),
|
|
3614
|
-
to: optionalNonEmptyString(args.to, "engram.transcript_search: to"),
|
|
3615
|
-
limit: optionalPositiveInteger(args.limit, "engram.transcript_search: limit")
|
|
3616
|
-
});
|
|
3617
|
-
}
|
|
3618
|
-
case "engram.transcript_memories":
|
|
3619
|
-
return this.service.wearablesTranscriptMemories({
|
|
3620
|
-
source: optionalNonEmptyString(args.source, "engram.transcript_memories: source"),
|
|
3621
|
-
date: optionalNonEmptyString(args.date, "engram.transcript_memories: date"),
|
|
3622
|
-
limit: optionalPositiveInteger(args.limit, "engram.transcript_memories: limit")
|
|
3623
|
-
});
|
|
3624
|
-
case "engram.action_confidence": {
|
|
3625
|
-
const body = parseMcpRequest("actionConfidence", args);
|
|
3626
|
-
return this.service.actionConfidence(body);
|
|
3627
|
-
}
|
|
3628
|
-
case REMNIC_CHATGPT_MEMORY_INSPECTOR_TOOL: {
|
|
3629
|
-
if (typeof args.query !== "string" || args.query.trim().length === 0) {
|
|
3630
|
-
throw new EngramAccessInputError(
|
|
3631
|
-
"chatgpt_memory_inspector requires a non-empty query string"
|
|
3632
|
-
);
|
|
3633
|
-
}
|
|
3634
|
-
if ("sessionKey" in args && args.sessionKey !== void 0 && args.sessionKey !== null && typeof args.sessionKey !== "string") {
|
|
3635
|
-
throw new EngramAccessInputError("sessionKey must be a string");
|
|
3636
|
-
}
|
|
3637
|
-
if ("namespace" in args && args.namespace !== void 0 && args.namespace !== null && typeof args.namespace !== "string") {
|
|
3638
|
-
throw new EngramAccessInputError("namespace must be a string");
|
|
3639
|
-
}
|
|
3640
|
-
let currentContextScopes;
|
|
3641
|
-
if (args.currentContextScopes !== void 0 && args.currentContextScopes !== null) {
|
|
3642
|
-
if (!Array.isArray(args.currentContextScopes) || !args.currentContextScopes.every((scope2) => typeof scope2 === "string")) {
|
|
3643
|
-
throw new EngramAccessInputError(
|
|
3644
|
-
"currentContextScopes must be an array of strings"
|
|
3645
|
-
);
|
|
3646
|
-
}
|
|
3647
|
-
currentContextScopes = args.currentContextScopes;
|
|
3648
|
-
}
|
|
3649
|
-
const input = {
|
|
3650
|
-
query: args.query.trim()
|
|
3651
|
-
};
|
|
3652
|
-
if (typeof args.sessionKey === "string" && args.sessionKey.trim().length > 0) {
|
|
3653
|
-
input.sessionKey = args.sessionKey;
|
|
3654
|
-
}
|
|
3655
|
-
if (typeof args.namespace === "string" && args.namespace.trim().length > 0) {
|
|
3656
|
-
input.namespace = args.namespace;
|
|
3657
|
-
}
|
|
3658
|
-
if (currentContextScopes !== void 0) {
|
|
3659
|
-
input.currentContextScopes = currentContextScopes;
|
|
3660
|
-
}
|
|
3661
|
-
if (args.allowUnverifiedPreview !== void 0 && args.allowUnverifiedPreview !== null) {
|
|
3662
|
-
if (typeof args.allowUnverifiedPreview !== "boolean") {
|
|
3663
|
-
throw new EngramAccessInputError(
|
|
3664
|
-
"allowUnverifiedPreview must be a boolean"
|
|
3665
|
-
);
|
|
3666
|
-
}
|
|
3667
|
-
input.allowUnverifiedPreview = args.allowUnverifiedPreview;
|
|
3668
|
-
}
|
|
3669
|
-
const recallSessionKey = resolveChatGptInspectorRecallSessionKey(
|
|
3670
|
-
input.sessionKey,
|
|
3671
|
-
effectivePrincipal
|
|
3672
|
-
);
|
|
3673
|
-
const xrayResponse = await this.service.recallXray({
|
|
3674
|
-
query: input.query,
|
|
3675
|
-
sessionKey: recallSessionKey,
|
|
3676
|
-
namespace: input.namespace,
|
|
3677
|
-
currentContextScopes: input.currentContextScopes,
|
|
3678
|
-
authenticatedPrincipal: effectivePrincipal,
|
|
3679
|
-
mode: "full",
|
|
3680
|
-
disclosure: "chunk",
|
|
3681
|
-
includeRecall: true
|
|
3682
|
-
});
|
|
3683
|
-
const xray = xrayResponse.snapshotFound === true ? xrayResponse.snapshot ?? null : null;
|
|
3684
|
-
const recall = xrayResponse.recall ?? {
|
|
3685
|
-
query: input.query,
|
|
3686
|
-
namespace: input.namespace ?? xray?.namespace ?? "global",
|
|
3687
|
-
context: "",
|
|
3688
|
-
count: 0,
|
|
3689
|
-
memoryIds: [],
|
|
3690
|
-
results: [],
|
|
3691
|
-
fallbackUsed: false,
|
|
3692
|
-
sourcesUsed: [],
|
|
3693
|
-
disclosure: "chunk"
|
|
3694
|
-
};
|
|
3695
|
-
const actionRequest = buildChatGptMemoryInspectorActionRequest(
|
|
3696
|
-
input,
|
|
3697
|
-
recall,
|
|
3698
|
-
xray
|
|
3699
|
-
);
|
|
3700
|
-
const actionConfidence = await this.service.actionConfidence(actionRequest);
|
|
3701
|
-
return buildChatGptMemoryInspectorResult(
|
|
3702
|
-
input,
|
|
3703
|
-
recall,
|
|
3704
|
-
xray,
|
|
3705
|
-
actionConfidence
|
|
3706
|
-
);
|
|
3707
|
-
}
|
|
3708
|
-
case "engram.day_summary": {
|
|
3709
|
-
const body = parseMcpRequest("daySummary", args);
|
|
3710
|
-
return this.service.daySummary(body);
|
|
3711
|
-
}
|
|
3712
|
-
case "engram.capsule_export": {
|
|
3713
|
-
const body = parseMcpRequest("capsuleExport", args);
|
|
3714
|
-
return this.service.capsuleExport({
|
|
3715
|
-
name: body.name,
|
|
3716
|
-
namespace: body.namespace,
|
|
3717
|
-
principal: effectivePrincipal,
|
|
3718
|
-
since: body.since,
|
|
3719
|
-
includeKinds: body.includeKinds,
|
|
3720
|
-
peerIds: body.peerIds,
|
|
3721
|
-
includeTranscripts: body.includeTranscripts,
|
|
3722
|
-
encrypt: body.encrypt
|
|
3723
|
-
});
|
|
3724
|
-
}
|
|
3725
|
-
case "engram.capsule_import": {
|
|
3726
|
-
const body = parseMcpRequest("capsuleImport", args);
|
|
3727
|
-
return this.service.capsuleImport({
|
|
3728
|
-
archivePath: expandTildePath(body.archivePath),
|
|
3729
|
-
namespace: body.namespace,
|
|
3730
|
-
principal: effectivePrincipal,
|
|
3731
|
-
mode: body.mode,
|
|
3732
|
-
passphrase: body.passphrase
|
|
3733
|
-
});
|
|
3734
|
-
}
|
|
3735
|
-
case "engram.capsule_list": {
|
|
3736
|
-
const body = parseMcpRequest("capsuleList", args);
|
|
3737
|
-
const requestPrincipal = effectivePrincipal ?? (body.sessionKey && this.service.configRef ? resolvePrincipal(body.sessionKey, this.service.configRef) : void 0);
|
|
3738
|
-
return this.service.capsuleList({
|
|
3739
|
-
namespace: body.namespace,
|
|
3740
|
-
principal: requestPrincipal
|
|
3741
|
-
});
|
|
3742
|
-
}
|
|
3743
|
-
case "engram.memory_governance_run":
|
|
3744
|
-
return this.service.governanceRun({
|
|
3745
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3746
|
-
mode: args.mode === "apply" ? "apply" : "shadow",
|
|
3747
|
-
recentDays: typeof args.recentDays === "number" && Number.isFinite(args.recentDays) ? args.recentDays : void 0,
|
|
3748
|
-
maxMemories: typeof args.maxMemories === "number" && Number.isFinite(args.maxMemories) ? args.maxMemories : void 0,
|
|
3749
|
-
batchSize: typeof args.batchSize === "number" && Number.isFinite(args.batchSize) ? args.batchSize : void 0,
|
|
3750
|
-
authenticatedPrincipal: effectivePrincipal
|
|
3751
|
-
}, effectivePrincipal);
|
|
3752
|
-
case "engram.procedure_mining_run":
|
|
3753
|
-
return this.service.procedureMiningRun(
|
|
3754
|
-
{
|
|
3755
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3756
|
-
authenticatedPrincipal: effectivePrincipal
|
|
3757
|
-
},
|
|
3758
|
-
effectivePrincipal
|
|
3759
|
-
);
|
|
3760
|
-
case "engram.pattern_reinforcement_run":
|
|
3761
|
-
return this.service.patternReinforcementRun(
|
|
3762
|
-
{
|
|
3763
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3764
|
-
authenticatedPrincipal: effectivePrincipal,
|
|
3765
|
-
force: args.force === true
|
|
3766
|
-
},
|
|
3767
|
-
effectivePrincipal
|
|
3768
|
-
);
|
|
3769
|
-
case "remnic.procedural_stats":
|
|
3770
|
-
case "engram.procedural_stats":
|
|
3771
|
-
return this.service.procedureStats(
|
|
3772
|
-
{
|
|
3773
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0
|
|
3774
|
-
},
|
|
3775
|
-
effectivePrincipal
|
|
3776
|
-
);
|
|
3777
|
-
case "engram.memory_timeline": {
|
|
3778
|
-
const limit = typeof args.limit === "number" && Number.isFinite(args.limit) ? args.limit : 200;
|
|
3779
|
-
return this.service.memoryTimeline(
|
|
3780
|
-
typeof args.memoryId === "string" ? args.memoryId : "",
|
|
3781
|
-
typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3782
|
-
limit,
|
|
3783
|
-
effectivePrincipal
|
|
3784
|
-
);
|
|
3785
|
-
}
|
|
3786
|
-
case "engram.suggestion_submit": {
|
|
3787
|
-
const body = parseMcpRequest("suggestionSubmit", args);
|
|
3788
|
-
return this.service.suggestionSubmit({
|
|
3789
|
-
schemaVersion: body.schemaVersion,
|
|
3790
|
-
idempotencyKey: body.idempotencyKey,
|
|
3791
|
-
dryRun: body.dryRun,
|
|
3792
|
-
sessionKey: body.sessionKey,
|
|
3793
|
-
authenticatedPrincipal: effectivePrincipal,
|
|
3794
|
-
content: body.content,
|
|
3795
|
-
category: body.category,
|
|
3796
|
-
confidence: body.confidence,
|
|
3797
|
-
namespace: body.namespace,
|
|
3798
|
-
tags: body.tags,
|
|
3799
|
-
entityRef: body.entityRef,
|
|
3800
|
-
ttl: body.ttl,
|
|
3801
|
-
sourceReason: body.sourceReason,
|
|
3802
|
-
cwd: body.cwd,
|
|
3803
|
-
projectTag: body.projectTag
|
|
3804
|
-
});
|
|
3805
|
-
}
|
|
3806
|
-
case "engram.entity_get":
|
|
3807
|
-
return this.service.entityGet(
|
|
3808
|
-
typeof args.name === "string" ? args.name : "",
|
|
3809
|
-
typeof args.namespace === "string" ? args.namespace : void 0
|
|
3810
|
-
);
|
|
3811
|
-
case "engram.review_queue_list":
|
|
3812
|
-
return this.service.reviewQueue(
|
|
3813
|
-
typeof args.runId === "string" ? args.runId : void 0,
|
|
3814
|
-
typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3815
|
-
effectivePrincipal
|
|
3816
|
-
);
|
|
3817
|
-
case "engram.observe": {
|
|
3818
|
-
const body = parseMcpRequest("observe", args);
|
|
3819
|
-
return this.service.observe(
|
|
3820
|
-
{
|
|
3821
|
-
sessionKey: body.sessionKey,
|
|
3822
|
-
messages: body.messages.map((message) => ({
|
|
3823
|
-
role: message.role,
|
|
3824
|
-
content: message.content,
|
|
3825
|
-
parts: message.parts ?? void 0,
|
|
3826
|
-
rawContent: message.rawContent ?? void 0,
|
|
3827
|
-
sourceFormat: message.sourceFormat ?? void 0
|
|
3828
|
-
})),
|
|
3829
|
-
skipExtraction: body.skipExtraction === true,
|
|
3830
|
-
idempotencyKey: body.idempotencyKey,
|
|
3831
|
-
namespace: body.namespace,
|
|
3832
|
-
authenticatedPrincipal: effectivePrincipal,
|
|
3833
|
-
cwd: body.cwd,
|
|
3834
|
-
projectTag: body.projectTag
|
|
3835
|
-
},
|
|
3836
|
-
// Forward the transport's write-quota enforcer into observe's
|
|
3837
|
-
// idempotency lock so a replay is never 429'd (issue #1649).
|
|
3838
|
-
enforceWriteQuota ? { enforceWriteQuota } : void 0
|
|
3839
|
-
);
|
|
3840
|
-
}
|
|
3841
|
-
case "engram.lcm_search":
|
|
3842
|
-
return this.service.lcmSearch({
|
|
3843
|
-
query: typeof args.query === "string" ? args.query : "",
|
|
3844
|
-
sessionKey: typeof args.sessionKey === "string" ? args.sessionKey : void 0,
|
|
3845
|
-
sessionPrefix: typeof args.sessionPrefix === "string" ? args.sessionPrefix : void 0,
|
|
3846
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3847
|
-
limit: typeof args.limit === "number" && Number.isFinite(args.limit) ? args.limit : void 0,
|
|
3848
|
-
authenticatedPrincipal: effectivePrincipal
|
|
3849
|
-
});
|
|
3850
|
-
case "engram.lcm_compaction_flush": {
|
|
3851
|
-
const body = parseMcpRequest("lcmCompactionFlush", args);
|
|
3852
|
-
return this.service.lcmCompactionFlush({
|
|
3853
|
-
sessionKey: body.sessionKey,
|
|
3854
|
-
namespace: body.namespace,
|
|
3855
|
-
authenticatedPrincipal: effectivePrincipal
|
|
3856
|
-
});
|
|
3857
|
-
}
|
|
3858
|
-
case "engram.lcm_compaction_record": {
|
|
3859
|
-
const body = parseMcpRequest("lcmCompactionRecord", args);
|
|
3860
|
-
return this.service.lcmCompactionRecord({
|
|
3861
|
-
sessionKey: body.sessionKey,
|
|
3862
|
-
namespace: body.namespace,
|
|
3863
|
-
tokensBefore: body.tokensBefore,
|
|
3864
|
-
tokensAfter: body.tokensAfter,
|
|
3865
|
-
authenticatedPrincipal: effectivePrincipal
|
|
3866
|
-
});
|
|
3867
|
-
}
|
|
3868
|
-
// ── Continuity / Identity tools ───────────────────────────────────
|
|
3869
|
-
case "engram.continuity_audit_generate":
|
|
3870
|
-
return this.service.continuityAuditGenerate({
|
|
3871
|
-
period: args.period === "monthly" ? "monthly" : args.period === "weekly" ? "weekly" : void 0,
|
|
3872
|
-
key: typeof args.key === "string" ? args.key : void 0
|
|
3873
|
-
});
|
|
3874
|
-
case "engram.continuity_incident_open":
|
|
3875
|
-
return this.service.continuityIncidentOpen({
|
|
3876
|
-
symptom: typeof args.symptom === "string" ? args.symptom : "",
|
|
3877
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3878
|
-
principal: effectivePrincipal,
|
|
3879
|
-
triggerWindow: typeof args.triggerWindow === "string" ? args.triggerWindow : void 0,
|
|
3880
|
-
suspectedCause: typeof args.suspectedCause === "string" ? args.suspectedCause : void 0
|
|
3881
|
-
});
|
|
3882
|
-
case "engram.continuity_incident_close":
|
|
3883
|
-
return this.service.continuityIncidentClose({
|
|
3884
|
-
id: typeof args.id === "string" ? args.id : "",
|
|
3885
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3886
|
-
principal: effectivePrincipal,
|
|
3887
|
-
fixApplied: typeof args.fixApplied === "string" ? args.fixApplied : "",
|
|
3888
|
-
verificationResult: typeof args.verificationResult === "string" ? args.verificationResult : "",
|
|
3889
|
-
preventiveRule: typeof args.preventiveRule === "string" ? args.preventiveRule : void 0
|
|
3890
|
-
});
|
|
3891
|
-
case "engram.continuity_incident_list":
|
|
3892
|
-
return this.service.continuityIncidentList({
|
|
3893
|
-
state: args.state === "closed" ? "closed" : args.state === "all" ? "all" : args.state === "open" ? "open" : void 0,
|
|
3894
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3895
|
-
principal: effectivePrincipal,
|
|
3896
|
-
limit: typeof args.limit === "number" ? args.limit : void 0
|
|
3897
|
-
});
|
|
3898
|
-
case "engram.continuity_loop_add_or_update":
|
|
3899
|
-
return this.service.continuityLoopAddOrUpdate({
|
|
3900
|
-
id: typeof args.id === "string" ? args.id : "",
|
|
3901
|
-
cadence: args.cadence ?? "weekly",
|
|
3902
|
-
purpose: typeof args.purpose === "string" ? args.purpose : "",
|
|
3903
|
-
status: args.status ?? "active",
|
|
3904
|
-
killCondition: typeof args.killCondition === "string" ? args.killCondition : "",
|
|
3905
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3906
|
-
principal: effectivePrincipal,
|
|
3907
|
-
lastReviewed: typeof args.lastReviewed === "string" ? args.lastReviewed : void 0,
|
|
3908
|
-
notes: typeof args.notes === "string" ? args.notes : void 0
|
|
3909
|
-
});
|
|
3910
|
-
case "engram.continuity_loop_review":
|
|
3911
|
-
return this.service.continuityLoopReview({
|
|
3912
|
-
id: typeof args.id === "string" ? args.id : "",
|
|
3913
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3914
|
-
principal: effectivePrincipal,
|
|
3915
|
-
status: args.status === "active" || args.status === "paused" || args.status === "retired" ? args.status : void 0,
|
|
3916
|
-
notes: typeof args.notes === "string" ? args.notes : void 0,
|
|
3917
|
-
reviewedAt: typeof args.reviewedAt === "string" ? args.reviewedAt : void 0
|
|
3918
|
-
});
|
|
3919
|
-
case "engram.identity_anchor_get":
|
|
3920
|
-
return this.service.identityAnchorGet({
|
|
3921
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3922
|
-
principal: effectivePrincipal
|
|
3923
|
-
});
|
|
3924
|
-
case "engram.identity_anchor_update":
|
|
3925
|
-
return this.service.identityAnchorUpdate({
|
|
3926
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3927
|
-
principal: effectivePrincipal,
|
|
3928
|
-
identityTraits: typeof args.identityTraits === "string" ? args.identityTraits : void 0,
|
|
3929
|
-
communicationPreferences: typeof args.communicationPreferences === "string" ? args.communicationPreferences : void 0,
|
|
3930
|
-
operatingPrinciples: typeof args.operatingPrinciples === "string" ? args.operatingPrinciples : void 0,
|
|
3931
|
-
continuityNotes: typeof args.continuityNotes === "string" ? args.continuityNotes : void 0
|
|
3932
|
-
});
|
|
3933
|
-
case "engram.memory_identity":
|
|
3934
|
-
return this.service.memoryIdentity({
|
|
3935
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
3936
|
-
principal: effectivePrincipal
|
|
3937
|
-
});
|
|
3938
|
-
// ── Work Layer tools ──────────────────────────────────────────────
|
|
3939
|
-
case "engram.work_task":
|
|
3940
|
-
return this.service.workTask({
|
|
3941
|
-
action: args.action ?? "list",
|
|
3942
|
-
id: typeof args.id === "string" ? args.id : void 0,
|
|
3943
|
-
title: typeof args.title === "string" ? args.title : void 0,
|
|
3944
|
-
description: typeof args.description === "string" ? args.description : void 0,
|
|
3945
|
-
status: typeof args.status === "string" ? args.status : void 0,
|
|
3946
|
-
priority: typeof args.priority === "string" ? args.priority : void 0,
|
|
3947
|
-
owner: typeof args.owner === "string" ? args.owner : void 0,
|
|
3948
|
-
assignee: typeof args.assignee === "string" ? args.assignee : void 0,
|
|
3949
|
-
projectId: typeof args.projectId === "string" ? args.projectId : void 0,
|
|
3950
|
-
tags: Array.isArray(args.tags) ? args.tags.filter((x) => typeof x === "string") : void 0,
|
|
3951
|
-
dueAt: typeof args.dueAt === "string" ? args.dueAt : void 0
|
|
3952
|
-
});
|
|
3953
|
-
case "engram.work_project":
|
|
3954
|
-
return this.service.workProject({
|
|
3955
|
-
action: args.action ?? "list",
|
|
3956
|
-
id: typeof args.id === "string" ? args.id : void 0,
|
|
3957
|
-
name: typeof args.name === "string" ? args.name : void 0,
|
|
3958
|
-
description: typeof args.description === "string" ? args.description : void 0,
|
|
3959
|
-
status: typeof args.status === "string" ? args.status : void 0,
|
|
3960
|
-
owner: typeof args.owner === "string" ? args.owner : void 0,
|
|
3961
|
-
tags: Array.isArray(args.tags) ? args.tags.filter((x) => typeof x === "string") : void 0,
|
|
3962
|
-
taskId: typeof args.taskId === "string" ? args.taskId : void 0,
|
|
3963
|
-
projectId: typeof args.projectId === "string" ? args.projectId : void 0
|
|
3964
|
-
});
|
|
3965
|
-
case "engram.work_board":
|
|
3966
|
-
return this.service.workBoard({
|
|
3967
|
-
action: args.action ?? "export_markdown",
|
|
3968
|
-
projectId: typeof args.projectId === "string" ? args.projectId : void 0,
|
|
3969
|
-
snapshotJson: typeof args.snapshotJson === "string" ? args.snapshotJson : void 0,
|
|
3970
|
-
linkToMemory: args.linkToMemory === true
|
|
3971
|
-
});
|
|
3972
|
-
// ── Shared Context / Compounding tools ─────────────────────────
|
|
3973
|
-
case "engram.shared_context_write_output":
|
|
3974
|
-
return this.service.sharedContextWriteOutput({
|
|
3975
|
-
agentId: typeof args.agentId === "string" ? args.agentId : "",
|
|
3976
|
-
title: typeof args.title === "string" ? args.title : "",
|
|
3977
|
-
content: typeof args.content === "string" ? args.content : ""
|
|
3978
|
-
});
|
|
3979
|
-
case "engram.shared_feedback_record":
|
|
3980
|
-
return this.service.sharedFeedbackRecord({
|
|
3981
|
-
agent: typeof args.agent === "string" ? args.agent : "",
|
|
3982
|
-
decision: args.decision ?? "approved",
|
|
3983
|
-
reason: typeof args.reason === "string" ? args.reason : "",
|
|
3984
|
-
date: typeof args.date === "string" ? args.date : void 0,
|
|
3985
|
-
learning: typeof args.learning === "string" ? args.learning : void 0,
|
|
3986
|
-
outcome: typeof args.outcome === "string" ? args.outcome : void 0,
|
|
3987
|
-
severity: args.severity === "low" || args.severity === "medium" || args.severity === "high" ? args.severity : void 0,
|
|
3988
|
-
confidence: typeof args.confidence === "number" ? args.confidence : void 0,
|
|
3989
|
-
workflow: typeof args.workflow === "string" ? args.workflow : void 0,
|
|
3990
|
-
tags: Array.isArray(args.tags) ? args.tags.filter((x) => typeof x === "string") : void 0,
|
|
3991
|
-
evidenceWindowStart: typeof args.evidenceWindowStart === "string" ? args.evidenceWindowStart : void 0,
|
|
3992
|
-
evidenceWindowEnd: typeof args.evidenceWindowEnd === "string" ? args.evidenceWindowEnd : void 0,
|
|
3993
|
-
refs: Array.isArray(args.refs) ? args.refs.filter((x) => typeof x === "string") : void 0
|
|
3994
|
-
});
|
|
3995
|
-
case "engram.shared_priorities_append":
|
|
3996
|
-
return this.service.sharedPrioritiesAppend({
|
|
3997
|
-
agentId: typeof args.agentId === "string" ? args.agentId : "",
|
|
3998
|
-
text: typeof args.text === "string" ? args.text : ""
|
|
3999
|
-
});
|
|
4000
|
-
case "engram.shared_context_cross_signals_run":
|
|
4001
|
-
return this.service.sharedContextCrossSignalsRun({
|
|
4002
|
-
date: typeof args.date === "string" ? args.date : void 0
|
|
4003
|
-
});
|
|
4004
|
-
case "engram.shared_context_curate_daily":
|
|
4005
|
-
return this.service.sharedContextCurateDaily({
|
|
4006
|
-
date: typeof args.date === "string" ? args.date : void 0
|
|
4007
|
-
});
|
|
4008
|
-
case "engram.compounding_weekly_synthesize":
|
|
4009
|
-
return this.service.compoundingWeeklySynthesize({
|
|
4010
|
-
weekId: typeof args.weekId === "string" ? args.weekId : void 0
|
|
4011
|
-
});
|
|
4012
|
-
case "engram.compounding_promote_candidate":
|
|
4013
|
-
return this.service.compoundingPromoteCandidate({
|
|
4014
|
-
weekId: typeof args.weekId === "string" ? args.weekId : "",
|
|
4015
|
-
candidateId: typeof args.candidateId === "string" ? args.candidateId : "",
|
|
4016
|
-
dryRun: args.dryRun === true
|
|
4017
|
-
});
|
|
4018
|
-
// ── Compression Guidelines tools ───────────────────────────────────
|
|
4019
|
-
case "engram.compression_guidelines_optimize":
|
|
4020
|
-
return this.service.compressionGuidelinesOptimize({
|
|
4021
|
-
dryRun: args.dryRun === true,
|
|
4022
|
-
eventLimit: typeof args.eventLimit === "number" ? args.eventLimit : void 0
|
|
4023
|
-
});
|
|
4024
|
-
case "engram.compression_guidelines_activate":
|
|
4025
|
-
return this.service.compressionGuidelinesActivate({
|
|
4026
|
-
expectedContentHash: typeof args.expectedContentHash === "string" ? args.expectedContentHash : void 0,
|
|
4027
|
-
expectedGuidelineVersion: typeof args.expectedGuidelineVersion === "number" ? args.expectedGuidelineVersion : void 0
|
|
4028
|
-
});
|
|
4029
|
-
// ── Memory search & debug tools ──────────────────────────────────
|
|
4030
|
-
case "engram.memory_profile":
|
|
4031
|
-
return this.service.memoryProfile(
|
|
4032
|
-
typeof args.namespace === "string" ? args.namespace : void 0,
|
|
4033
|
-
effectivePrincipal
|
|
4034
|
-
);
|
|
4035
|
-
case "engram.memory_entities_list":
|
|
4036
|
-
return this.service.memoryEntitiesList(
|
|
4037
|
-
typeof args.namespace === "string" ? args.namespace : void 0,
|
|
4038
|
-
effectivePrincipal
|
|
4039
|
-
);
|
|
4040
|
-
case "engram.memory_questions":
|
|
4041
|
-
return this.service.memoryQuestions(
|
|
4042
|
-
typeof args.namespace === "string" ? args.namespace : void 0,
|
|
4043
|
-
effectivePrincipal
|
|
4044
|
-
);
|
|
4045
|
-
case "engram.memory_last_recall":
|
|
4046
|
-
return this.service.lastRecallSnapshot(
|
|
4047
|
-
typeof args.sessionKey === "string" ? args.sessionKey : void 0
|
|
4048
|
-
);
|
|
4049
|
-
case "engram.memory_intent_debug":
|
|
4050
|
-
return this.service.intentDebug(
|
|
4051
|
-
typeof args.namespace === "string" ? args.namespace : void 0
|
|
4052
|
-
);
|
|
4053
|
-
case "engram.memory_qmd_debug":
|
|
4054
|
-
return this.service.qmdDebug(
|
|
4055
|
-
typeof args.namespace === "string" ? args.namespace : void 0
|
|
4056
|
-
);
|
|
4057
|
-
case "engram.memory_graph_explain":
|
|
4058
|
-
return this.service.graphExplainLastRecall(
|
|
4059
|
-
typeof args.namespace === "string" ? args.namespace : void 0
|
|
4060
|
-
);
|
|
4061
|
-
case "engram.graph_snapshot": {
|
|
4062
|
-
if (args.limit !== void 0 && typeof args.limit !== "number") {
|
|
4063
|
-
throw new Error("engram.graph_snapshot: limit must be a number");
|
|
4064
|
-
}
|
|
4065
|
-
if (args.since !== void 0 && typeof args.since !== "string") {
|
|
4066
|
-
throw new Error("engram.graph_snapshot: since must be a string");
|
|
4067
|
-
}
|
|
4068
|
-
if (args.focusNodeId !== void 0 && typeof args.focusNodeId !== "string") {
|
|
4069
|
-
throw new Error("engram.graph_snapshot: focusNodeId must be a string");
|
|
4070
|
-
}
|
|
4071
|
-
let categories;
|
|
4072
|
-
if (args.categories !== void 0) {
|
|
4073
|
-
if (!Array.isArray(args.categories)) {
|
|
4074
|
-
throw new Error(
|
|
4075
|
-
"engram.graph_snapshot: categories must be an array of strings"
|
|
4076
|
-
);
|
|
4077
|
-
}
|
|
4078
|
-
categories = args.categories.map((value, index) => {
|
|
4079
|
-
if (typeof value !== "string") {
|
|
4080
|
-
throw new Error(
|
|
4081
|
-
`engram.graph_snapshot: categories[${index}] must be a string`
|
|
4082
|
-
);
|
|
4083
|
-
}
|
|
4084
|
-
return value;
|
|
4085
|
-
});
|
|
4086
|
-
}
|
|
4087
|
-
return this.service.graphSnapshot(
|
|
4088
|
-
{
|
|
4089
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
4090
|
-
limit: typeof args.limit === "number" ? args.limit : void 0,
|
|
4091
|
-
since: typeof args.since === "string" ? args.since : void 0,
|
|
4092
|
-
focusNodeId: typeof args.focusNodeId === "string" ? args.focusNodeId : void 0,
|
|
4093
|
-
...categories !== void 0 ? { categories } : {}
|
|
4094
|
-
},
|
|
4095
|
-
effectivePrincipal
|
|
4096
|
-
);
|
|
4097
|
-
}
|
|
4098
|
-
case "engram.memory_feedback":
|
|
4099
|
-
return this.service.memoryFeedback({
|
|
4100
|
-
memoryId: typeof args.memoryId === "string" ? args.memoryId : "",
|
|
4101
|
-
vote: args.vote === "down" ? "down" : "up",
|
|
4102
|
-
note: typeof args.note === "string" ? args.note : void 0
|
|
4103
|
-
});
|
|
4104
|
-
case "engram.memory_promote":
|
|
4105
|
-
return this.service.memoryPromote({
|
|
4106
|
-
memoryId: typeof args.memoryId === "string" ? args.memoryId : "",
|
|
4107
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
4108
|
-
principal: effectivePrincipal,
|
|
4109
|
-
sessionKey: typeof args.sessionKey === "string" ? args.sessionKey : void 0
|
|
4110
|
-
});
|
|
4111
|
-
case "engram.memory_outcome": {
|
|
4112
|
-
const outcome = args.outcome;
|
|
4113
|
-
if (outcome !== "success" && outcome !== "failure") {
|
|
4114
|
-
throw new Error(
|
|
4115
|
-
`engram.memory_outcome: outcome must be "success" or "failure"; got ${JSON.stringify(outcome)}`
|
|
4116
|
-
);
|
|
4117
|
-
}
|
|
4118
|
-
return this.service.memoryOutcome({
|
|
4119
|
-
memoryId: typeof args.memoryId === "string" ? args.memoryId : "",
|
|
4120
|
-
outcome,
|
|
4121
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
4122
|
-
principal: effectivePrincipal,
|
|
4123
|
-
sessionKey: typeof args.sessionKey === "string" ? args.sessionKey : void 0,
|
|
4124
|
-
timestamp: typeof args.timestamp === "string" ? args.timestamp : void 0
|
|
4125
|
-
});
|
|
4126
|
-
}
|
|
4127
|
-
case "engram.memory_action_apply":
|
|
4128
|
-
return this.service.memoryActionApply({
|
|
4129
|
-
action: typeof args.action === "string" ? args.action : "",
|
|
4130
|
-
outcome: typeof args.outcome === "string" ? args.outcome : void 0,
|
|
4131
|
-
reason: typeof args.reason === "string" ? args.reason : void 0,
|
|
4132
|
-
memoryId: typeof args.memoryId === "string" ? args.memoryId : void 0,
|
|
4133
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
4134
|
-
principal: effectivePrincipal,
|
|
4135
|
-
sessionKey: typeof args.sessionKey === "string" ? args.sessionKey : void 0,
|
|
4136
|
-
content: typeof args.content === "string" ? args.content : void 0,
|
|
4137
|
-
category: typeof args.category === "string" ? args.category : void 0,
|
|
4138
|
-
linkTargetId: typeof args.linkTargetId === "string" ? args.linkTargetId : void 0,
|
|
4139
|
-
linkType: typeof args.linkType === "string" ? args.linkType : void 0,
|
|
4140
|
-
linkStrength: typeof args.linkStrength === "number" ? args.linkStrength : void 0,
|
|
4141
|
-
artifactType: typeof args.artifactType === "string" ? args.artifactType : void 0,
|
|
4142
|
-
execute: typeof args.execute === "boolean" ? args.execute : void 0,
|
|
4143
|
-
sourcePrompt: typeof args.sourcePrompt === "string" ? args.sourcePrompt : void 0,
|
|
4144
|
-
dryRun: args.dryRun === true
|
|
4145
|
-
});
|
|
4146
|
-
case "engram.context_checkpoint":
|
|
4147
|
-
return this.service.contextCheckpoint({
|
|
4148
|
-
sessionKey: typeof args.sessionKey === "string" ? args.sessionKey : "",
|
|
4149
|
-
context: typeof args.context === "string" ? args.context : "",
|
|
4150
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
4151
|
-
principal: effectivePrincipal
|
|
4152
|
-
});
|
|
4153
|
-
// ── Daily Context Briefing (#370) ───────────────────────────────────
|
|
4154
|
-
case "engram.briefing": {
|
|
4155
|
-
const rawFormat = typeof args.format === "string" ? args.format : void 0;
|
|
4156
|
-
const formatErr = validateBriefingFormat(rawFormat);
|
|
4157
|
-
if (formatErr) throw new Error(formatErr);
|
|
4158
|
-
return this.service.briefing({
|
|
4159
|
-
since: typeof args.since === "string" ? args.since : void 0,
|
|
4160
|
-
focus: typeof args.focus === "string" ? args.focus : void 0,
|
|
4161
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0,
|
|
4162
|
-
format: rawFormat,
|
|
4163
|
-
maxFollowups: typeof args.maxFollowups === "number" ? args.maxFollowups : void 0,
|
|
4164
|
-
principal: effectivePrincipal
|
|
4165
|
-
});
|
|
4166
|
-
}
|
|
4167
|
-
// ── Contradiction Review (issue #520) ──────────────────────────────────
|
|
4168
|
-
case "engram.review_list":
|
|
4169
|
-
case "remnic.review_list": {
|
|
4170
|
-
const {
|
|
4171
|
-
isDefaultReviewNamespace,
|
|
4172
|
-
listPairs
|
|
4173
|
-
} = await import("./contradiction-review-QKJH5DKD.js");
|
|
4174
|
-
const VALID_REVIEW_FILTERS = /* @__PURE__ */ new Set(["all", "unresolved", "contradicts", "independent", "duplicates", "needs-user"]);
|
|
4175
|
-
const rawFilter = typeof args.filter === "string" ? args.filter : "unresolved";
|
|
4176
|
-
if (!VALID_REVIEW_FILTERS.has(rawFilter)) {
|
|
4177
|
-
throw new Error(`Invalid filter '${rawFilter}'. Valid: ${[...VALID_REVIEW_FILTERS].join(", ")}`);
|
|
4178
|
-
}
|
|
4179
|
-
const filter = rawFilter;
|
|
4180
|
-
const ns = typeof args.namespace === "string" ? args.namespace : void 0;
|
|
4181
|
-
const limit = typeof args.limit === "number" ? args.limit : 50;
|
|
4182
|
-
const resolved = await this.service.getReadableStorageForNamespace(ns, effectivePrincipal);
|
|
4183
|
-
const reviewNamespace = this.service.configRef.namespacesEnabled ? resolved.namespace : void 0;
|
|
4184
|
-
const includeUnscopedForNamespace = Boolean(
|
|
4185
|
-
reviewNamespace && isDefaultReviewNamespace(this.service.configRef.defaultNamespace, ns, reviewNamespace)
|
|
4186
|
-
);
|
|
4187
|
-
return listPairs(this.service.memoryDir, {
|
|
4188
|
-
filter,
|
|
4189
|
-
namespace: reviewNamespace,
|
|
4190
|
-
includeUnscopedForNamespace,
|
|
4191
|
-
limit
|
|
4192
|
-
});
|
|
4193
|
-
}
|
|
4194
|
-
case "engram.review_resolve":
|
|
4195
|
-
case "remnic.review_resolve": {
|
|
4196
|
-
const pairId = typeof args.pairId === "string" ? args.pairId : "";
|
|
4197
|
-
const verb = typeof args.verb === "string" ? args.verb : "";
|
|
4198
|
-
if (!pairId) throw new Error("pairId is required");
|
|
4199
|
-
if (!verb) throw new Error("verb is required");
|
|
4200
|
-
const { isValidResolutionVerb } = await import("./resolution-MN36NW5P.js");
|
|
4201
|
-
if (!isValidResolutionVerb(verb)) throw new Error(`Invalid verb: ${verb}. Must be one of: keep-a, keep-b, merge, both-valid, needs-more-context`);
|
|
4202
|
-
const { executeResolution } = await import("./resolution-MN36NW5P.js");
|
|
4203
|
-
return executeResolution(this.service.memoryDir, this.service.storageRef, pairId, verb, {
|
|
4204
|
-
mergedMemoryId: typeof args.mergedMemoryId === "string" ? args.mergedMemoryId : void 0,
|
|
4205
|
-
mergedContent: typeof args.mergedContent === "string" ? args.mergedContent : void 0,
|
|
4206
|
-
storageForNamespace: async (namespace) => {
|
|
4207
|
-
const resolved = await this.service.getWritableStorageForNamespace(namespace, effectivePrincipal);
|
|
4208
|
-
return resolved.storage;
|
|
4209
|
-
},
|
|
4210
|
-
// Catalog write touch (issue #1499 sweep): a contradiction merge writes
|
|
4211
|
-
// a new memory directly to the resolved namespace storage, bypassing the
|
|
4212
|
-
// extraction write path. Record it so QMD maintenance / writtenSince
|
|
4213
|
-
// don't miss the write. Best-effort and failure-tolerant.
|
|
4214
|
-
onMergedMemoryWritten: (namespace, storageDir) => {
|
|
4215
|
-
}
|
|
4216
|
-
});
|
|
4217
|
-
}
|
|
4218
|
-
case "engram.contradiction_scan_run":
|
|
4219
|
-
case "remnic.contradiction_scan_run": {
|
|
4220
|
-
const { runContradictionScan } = await import("./contradiction-scan-HWGEOUDS.js");
|
|
4221
|
-
return runContradictionScan({
|
|
4222
|
-
storage: this.service.storageRef,
|
|
4223
|
-
config: this.service.configRef,
|
|
4224
|
-
memoryDir: this.service.memoryDir,
|
|
4225
|
-
embeddingLookupFactory: this.service.embeddingLookupFactoryRef,
|
|
4226
|
-
storageForNamespace: (namespace) => this.service.getWritableStorageForNamespace(namespace, effectivePrincipal),
|
|
4227
|
-
localLlm: this.service.localLlmRef,
|
|
4228
|
-
fallbackLlm: this.service.fallbackLlmRef,
|
|
4229
|
-
namespace: typeof args.namespace === "string" ? args.namespace : void 0
|
|
4230
|
-
});
|
|
4231
|
-
}
|
|
4232
|
-
case "engram.memory_summarize_hourly":
|
|
4233
|
-
case "remnic.memory_summarize_hourly":
|
|
4234
|
-
return this.service.memorySummarizeHourly();
|
|
4235
|
-
case "engram.conversation_index_update":
|
|
4236
|
-
case "remnic.conversation_index_update": {
|
|
4237
|
-
if ("sessionKey" in args && args.sessionKey !== void 0 && typeof args.sessionKey !== "string") {
|
|
4238
|
-
throw new Error("sessionKey must be a string when provided");
|
|
4239
|
-
}
|
|
4240
|
-
const sessionKey = typeof args.sessionKey === "string" ? args.sessionKey : void 0;
|
|
4241
|
-
return this.service.conversationIndexUpdate({
|
|
4242
|
-
sessionKey,
|
|
4243
|
-
hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? args.hours : void 0,
|
|
4244
|
-
embed: typeof args.embed === "boolean" ? args.embed : void 0
|
|
4245
|
-
});
|
|
4246
|
-
}
|
|
4247
|
-
case "engram.profiling_report":
|
|
4248
|
-
case "remnic.profiling_report": {
|
|
4249
|
-
if ("format" in args && args.format !== void 0 && typeof args.format !== "string") {
|
|
4250
|
-
throw new EngramAccessInputError("format must be a string when provided");
|
|
4251
|
-
}
|
|
4252
|
-
if ("limit" in args && args.limit !== void 0 && typeof args.limit !== "number") {
|
|
4253
|
-
throw new EngramAccessInputError("limit must be a number when provided");
|
|
4254
|
-
}
|
|
4255
|
-
return this.service.profilingReport({
|
|
4256
|
-
format: typeof args.format === "string" ? args.format : void 0,
|
|
4257
|
-
limit: typeof args.limit === "number" ? args.limit : void 0
|
|
4258
|
-
});
|
|
4259
|
-
}
|
|
4260
|
-
case "engram.graph_edge_decay_run":
|
|
4261
|
-
case "remnic.graph_edge_decay_run": {
|
|
4262
|
-
const cfg = this.service.configRef;
|
|
4263
|
-
if (!cfg.graphEdgeDecayEnabled) {
|
|
4264
|
-
return {
|
|
4265
|
-
ranAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4266
|
-
disabled: true,
|
|
4267
|
-
reason: "graphEdgeDecayEnabled is false"
|
|
4268
|
-
};
|
|
4269
|
-
}
|
|
4270
|
-
const { runGraphEdgeDecayMaintenanceAcrossNamespaces } = await import("./graph-edge-decay-QPRJQ7DL.js");
|
|
4271
|
-
const dryRun = args.dryRun === true;
|
|
4272
|
-
const results = await runGraphEdgeDecayMaintenanceAcrossNamespaces(
|
|
4273
|
-
this.service.memoryDir,
|
|
4274
|
-
{
|
|
4275
|
-
windowMs: cfg.graphEdgeDecayWindowMs,
|
|
4276
|
-
perWindow: cfg.graphEdgeDecayPerWindow,
|
|
4277
|
-
floor: cfg.graphEdgeDecayFloor,
|
|
4278
|
-
visibilityThreshold: cfg.graphEdgeDecayVisibilityThreshold,
|
|
4279
|
-
dryRun,
|
|
4280
|
-
namespacesEnabled: cfg.namespacesEnabled === true,
|
|
4281
|
-
defaultNamespace: cfg.defaultNamespace
|
|
4282
|
-
}
|
|
4283
|
-
);
|
|
4284
|
-
return { results };
|
|
4285
|
-
}
|
|
4286
|
-
case "engram.live_connectors_run":
|
|
4287
|
-
case "remnic.live_connectors_run":
|
|
4288
|
-
return this.service.liveConnectorsRun(
|
|
4289
|
-
{
|
|
4290
|
-
authenticatedPrincipal: effectivePrincipal,
|
|
4291
|
-
force: args.force === true
|
|
4292
|
-
},
|
|
4293
|
-
effectivePrincipal
|
|
4294
|
-
);
|
|
4295
|
-
// ── Peer Registry dispatchers (issue #679 PR 4/5) ─────────────────
|
|
4296
|
-
case "engram.peer_list":
|
|
4297
|
-
case "remnic.peer_list":
|
|
4298
|
-
return this.service.peerList();
|
|
4299
|
-
case "engram.peer_get":
|
|
4300
|
-
case "remnic.peer_get": {
|
|
4301
|
-
const id = typeof args.id === "string" ? args.id : "";
|
|
4302
|
-
if (!id) throw new Error("engram.peer_get: id is required");
|
|
4303
|
-
return this.service.peerGet(id);
|
|
3488
|
+
if (chatResult && typeof chatResult === "object" && "error" in chatResult) {
|
|
3489
|
+
const { error: _stripped, ...wireResult } = chatResult;
|
|
3490
|
+
return wireResult;
|
|
4304
3491
|
}
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
if (
|
|
4316
|
-
|
|
4317
|
-
}
|
|
4318
|
-
return this.service.peerSet({
|
|
4319
|
-
id,
|
|
4320
|
-
kind: typeof args.kind === "string" ? args.kind : void 0,
|
|
4321
|
-
displayName: typeof args.displayName === "string" ? args.displayName : void 0,
|
|
4322
|
-
notes: typeof args.notes === "string" ? args.notes : void 0
|
|
4323
|
-
});
|
|
4324
|
-
}
|
|
4325
|
-
case "engram.peer_delete":
|
|
4326
|
-
case "remnic.peer_delete": {
|
|
4327
|
-
const id = typeof args.id === "string" ? args.id : "";
|
|
4328
|
-
if (!id) throw new Error("engram.peer_delete: id is required");
|
|
4329
|
-
return this.service.peerDelete(id);
|
|
4330
|
-
}
|
|
4331
|
-
case "engram.peer_profile_get":
|
|
4332
|
-
case "remnic.peer_profile_get": {
|
|
4333
|
-
const id = typeof args.id === "string" ? args.id : "";
|
|
4334
|
-
if (!id) throw new Error("engram.peer_profile_get: id is required");
|
|
4335
|
-
return this.service.peerProfileGet(id);
|
|
4336
|
-
}
|
|
4337
|
-
case "engram.peer_forget":
|
|
4338
|
-
case "remnic.peer_forget": {
|
|
4339
|
-
const id = typeof args.id === "string" ? args.id : "";
|
|
4340
|
-
if (!id) throw new Error("engram.peer_forget: id is required");
|
|
4341
|
-
const confirm = typeof args.confirm === "string" ? args.confirm : "";
|
|
4342
|
-
if (confirm !== "yes") {
|
|
4343
|
-
throw new Error(
|
|
4344
|
-
"engram.peer_forget: confirm must be 'yes' to prevent accidental data loss"
|
|
4345
|
-
);
|
|
4346
|
-
}
|
|
4347
|
-
return this.service.peerForget(id, { confirm: "yes" });
|
|
4348
|
-
}
|
|
4349
|
-
// ── Operator Console state (issue #688 PR 2/3) ──────────────────────────
|
|
4350
|
-
case "engram.console_state":
|
|
4351
|
-
case "remnic.console_state":
|
|
4352
|
-
return this.service.consoleState(
|
|
4353
|
-
typeof args.namespace === "string" ? args.namespace : void 0,
|
|
4354
|
-
effectivePrincipal
|
|
4355
|
-
);
|
|
4356
|
-
// ── Dreams telemetry (issue #678 PR 3+4) ──────────────────────────────
|
|
4357
|
-
case "engram.dreams_status":
|
|
4358
|
-
case "remnic.dreams_status": {
|
|
4359
|
-
const { normalizeDreamsStatusWindowHours } = await import("./dreams-ledger-3WSCI5V4.js");
|
|
4360
|
-
let windowHours = 24;
|
|
4361
|
-
try {
|
|
4362
|
-
windowHours = normalizeDreamsStatusWindowHours(args.windowHours);
|
|
4363
|
-
} catch {
|
|
4364
|
-
throw new Error(
|
|
4365
|
-
`engram.dreams_status: windowHours must be a positive integer (e.g. 24). Got: ${String(args.windowHours)}`
|
|
4366
|
-
);
|
|
4367
|
-
}
|
|
4368
|
-
if ("namespace" in args && args.namespace !== void 0 && typeof args.namespace !== "string") {
|
|
4369
|
-
throw new Error("engram.dreams_status: namespace must be a string when provided");
|
|
4370
|
-
}
|
|
4371
|
-
const namespace = typeof args.namespace === "string" ? args.namespace : void 0;
|
|
4372
|
-
return this.service.dreamsStatus({
|
|
4373
|
-
windowHours,
|
|
4374
|
-
namespace,
|
|
4375
|
-
principal: effectivePrincipal
|
|
4376
|
-
});
|
|
4377
|
-
}
|
|
4378
|
-
case "engram.dreams_run":
|
|
4379
|
-
case "remnic.dreams_run": {
|
|
4380
|
-
const VALID_PHASES = ["lightSleep", "rem", "deepSleep"];
|
|
4381
|
-
const phase = typeof args.phase === "string" ? args.phase : "";
|
|
4382
|
-
if (!phase || !VALID_PHASES.includes(phase)) {
|
|
4383
|
-
throw new Error(
|
|
4384
|
-
`engram.dreams_run: phase is required and must be one of: ${VALID_PHASES.join(", ")}`
|
|
4385
|
-
);
|
|
4386
|
-
}
|
|
4387
|
-
if ("dryRun" in args && args.dryRun !== void 0 && typeof args.dryRun !== "boolean") {
|
|
4388
|
-
throw new Error("engram.dreams_run: dryRun must be a boolean when provided");
|
|
4389
|
-
}
|
|
4390
|
-
if ("namespace" in args && args.namespace !== void 0 && typeof args.namespace !== "string") {
|
|
4391
|
-
throw new Error("engram.dreams_run: namespace must be a string when provided");
|
|
4392
|
-
}
|
|
4393
|
-
const namespace = typeof args.namespace === "string" ? args.namespace : void 0;
|
|
4394
|
-
const dryRun = args.dryRun === true;
|
|
4395
|
-
return this.service.dreamsRun({
|
|
4396
|
-
phase,
|
|
4397
|
-
dryRun,
|
|
4398
|
-
namespace,
|
|
4399
|
-
authenticatedPrincipal: effectivePrincipal
|
|
4400
|
-
});
|
|
4401
|
-
}
|
|
4402
|
-
case "engram.memory_chat": {
|
|
4403
|
-
const message = typeof args.message === "string" ? args.message : "";
|
|
4404
|
-
if (!message) {
|
|
4405
|
-
throw new EngramAccessInputError("message is required");
|
|
4406
|
-
}
|
|
4407
|
-
const chatSessionId = typeof args.chatSessionId === "string" ? args.chatSessionId : void 0;
|
|
4408
|
-
const chatResult = await processChatMessage({
|
|
4409
|
-
service: this.service,
|
|
4410
|
-
config: this.service.configRef?.chat,
|
|
4411
|
-
memoryDir: this.service.memoryDir,
|
|
4412
|
-
message,
|
|
4413
|
-
...chatSessionId ? { chatSessionId } : {},
|
|
4414
|
-
...effectivePrincipal ? { principal: effectivePrincipal } : {},
|
|
4415
|
-
...scope?.namespace ? { namespace: scope.namespace } : {},
|
|
4416
|
-
...scope?.sessionKey ? { sessionKey: scope.sessionKey } : {}
|
|
4417
|
-
});
|
|
4418
|
-
if (chatResult && typeof chatResult === "object" && "error" in chatResult) {
|
|
4419
|
-
const { error: _stripped, ...wireResult } = chatResult;
|
|
4420
|
-
return wireResult;
|
|
3492
|
+
return chatResult;
|
|
3493
|
+
} else {
|
|
3494
|
+
envelope = args;
|
|
3495
|
+
}
|
|
3496
|
+
if (migrated === "recall") {
|
|
3497
|
+
const result = await op.run(envelope, { service: this.service, authenticatedPrincipal: effectivePrincipal });
|
|
3498
|
+
const response = result.result;
|
|
3499
|
+
if (this.shouldEmitCitations(mcpSessionId)) {
|
|
3500
|
+
const citations = this.buildRecallCitations(response);
|
|
3501
|
+
const guidance = buildCitationGuidance(citations);
|
|
3502
|
+
if (guidance.length > 0) {
|
|
3503
|
+
return { ...response, context: (response.context ?? "") + guidance, citations };
|
|
4421
3504
|
}
|
|
4422
|
-
return chatResult;
|
|
4423
3505
|
}
|
|
4424
|
-
|
|
4425
|
-
throw new Error(`unknown tool: ${name}`);
|
|
3506
|
+
return response;
|
|
4426
3507
|
}
|
|
3508
|
+
const output = await op.run(envelope, {
|
|
3509
|
+
service: this.service,
|
|
3510
|
+
authenticatedPrincipal: effectivePrincipal,
|
|
3511
|
+
...enforceWriteQuota ? { hooks: { enforceWriteQuota } } : {}
|
|
3512
|
+
});
|
|
3513
|
+
return output.result;
|
|
4427
3514
|
}
|
|
4428
3515
|
};
|
|
4429
3516
|
|
|
@@ -4441,4 +3528,4 @@ export {
|
|
|
4441
3528
|
sessionBelongsToPrincipal,
|
|
4442
3529
|
EngramMcpServer
|
|
4443
3530
|
};
|
|
4444
|
-
//# sourceMappingURL=chunk-
|
|
3531
|
+
//# sourceMappingURL=chunk-FN6QP7JQ.js.map
|