@remnic/core 9.3.723 → 9.3.725
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
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runGraphEdgeDecayMaintenanceAcrossNamespaces
|
|
3
|
+
} from "./chunk-ZQNCHPTZ.js";
|
|
4
|
+
import {
|
|
5
|
+
normalizeDreamsStatusWindowHours
|
|
6
|
+
} from "./chunk-YF6FMLBT.js";
|
|
7
|
+
import {
|
|
8
|
+
executeResolution,
|
|
9
|
+
isValidResolutionVerb
|
|
10
|
+
} from "./chunk-R6OVFAX6.js";
|
|
11
|
+
import {
|
|
12
|
+
runContradictionScan
|
|
13
|
+
} from "./chunk-PLBIPT6I.js";
|
|
14
|
+
import {
|
|
15
|
+
isDefaultReviewNamespace,
|
|
16
|
+
listPairs
|
|
17
|
+
} from "./chunk-35NN3ZFA.js";
|
|
18
|
+
import {
|
|
19
|
+
buildChatGptMemoryInspectorActionRequest,
|
|
20
|
+
buildChatGptMemoryInspectorResult
|
|
21
|
+
} from "./chunk-T4WDJPEZ.js";
|
|
22
|
+
import {
|
|
23
|
+
defineOperation
|
|
24
|
+
} from "./chunk-NT36GU6X.js";
|
|
25
|
+
import {
|
|
26
|
+
EngramAccessInputError
|
|
27
|
+
} from "./chunk-KGZF2VO3.js";
|
|
28
|
+
import {
|
|
29
|
+
projectTagProjectId
|
|
30
|
+
} from "./chunk-J6BH2OBA.js";
|
|
31
|
+
import {
|
|
32
|
+
validateBriefingFormat
|
|
33
|
+
} from "./chunk-4WZ3J7M6.js";
|
|
34
|
+
import {
|
|
35
|
+
resolvePrincipal
|
|
36
|
+
} from "./chunk-UZYLX7M6.js";
|
|
37
|
+
import {
|
|
38
|
+
expandTildePath
|
|
39
|
+
} from "./chunk-EYIEWJNI.js";
|
|
40
|
+
|
|
41
|
+
// src/access-operations-batch.ts
|
|
42
|
+
import { randomUUID } from "crypto";
|
|
43
|
+
import { z } from "zod";
|
|
44
|
+
function stripNulls(data) {
|
|
45
|
+
if (data !== null && typeof data === "object" && !Array.isArray(data)) {
|
|
46
|
+
const obj = data;
|
|
47
|
+
const cleaned = {};
|
|
48
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
49
|
+
if (value !== null) cleaned[key] = value;
|
|
50
|
+
}
|
|
51
|
+
return cleaned;
|
|
52
|
+
}
|
|
53
|
+
return data;
|
|
54
|
+
}
|
|
55
|
+
function strictSchema(shape) {
|
|
56
|
+
return z.preprocess(stripNulls, z.object(shape).passthrough());
|
|
57
|
+
}
|
|
58
|
+
function optStr(v) {
|
|
59
|
+
return typeof v === "string" ? v : void 0;
|
|
60
|
+
}
|
|
61
|
+
function defStr(v, d) {
|
|
62
|
+
return typeof v === "string" ? v : d;
|
|
63
|
+
}
|
|
64
|
+
function optNum(v) {
|
|
65
|
+
return typeof v === "number" && Number.isFinite(v) ? v : void 0;
|
|
66
|
+
}
|
|
67
|
+
function optBool(v) {
|
|
68
|
+
return typeof v === "boolean" ? v : void 0;
|
|
69
|
+
}
|
|
70
|
+
function optStrArr(v) {
|
|
71
|
+
return Array.isArray(v) && v.every((x) => typeof x === "string") ? v : void 0;
|
|
72
|
+
}
|
|
73
|
+
var S = {
|
|
74
|
+
str: z.string().optional(),
|
|
75
|
+
num: z.number().optional(),
|
|
76
|
+
// Accept numbers and numeric strings (MCP clients sometimes send "7" for 7).
|
|
77
|
+
flexNum: z.union([z.number(), z.string()]).optional(),
|
|
78
|
+
bool: z.boolean().optional(),
|
|
79
|
+
strArr: z.array(z.string()).optional()
|
|
80
|
+
};
|
|
81
|
+
defineOperation({
|
|
82
|
+
name: "recall",
|
|
83
|
+
description: "Semantic recall.",
|
|
84
|
+
schema: strictSchema({ query: S.str, sessionKey: S.str, namespace: S.str, topK: S.num, mode: S.str, includeDebug: S.bool, disclosure: S.str, cwd: S.str, projectTag: S.str, asOf: S.str, tags: S.strArr, tagMatch: S.str }),
|
|
85
|
+
handler: async (input, ctx) => {
|
|
86
|
+
let disclosure;
|
|
87
|
+
if (input.disclosure !== void 0) {
|
|
88
|
+
if (typeof input.disclosure !== "string") throw new EngramAccessInputError("disclosure must be a string");
|
|
89
|
+
disclosure = input.disclosure;
|
|
90
|
+
}
|
|
91
|
+
if (input.cwd !== void 0 && typeof input.cwd !== "string") throw new EngramAccessInputError("cwd must be a string");
|
|
92
|
+
if (input.projectTag !== void 0 && typeof input.projectTag !== "string") throw new EngramAccessInputError("projectTag must be a string");
|
|
93
|
+
if (input.asOf !== void 0 && typeof input.asOf !== "string") throw new EngramAccessInputError("asOf must be a string");
|
|
94
|
+
let tags;
|
|
95
|
+
if (input.tags !== void 0) {
|
|
96
|
+
if (!Array.isArray(input.tags) || !input.tags.every((t) => typeof t === "string")) throw new EngramAccessInputError("tags must be an array of strings");
|
|
97
|
+
tags = input.tags;
|
|
98
|
+
}
|
|
99
|
+
let tagMatch;
|
|
100
|
+
if (input.tagMatch !== void 0) {
|
|
101
|
+
if (input.tagMatch !== "any" && input.tagMatch !== "all") throw new EngramAccessInputError("tagMatch must be one of: any, all");
|
|
102
|
+
tagMatch = input.tagMatch;
|
|
103
|
+
}
|
|
104
|
+
const result = await ctx.service.recall({ query: typeof input.query === "string" ? input.query : "", sessionKey: optStr(input.sessionKey), authenticatedPrincipal: ctx.authenticatedPrincipal, namespace: optStr(input.namespace), topK: optNum(input.topK), mode: optStr(input.mode), includeDebug: input.includeDebug === true, disclosure, cwd: optStr(input.cwd), projectTag: optStr(input.projectTag), asOf: optStr(input.asOf), ...tags ? { tags } : {}, ...tagMatch ? { tagMatch } : {} });
|
|
105
|
+
return { result };
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
defineOperation({ name: "recall_explain", description: "Explain recall plan.", schema: strictSchema({ sessionKey: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.recallExplain({ sessionKey: optStr(input.sessionKey), namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });
|
|
109
|
+
defineOperation({
|
|
110
|
+
name: "set_coding_context",
|
|
111
|
+
description: "Set coding context.",
|
|
112
|
+
schema: z.preprocess((data) => {
|
|
113
|
+
if (data !== null && typeof data === "object" && !Array.isArray(data)) {
|
|
114
|
+
const o = data;
|
|
115
|
+
const c = {};
|
|
116
|
+
for (const [k, v] of Object.entries(o)) {
|
|
117
|
+
if (v !== null || k === "codingContext") c[k] = v;
|
|
118
|
+
}
|
|
119
|
+
return c;
|
|
120
|
+
}
|
|
121
|
+
return data;
|
|
122
|
+
}, z.object({ sessionKey: S.str, codingContext: z.union([z.null(), z.object({ projectId: S.str, branch: z.union([z.string(), z.null()]).optional(), rootPath: S.str, defaultBranch: z.union([z.string(), z.null()]).optional() }).passthrough()]).optional(), projectTag: S.str }).passthrough()),
|
|
123
|
+
handler: async (input, ctx) => {
|
|
124
|
+
const sessionKey = defStr(input.sessionKey, "");
|
|
125
|
+
const projectTag = optStr(input.projectTag);
|
|
126
|
+
const hasProjectTag = projectTag !== void 0 && projectTag.trim().length > 0;
|
|
127
|
+
const hasCodingContext = "codingContext" in input;
|
|
128
|
+
if (!hasCodingContext && hasProjectTag) {
|
|
129
|
+
const tag = projectTag.trim();
|
|
130
|
+
const pid = projectTagProjectId(tag);
|
|
131
|
+
ctx.service.setCodingContext({ sessionKey, codingContext: { projectId: pid, branch: null, rootPath: pid, defaultBranch: null } });
|
|
132
|
+
return { result: { ok: true } };
|
|
133
|
+
}
|
|
134
|
+
if (!hasCodingContext && !hasProjectTag) throw new EngramAccessInputError("set_coding_context requires either codingContext or projectTag");
|
|
135
|
+
const rawCtx = input.codingContext;
|
|
136
|
+
let codingContext = null;
|
|
137
|
+
if (rawCtx !== null) {
|
|
138
|
+
if (typeof rawCtx !== "object") throw new EngramAccessInputError("codingContext must be an object or null");
|
|
139
|
+
const o = rawCtx;
|
|
140
|
+
const branch = o.branch === null ? null : optStr(o.branch);
|
|
141
|
+
const dB = o.defaultBranch === null ? null : optStr(o.defaultBranch);
|
|
142
|
+
if (branch === void 0) throw new EngramAccessInputError("codingContext.branch must be a string or null");
|
|
143
|
+
if (dB === void 0) throw new EngramAccessInputError("codingContext.defaultBranch must be a string or null");
|
|
144
|
+
codingContext = { projectId: defStr(o.projectId, ""), branch, rootPath: defStr(o.rootPath, ""), defaultBranch: dB };
|
|
145
|
+
}
|
|
146
|
+
ctx.service.setCodingContext({ sessionKey, codingContext });
|
|
147
|
+
return { result: { ok: true } };
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
defineOperation({ name: "recall_tier_explain", description: "Explain recall tiers.", schema: strictSchema({ sessionKey: S.str, namespace: S.str }), handler: async (input, ctx) => {
|
|
151
|
+
const sk = optStr(input.sessionKey);
|
|
152
|
+
const ns = optStr(input.namespace);
|
|
153
|
+
return { result: await ctx.service.recallTierExplain(sk && sk.length > 0 ? sk : void 0, ns && ns.length > 0 ? ns : void 0, ctx.authenticatedPrincipal) };
|
|
154
|
+
} });
|
|
155
|
+
defineOperation({
|
|
156
|
+
name: "recall_xray",
|
|
157
|
+
description: "X-ray recall.",
|
|
158
|
+
schema: strictSchema({ query: S.str, sessionKey: S.str, namespace: S.str, budget: z.unknown().optional(), disclosure: S.str }),
|
|
159
|
+
handler: async (input, ctx) => {
|
|
160
|
+
let budget;
|
|
161
|
+
if (input.budget !== void 0) {
|
|
162
|
+
const p = typeof input.budget === "number" ? input.budget : typeof input.budget === "string" ? Number(input.budget) : void 0;
|
|
163
|
+
if (p === void 0 || !Number.isFinite(p) || p <= 0 || !Number.isInteger(p)) throw new EngramAccessInputError("recall_xray: budget expects a positive integer");
|
|
164
|
+
budget = p;
|
|
165
|
+
}
|
|
166
|
+
const dr = optStr(input.disclosure);
|
|
167
|
+
return { result: await ctx.service.recallXray({ query: defStr(input.query, ""), sessionKey: optStr(input.sessionKey), namespace: optStr(input.namespace), budget, authenticatedPrincipal: ctx.authenticatedPrincipal, ...dr && dr !== "" ? { disclosure: dr } : {} }) };
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
defineOperation({ name: "wearables_status", description: "Wearables status.", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.wearablesStatus() }) });
|
|
171
|
+
defineOperation({ name: "wearables_sync", description: "Sync wearables.", schema: strictSchema({ source: S.str, date: S.str, days: S.flexNum, forceMemories: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.wearablesSync({ source: optStr(input.source), date: optStr(input.date), days: typeof input.days === "number" ? input.days : typeof input.days === "string" && Number.isFinite(Number(input.days)) ? Number(input.days) : void 0, forceMemories: optBool(input.forceMemories) }) }) });
|
|
172
|
+
defineOperation({ name: "transcript_day", description: "Transcript for a day.", schema: strictSchema({ date: S.str, source: S.str }), handler: async (input, ctx) => {
|
|
173
|
+
const d = defStr(input.date, "");
|
|
174
|
+
if (d.trim().length === 0) throw new EngramAccessInputError("transcript_day: date is required (YYYY-MM-DD)");
|
|
175
|
+
return { result: await ctx.service.wearablesTranscriptDay({ date: d, source: optStr(input.source) }) };
|
|
176
|
+
} });
|
|
177
|
+
defineOperation({ name: "transcript_search", description: "Search transcripts.", schema: strictSchema({ query: S.str, source: S.str, from: S.str, to: S.str, limit: S.flexNum }), handler: async (input, ctx) => {
|
|
178
|
+
const q = defStr(input.query, "");
|
|
179
|
+
if (q.trim().length === 0) throw new EngramAccessInputError("transcript_search: query is required");
|
|
180
|
+
return { result: await ctx.service.wearablesTranscriptSearch({ query: q, source: optStr(input.source), from: optStr(input.from), to: optStr(input.to), limit: typeof input.limit === "number" ? input.limit : typeof input.limit === "string" && Number.isFinite(Number(input.limit)) ? Number(input.limit) : void 0 }) };
|
|
181
|
+
} });
|
|
182
|
+
defineOperation({ name: "transcript_memories", description: "Transcript memories.", schema: strictSchema({ source: S.str, date: S.str, limit: S.flexNum }), handler: async (input, ctx) => ({ result: await ctx.service.wearablesTranscriptMemories({ source: optStr(input.source), date: optStr(input.date), limit: typeof input.limit === "number" ? input.limit : typeof input.limit === "string" && Number.isFinite(Number(input.limit)) ? Number(input.limit) : void 0 }) }) });
|
|
183
|
+
defineOperation({ name: "action_confidence", description: "Action confidence.", schema: strictSchema({ intendedAction: S.str, confidence: S.num, risk: S.str, contextReadiness: S.str, currentContextScopes: S.strArr, userRules: z.array(z.unknown()).optional(), retrievedMemories: z.array(z.unknown()).optional() }), handler: async (input, ctx) => {
|
|
184
|
+
const req = {};
|
|
185
|
+
if (input.intendedAction !== void 0) req.intendedAction = optStr(input.intendedAction);
|
|
186
|
+
if (input.confidence !== void 0) req.confidence = optNum(input.confidence);
|
|
187
|
+
if (input.risk !== void 0) req.risk = optStr(input.risk);
|
|
188
|
+
if (input.contextReadiness !== void 0) req.contextReadiness = optStr(input.contextReadiness);
|
|
189
|
+
if (input.currentContextScopes !== void 0) req.currentContextScopes = optStrArr(input.currentContextScopes);
|
|
190
|
+
if (input.userRules !== void 0) req.userRules = input.userRules;
|
|
191
|
+
if (input.retrievedMemories !== void 0) req.retrievedMemories = input.retrievedMemories;
|
|
192
|
+
return { result: await ctx.service.actionConfidence(req) };
|
|
193
|
+
} });
|
|
194
|
+
defineOperation({
|
|
195
|
+
name: "chatgpt_memory_inspector",
|
|
196
|
+
description: "Memory inspector.",
|
|
197
|
+
schema: strictSchema({ query: S.str, sessionKey: S.str, namespace: S.str, currentContextScopes: S.strArr, allowUnverifiedPreview: S.bool }),
|
|
198
|
+
handler: async (input, ctx) => {
|
|
199
|
+
const q = defStr(input.query, "");
|
|
200
|
+
if (q.trim().length === 0) throw new EngramAccessInputError("chatgpt_memory_inspector requires a non-empty query string");
|
|
201
|
+
const ii = { query: q.trim() };
|
|
202
|
+
if (typeof input.sessionKey === "string" && input.sessionKey.trim().length > 0) ii.sessionKey = input.sessionKey;
|
|
203
|
+
if (typeof input.namespace === "string" && input.namespace.trim().length > 0) ii.namespace = input.namespace;
|
|
204
|
+
if (input.currentContextScopes !== void 0) ii.currentContextScopes = input.currentContextScopes;
|
|
205
|
+
if (input.allowUnverifiedPreview !== void 0) ii.allowUnverifiedPreview = input.allowUnverifiedPreview;
|
|
206
|
+
const rsk = ii.sessionKey ?? (ctx.authenticatedPrincipal ? "remnic:chatgpt-memory-inspector:" + randomUUID() : void 0);
|
|
207
|
+
const xr = await ctx.service.recallXray({ query: ii.query, sessionKey: rsk, namespace: ii.namespace, currentContextScopes: ii.currentContextScopes, authenticatedPrincipal: ctx.authenticatedPrincipal, mode: "full", disclosure: "chunk", includeRecall: true });
|
|
208
|
+
const x = xr.snapshotFound === true ? xr.snapshot ?? null : null;
|
|
209
|
+
const r = xr.recall ?? { query: ii.query, namespace: ii.namespace ?? x?.namespace ?? "global", context: "", count: 0, memoryIds: [], results: [], fallbackUsed: false, sourcesUsed: [], disclosure: "chunk" };
|
|
210
|
+
const ac = await ctx.service.actionConfidence(buildChatGptMemoryInspectorActionRequest(ii, r, x));
|
|
211
|
+
return { result: buildChatGptMemoryInspectorResult(ii, r, x, ac) };
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
defineOperation({ name: "day_summary", description: "Day summary.", schema: strictSchema({ memories: S.str, sessionKey: S.str, namespace: S.str, timeZone: S.str, cwd: S.str, projectTag: S.str }), handler: async (input, ctx) => {
|
|
215
|
+
const req = {};
|
|
216
|
+
if (input.memories !== void 0) req.memories = optStr(input.memories);
|
|
217
|
+
if (input.sessionKey !== void 0) req.sessionKey = optStr(input.sessionKey);
|
|
218
|
+
if (input.namespace !== void 0) req.namespace = optStr(input.namespace);
|
|
219
|
+
if (input.timeZone !== void 0) req.timeZone = optStr(input.timeZone);
|
|
220
|
+
return { result: await ctx.service.daySummary(req) };
|
|
221
|
+
} });
|
|
222
|
+
defineOperation({ name: "capsule_export", description: "Export capsule.", schema: strictSchema({ name: S.str, namespace: S.str, since: S.str, includeKinds: S.strArr, peerIds: S.strArr, includeTranscripts: S.bool, encrypt: S.bool, cwd: S.str, projectTag: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.capsuleExport({ name: optStr(input.name) ?? "", namespace: optStr(input.namespace), since: optStr(input.since), includeKinds: optStrArr(input.includeKinds), peerIds: optStrArr(input.peerIds), includeTranscripts: optBool(input.includeTranscripts), encrypt: optBool(input.encrypt), principal: ctx.authenticatedPrincipal }) }) });
|
|
223
|
+
defineOperation({ name: "capsule_import", description: "Import capsule.", schema: strictSchema({ archivePath: S.str, namespace: S.str, mode: S.str, passphrase: S.str, cwd: S.str, projectTag: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.capsuleImport({ archivePath: expandTildePath(optStr(input.archivePath) ?? ""), namespace: optStr(input.namespace), mode: optStr(input.mode), passphrase: optStr(input.passphrase), principal: ctx.authenticatedPrincipal }) }) });
|
|
224
|
+
defineOperation({ name: "capsule_list", description: "List capsules.", schema: strictSchema({ namespace: S.str, sessionKey: S.str, cwd: S.str, projectTag: S.str }), handler: async (input, ctx) => {
|
|
225
|
+
const rp = ctx.authenticatedPrincipal ?? (typeof input.sessionKey === "string" && input.sessionKey.length > 0 && ctx.service.configRef ? resolvePrincipal(input.sessionKey, ctx.service.configRef) : void 0);
|
|
226
|
+
return { result: await ctx.service.capsuleList({ namespace: optStr(input.namespace), principal: rp }) };
|
|
227
|
+
} });
|
|
228
|
+
defineOperation({ name: "memory_governance_run", description: "Run governance.", schema: strictSchema({ namespace: S.str, mode: S.str, recentDays: S.num, maxMemories: S.num, batchSize: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.governanceRun({ namespace: optStr(input.namespace), mode: optStr(input.mode) === "apply" ? "apply" : "shadow", recentDays: optNum(input.recentDays), maxMemories: optNum(input.maxMemories), batchSize: optNum(input.batchSize), authenticatedPrincipal: ctx.authenticatedPrincipal }, ctx.authenticatedPrincipal) }) });
|
|
229
|
+
defineOperation({ name: "procedure_mining_run", description: "Run procedure mining.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.procedureMiningRun({ namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }, ctx.authenticatedPrincipal) }) });
|
|
230
|
+
defineOperation({ name: "pattern_reinforcement_run", description: "Run pattern reinforcement.", schema: strictSchema({ namespace: S.str, force: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.patternReinforcementRun({ namespace: optStr(input.namespace), force: input.force === true, authenticatedPrincipal: ctx.authenticatedPrincipal }, ctx.authenticatedPrincipal) }) });
|
|
231
|
+
defineOperation({ name: "procedural_stats", description: "Procedural stats.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.procedureStats({ namespace: optStr(input.namespace) }, ctx.authenticatedPrincipal) }) });
|
|
232
|
+
defineOperation({ name: "memory_timeline", description: "Memory timeline.", schema: strictSchema({ memoryId: S.str, namespace: S.str, limit: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.memoryTimeline(optStr(input.memoryId) ?? "", optStr(input.namespace), optNum(input.limit) ?? 200, ctx.authenticatedPrincipal) }) });
|
|
233
|
+
defineOperation({ name: "suggestion_submit", description: "Submit suggestion.", schema: strictSchema({ schemaVersion: S.num, idempotencyKey: S.str, dryRun: S.bool, sessionKey: S.str, content: S.str, category: S.str, confidence: S.num, namespace: S.str, tags: S.strArr, entityRef: S.str, ttl: S.str, sourceReason: S.str, cwd: S.str, projectTag: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.suggestionSubmit({ schemaVersion: optNum(input.schemaVersion), idempotencyKey: optStr(input.idempotencyKey), dryRun: input.dryRun === true, sessionKey: optStr(input.sessionKey), authenticatedPrincipal: ctx.authenticatedPrincipal, content: optStr(input.content) ?? "", category: optStr(input.category), confidence: optNum(input.confidence), namespace: optStr(input.namespace), tags: optStrArr(input.tags), entityRef: optStr(input.entityRef), ttl: optStr(input.ttl), sourceReason: optStr(input.sourceReason), cwd: optStr(input.cwd), projectTag: optStr(input.projectTag) }) }) });
|
|
234
|
+
defineOperation({ name: "entity_get", description: "Get entity.", schema: strictSchema({ name: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.entityGet(optStr(input.name) ?? "", optStr(input.namespace)) }) });
|
|
235
|
+
defineOperation({ name: "review_queue_list", description: "List review queue.", schema: strictSchema({ runId: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.reviewQueue(optStr(input.runId) ?? "", optStr(input.namespace), ctx.authenticatedPrincipal) }) });
|
|
236
|
+
defineOperation({
|
|
237
|
+
name: "observe",
|
|
238
|
+
description: "Observe messages.",
|
|
239
|
+
schema: strictSchema({ sessionKey: S.str, messages: z.array(z.object({ role: z.string(), content: z.string(), parts: z.array(z.unknown()).optional(), rawContent: z.unknown().optional(), sourceFormat: z.string().optional() }).passthrough()), skipExtraction: S.bool, idempotencyKey: S.str, namespace: S.str, cwd: S.str, projectTag: S.str }),
|
|
240
|
+
handler: async (input, ctx) => ({ result: await ctx.service.observe({ sessionKey: defStr(input.sessionKey, ""), messages: input.messages.map((m) => {
|
|
241
|
+
const r = m;
|
|
242
|
+
return { role: String(r.role), content: String(r.content), parts: r.parts, rawContent: r.rawContent, sourceFormat: r.sourceFormat };
|
|
243
|
+
}), skipExtraction: input.skipExtraction === true, idempotencyKey: optStr(input.idempotencyKey), namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal, cwd: optStr(input.cwd), projectTag: optStr(input.projectTag) }, ctx.hooks?.enforceWriteQuota ? { enforceWriteQuota: ctx.hooks.enforceWriteQuota } : void 0) })
|
|
244
|
+
});
|
|
245
|
+
defineOperation({ name: "lcm_search", description: "Search LCM.", schema: strictSchema({ query: S.str, sessionKey: S.str, sessionPrefix: S.str, namespace: S.str, limit: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.lcmSearch({ query: defStr(input.query, ""), sessionKey: optStr(input.sessionKey), sessionPrefix: optStr(input.sessionPrefix), namespace: optStr(input.namespace), limit: optNum(input.limit), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });
|
|
246
|
+
defineOperation({ name: "lcm_compaction_flush", description: "Flush LCM compaction.", schema: strictSchema({ sessionKey: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.lcmCompactionFlush({ sessionKey: optStr(input.sessionKey) ?? "", namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });
|
|
247
|
+
defineOperation({ name: "lcm_compaction_record", description: "Record LCM compaction.", schema: strictSchema({ sessionKey: S.str, namespace: S.str, tokensBefore: S.num, tokensAfter: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.lcmCompactionRecord({ sessionKey: optStr(input.sessionKey) ?? "", namespace: optStr(input.namespace), tokensBefore: optNum(input.tokensBefore) ?? 0, tokensAfter: optNum(input.tokensAfter) ?? 0, authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });
|
|
248
|
+
defineOperation({ name: "continuity_audit_generate", description: "Continuity audit.", schema: strictSchema({ period: S.str, key: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.continuityAuditGenerate({ period: optStr(input.period) === "monthly" ? "monthly" : optStr(input.period) === "weekly" ? "weekly" : void 0, key: optStr(input.key) }) }) });
|
|
249
|
+
defineOperation({ name: "continuity_incident_open", description: "Open incident.", schema: strictSchema({ symptom: S.str, namespace: S.str, triggerWindow: S.str, suspectedCause: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.continuityIncidentOpen({ symptom: optStr(input.symptom) ?? "", namespace: optStr(input.namespace), triggerWindow: optStr(input.triggerWindow), suspectedCause: optStr(input.suspectedCause), principal: ctx.authenticatedPrincipal }) }) });
|
|
250
|
+
defineOperation({ name: "continuity_incident_close", description: "Close incident.", schema: strictSchema({ id: S.str, namespace: S.str, fixApplied: S.str, verificationResult: S.str, preventiveRule: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.continuityIncidentClose({ id: optStr(input.id) ?? "", namespace: optStr(input.namespace), fixApplied: optStr(input.fixApplied) ?? "", verificationResult: optStr(input.verificationResult) ?? "", preventiveRule: optStr(input.preventiveRule), principal: ctx.authenticatedPrincipal }) }) });
|
|
251
|
+
defineOperation({ name: "continuity_incident_list", description: "List incidents.", schema: strictSchema({ state: S.str, namespace: S.str, limit: S.num }), handler: async (input, ctx) => {
|
|
252
|
+
const st = optStr(input.state);
|
|
253
|
+
return { result: await ctx.service.continuityIncidentList({ state: st === "closed" ? "closed" : st === "all" ? "all" : st === "open" ? "open" : void 0, namespace: optStr(input.namespace), limit: optNum(input.limit), principal: ctx.authenticatedPrincipal }) };
|
|
254
|
+
} });
|
|
255
|
+
defineOperation({ name: "continuity_loop_add_or_update", description: "Add/update loop.", schema: strictSchema({ id: S.str, cadence: S.str, purpose: S.str, status: S.str, killCondition: S.str, namespace: S.str, lastReviewed: S.str, notes: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.continuityLoopAddOrUpdate({ id: optStr(input.id) ?? "", cadence: optStr(input.cadence) ?? "weekly", purpose: optStr(input.purpose) ?? "", status: optStr(input.status) ?? "active", killCondition: optStr(input.killCondition) ?? "", namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal, lastReviewed: optStr(input.lastReviewed), notes: optStr(input.notes) }) }) });
|
|
256
|
+
defineOperation({ name: "continuity_loop_review", description: "Review loop.", schema: strictSchema({ id: S.str, namespace: S.str, status: S.str, notes: S.str, reviewedAt: S.str }), handler: async (input, ctx) => {
|
|
257
|
+
const st = optStr(input.status);
|
|
258
|
+
return { result: await ctx.service.continuityLoopReview({ id: optStr(input.id) ?? "", namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal, status: st === "active" || st === "paused" || st === "retired" ? st : void 0, notes: optStr(input.notes), reviewedAt: optStr(input.reviewedAt) }) };
|
|
259
|
+
} });
|
|
260
|
+
defineOperation({ name: "identity_anchor_get", description: "Get identity anchor.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.identityAnchorGet({ namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) }) });
|
|
261
|
+
defineOperation({ name: "identity_anchor_update", description: "Update identity anchor.", schema: strictSchema({ namespace: S.str, identityTraits: S.str, communicationPreferences: S.str, operatingPrinciples: S.str, continuityNotes: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.identityAnchorUpdate({ namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal, identityTraits: optStr(input.identityTraits), communicationPreferences: optStr(input.communicationPreferences), operatingPrinciples: optStr(input.operatingPrinciples), continuityNotes: optStr(input.continuityNotes) }) }) });
|
|
262
|
+
defineOperation({ name: "memory_identity", description: "Memory identity.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.memoryIdentity({ namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) }) });
|
|
263
|
+
defineOperation({ name: "work_task", description: "Manage work task.", schema: strictSchema({ action: S.str, id: S.str, title: S.str, description: S.str, status: S.str, priority: S.str, owner: S.str, assignee: S.str, projectId: S.str, tags: S.strArr, dueAt: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.workTask({ action: optStr(input.action) ?? "list", id: optStr(input.id), title: optStr(input.title), description: optStr(input.description), status: optStr(input.status), priority: optStr(input.priority), owner: optStr(input.owner), assignee: optStr(input.assignee), projectId: optStr(input.projectId), tags: optStrArr(input.tags), dueAt: optStr(input.dueAt) }) }) });
|
|
264
|
+
defineOperation({ name: "work_project", description: "Manage work project.", schema: strictSchema({ action: S.str, id: S.str, name: S.str, description: S.str, status: S.str, owner: S.str, tags: S.strArr, taskId: S.str, projectId: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.workProject({ action: optStr(input.action) ?? "list", id: optStr(input.id), name: optStr(input.name), description: optStr(input.description), status: optStr(input.status), owner: optStr(input.owner), tags: optStrArr(input.tags), taskId: optStr(input.taskId), projectId: optStr(input.projectId) }) }) });
|
|
265
|
+
defineOperation({ name: "work_board", description: "Manage work board.", schema: strictSchema({ action: S.str, projectId: S.str, snapshotJson: S.str, linkToMemory: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.workBoard({ action: optStr(input.action) ?? "export_markdown", projectId: optStr(input.projectId) ?? "", snapshotJson: optStr(input.snapshotJson) ?? "", linkToMemory: input.linkToMemory === true }) }) });
|
|
266
|
+
defineOperation({ name: "shared_context_write_output", description: "Write shared output.", schema: strictSchema({ agentId: S.str, title: S.str, content: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.sharedContextWriteOutput({ agentId: optStr(input.agentId) ?? "", title: optStr(input.title) ?? "", content: optStr(input.content) ?? "" }) }) });
|
|
267
|
+
defineOperation({ name: "shared_feedback_record", description: "Record shared feedback.", schema: strictSchema({ agent: S.str, decision: S.str, reason: S.str, date: S.str, learning: S.str, outcome: S.str, severity: S.str, confidence: S.num, workflow: S.str, tags: S.strArr, evidenceWindowStart: S.str, evidenceWindowEnd: S.str, refs: S.strArr }), handler: async (input, ctx) => {
|
|
268
|
+
const sv = optStr(input.severity);
|
|
269
|
+
return { result: await ctx.service.sharedFeedbackRecord({ agent: optStr(input.agent) ?? "", decision: optStr(input.decision) ?? "approved", reason: optStr(input.reason) ?? "", date: optStr(input.date), learning: optStr(input.learning), outcome: optStr(input.outcome), severity: sv === "low" || sv === "medium" || sv === "high" ? sv : void 0, confidence: optNum(input.confidence), workflow: optStr(input.workflow), tags: optStrArr(input.tags), evidenceWindowStart: optStr(input.evidenceWindowStart), evidenceWindowEnd: optStr(input.evidenceWindowEnd), refs: optStrArr(input.refs) }) };
|
|
270
|
+
} });
|
|
271
|
+
defineOperation({ name: "shared_priorities_append", description: "Append priorities.", schema: strictSchema({ agentId: S.str, text: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.sharedPrioritiesAppend({ agentId: optStr(input.agentId) ?? "", text: optStr(input.text) ?? "" }) }) });
|
|
272
|
+
defineOperation({ name: "shared_context_cross_signals_run", description: "Run cross signals.", schema: strictSchema({ date: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.sharedContextCrossSignalsRun({ date: optStr(input.date) }) }) });
|
|
273
|
+
defineOperation({ name: "shared_context_curate_daily", description: "Curate daily.", schema: strictSchema({ date: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.sharedContextCurateDaily({ date: optStr(input.date) }) }) });
|
|
274
|
+
defineOperation({ name: "compounding_weekly_synthesize", description: "Weekly synthesize.", schema: strictSchema({ weekId: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.compoundingWeeklySynthesize({ weekId: optStr(input.weekId) }) }) });
|
|
275
|
+
defineOperation({ name: "compounding_promote_candidate", description: "Promote candidate.", schema: strictSchema({ weekId: S.str, candidateId: S.str, dryRun: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.compoundingPromoteCandidate({ weekId: optStr(input.weekId) ?? "", candidateId: optStr(input.candidateId) ?? "", dryRun: input.dryRun === true }) }) });
|
|
276
|
+
defineOperation({ name: "compression_guidelines_optimize", description: "Optimize guidelines.", schema: strictSchema({ dryRun: S.bool, eventLimit: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.compressionGuidelinesOptimize({ dryRun: input.dryRun === true, eventLimit: optNum(input.eventLimit) }) }) });
|
|
277
|
+
defineOperation({ name: "compression_guidelines_activate", description: "Activate guidelines.", schema: strictSchema({ expectedContentHash: S.str, expectedGuidelineVersion: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.compressionGuidelinesActivate({ expectedContentHash: optStr(input.expectedContentHash), expectedGuidelineVersion: optNum(input.expectedGuidelineVersion) }) }) });
|
|
278
|
+
defineOperation({ name: "memory_profile", description: "Memory profile.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.memoryProfile(optStr(input.namespace), ctx.authenticatedPrincipal) }) });
|
|
279
|
+
defineOperation({ name: "memory_entities_list", description: "List entities.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.memoryEntitiesList(optStr(input.namespace), ctx.authenticatedPrincipal) }) });
|
|
280
|
+
defineOperation({ name: "memory_questions", description: "Memory questions.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.memoryQuestions(optStr(input.namespace), ctx.authenticatedPrincipal) }) });
|
|
281
|
+
defineOperation({ name: "memory_last_recall", description: "Last recall.", schema: strictSchema({ sessionKey: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.lastRecallSnapshot(optStr(input.sessionKey)) }) });
|
|
282
|
+
defineOperation({ name: "memory_intent_debug", description: "Debug intent.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.intentDebug(optStr(input.namespace)) }) });
|
|
283
|
+
defineOperation({ name: "memory_qmd_debug", description: "Debug QMD.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.qmdDebug(optStr(input.namespace)) }) });
|
|
284
|
+
defineOperation({ name: "memory_graph_explain", description: "Explain graph.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.graphExplainLastRecall(optStr(input.namespace)) }) });
|
|
285
|
+
defineOperation({ name: "graph_snapshot", description: "Graph snapshot.", schema: strictSchema({ namespace: S.str, limit: S.num, since: S.str, focusNodeId: S.str, categories: S.strArr }), handler: async (input, ctx) => ({ result: await ctx.service.graphSnapshot({ namespace: optStr(input.namespace), limit: optNum(input.limit), since: optStr(input.since), focusNodeId: optStr(input.focusNodeId), categories: optStrArr(input.categories) }, ctx.authenticatedPrincipal) }) });
|
|
286
|
+
defineOperation({ name: "memory_feedback", description: "Record feedback.", schema: strictSchema({ memoryId: S.str, vote: S.str, note: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.memoryFeedback({ memoryId: optStr(input.memoryId) ?? "", vote: optStr(input.vote) === "down" ? "down" : "up", note: optStr(input.note) }) }) });
|
|
287
|
+
defineOperation({ name: "memory_promote", description: "Promote memory.", schema: strictSchema({ memoryId: S.str, namespace: S.str, sessionKey: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.memoryPromote({ memoryId: optStr(input.memoryId) ?? "", namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey), principal: ctx.authenticatedPrincipal }) }) });
|
|
288
|
+
defineOperation({ name: "memory_outcome", description: "Record outcome.", schema: strictSchema({ memoryId: S.str, outcome: S.str, namespace: S.str, sessionKey: S.str, timestamp: S.str }), handler: async (input, ctx) => {
|
|
289
|
+
const o = optStr(input.outcome);
|
|
290
|
+
if (o !== "success" && o !== "failure") throw new EngramAccessInputError('memory_outcome: outcome must be "success" or "failure"; got ' + JSON.stringify(o));
|
|
291
|
+
return { result: await ctx.service.memoryOutcome({ memoryId: optStr(input.memoryId) ?? "", outcome: o, namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey), timestamp: optStr(input.timestamp), principal: ctx.authenticatedPrincipal }) };
|
|
292
|
+
} });
|
|
293
|
+
defineOperation({ name: "memory_action_apply", description: "Apply action.", schema: strictSchema({ action: S.str, outcome: S.str, reason: S.str, memoryId: S.str, namespace: S.str, sessionKey: S.str, content: S.str, category: S.str, linkTargetId: S.str, linkType: S.str, linkStrength: S.num, artifactType: S.str, execute: S.bool, sourcePrompt: S.str, dryRun: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.memoryActionApply({ action: optStr(input.action) ?? "", outcome: optStr(input.outcome), reason: optStr(input.reason), memoryId: optStr(input.memoryId) ?? "", namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey), content: optStr(input.content), category: optStr(input.category), linkTargetId: optStr(input.linkTargetId), linkType: optStr(input.linkType), linkStrength: optNum(input.linkStrength), artifactType: optStr(input.artifactType), execute: optBool(input.execute), sourcePrompt: optStr(input.sourcePrompt), dryRun: input.dryRun === true, principal: ctx.authenticatedPrincipal }) }) });
|
|
294
|
+
defineOperation({ name: "context_checkpoint", description: "Context checkpoint.", schema: strictSchema({ sessionKey: S.str, context: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.contextCheckpoint({ sessionKey: optStr(input.sessionKey) ?? "", context: optStr(input.context) ?? "", namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) }) });
|
|
295
|
+
defineOperation({ name: "briefing", description: "Daily briefing.", schema: strictSchema({ since: S.str, focus: S.str, namespace: S.str, format: S.str, maxFollowups: S.num }), handler: async (input, ctx) => {
|
|
296
|
+
const rf = optStr(input.format);
|
|
297
|
+
const fe = validateBriefingFormat(rf);
|
|
298
|
+
if (fe) throw new EngramAccessInputError(fe);
|
|
299
|
+
return { result: await ctx.service.briefing({ since: optStr(input.since), focus: optStr(input.focus), namespace: optStr(input.namespace), format: rf, maxFollowups: optNum(input.maxFollowups), principal: ctx.authenticatedPrincipal }) };
|
|
300
|
+
} });
|
|
301
|
+
defineOperation({
|
|
302
|
+
name: "review_list",
|
|
303
|
+
description: "List review pairs.",
|
|
304
|
+
schema: strictSchema({ filter: S.str, namespace: S.str, limit: S.num }),
|
|
305
|
+
handler: async (input, ctx) => {
|
|
306
|
+
const VF = /* @__PURE__ */ new Set(["all", "unresolved", "contradicts", "independent", "duplicates", "needs-user"]);
|
|
307
|
+
const rf = optStr(input.filter) ?? "unresolved";
|
|
308
|
+
if (!VF.has(rf)) throw new EngramAccessInputError("Invalid filter '" + rf + "'. Valid: " + [...VF].join(", "));
|
|
309
|
+
const ns = optStr(input.namespace);
|
|
310
|
+
const resolved = await ctx.service.getReadableStorageForNamespace(ns, ctx.authenticatedPrincipal);
|
|
311
|
+
const rn = ctx.service.configRef.namespacesEnabled ? resolved.namespace : void 0;
|
|
312
|
+
const iun = Boolean(rn && isDefaultReviewNamespace(ctx.service.configRef.defaultNamespace, ns, rn));
|
|
313
|
+
return { result: await listPairs(ctx.service.memoryDir, { filter: rf, namespace: rn, includeUnscopedForNamespace: iun, limit: optNum(input.limit) ?? 50 }) };
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
defineOperation({
|
|
317
|
+
name: "review_resolve",
|
|
318
|
+
description: "Resolve pair.",
|
|
319
|
+
schema: strictSchema({ pairId: S.str, verb: S.str, mergedMemoryId: S.str, mergedContent: S.str }),
|
|
320
|
+
handler: async (input, ctx) => {
|
|
321
|
+
const pid = defStr(input.pairId, "");
|
|
322
|
+
const vb = defStr(input.verb, "");
|
|
323
|
+
if (!pid) throw new EngramAccessInputError("pairId is required");
|
|
324
|
+
if (!vb) throw new EngramAccessInputError("verb is required");
|
|
325
|
+
if (!isValidResolutionVerb(vb)) throw new EngramAccessInputError("Invalid verb: " + vb);
|
|
326
|
+
return { result: await executeResolution(ctx.service.memoryDir, ctx.service.storageRef, pid, vb, { mergedMemoryId: optStr(input.mergedMemoryId), mergedContent: optStr(input.mergedContent), storageForNamespace: async (namespace) => {
|
|
327
|
+
const r = await ctx.service.getWritableStorageForNamespace(namespace, ctx.authenticatedPrincipal);
|
|
328
|
+
return r.storage;
|
|
329
|
+
}, onMergedMemoryWritten: () => {
|
|
330
|
+
} }) };
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
defineOperation({ name: "contradiction_scan_run", description: "Run scan.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await runContradictionScan({ storage: ctx.service.storageRef, config: ctx.service.configRef, memoryDir: ctx.service.memoryDir, embeddingLookupFactory: ctx.service.embeddingLookupFactoryRef, storageForNamespace: (ns) => ctx.service.getWritableStorageForNamespace(ns ?? void 0, ctx.authenticatedPrincipal), localLlm: ctx.service.localLlmRef, fallbackLlm: ctx.service.fallbackLlmRef, namespace: optStr(input.namespace) }) }) });
|
|
334
|
+
defineOperation({ name: "graph_edge_decay_run", description: "Run edge decay.", schema: strictSchema({ dryRun: S.bool }), handler: async (input, ctx) => {
|
|
335
|
+
const cfg = ctx.service.configRef;
|
|
336
|
+
if (!cfg.graphEdgeDecayEnabled) return { result: { ranAt: (/* @__PURE__ */ new Date()).toISOString(), disabled: true, reason: "graphEdgeDecayEnabled is false" } };
|
|
337
|
+
return { result: { results: await runGraphEdgeDecayMaintenanceAcrossNamespaces(ctx.service.memoryDir, { windowMs: cfg.graphEdgeDecayWindowMs, perWindow: cfg.graphEdgeDecayPerWindow, floor: cfg.graphEdgeDecayFloor, visibilityThreshold: cfg.graphEdgeDecayVisibilityThreshold, dryRun: input.dryRun === true, namespacesEnabled: cfg.namespacesEnabled === true, defaultNamespace: cfg.defaultNamespace }) } };
|
|
338
|
+
} });
|
|
339
|
+
defineOperation({ name: "memory_summarize_hourly", description: "Hourly summarize.", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.memorySummarizeHourly() }) });
|
|
340
|
+
defineOperation({ name: "conversation_index_update", description: "Update conv index.", schema: strictSchema({ sessionKey: S.str, hours: S.num, embed: S.bool }), handler: async (input, ctx) => {
|
|
341
|
+
if (input.sessionKey !== void 0 && typeof input.sessionKey !== "string") throw new EngramAccessInputError("sessionKey must be a string when provided");
|
|
342
|
+
return { result: await ctx.service.conversationIndexUpdate({ sessionKey: optStr(input.sessionKey), hours: optNum(input.hours), embed: optBool(input.embed) }) };
|
|
343
|
+
} });
|
|
344
|
+
defineOperation({ name: "profiling_report", description: "Profiling report.", schema: strictSchema({ format: S.str, limit: S.num }), handler: async (input, ctx) => {
|
|
345
|
+
if (input.format !== void 0 && typeof input.format !== "string") throw new EngramAccessInputError("format must be a string when provided");
|
|
346
|
+
if (input.limit !== void 0 && typeof input.limit !== "number") throw new EngramAccessInputError("limit must be a number when provided");
|
|
347
|
+
return { result: await ctx.service.profilingReport({ format: optStr(input.format), limit: optNum(input.limit) }) };
|
|
348
|
+
} });
|
|
349
|
+
defineOperation({ name: "live_connectors_run", description: "Run connectors.", schema: strictSchema({ force: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.liveConnectorsRun({ authenticatedPrincipal: ctx.authenticatedPrincipal, force: input.force === true }, ctx.authenticatedPrincipal) }) });
|
|
350
|
+
defineOperation({ name: "peer_list", description: "List peers.", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.peerList() }) });
|
|
351
|
+
defineOperation({ name: "peer_get", description: "Get peer.", schema: strictSchema({ id: S.str }), handler: async (input, ctx) => {
|
|
352
|
+
const id = defStr(input.id, "");
|
|
353
|
+
if (!id) throw new EngramAccessInputError("peer_get: id is required");
|
|
354
|
+
return { result: await ctx.service.peerGet(id) };
|
|
355
|
+
} });
|
|
356
|
+
defineOperation({ name: "peer_set", description: "Set peer.", schema: strictSchema({ id: S.str, kind: S.str, displayName: S.str, notes: S.str }), handler: async (input, ctx) => {
|
|
357
|
+
const id = defStr(input.id, "");
|
|
358
|
+
if (!id) throw new EngramAccessInputError("peer_set: id is required");
|
|
359
|
+
if (input.kind !== void 0 && typeof input.kind !== "string") throw new EngramAccessInputError("peer_set: kind must be a string when provided");
|
|
360
|
+
if (input.displayName !== void 0 && typeof input.displayName !== "string") throw new EngramAccessInputError("peer_set: displayName must be a string when provided");
|
|
361
|
+
if (input.notes !== void 0 && typeof input.notes !== "string") throw new EngramAccessInputError("peer_set: notes must be a string when provided");
|
|
362
|
+
return { result: await ctx.service.peerSet({ id, kind: optStr(input.kind), displayName: optStr(input.displayName), notes: optStr(input.notes) }) };
|
|
363
|
+
} });
|
|
364
|
+
defineOperation({ name: "peer_delete", description: "Delete peer.", schema: strictSchema({ id: S.str }), handler: async (input, ctx) => {
|
|
365
|
+
const id = defStr(input.id, "");
|
|
366
|
+
if (!id) throw new EngramAccessInputError("peer_delete: id is required");
|
|
367
|
+
return { result: await ctx.service.peerDelete(id) };
|
|
368
|
+
} });
|
|
369
|
+
defineOperation({ name: "peer_profile_get", description: "Get peer profile.", schema: strictSchema({ id: S.str }), handler: async (input, ctx) => {
|
|
370
|
+
const id = defStr(input.id, "");
|
|
371
|
+
if (!id) throw new EngramAccessInputError("peer_profile_get: id is required");
|
|
372
|
+
return { result: await ctx.service.peerProfileGet(id) };
|
|
373
|
+
} });
|
|
374
|
+
defineOperation({ name: "peer_forget", description: "Forget peer.", schema: strictSchema({ id: S.str, confirm: S.str }), handler: async (input, ctx) => {
|
|
375
|
+
const id = defStr(input.id, "");
|
|
376
|
+
if (!id) throw new EngramAccessInputError("peer_forget: id is required");
|
|
377
|
+
const c = optStr(input.confirm) ?? "";
|
|
378
|
+
if (c !== "yes") throw new EngramAccessInputError("peer_forget: confirm must be 'yes' to prevent accidental data loss");
|
|
379
|
+
return { result: await ctx.service.peerForget(id, { confirm: "yes" }) };
|
|
380
|
+
} });
|
|
381
|
+
defineOperation({ name: "console_state", description: "Console state.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.consoleState(optStr(input.namespace), ctx.authenticatedPrincipal) }) });
|
|
382
|
+
defineOperation({ name: "dreams_status", description: "Dreams status.", schema: strictSchema({ windowHours: S.num, namespace: S.str }), handler: async (input, ctx) => {
|
|
383
|
+
let wh = 24;
|
|
384
|
+
try {
|
|
385
|
+
wh = normalizeDreamsStatusWindowHours(input.windowHours);
|
|
386
|
+
} catch {
|
|
387
|
+
throw new EngramAccessInputError("dreams_status: windowHours must be a positive integer. Got: " + String(input.windowHours));
|
|
388
|
+
}
|
|
389
|
+
return { result: await ctx.service.dreamsStatus({ windowHours: wh, namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) };
|
|
390
|
+
} });
|
|
391
|
+
defineOperation({ name: "dreams_run", description: "Run dreams.", schema: strictSchema({ phase: S.str, dryRun: S.bool, namespace: S.str }), handler: async (input, ctx) => {
|
|
392
|
+
const VP = ["lightSleep", "rem", "deepSleep"];
|
|
393
|
+
const ph = optStr(input.phase) ?? "";
|
|
394
|
+
if (!ph || !VP.includes(ph)) throw new EngramAccessInputError("dreams_run: phase must be one of: " + VP.join(", "));
|
|
395
|
+
if (input.dryRun !== void 0 && typeof input.dryRun !== "boolean") throw new EngramAccessInputError("dreams_run: dryRun must be boolean");
|
|
396
|
+
return { result: await ctx.service.dreamsRun({ phase: ph, dryRun: input.dryRun === true, namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) };
|
|
397
|
+
} });
|
|
398
|
+
defineOperation({ name: "correction_pending", description: "List pending corrections (HTTP GET).", schema: strictSchema({ namespace: S.str, sessionKey: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.correctionListPending({ namespace: optStr(input.namespace), sessionKey: optStr(input.sessionKey), principal: ctx.authenticatedPrincipal }) }) });
|
|
399
|
+
defineOperation({ name: "offline_sync_snapshot", description: "Offline sync snapshot.", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.offlineSyncSnapshot() }) });
|
|
400
|
+
defineOperation({ name: "offline_sync_files", description: "Offline sync files.", schema: strictSchema({ paths: S.strArr, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.offlineSyncFiles({ paths: optStrArr(input.paths) ?? [], namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) }) });
|
|
401
|
+
defineOperation({ name: "offline_sync_file_content", description: "Read file content.", schema: strictSchema({ path: S.str, namespace: S.str, offset: S.num, length: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.offlineSyncFileContent({ path: optStr(input.path) ?? "", namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal, offset: optNum(input.offset), length: optNum(input.length) }) }) });
|
|
402
|
+
defineOperation({ name: "offline_sync_apply_file_content", description: "Apply file content.", schema: strictSchema({ sourceId: S.str, path: S.str, sha256: S.str, bytes: S.num, mtimeMs: S.num, offset: S.num, baseSha256: S.str, content: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.offlineSyncApplyFileContent({ sourceId: optStr(input.sourceId) ?? "", path: optStr(input.path) ?? "", sha256: optStr(input.sha256) ?? "", bytes: optNum(input.bytes) ?? 0, mtimeMs: optNum(input.mtimeMs) ?? 0, offset: optNum(input.offset), baseSha256: optStr(input.baseSha256), content: Buffer.from(defStr(input.content, ""), "base64"), namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) }) });
|
|
403
|
+
defineOperation({ name: "offline_sync_apply", description: "Apply sync.", schema: strictSchema({ changeset: z.unknown().optional(), namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.offlineSyncApply({ changeset: input.changeset, namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) }) });
|
|
404
|
+
defineOperation({ name: "lcm_status", description: "LCM status.", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.lcmStatus() }) });
|
|
405
|
+
defineOperation({ name: "memory_list", description: "List memories.", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.memoryBrowse() }) });
|
|
406
|
+
defineOperation({ name: "entity_list", description: "List entities.", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.entityList() }) });
|
|
407
|
+
defineOperation({ name: "maintenance_status", description: "Maintenance status.", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.maintenance() }) });
|
|
408
|
+
defineOperation({ name: "quality_status", description: "Quality status.", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.quality() }) });
|
|
409
|
+
defineOperation({ name: "trust_zones_status", description: "Trust-zone status.", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.trustZoneStatus() }) });
|
|
410
|
+
defineOperation({ name: "trust_zones_records", description: "Browse trust-zone records.", schema: strictSchema({ namespace: S.str, limit: S.num, offset: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.trustZoneBrowse({ namespace: optStr(input.namespace), limit: optNum(input.limit), offset: optNum(input.offset) }, ctx.authenticatedPrincipal) }) });
|
|
411
|
+
defineOperation({ name: "review_disposition", description: "Review disposition.", schema: strictSchema({ memoryId: S.str, status: S.str, reasonCode: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.reviewDisposition({ memoryId: optStr(input.memoryId) ?? "", status: optStr(input.status) ?? "archived", reasonCode: optStr(input.reasonCode) ?? "", namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });
|
|
412
|
+
defineOperation({ name: "trust_zones_promote", description: "Promote trust-zone.", schema: strictSchema({ recordId: S.str, targetZone: S.str, promotionReason: S.str, dryRun: S.bool, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.trustZonePromote({ recordId: optStr(input.recordId) ?? "", targetZone: optStr(input.targetZone) ?? "working", promotionReason: optStr(input.promotionReason) ?? "", dryRun: input.dryRun === true, namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });
|
|
413
|
+
defineOperation({ name: "trust_zones_demo_seed", description: "Demo seed.", schema: strictSchema({ scenario: S.str, dryRun: S.bool, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.trustZoneDemoSeed({ scenario: optStr(input.scenario), dryRun: input.dryRun === true, namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });
|
|
414
|
+
defineOperation({ name: "citations_observed", description: "Record citations.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
|
|
415
|
+
defineOperation({ name: "contradiction_detail", description: "Contradiction detail.", schema: strictSchema({ id: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await listPairs(ctx.service.memoryDir, { filter: "all", namespace: optStr(input.namespace), includeUnscopedForNamespace: false, limit: 1 }) }) });
|
|
416
|
+
defineOperation({ name: "offline_sync_snapshot_stream", description: "SSE stream.", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.offlineSyncSnapshotStream() }) });
|
|
417
|
+
defineOperation({ name: "graph_events", description: "SSE graph events.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { stream: "sse" } }) });
|
|
418
|
+
defineOperation({ name: "chat_message", description: "Chat message.", schema: strictSchema({ message: S.str, chatSessionId: S.str }), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
|
|
419
|
+
defineOperation({ name: "chat_events", description: "SSE chat events.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { stream: "sse" } }) });
|
|
420
|
+
//# sourceMappingURL=chunk-VI5SGGXB.js.map
|