@remnic/core 9.3.722 → 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.
Files changed (268) hide show
  1. package/dist/access-boundary.d.ts +6 -11
  2. package/dist/access-boundary.js +9 -9
  3. package/dist/access-cli.js +29 -23
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +5 -5
  6. package/dist/access-http.js +19 -14
  7. package/dist/access-mcp.d.ts +5 -5
  8. package/dist/access-mcp.js +18 -13
  9. package/dist/access-operations-batch.js +16 -10
  10. package/dist/access-operations.d.ts +5 -5
  11. package/dist/access-operations.js +17 -11
  12. package/dist/{access-service-Dj3I-VBS.d.ts → access-service-B2PlPtxh.d.ts} +3 -3
  13. package/dist/access-service.d.ts +5 -5
  14. package/dist/access-service.js +8 -8
  15. package/dist/access-surface-catalog.d.ts +5 -5
  16. package/dist/access-surface-catalog.js +82 -82
  17. package/dist/access-surface-catalog.js.map +1 -1
  18. package/dist/action-confidence.d.ts +1 -1
  19. package/dist/active-memory-bridge.d.ts +1 -1
  20. package/dist/active-recall.d.ts +1 -1
  21. package/dist/behavior-learner.d.ts +1 -1
  22. package/dist/behavior-signals.d.ts +1 -1
  23. package/dist/bootstrap.d.ts +4 -4
  24. package/dist/briefing.d.ts +1 -1
  25. package/dist/briefing.js +3 -3
  26. package/dist/buffer-surprise-report.d.ts +1 -1
  27. package/dist/buffer.d.ts +1 -1
  28. package/dist/calibration.d.ts +1 -1
  29. package/dist/capabilities.d.ts +1 -1
  30. package/dist/{catalog-F-OEVbRQ.d.ts → catalog-CzUb-GyD.d.ts} +1 -1
  31. package/dist/causal-behavior.d.ts +1 -1
  32. package/dist/causal-consolidation.d.ts +1 -1
  33. package/dist/causal-consolidation.js +4 -4
  34. package/dist/causal-trajectory-graph.d.ts +1 -1
  35. package/dist/{chunk-EVPNWN7Z.js → chunk-4R3CGCI5.js} +2 -2
  36. package/dist/{chunk-UO5ZHIIH.js → chunk-4WZ3J7M6.js} +2 -2
  37. package/dist/{chunk-PD42EYQN.js → chunk-5OPYYPJN.js} +2 -2
  38. package/dist/{chunk-EEJMD2L2.js → chunk-6CWGS2LY.js} +2 -2
  39. package/dist/{chunk-7CTNUVHZ.js → chunk-6SQQOJ4U.js} +2 -2
  40. package/dist/{chunk-ILFSEIRT.js → chunk-7AG54AF3.js} +1 -1
  41. package/dist/{chunk-ILFSEIRT.js.map → chunk-7AG54AF3.js.map} +1 -1
  42. package/dist/{chunk-UIXXE6NI.js → chunk-C6BWLYW5.js} +24 -15
  43. package/dist/chunk-C6BWLYW5.js.map +1 -0
  44. package/dist/{chunk-A5XNBK2D.js → chunk-DF3I6JGP.js} +6 -6
  45. package/dist/{chunk-GJSL4WG2.js → chunk-F3XZN24Z.js} +2 -2
  46. package/dist/{chunk-J3JPB7ZI.js → chunk-FACTVMXQ.js} +2 -2
  47. package/dist/{chunk-B7WISIAJ.js → chunk-FN6QP7JQ.js} +154 -1067
  48. package/dist/chunk-FN6QP7JQ.js.map +1 -0
  49. package/dist/{chunk-EBDA5TYA.js → chunk-FXCIOLRB.js} +2 -2
  50. package/dist/{chunk-TXQCG6SE.js → chunk-H7HUQIY7.js} +3 -3
  51. package/dist/{chunk-QD6QP5P6.js → chunk-I2HL5M6T.js} +17 -17
  52. package/dist/{chunk-M7R5R6OJ.js → chunk-IAIPNEHD.js} +20 -2
  53. package/dist/{chunk-M7R5R6OJ.js.map → chunk-IAIPNEHD.js.map} +1 -1
  54. package/dist/{chunk-Z4RU5VPM.js → chunk-J334N6QV.js} +2 -2
  55. package/dist/{chunk-NXRUUDUF.js → chunk-JJJCVCCQ.js} +2 -2
  56. package/dist/{chunk-GDUOCHCD.js → chunk-KGZF2VO3.js} +10 -10
  57. package/dist/{chunk-LA3HZKES.js → chunk-KLFYKC3K.js} +448 -49
  58. package/dist/chunk-KLFYKC3K.js.map +1 -0
  59. package/dist/{chunk-LLUGAZ3B.js → chunk-NT36GU6X.js} +30 -4
  60. package/dist/chunk-NT36GU6X.js.map +1 -0
  61. package/dist/{chunk-OHTOPFRF.js → chunk-SC2YAWRF.js} +2 -2
  62. package/dist/{chunk-YEE5KJQQ.js → chunk-T55EGZSJ.js} +2 -2
  63. package/dist/{chunk-N77ELJ2D.js → chunk-TT5U3UDO.js} +4 -4
  64. package/dist/{chunk-6FAMMBQ3.js → chunk-UBHVAGO7.js} +2 -2
  65. package/dist/chunk-VI5SGGXB.js +420 -0
  66. package/dist/chunk-VI5SGGXB.js.map +1 -0
  67. package/dist/{chunk-EDOQM4E4.js → chunk-WAFDHKES.js} +2 -2
  68. package/dist/{chunk-EXUCUPV2.js → chunk-WM7DNKBD.js} +2 -2
  69. package/dist/{dreams-ledger-3WSCI5V4.js → chunk-YF6FMLBT.js} +5 -6
  70. package/dist/{dreams-ledger-3WSCI5V4.js.map → chunk-YF6FMLBT.js.map} +1 -1
  71. package/dist/{chunk-WQYSDPMA.js → chunk-YQMPUYHE.js} +2 -2
  72. package/dist/{chunk-5O42UKXI.js → chunk-YUYPWJD3.js} +2 -2
  73. package/dist/{chunk-VCLGUIFM.js → chunk-Z3FGC3QE.js} +2 -2
  74. package/dist/{chunk-A7TJZLPK.js → chunk-ZK2L72VN.js} +2 -2
  75. package/dist/{chunk-BXEOHV7K.js → chunk-ZOHMPFOB.js} +3 -3
  76. package/dist/{graph-edge-decay-QPRJQ7DL.js → chunk-ZQNCHPTZ.js} +4 -5
  77. package/dist/{graph-edge-decay-QPRJQ7DL.js.map → chunk-ZQNCHPTZ.js.map} +1 -1
  78. package/dist/{cli-P_GaYcCY.d.ts → cli-IOlDHSBT.d.ts} +3 -3
  79. package/dist/cli.d.ts +6 -6
  80. package/dist/cli.js +31 -26
  81. package/dist/compounding/engine.d.ts +1 -1
  82. package/dist/compounding/engine.js +3 -3
  83. package/dist/compounding/preference-consolidator.d.ts +1 -1
  84. package/dist/compression-optimizer.d.ts +1 -1
  85. package/dist/config.d.ts +1 -1
  86. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  87. package/dist/connectors/codex-materialize-runner.js +3 -3
  88. package/dist/connectors/codex-materialize.d.ts +1 -1
  89. package/dist/connectors/index.d.ts +1 -1
  90. package/dist/connectors/index.js +3 -3
  91. package/dist/consolidation-provenance-check.d.ts +1 -1
  92. package/dist/consolidation-undo.d.ts +1 -1
  93. package/dist/contradiction/index.d.ts +1 -1
  94. package/dist/conversation-index/backend.d.ts +1 -1
  95. package/dist/conversation-index/chunker.d.ts +1 -1
  96. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  97. package/dist/conversation-index/indexer.d.ts +1 -1
  98. package/dist/conversation-index/search.d.ts +1 -1
  99. package/dist/day-summary.d.ts +1 -1
  100. package/dist/delinearize.d.ts +1 -1
  101. package/dist/direct-answer-wiring.d.ts +1 -1
  102. package/dist/direct-answer.d.ts +1 -1
  103. package/dist/dreams-ledger-6UODQOX6.js +22 -0
  104. package/dist/dreams-ledger-6UODQOX6.js.map +1 -0
  105. package/dist/embedding-fallback.d.ts +1 -1
  106. package/dist/enrichment/index.d.ts +1 -1
  107. package/dist/entity-retrieval.d.ts +1 -1
  108. package/dist/entity-retrieval.js +3 -3
  109. package/dist/entity-schema.d.ts +1 -1
  110. package/dist/event-time.d.ts +33 -1
  111. package/dist/event-time.js +3 -1
  112. package/dist/explicit-capture.d.ts +4 -4
  113. package/dist/extraction-faithfulness.d.ts +1 -1
  114. package/dist/extraction-judge-telemetry.d.ts +1 -1
  115. package/dist/extraction-judge-training.d.ts +1 -1
  116. package/dist/extraction-judge.d.ts +1 -1
  117. package/dist/extraction.d.ts +1 -1
  118. package/dist/fallback-llm.d.ts +1 -1
  119. package/dist/graph-dashboard-diff.d.ts +1 -1
  120. package/dist/graph-dashboard-key.d.ts +1 -1
  121. package/dist/graph-dashboard-parser.d.ts +1 -1
  122. package/dist/graph-edge-decay-RXUCJIN4.js +22 -0
  123. package/dist/graph-edge-decay-RXUCJIN4.js.map +1 -0
  124. package/dist/graph-edge-reinforcement.d.ts +1 -1
  125. package/dist/graph-snapshot.d.ts +1 -1
  126. package/dist/graph.d.ts +1 -1
  127. package/dist/identity-continuity.d.ts +1 -1
  128. package/dist/importance.d.ts +1 -1
  129. package/dist/index.d.ts +9 -9
  130. package/dist/index.js +58 -56
  131. package/dist/index.js.map +1 -1
  132. package/dist/intent.d.ts +1 -1
  133. package/dist/lcm/engine.d.ts +1 -1
  134. package/dist/lcm/index.d.ts +1 -1
  135. package/dist/lcm/tools.d.ts +1 -1
  136. package/dist/lifecycle.d.ts +1 -1
  137. package/dist/live-connectors-runner.d.ts +1 -1
  138. package/dist/local-llm.d.ts +1 -1
  139. package/dist/local-model-endpoint.d.ts +1 -1
  140. package/dist/maintenance/memory-governance.d.ts +1 -1
  141. package/dist/maintenance/memory-governance.js +3 -3
  142. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  143. package/dist/maintenance/rebuild-memory-projection.js +4 -4
  144. package/dist/mcp-memory-inspector-app.d.ts +5 -5
  145. package/dist/memory-action-policy.d.ts +1 -1
  146. package/dist/memory-cache.d.ts +1 -1
  147. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  148. package/dist/memory-projection-store.d.ts +1 -1
  149. package/dist/memory-provenance.d.ts +1 -1
  150. package/dist/memory-worth-outcomes.d.ts +1 -1
  151. package/dist/models-json.d.ts +1 -1
  152. package/dist/namespaces/migrate.d.ts +2 -2
  153. package/dist/namespaces/migrate.js +4 -4
  154. package/dist/namespaces/principal.d.ts +1 -1
  155. package/dist/namespaces/search.d.ts +1 -1
  156. package/dist/namespaces/storage.d.ts +2 -2
  157. package/dist/namespaces/storage.js +3 -3
  158. package/dist/native-knowledge.d.ts +1 -1
  159. package/dist/operator-toolkit.d.ts +1 -1
  160. package/dist/operator-toolkit.js +8 -8
  161. package/dist/orchestration/maintenance.d.ts +2 -2
  162. package/dist/orchestration/maintenance.js +5 -5
  163. package/dist/{orchestrator-f5xv19kp.d.ts → orchestrator-C_OMSIMZ.d.ts} +34 -3
  164. package/dist/orchestrator.d.ts +4 -4
  165. package/dist/orchestrator.js +17 -17
  166. package/dist/patterns-cli.d.ts +1 -1
  167. package/dist/policy-runtime.d.ts +1 -1
  168. package/dist/provenance.d.ts +1 -1
  169. package/dist/qmd-recall-cache.d.ts +1 -1
  170. package/dist/qmd.d.ts +1 -1
  171. package/dist/recall-disclosure-escalation.d.ts +1 -1
  172. package/dist/recall-explain-renderer.d.ts +1 -1
  173. package/dist/recall-explain-renderer.js +3 -3
  174. package/dist/recall-planner-llm.d.ts +1 -1
  175. package/dist/recall-state.d.ts +1 -1
  176. package/dist/recall-tag-filter.d.ts +1 -1
  177. package/dist/recall-xray-cli.d.ts +1 -1
  178. package/dist/recall-xray-cli.js +4 -4
  179. package/dist/recall-xray-renderer.d.ts +1 -1
  180. package/dist/recall-xray-renderer.js +3 -3
  181. package/dist/recall-xray.d.ts +1 -1
  182. package/dist/recall-xray.js +2 -2
  183. package/dist/resolve-auth-token.d.ts +1 -1
  184. package/dist/retrieval-agents.d.ts +1 -1
  185. package/dist/retrieval-tiers.d.ts +1 -1
  186. package/dist/routing/engine.d.ts +1 -1
  187. package/dist/routing/store.d.ts +1 -1
  188. package/dist/search/embed-helper.d.ts +1 -1
  189. package/dist/search/factory.d.ts +1 -1
  190. package/dist/search/index.d.ts +1 -1
  191. package/dist/search/lancedb-backend.d.ts +1 -1
  192. package/dist/search/meilisearch-backend.d.ts +1 -1
  193. package/dist/search/noop-backend.d.ts +1 -1
  194. package/dist/search/orama-backend.d.ts +1 -1
  195. package/dist/search/port.d.ts +1 -1
  196. package/dist/search/remote-backend.d.ts +1 -1
  197. package/dist/{semantic-consolidation-BQm1e1Pn.d.ts → semantic-consolidation-B8LiYtvx.d.ts} +1 -1
  198. package/dist/semantic-consolidation.d.ts +2 -2
  199. package/dist/semantic-consolidation.js +4 -4
  200. package/dist/semantic-rule-promotion.js +3 -3
  201. package/dist/semantic-rule-verifier.d.ts +1 -1
  202. package/dist/semantic-rule-verifier.js +3 -3
  203. package/dist/session-observer-bands.d.ts +1 -1
  204. package/dist/session-observer-state.d.ts +1 -1
  205. package/dist/shared-context/manager.d.ts +1 -1
  206. package/dist/signal.d.ts +1 -1
  207. package/dist/storage.d.ts +1 -1
  208. package/dist/storage.js +2 -2
  209. package/dist/summarizer.d.ts +1 -1
  210. package/dist/summary-snapshot.d.ts +1 -1
  211. package/dist/temporal-supersession.d.ts +1 -1
  212. package/dist/temporal-validity.d.ts +1 -1
  213. package/dist/threading.d.ts +1 -1
  214. package/dist/tier-migration.d.ts +1 -1
  215. package/dist/tier-routing.d.ts +1 -1
  216. package/dist/topics.d.ts +1 -1
  217. package/dist/transcript.d.ts +1 -1
  218. package/dist/trust-score-stage.d.ts +1 -1
  219. package/dist/trust-score.d.ts +1 -1
  220. package/dist/{types-DwO1Ot4n.d.ts → types-DmTaqob2.d.ts} +14 -0
  221. package/dist/types.d.ts +1 -1
  222. package/dist/types.js +1 -1
  223. package/dist/utility-runtime.d.ts +1 -1
  224. package/dist/verified-recall.js +3 -3
  225. package/package.json +2 -2
  226. package/src/access-boundary.ts +36 -2
  227. package/src/access-http.ts +17 -8
  228. package/src/access-mcp.ts +149 -1189
  229. package/src/access-operations-batch.ts +227 -1439
  230. package/src/access-surface-catalog.test.ts +4 -15
  231. package/src/access-surface-catalog.ts +82 -82
  232. package/src/bitemporal-dedup-backfill.test.ts +169 -0
  233. package/src/event-time.ts +57 -0
  234. package/src/extraction-eventtime-wiring.test.ts +101 -1
  235. package/src/orchestrator.ts +238 -43
  236. package/src/recall/archive-scoring.ts +526 -0
  237. package/src/types.ts +14 -0
  238. package/dist/chunk-B7WISIAJ.js.map +0 -1
  239. package/dist/chunk-EM2LDXJ2.js +0 -1315
  240. package/dist/chunk-EM2LDXJ2.js.map +0 -1
  241. package/dist/chunk-LA3HZKES.js.map +0 -1
  242. package/dist/chunk-LLUGAZ3B.js.map +0 -1
  243. package/dist/chunk-UIXXE6NI.js.map +0 -1
  244. /package/dist/{chunk-EVPNWN7Z.js.map → chunk-4R3CGCI5.js.map} +0 -0
  245. /package/dist/{chunk-UO5ZHIIH.js.map → chunk-4WZ3J7M6.js.map} +0 -0
  246. /package/dist/{chunk-PD42EYQN.js.map → chunk-5OPYYPJN.js.map} +0 -0
  247. /package/dist/{chunk-EEJMD2L2.js.map → chunk-6CWGS2LY.js.map} +0 -0
  248. /package/dist/{chunk-7CTNUVHZ.js.map → chunk-6SQQOJ4U.js.map} +0 -0
  249. /package/dist/{chunk-A5XNBK2D.js.map → chunk-DF3I6JGP.js.map} +0 -0
  250. /package/dist/{chunk-GJSL4WG2.js.map → chunk-F3XZN24Z.js.map} +0 -0
  251. /package/dist/{chunk-J3JPB7ZI.js.map → chunk-FACTVMXQ.js.map} +0 -0
  252. /package/dist/{chunk-EBDA5TYA.js.map → chunk-FXCIOLRB.js.map} +0 -0
  253. /package/dist/{chunk-TXQCG6SE.js.map → chunk-H7HUQIY7.js.map} +0 -0
  254. /package/dist/{chunk-QD6QP5P6.js.map → chunk-I2HL5M6T.js.map} +0 -0
  255. /package/dist/{chunk-Z4RU5VPM.js.map → chunk-J334N6QV.js.map} +0 -0
  256. /package/dist/{chunk-NXRUUDUF.js.map → chunk-JJJCVCCQ.js.map} +0 -0
  257. /package/dist/{chunk-GDUOCHCD.js.map → chunk-KGZF2VO3.js.map} +0 -0
  258. /package/dist/{chunk-OHTOPFRF.js.map → chunk-SC2YAWRF.js.map} +0 -0
  259. /package/dist/{chunk-YEE5KJQQ.js.map → chunk-T55EGZSJ.js.map} +0 -0
  260. /package/dist/{chunk-N77ELJ2D.js.map → chunk-TT5U3UDO.js.map} +0 -0
  261. /package/dist/{chunk-6FAMMBQ3.js.map → chunk-UBHVAGO7.js.map} +0 -0
  262. /package/dist/{chunk-EDOQM4E4.js.map → chunk-WAFDHKES.js.map} +0 -0
  263. /package/dist/{chunk-EXUCUPV2.js.map → chunk-WM7DNKBD.js.map} +0 -0
  264. /package/dist/{chunk-WQYSDPMA.js.map → chunk-YQMPUYHE.js.map} +0 -0
  265. /package/dist/{chunk-5O42UKXI.js.map → chunk-YUYPWJD3.js.map} +0 -0
  266. /package/dist/{chunk-VCLGUIFM.js.map → chunk-Z3FGC3QE.js.map} +0 -0
  267. /package/dist/{chunk-A7TJZLPK.js.map → chunk-ZK2L72VN.js.map} +0 -0
  268. /package/dist/{chunk-BXEOHV7K.js.map → chunk-ZOHMPFOB.js.map} +0 -0
@@ -1,1315 +0,0 @@
1
- import {
2
- defineOperation
3
- } from "./chunk-LLUGAZ3B.js";
4
- import {
5
- EngramAccessInputError
6
- } from "./chunk-GDUOCHCD.js";
7
- import {
8
- projectTagProjectId
9
- } from "./chunk-J6BH2OBA.js";
10
- import {
11
- expandTildePath
12
- } from "./chunk-EYIEWJNI.js";
13
-
14
- // src/access-operations-batch.ts
15
- import { z } from "zod";
16
- function stripNulls(data) {
17
- if (data !== null && typeof data === "object" && !Array.isArray(data)) {
18
- const obj = data;
19
- const cleaned = {};
20
- for (const [key, value] of Object.entries(obj)) {
21
- if (value !== null) cleaned[key] = value;
22
- }
23
- return cleaned;
24
- }
25
- return data;
26
- }
27
- var looseSchema = z.preprocess(
28
- stripNulls,
29
- z.record(z.string(), z.unknown())
30
- );
31
- function optStr(v) {
32
- return typeof v === "string" ? v : void 0;
33
- }
34
- function defStr(v, d) {
35
- return typeof v === "string" ? v : d;
36
- }
37
- function optNum(v) {
38
- return typeof v === "number" && Number.isFinite(v) ? v : void 0;
39
- }
40
- function optBool(v) {
41
- return typeof v === "boolean" ? v : void 0;
42
- }
43
- function optStrArr(v) {
44
- return Array.isArray(v) && v.every((x) => typeof x === "string") ? v : void 0;
45
- }
46
- defineOperation({
47
- name: "recall",
48
- description: "Semantic recall across memories.",
49
- schema: looseSchema,
50
- handler: async (input, ctx) => {
51
- const result = await ctx.service.recall({
52
- query: defStr(input.query, ""),
53
- sessionKey: optStr(input.sessionKey),
54
- authenticatedPrincipal: ctx.authenticatedPrincipal,
55
- namespace: optStr(input.namespace),
56
- topK: optNum(input.topK),
57
- mode: optStr(input.mode),
58
- includeDebug: input.includeDebug === true,
59
- disclosure: optStr(input.disclosure),
60
- cwd: optStr(input.cwd),
61
- projectTag: optStr(input.projectTag),
62
- asOf: optStr(input.asOf),
63
- ...optStrArr(input.tags) !== void 0 ? { tags: optStrArr(input.tags) } : {},
64
- ...optStr(input.tagMatch) !== void 0 ? { tagMatch: optStr(input.tagMatch) } : {}
65
- });
66
- return { result };
67
- }
68
- });
69
- defineOperation({
70
- name: "recall_explain",
71
- description: "Explain the recall plan for the session.",
72
- schema: looseSchema,
73
- handler: async (input, ctx) => {
74
- const result = await ctx.service.recallExplain({
75
- sessionKey: optStr(input.sessionKey),
76
- namespace: optStr(input.namespace),
77
- authenticatedPrincipal: ctx.authenticatedPrincipal
78
- });
79
- return { result };
80
- }
81
- });
82
- defineOperation({
83
- name: "set_coding_context",
84
- description: "Set the coding context for a session (issue #569).",
85
- schema: looseSchema,
86
- handler: async (input, ctx) => {
87
- const sessionKey = defStr(input.sessionKey, "");
88
- const projectTag = optStr(input.projectTag);
89
- const hasProjectTag = projectTag !== void 0 && projectTag.trim().length > 0;
90
- const hasCodingContext = "codingContext" in input;
91
- if (!hasCodingContext && hasProjectTag) {
92
- const tag = projectTag.trim();
93
- const projectId = projectTagProjectId(tag);
94
- ctx.service.setCodingContext({
95
- sessionKey,
96
- codingContext: { projectId, branch: null, rootPath: projectId, defaultBranch: null }
97
- });
98
- return { result: { ok: true } };
99
- }
100
- if (!hasCodingContext && !hasProjectTag) {
101
- throw new EngramAccessInputError("set_coding_context requires either codingContext or projectTag");
102
- }
103
- const rawCtx = input.codingContext;
104
- let codingContext = null;
105
- if (rawCtx !== null) {
106
- if (typeof rawCtx !== "object" || rawCtx === void 0) {
107
- throw new EngramAccessInputError("codingContext must be an object or null");
108
- }
109
- const obj = rawCtx;
110
- const projectId = defStr(obj.projectId, "");
111
- const rootPath = defStr(obj.rootPath, "");
112
- const branch = obj.branch === null ? null : optStr(obj.branch);
113
- const defaultBranch = obj.defaultBranch === null ? null : optStr(obj.defaultBranch);
114
- if (branch === void 0) throw new EngramAccessInputError("codingContext.branch must be a string or null");
115
- if (defaultBranch === void 0) throw new EngramAccessInputError("codingContext.defaultBranch must be a string or null");
116
- codingContext = { projectId, branch, rootPath, defaultBranch };
117
- }
118
- ctx.service.setCodingContext({ sessionKey, codingContext });
119
- return { result: { ok: true } };
120
- }
121
- });
122
- defineOperation({
123
- name: "recall_tier_explain",
124
- description: "Explain the recall tier breakdown.",
125
- schema: looseSchema,
126
- handler: async (input, ctx) => {
127
- const sessionKey = optStr(input.sessionKey);
128
- const namespace = optStr(input.namespace);
129
- const result = await ctx.service.recallTierExplain(
130
- sessionKey !== void 0 && sessionKey.length > 0 ? sessionKey : void 0,
131
- namespace !== void 0 && namespace.length > 0 ? namespace : void 0,
132
- ctx.authenticatedPrincipal
133
- );
134
- return { result };
135
- }
136
- });
137
- defineOperation({
138
- name: "recall_xray",
139
- description: "X-ray the recall pipeline for a query.",
140
- schema: looseSchema,
141
- handler: async (input, ctx) => {
142
- const budgetRaw = input.budget;
143
- let budget;
144
- if (budgetRaw !== void 0 && budgetRaw !== null) {
145
- const parsed = typeof budgetRaw === "number" ? budgetRaw : typeof budgetRaw === "string" ? Number(budgetRaw) : void 0;
146
- if (parsed === void 0 || !Number.isFinite(parsed) || parsed <= 0 || !Number.isInteger(parsed)) {
147
- throw new EngramAccessInputError("recall_xray: budget expects a positive integer");
148
- }
149
- budget = parsed;
150
- }
151
- const disclosureRaw = optStr(input.disclosure);
152
- const result = await ctx.service.recallXray({
153
- query: defStr(input.query, ""),
154
- sessionKey: optStr(input.sessionKey),
155
- namespace: optStr(input.namespace),
156
- budget,
157
- authenticatedPrincipal: ctx.authenticatedPrincipal,
158
- ...disclosureRaw !== void 0 && disclosureRaw !== "" ? { disclosure: disclosureRaw } : {}
159
- });
160
- return { result };
161
- }
162
- });
163
- defineOperation({
164
- name: "wearables_status",
165
- description: "Get wearables sync status.",
166
- schema: looseSchema,
167
- handler: async (_input, ctx) => ({ result: await ctx.service.wearablesStatus() })
168
- });
169
- defineOperation({
170
- name: "wearables_sync",
171
- description: "Sync wearables data.",
172
- schema: looseSchema,
173
- handler: async (input, ctx) => {
174
- const result = await ctx.service.wearablesSync({
175
- source: optStr(input.source),
176
- date: optStr(input.date),
177
- days: optNum(input.days),
178
- forceMemories: optBool(input.forceMemories)
179
- });
180
- return { result };
181
- }
182
- });
183
- defineOperation({
184
- name: "transcript_day",
185
- description: "Get transcript for a specific day.",
186
- schema: looseSchema,
187
- handler: async (input, ctx) => {
188
- const date = defStr(input.date, "");
189
- if (date.trim().length === 0) throw new EngramAccessInputError("transcript_day: date is required and must be YYYY-MM-DD");
190
- const result = await ctx.service.wearablesTranscriptDay({ date, source: optStr(input.source) });
191
- return { result };
192
- }
193
- });
194
- defineOperation({
195
- name: "transcript_search",
196
- description: "Search transcripts.",
197
- schema: looseSchema,
198
- handler: async (input, ctx) => {
199
- const query = defStr(input.query, "");
200
- if (query.trim().length === 0) throw new EngramAccessInputError("transcript_search: query is required and must be non-empty");
201
- const result = await ctx.service.wearablesTranscriptSearch({
202
- query,
203
- source: optStr(input.source),
204
- from: optStr(input.from),
205
- to: optStr(input.to),
206
- limit: optNum(input.limit)
207
- });
208
- return { result };
209
- }
210
- });
211
- defineOperation({
212
- name: "transcript_memories",
213
- description: "Get transcript memories.",
214
- schema: looseSchema,
215
- handler: async (input, ctx) => {
216
- const result = await ctx.service.wearablesTranscriptMemories({
217
- source: optStr(input.source),
218
- date: optStr(input.date),
219
- limit: optNum(input.limit)
220
- });
221
- return { result };
222
- }
223
- });
224
- defineOperation({
225
- name: "action_confidence",
226
- description: "Get action confidence for recent memories.",
227
- schema: looseSchema,
228
- handler: async (input, ctx) => {
229
- const result = await ctx.service.actionConfidence({
230
- intendedAction: optStr(input.intendedAction),
231
- confidence: optNum(input.confidence),
232
- risk: optStr(input.risk),
233
- contextReadiness: optStr(input.contextReadiness),
234
- currentContextScopes: optStrArr(input.currentContextScopes)
235
- });
236
- return { result };
237
- }
238
- });
239
- defineOperation({
240
- name: "chatgpt_memory_inspector",
241
- description: "ChatGPT memory inspector (recall xray + action confidence orchestrator).",
242
- schema: looseSchema,
243
- handler: async (input, ctx) => {
244
- const xray = await ctx.service.recallXray({
245
- query: defStr(input.query, ""),
246
- sessionKey: optStr(input.sessionKey),
247
- namespace: optStr(input.namespace),
248
- authenticatedPrincipal: ctx.authenticatedPrincipal
249
- });
250
- const confidence = await ctx.service.actionConfidence({});
251
- return { result: { xray, confidence } };
252
- }
253
- });
254
- defineOperation({
255
- name: "day_summary",
256
- description: "Get a day summary.",
257
- schema: looseSchema,
258
- handler: async (input, ctx) => {
259
- const result = await ctx.service.daySummary({
260
- memories: optStr(input.memories),
261
- sessionKey: optStr(input.sessionKey),
262
- namespace: optStr(input.namespace),
263
- timeZone: optStr(input.timeZone)
264
- });
265
- return { result };
266
- }
267
- });
268
- defineOperation({
269
- name: "capsule_export",
270
- description: "Export a capsule.",
271
- schema: looseSchema,
272
- handler: async (input, ctx) => {
273
- const result = await ctx.service.capsuleExport({
274
- name: optStr(input.name) ?? "",
275
- namespace: optStr(input.namespace),
276
- since: optStr(input.since),
277
- includeKinds: optStrArr(input.includeKinds),
278
- peerIds: optStrArr(input.peerIds),
279
- includeTranscripts: optBool(input.includeTranscripts),
280
- encrypt: optBool(input.encrypt),
281
- principal: ctx.authenticatedPrincipal
282
- });
283
- return { result };
284
- }
285
- });
286
- defineOperation({
287
- name: "capsule_import",
288
- description: "Import a capsule.",
289
- schema: looseSchema,
290
- handler: async (input, ctx) => {
291
- const result = await ctx.service.capsuleImport({
292
- archivePath: expandTildePath(optStr(input.archivePath) ?? ""),
293
- namespace: optStr(input.namespace),
294
- mode: optStr(input.mode),
295
- passphrase: optStr(input.passphrase),
296
- principal: ctx.authenticatedPrincipal
297
- });
298
- return { result };
299
- }
300
- });
301
- defineOperation({
302
- name: "capsule_list",
303
- description: "List capsules.",
304
- schema: looseSchema,
305
- handler: async (input, ctx) => {
306
- const result = await ctx.service.capsuleList({
307
- namespace: optStr(input.namespace),
308
- principal: ctx.authenticatedPrincipal
309
- });
310
- return { result };
311
- }
312
- });
313
- defineOperation({
314
- name: "memory_governance_run",
315
- description: "Run memory governance.",
316
- schema: looseSchema,
317
- handler: async (input, ctx) => {
318
- const result = await ctx.service.governanceRun({
319
- namespace: optStr(input.namespace),
320
- mode: optStr(input.mode),
321
- recentDays: optNum(input.recentDays),
322
- maxMemories: optNum(input.maxMemories),
323
- batchSize: optNum(input.batchSize),
324
- authenticatedPrincipal: ctx.authenticatedPrincipal
325
- });
326
- return { result };
327
- }
328
- });
329
- defineOperation({
330
- name: "procedure_mining_run",
331
- description: "Run procedure mining.",
332
- schema: looseSchema,
333
- handler: async (input, ctx) => {
334
- const result = await ctx.service.procedureMiningRun({
335
- namespace: optStr(input.namespace),
336
- authenticatedPrincipal: ctx.authenticatedPrincipal
337
- });
338
- return { result };
339
- }
340
- });
341
- defineOperation({
342
- name: "pattern_reinforcement_run",
343
- description: "Run pattern reinforcement.",
344
- schema: looseSchema,
345
- handler: async (input, ctx) => {
346
- const result = await ctx.service.patternReinforcementRun({
347
- namespace: optStr(input.namespace),
348
- force: input.force === true,
349
- authenticatedPrincipal: ctx.authenticatedPrincipal
350
- });
351
- return { result };
352
- }
353
- });
354
- defineOperation({
355
- name: "procedural_stats",
356
- description: "Get procedural stats.",
357
- schema: looseSchema,
358
- handler: async (input, ctx) => {
359
- const result = await ctx.service.procedureStats({ namespace: optStr(input.namespace) }, ctx.authenticatedPrincipal);
360
- return { result };
361
- }
362
- });
363
- defineOperation({
364
- name: "memory_timeline",
365
- description: "Get the timeline for a memory.",
366
- schema: looseSchema,
367
- handler: async (input, ctx) => {
368
- const result = await ctx.service.memoryTimeline(
369
- optStr(input.memoryId) ?? "",
370
- optStr(input.namespace),
371
- optNum(input.limit),
372
- ctx.authenticatedPrincipal
373
- );
374
- return { result };
375
- }
376
- });
377
- defineOperation({
378
- name: "suggestion_submit",
379
- description: "Submit a memory suggestion.",
380
- schema: looseSchema,
381
- handler: async (input, ctx) => {
382
- const result = await ctx.service.suggestionSubmit({
383
- schemaVersion: optNum(input.schemaVersion),
384
- idempotencyKey: optStr(input.idempotencyKey),
385
- dryRun: input.dryRun === true,
386
- sessionKey: optStr(input.sessionKey),
387
- authenticatedPrincipal: ctx.authenticatedPrincipal,
388
- content: optStr(input.content) ?? "",
389
- category: optStr(input.category),
390
- confidence: optNum(input.confidence),
391
- namespace: optStr(input.namespace),
392
- tags: optStrArr(input.tags),
393
- entityRef: optStr(input.entityRef),
394
- ttl: optStr(input.ttl),
395
- sourceReason: optStr(input.sourceReason),
396
- cwd: optStr(input.cwd),
397
- projectTag: optStr(input.projectTag)
398
- });
399
- return { result };
400
- }
401
- });
402
- defineOperation({
403
- name: "entity_get",
404
- description: "Get an entity by name.",
405
- schema: looseSchema,
406
- handler: async (input, ctx) => {
407
- const result = await ctx.service.entityGet(optStr(input.name) ?? "", optStr(input.namespace));
408
- return { result };
409
- }
410
- });
411
- defineOperation({
412
- name: "review_queue_list",
413
- description: "List the review queue.",
414
- schema: looseSchema,
415
- handler: async (input, ctx) => {
416
- const result = await ctx.service.reviewQueue(optStr(input.runId) ?? "", optStr(input.namespace), ctx.authenticatedPrincipal);
417
- return { result };
418
- }
419
- });
420
- defineOperation({
421
- name: "observe",
422
- description: "Observe messages into the memory system.",
423
- schema: looseSchema,
424
- handler: async (input, ctx) => {
425
- const messages = input.messages;
426
- if (!Array.isArray(messages)) throw new EngramAccessInputError("observe: messages must be an array");
427
- const result = await ctx.service.observe({
428
- sessionKey: defStr(input.sessionKey, ""),
429
- messages,
430
- authenticatedPrincipal: ctx.authenticatedPrincipal,
431
- namespace: optStr(input.namespace),
432
- skipExtraction: input.skipExtraction === true,
433
- cwd: optStr(input.cwd),
434
- projectTag: optStr(input.projectTag)
435
- });
436
- return { result };
437
- }
438
- });
439
- defineOperation({
440
- name: "lcm_search",
441
- description: "Search the LCM (long-context memory).",
442
- schema: looseSchema,
443
- handler: async (input, ctx) => {
444
- const result = await ctx.service.lcmSearch({
445
- query: defStr(input.query, ""),
446
- sessionKey: optStr(input.sessionKey),
447
- sessionPrefix: optStr(input.sessionPrefix),
448
- namespace: optStr(input.namespace),
449
- limit: optNum(input.limit),
450
- authenticatedPrincipal: ctx.authenticatedPrincipal
451
- });
452
- return { result };
453
- }
454
- });
455
- defineOperation({
456
- name: "lcm_compaction_flush",
457
- description: "Flush LCM compaction.",
458
- schema: looseSchema,
459
- handler: async (input, ctx) => {
460
- const result = await ctx.service.lcmCompactionFlush({
461
- sessionKey: optStr(input.sessionKey) ?? "",
462
- namespace: optStr(input.namespace),
463
- authenticatedPrincipal: ctx.authenticatedPrincipal
464
- });
465
- return { result };
466
- }
467
- });
468
- defineOperation({
469
- name: "lcm_compaction_record",
470
- description: "Record an LCM compaction.",
471
- schema: looseSchema,
472
- handler: async (input, ctx) => {
473
- const result = await ctx.service.lcmCompactionRecord({
474
- sessionKey: optStr(input.sessionKey) ?? "",
475
- namespace: optStr(input.namespace),
476
- tokensBefore: optNum(input.tokensBefore) ?? 0,
477
- tokensAfter: optNum(input.tokensAfter) ?? 0,
478
- authenticatedPrincipal: ctx.authenticatedPrincipal
479
- });
480
- return { result };
481
- }
482
- });
483
- defineOperation({
484
- name: "continuity_audit_generate",
485
- description: "Generate a continuity audit.",
486
- schema: looseSchema,
487
- handler: async (input, ctx) => {
488
- const result = await ctx.service.continuityAuditGenerate({
489
- period: optStr(input.period),
490
- key: optStr(input.key)
491
- });
492
- return { result };
493
- }
494
- });
495
- defineOperation({
496
- name: "continuity_incident_open",
497
- description: "Open a continuity incident.",
498
- schema: looseSchema,
499
- handler: async (input, ctx) => {
500
- const result = await ctx.service.continuityIncidentOpen({
501
- symptom: optStr(input.symptom) ?? "",
502
- namespace: optStr(input.namespace),
503
- triggerWindow: optStr(input.triggerWindow),
504
- suspectedCause: optStr(input.suspectedCause),
505
- principal: ctx.authenticatedPrincipal
506
- });
507
- return { result };
508
- }
509
- });
510
- defineOperation({
511
- name: "continuity_incident_close",
512
- description: "Close a continuity incident.",
513
- schema: looseSchema,
514
- handler: async (input, ctx) => {
515
- const result = await ctx.service.continuityIncidentClose({
516
- id: optStr(input.id) ?? "",
517
- namespace: optStr(input.namespace),
518
- fixApplied: optStr(input.fixApplied) ?? "",
519
- verificationResult: optStr(input.verificationResult) ?? "",
520
- preventiveRule: optStr(input.preventiveRule),
521
- principal: ctx.authenticatedPrincipal
522
- });
523
- return { result };
524
- }
525
- });
526
- defineOperation({
527
- name: "continuity_incident_list",
528
- description: "List continuity incidents.",
529
- schema: looseSchema,
530
- handler: async (input, ctx) => {
531
- const result = await ctx.service.continuityIncidentList({
532
- state: optStr(input.state),
533
- namespace: optStr(input.namespace),
534
- limit: optNum(input.limit),
535
- principal: ctx.authenticatedPrincipal
536
- });
537
- return { result };
538
- }
539
- });
540
- defineOperation({
541
- name: "continuity_loop_add_or_update",
542
- description: "Add or update a continuity loop.",
543
- schema: looseSchema,
544
- handler: async (input, ctx) => {
545
- const result = await ctx.service.continuityLoopAddOrUpdate({
546
- id: optStr(input.id) ?? "",
547
- cadence: optStr(input.cadence),
548
- purpose: optStr(input.purpose) ?? "",
549
- status: optStr(input.status),
550
- killCondition: optStr(input.killCondition) ?? "",
551
- namespace: optStr(input.namespace),
552
- lastReviewed: optStr(input.lastReviewed),
553
- notes: optStr(input.notes),
554
- principal: ctx.authenticatedPrincipal
555
- });
556
- return { result };
557
- }
558
- });
559
- defineOperation({
560
- name: "continuity_loop_review",
561
- description: "Review a continuity loop.",
562
- schema: looseSchema,
563
- handler: async (input, ctx) => {
564
- const result = await ctx.service.continuityLoopReview({
565
- id: optStr(input.id) ?? "",
566
- namespace: optStr(input.namespace),
567
- status: optStr(input.status),
568
- notes: optStr(input.notes),
569
- reviewedAt: optStr(input.reviewedAt),
570
- principal: ctx.authenticatedPrincipal
571
- });
572
- return { result };
573
- }
574
- });
575
- defineOperation({
576
- name: "identity_anchor_get",
577
- description: "Get identity anchor.",
578
- schema: looseSchema,
579
- handler: async (input, ctx) => {
580
- const result = await ctx.service.identityAnchorGet({ namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal });
581
- return { result };
582
- }
583
- });
584
- defineOperation({
585
- name: "identity_anchor_update",
586
- description: "Update identity anchor.",
587
- schema: looseSchema,
588
- handler: async (input, ctx) => {
589
- const result = await ctx.service.identityAnchorUpdate({
590
- namespace: optStr(input.namespace),
591
- identityTraits: optStr(input.identityTraits) ?? "",
592
- communicationPreferences: optStr(input.communicationPreferences) ?? "",
593
- operatingPrinciples: optStr(input.operatingPrinciples) ?? "",
594
- continuityNotes: optStr(input.continuityNotes) ?? ""
595
- });
596
- return { result };
597
- }
598
- });
599
- defineOperation({
600
- name: "memory_identity",
601
- description: "Get memory identity.",
602
- schema: looseSchema,
603
- handler: async (input, ctx) => {
604
- const result = await ctx.service.memoryIdentity({ namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal });
605
- return { result };
606
- }
607
- });
608
- defineOperation({
609
- name: "work_task",
610
- description: "Manage a work task.",
611
- schema: looseSchema,
612
- handler: async (input, ctx) => {
613
- const result = await ctx.service.workTask({
614
- action: optStr(input.action),
615
- id: optStr(input.id) ?? "",
616
- title: optStr(input.title),
617
- description: optStr(input.description),
618
- status: optStr(input.status),
619
- priority: optStr(input.priority),
620
- owner: optStr(input.owner),
621
- assignee: optStr(input.assignee),
622
- projectId: optStr(input.projectId),
623
- tags: optStrArr(input.tags),
624
- dueAt: optStr(input.dueAt)
625
- });
626
- return { result };
627
- }
628
- });
629
- defineOperation({
630
- name: "work_project",
631
- description: "Manage a work project.",
632
- schema: looseSchema,
633
- handler: async (input, ctx) => {
634
- const result = await ctx.service.workProject({
635
- action: optStr(input.action),
636
- id: optStr(input.id) ?? "",
637
- name: optStr(input.name),
638
- description: optStr(input.description),
639
- status: optStr(input.status),
640
- owner: optStr(input.owner),
641
- tags: optStrArr(input.tags),
642
- taskId: optStr(input.taskId),
643
- projectId: optStr(input.projectId)
644
- });
645
- return { result };
646
- }
647
- });
648
- defineOperation({
649
- name: "work_board",
650
- description: "Manage a work board.",
651
- schema: looseSchema,
652
- handler: async (input, ctx) => {
653
- const result = await ctx.service.workBoard({
654
- action: optStr(input.action),
655
- projectId: optStr(input.projectId) ?? "",
656
- snapshotJson: optStr(input.snapshotJson) ?? "",
657
- linkToMemory: input.linkToMemory === true
658
- });
659
- return { result };
660
- }
661
- });
662
- defineOperation({
663
- name: "shared_context_write_output",
664
- description: "Write shared context output.",
665
- schema: looseSchema,
666
- handler: async (input, ctx) => {
667
- const result = await ctx.service.sharedContextWriteOutput({
668
- agentId: optStr(input.agentId) ?? "",
669
- title: optStr(input.title) ?? "",
670
- content: optStr(input.content) ?? ""
671
- });
672
- return { result };
673
- }
674
- });
675
- defineOperation({
676
- name: "shared_feedback_record",
677
- description: "Record shared feedback.",
678
- schema: looseSchema,
679
- handler: async (input, ctx) => {
680
- const result = await ctx.service.sharedFeedbackRecord({
681
- agent: optStr(input.agent) ?? "",
682
- decision: optStr(input.decision),
683
- reason: optStr(input.reason) ?? "",
684
- date: optStr(input.date) ?? "",
685
- learning: optStr(input.learning) ?? "",
686
- outcome: optStr(input.outcome) ?? "",
687
- severity: optStr(input.severity),
688
- confidence: optNum(input.confidence),
689
- workflow: optStr(input.workflow),
690
- tags: optStrArr(input.tags),
691
- evidenceWindowStart: optStr(input.evidenceWindowStart),
692
- evidenceWindowEnd: optStr(input.evidenceWindowEnd),
693
- refs: optStrArr(input.refs)
694
- });
695
- return { result };
696
- }
697
- });
698
- defineOperation({
699
- name: "shared_priorities_append",
700
- description: "Append to shared priorities.",
701
- schema: looseSchema,
702
- handler: async (input, ctx) => {
703
- const result = await ctx.service.sharedPrioritiesAppend({
704
- agentId: optStr(input.agentId) ?? "",
705
- text: optStr(input.text) ?? ""
706
- });
707
- return { result };
708
- }
709
- });
710
- defineOperation({
711
- name: "shared_context_cross_signals_run",
712
- description: "Run shared context cross signals.",
713
- schema: looseSchema,
714
- handler: async (input, ctx) => {
715
- const result = await ctx.service.sharedContextCrossSignalsRun({ date: optStr(input.date) });
716
- return { result };
717
- }
718
- });
719
- defineOperation({
720
- name: "shared_context_curate_daily",
721
- description: "Curate daily shared context.",
722
- schema: looseSchema,
723
- handler: async (input, ctx) => {
724
- const result = await ctx.service.sharedContextCurateDaily({ date: optStr(input.date) });
725
- return { result };
726
- }
727
- });
728
- defineOperation({
729
- name: "compounding_weekly_synthesize",
730
- description: "Weekly compound synthesis.",
731
- schema: looseSchema,
732
- handler: async (input, ctx) => {
733
- const result = await ctx.service.compoundingWeeklySynthesize({ weekId: optStr(input.weekId) });
734
- return { result };
735
- }
736
- });
737
- defineOperation({
738
- name: "compounding_promote_candidate",
739
- description: "Promote a compounding candidate.",
740
- schema: looseSchema,
741
- handler: async (input, ctx) => {
742
- const result = await ctx.service.compoundingPromoteCandidate({
743
- weekId: optStr(input.weekId) ?? "",
744
- candidateId: optStr(input.candidateId) ?? "",
745
- dryRun: input.dryRun === true
746
- });
747
- return { result };
748
- }
749
- });
750
- defineOperation({
751
- name: "compression_guidelines_optimize",
752
- description: "Optimize compression guidelines.",
753
- schema: looseSchema,
754
- handler: async (input, ctx) => {
755
- const result = await ctx.service.compressionGuidelinesOptimize({
756
- dryRun: input.dryRun === true,
757
- eventLimit: optNum(input.eventLimit)
758
- });
759
- return { result };
760
- }
761
- });
762
- defineOperation({
763
- name: "compression_guidelines_activate",
764
- description: "Activate compression guidelines.",
765
- schema: looseSchema,
766
- handler: async (input, ctx) => {
767
- const result = await ctx.service.compressionGuidelinesActivate({
768
- expectedContentHash: optStr(input.expectedContentHash) ?? "",
769
- expectedGuidelineVersion: optNum(input.expectedGuidelineVersion)
770
- });
771
- return { result };
772
- }
773
- });
774
- defineOperation({
775
- name: "memory_profile",
776
- description: "Get the memory profile.",
777
- schema: looseSchema,
778
- handler: async (input, ctx) => {
779
- const result = await ctx.service.memoryProfile(optStr(input.namespace), ctx.authenticatedPrincipal);
780
- return { result };
781
- }
782
- });
783
- defineOperation({
784
- name: "memory_entities_list",
785
- description: "List memory entities.",
786
- schema: looseSchema,
787
- handler: async (input, ctx) => {
788
- const result = await ctx.service.memoryEntitiesList(optStr(input.namespace), ctx.authenticatedPrincipal);
789
- return { result };
790
- }
791
- });
792
- defineOperation({
793
- name: "memory_questions",
794
- description: "List memory questions.",
795
- schema: looseSchema,
796
- handler: async (input, ctx) => {
797
- const result = await ctx.service.memoryQuestions(optStr(input.namespace), ctx.authenticatedPrincipal);
798
- return { result };
799
- }
800
- });
801
- defineOperation({
802
- name: "memory_last_recall",
803
- description: "Get last recall snapshot.",
804
- schema: looseSchema,
805
- handler: async (input, ctx) => {
806
- const result = await ctx.service.lastRecallSnapshot(optStr(input.sessionKey));
807
- return { result };
808
- }
809
- });
810
- defineOperation({
811
- name: "memory_intent_debug",
812
- description: "Debug memory intent.",
813
- schema: looseSchema,
814
- handler: async (input, ctx) => {
815
- const result = await ctx.service.intentDebug(optStr(input.namespace));
816
- return { result };
817
- }
818
- });
819
- defineOperation({
820
- name: "memory_qmd_debug",
821
- description: "Debug QMD.",
822
- schema: looseSchema,
823
- handler: async (input, ctx) => {
824
- const result = await ctx.service.qmdDebug(optStr(input.namespace));
825
- return { result };
826
- }
827
- });
828
- defineOperation({
829
- name: "memory_graph_explain",
830
- description: "Explain the memory graph.",
831
- schema: looseSchema,
832
- handler: async (input, ctx) => {
833
- const result = await ctx.service.graphExplainLastRecall(optStr(input.namespace));
834
- return { result };
835
- }
836
- });
837
- defineOperation({
838
- name: "graph_snapshot",
839
- description: "Get a graph snapshot.",
840
- schema: looseSchema,
841
- handler: async (input, ctx) => {
842
- const result = await ctx.service.graphSnapshot({
843
- namespace: optStr(input.namespace),
844
- limit: optNum(input.limit),
845
- since: optStr(input.since),
846
- focusNodeId: optStr(input.focusNodeId),
847
- categories: optStrArr(input.categories)
848
- }, ctx.authenticatedPrincipal);
849
- return { result };
850
- }
851
- });
852
- defineOperation({
853
- name: "memory_feedback",
854
- description: "Record memory feedback.",
855
- schema: looseSchema,
856
- handler: async (input, ctx) => {
857
- const result = await ctx.service.memoryFeedback({
858
- memoryId: optStr(input.memoryId) ?? "",
859
- vote: optStr(input.vote),
860
- note: optStr(input.note)
861
- });
862
- return { result };
863
- }
864
- });
865
- defineOperation({
866
- name: "memory_promote",
867
- description: "Promote a memory.",
868
- schema: looseSchema,
869
- handler: async (input, ctx) => {
870
- const result = await ctx.service.memoryPromote({
871
- memoryId: optStr(input.memoryId) ?? "",
872
- namespace: optStr(input.namespace),
873
- sessionKey: optStr(input.sessionKey),
874
- principal: ctx.authenticatedPrincipal
875
- });
876
- return { result };
877
- }
878
- });
879
- defineOperation({
880
- name: "memory_outcome",
881
- description: "Record a memory outcome.",
882
- schema: looseSchema,
883
- handler: async (input, ctx) => {
884
- const result = await ctx.service.memoryOutcome({
885
- memoryId: optStr(input.memoryId) ?? "",
886
- outcome: optStr(input.outcome),
887
- namespace: optStr(input.namespace),
888
- sessionKey: optStr(input.sessionKey),
889
- timestamp: optStr(input.timestamp),
890
- principal: ctx.authenticatedPrincipal
891
- });
892
- return { result };
893
- }
894
- });
895
- defineOperation({
896
- name: "memory_action_apply",
897
- description: "Apply a memory action.",
898
- schema: looseSchema,
899
- handler: async (input, ctx) => {
900
- const result = await ctx.service.memoryActionApply({
901
- action: optStr(input.action) ?? "",
902
- outcome: optStr(input.outcome),
903
- reason: optStr(input.reason),
904
- memoryId: optStr(input.memoryId) ?? "",
905
- namespace: optStr(input.namespace),
906
- sessionKey: optStr(input.sessionKey),
907
- content: optStr(input.content),
908
- category: optStr(input.category),
909
- linkTargetId: optStr(input.linkTargetId),
910
- linkType: optStr(input.linkType),
911
- linkStrength: optNum(input.linkStrength),
912
- artifactType: optStr(input.artifactType),
913
- execute: input.execute === true,
914
- sourcePrompt: optStr(input.sourcePrompt),
915
- dryRun: input.dryRun === true,
916
- principal: ctx.authenticatedPrincipal
917
- });
918
- return { result };
919
- }
920
- });
921
- defineOperation({
922
- name: "context_checkpoint",
923
- description: "Create a context checkpoint.",
924
- schema: looseSchema,
925
- handler: async (input, ctx) => {
926
- const result = await ctx.service.contextCheckpoint({
927
- sessionKey: optStr(input.sessionKey) ?? "",
928
- context: optStr(input.context) ?? "",
929
- namespace: optStr(input.namespace),
930
- principal: ctx.authenticatedPrincipal
931
- });
932
- return { result };
933
- }
934
- });
935
- defineOperation({
936
- name: "briefing",
937
- description: "Get a daily context briefing.",
938
- schema: looseSchema,
939
- handler: async (input, ctx) => {
940
- const result = await ctx.service.briefing({
941
- since: optStr(input.since),
942
- focus: optStr(input.focus),
943
- namespace: optStr(input.namespace),
944
- format: optStr(input.format),
945
- maxFollowups: optNum(input.maxFollowups),
946
- principal: ctx.authenticatedPrincipal
947
- });
948
- return { result };
949
- }
950
- });
951
- defineOperation({
952
- name: "review_list",
953
- description: "List contradiction review pairs.",
954
- schema: looseSchema,
955
- handler: async (input, ctx) => {
956
- const { isDefaultReviewNamespace, listPairs } = await import("./contradiction-review-QKJH5DKD.js");
957
- const VALID_FILTERS = /* @__PURE__ */ new Set(["all", "unresolved", "contradicts", "independent", "duplicates", "needs-user"]);
958
- const rawFilter = optStr(input.filter) ?? "unresolved";
959
- if (!VALID_FILTERS.has(rawFilter)) {
960
- throw new EngramAccessInputError("Invalid filter '" + rawFilter + "'. Valid: " + [...VALID_FILTERS].join(", "));
961
- }
962
- const filter = rawFilter;
963
- const ns = optStr(input.namespace);
964
- const limit = optNum(input.limit) ?? 50;
965
- const resolved = await ctx.service.getReadableStorageForNamespace(ns, ctx.authenticatedPrincipal);
966
- const reviewNamespace = ctx.service.configRef.namespacesEnabled ? resolved.namespace : void 0;
967
- const includeUnscopedForNamespace = Boolean(
968
- reviewNamespace && isDefaultReviewNamespace(ctx.service.configRef.defaultNamespace, ns, reviewNamespace)
969
- );
970
- const result = await listPairs(ctx.service.memoryDir, { filter, namespace: reviewNamespace, includeUnscopedForNamespace, limit });
971
- return { result };
972
- }
973
- });
974
- defineOperation({
975
- name: "review_resolve",
976
- description: "Resolve a contradiction pair.",
977
- schema: looseSchema,
978
- handler: async (input, ctx) => {
979
- const pairId = defStr(input.pairId, "");
980
- const verb = defStr(input.verb, "");
981
- if (!pairId) throw new EngramAccessInputError("pairId is required");
982
- if (!verb) throw new EngramAccessInputError("verb is required");
983
- const { isValidResolutionVerb, executeResolution } = await import("./resolution-MN36NW5P.js");
984
- if (!isValidResolutionVerb(verb)) throw new EngramAccessInputError("Invalid verb: " + verb + ". Must be one of: keep-a, keep-b, merge, both-valid, needs-more-context");
985
- const result = await executeResolution(ctx.service.memoryDir, ctx.service.storageRef, pairId, verb, {
986
- mergedMemoryId: optStr(input.mergedMemoryId),
987
- mergedContent: optStr(input.mergedContent),
988
- storageForNamespace: async (namespace) => {
989
- const r = await ctx.service.getWritableStorageForNamespace(namespace, ctx.authenticatedPrincipal);
990
- return r.storage;
991
- },
992
- onMergedMemoryWritten: () => {
993
- }
994
- });
995
- return { result };
996
- }
997
- });
998
- defineOperation({
999
- name: "contradiction_scan_run",
1000
- description: "Run a contradiction scan.",
1001
- schema: looseSchema,
1002
- handler: async (input, ctx) => {
1003
- const { runContradictionScan } = await import("./contradiction-scan-HWGEOUDS.js");
1004
- const result = await runContradictionScan({
1005
- storage: ctx.service.storageRef,
1006
- config: ctx.service.configRef,
1007
- memoryDir: ctx.service.memoryDir,
1008
- embeddingLookupFactory: ctx.service.embeddingLookupFactoryRef,
1009
- storageForNamespace: (namespace) => ctx.service.getWritableStorageForNamespace(namespace ?? void 0, ctx.authenticatedPrincipal),
1010
- localLlm: ctx.service.localLlmRef,
1011
- fallbackLlm: ctx.service.fallbackLlmRef,
1012
- namespace: optStr(input.namespace)
1013
- });
1014
- return { result };
1015
- }
1016
- });
1017
- defineOperation({
1018
- name: "graph_edge_decay_run",
1019
- description: "Run graph edge decay maintenance.",
1020
- schema: looseSchema,
1021
- handler: async (input, ctx) => {
1022
- const cfg = ctx.service.configRef;
1023
- if (!cfg.graphEdgeDecayEnabled) {
1024
- return { result: { ranAt: (/* @__PURE__ */ new Date()).toISOString(), disabled: true, reason: "graphEdgeDecayEnabled is false" } };
1025
- }
1026
- const { runGraphEdgeDecayMaintenanceAcrossNamespaces } = await import("./graph-edge-decay-QPRJQ7DL.js");
1027
- const dryRun = input.dryRun === true;
1028
- const results = await runGraphEdgeDecayMaintenanceAcrossNamespaces(ctx.service.memoryDir, {
1029
- windowMs: cfg.graphEdgeDecayWindowMs,
1030
- perWindow: cfg.graphEdgeDecayPerWindow,
1031
- floor: cfg.graphEdgeDecayFloor,
1032
- visibilityThreshold: cfg.graphEdgeDecayVisibilityThreshold,
1033
- dryRun,
1034
- namespacesEnabled: cfg.namespacesEnabled === true,
1035
- defaultNamespace: cfg.defaultNamespace
1036
- });
1037
- return { result: { results } };
1038
- }
1039
- });
1040
- defineOperation({
1041
- name: "memory_summarize_hourly",
1042
- description: "Run hourly memory summarization.",
1043
- schema: looseSchema,
1044
- handler: async (_input, ctx) => ({ result: await ctx.service.memorySummarizeHourly() })
1045
- });
1046
- defineOperation({
1047
- name: "conversation_index_update",
1048
- description: "Update the conversation index.",
1049
- schema: looseSchema,
1050
- handler: async (input, ctx) => {
1051
- const result = await ctx.service.conversationIndexUpdate({
1052
- sessionKey: optStr(input.sessionKey),
1053
- hours: optNum(input.hours),
1054
- embed: optBool(input.embed)
1055
- });
1056
- return { result };
1057
- }
1058
- });
1059
- defineOperation({
1060
- name: "profiling_report",
1061
- description: "Get a profiling report.",
1062
- schema: looseSchema,
1063
- handler: async (input, ctx) => {
1064
- const result = await ctx.service.profilingReport({
1065
- format: optStr(input.format),
1066
- limit: optNum(input.limit)
1067
- });
1068
- return { result };
1069
- }
1070
- });
1071
- defineOperation({
1072
- name: "live_connectors_run",
1073
- description: "Run live connectors.",
1074
- schema: looseSchema,
1075
- handler: async (input, ctx) => {
1076
- const result = await ctx.service.liveConnectorsRun(
1077
- { authenticatedPrincipal: ctx.authenticatedPrincipal, force: input.force === true },
1078
- ctx.authenticatedPrincipal
1079
- );
1080
- return { result };
1081
- }
1082
- });
1083
- defineOperation({
1084
- name: "peer_list",
1085
- description: "List peers.",
1086
- schema: looseSchema,
1087
- handler: async (_input, ctx) => ({ result: await ctx.service.peerList() })
1088
- });
1089
- defineOperation({
1090
- name: "peer_get",
1091
- description: "Get a peer.",
1092
- schema: looseSchema,
1093
- handler: async (input, ctx) => {
1094
- const result = await ctx.service.peerGet(defStr(input.id, ""));
1095
- return { result };
1096
- }
1097
- });
1098
- defineOperation({
1099
- name: "peer_set",
1100
- description: "Create or update a peer.",
1101
- schema: looseSchema,
1102
- handler: async (input, ctx) => {
1103
- const result = await ctx.service.peerSet({
1104
- id: optStr(input.id) ?? "",
1105
- kind: optStr(input.kind),
1106
- displayName: optStr(input.displayName),
1107
- notes: optStr(input.notes)
1108
- });
1109
- return { result };
1110
- }
1111
- });
1112
- defineOperation({
1113
- name: "peer_delete",
1114
- description: "Delete a peer.",
1115
- schema: looseSchema,
1116
- handler: async (input, ctx) => {
1117
- const result = await ctx.service.peerDelete(defStr(input.id, ""));
1118
- return { result };
1119
- }
1120
- });
1121
- defineOperation({
1122
- name: "peer_profile_get",
1123
- description: "Get a peer profile.",
1124
- schema: looseSchema,
1125
- handler: async (input, ctx) => {
1126
- const result = await ctx.service.peerProfileGet(optStr(input.id) ?? "");
1127
- return { result };
1128
- }
1129
- });
1130
- defineOperation({
1131
- name: "peer_forget",
1132
- description: "Forget a peer.",
1133
- schema: looseSchema,
1134
- handler: async (input, ctx) => {
1135
- const result = await ctx.service.peerForget(optStr(input.id) ?? "", { confirm: input.confirm === true || optStr(input.confirm) === "yes" ? "yes" : "" });
1136
- return { result };
1137
- }
1138
- });
1139
- defineOperation({
1140
- name: "console_state",
1141
- description: "Get console state.",
1142
- schema: looseSchema,
1143
- handler: async (input, ctx) => {
1144
- const result = await ctx.service.consoleState(optStr(input.namespace), ctx.authenticatedPrincipal);
1145
- return { result };
1146
- }
1147
- });
1148
- defineOperation({
1149
- name: "dreams_status",
1150
- description: "Get dreams status.",
1151
- schema: looseSchema,
1152
- handler: async (input, ctx) => {
1153
- const result = await ctx.service.dreamsStatus({
1154
- windowHours: optNum(input.windowHours),
1155
- namespace: optStr(input.namespace),
1156
- principal: ctx.authenticatedPrincipal
1157
- });
1158
- return { result };
1159
- }
1160
- });
1161
- defineOperation({
1162
- name: "dreams_run",
1163
- description: "Run dreams.",
1164
- schema: looseSchema,
1165
- handler: async (input, ctx) => {
1166
- const result = await ctx.service.dreamsRun({
1167
- phase: optStr(input.phase),
1168
- dryRun: input.dryRun === true,
1169
- namespace: optStr(input.namespace),
1170
- authenticatedPrincipal: ctx.authenticatedPrincipal
1171
- });
1172
- return { result };
1173
- }
1174
- });
1175
- defineOperation({
1176
- name: "offline_sync_snapshot",
1177
- description: "Get or create an offline-sync snapshot.",
1178
- schema: looseSchema,
1179
- handler: async (_input, ctx) => {
1180
- const result = await ctx.service.offlineSyncSnapshot();
1181
- return { result };
1182
- }
1183
- });
1184
- defineOperation({
1185
- name: "offline_sync_files",
1186
- description: "List offline-sync files.",
1187
- schema: looseSchema,
1188
- handler: async (input, ctx) => ({ result: await ctx.service.offlineSyncFiles({ paths: optStrArr(input.paths) ?? [], namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) })
1189
- });
1190
- defineOperation({
1191
- name: "offline_sync_file_content",
1192
- description: "Read offline-sync file content.",
1193
- schema: looseSchema,
1194
- 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) }) })
1195
- });
1196
- defineOperation({
1197
- name: "offline_sync_apply_file_content",
1198
- description: "Apply offline-sync file content.",
1199
- schema: looseSchema,
1200
- 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 }) })
1201
- });
1202
- defineOperation({
1203
- name: "offline_sync_apply",
1204
- description: "Apply an offline-sync snapshot.",
1205
- schema: looseSchema,
1206
- handler: async (input, ctx) => ({ result: await ctx.service.offlineSyncApply({ changeset: input.changeset, namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal }) })
1207
- });
1208
- defineOperation({
1209
- name: "lcm_status",
1210
- description: "Get LCM status.",
1211
- schema: looseSchema,
1212
- handler: async (_input, ctx) => ({ result: await ctx.service.lcmStatus() })
1213
- });
1214
- defineOperation({
1215
- name: "memory_list",
1216
- description: "Browse/list memories (HTTP GET /memories).",
1217
- schema: looseSchema,
1218
- handler: async (input, ctx) => ({ result: await ctx.service.memoryBrowse() })
1219
- });
1220
- defineOperation({
1221
- name: "entity_list",
1222
- description: "List entities (HTTP GET /entities).",
1223
- schema: looseSchema,
1224
- handler: async (input, ctx) => ({ result: await ctx.service.entityList() })
1225
- });
1226
- defineOperation({
1227
- name: "maintenance_status",
1228
- description: "Get maintenance status (HTTP GET /maintenance).",
1229
- schema: looseSchema,
1230
- handler: async (input, ctx) => ({ result: await ctx.service.maintenance() })
1231
- });
1232
- defineOperation({
1233
- name: "quality_status",
1234
- description: "Get quality status (HTTP GET /quality).",
1235
- schema: looseSchema,
1236
- handler: async (input, ctx) => ({ result: await ctx.service.quality() })
1237
- });
1238
- defineOperation({
1239
- name: "trust_zones_status",
1240
- description: "Get trust-zone status.",
1241
- schema: looseSchema,
1242
- handler: async (input, ctx) => ({ result: await ctx.service.trustZoneStatus() })
1243
- });
1244
- defineOperation({
1245
- name: "trust_zones_records",
1246
- description: "Browse trust-zone records.",
1247
- schema: looseSchema,
1248
- handler: async (input, ctx) => ({ result: await ctx.service.trustZoneBrowse({ namespace: optStr(input.namespace), limit: optNum(input.limit), offset: optNum(input.offset) }, ctx.authenticatedPrincipal) })
1249
- });
1250
- defineOperation({
1251
- name: "review_disposition",
1252
- description: "Apply a review disposition.",
1253
- schema: looseSchema,
1254
- 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 }) })
1255
- });
1256
- defineOperation({
1257
- name: "trust_zones_promote",
1258
- description: "Promote a trust-zone record.",
1259
- schema: looseSchema,
1260
- 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 }) })
1261
- });
1262
- defineOperation({
1263
- name: "trust_zones_demo_seed",
1264
- description: "Seed demo trust-zone records.",
1265
- schema: looseSchema,
1266
- handler: async (input, ctx) => ({ result: await ctx.service.trustZoneDemoSeed({ scenario: optStr(input.scenario), dryRun: input.dryRun === true, namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) })
1267
- });
1268
- defineOperation({
1269
- name: "citations_observed",
1270
- description: "Record observed citations (HTTP POST /v1/citations/observed).",
1271
- schema: looseSchema,
1272
- handler: async (input, ctx) => {
1273
- return { result: { ok: true } };
1274
- }
1275
- });
1276
- defineOperation({
1277
- name: "contradiction_detail",
1278
- description: "Get a single contradiction pair detail (HTTP GET /review/contradictions/:id).",
1279
- schema: looseSchema,
1280
- handler: async (input, ctx) => {
1281
- const { listPairs } = await import("./contradiction-review-QKJH5DKD.js");
1282
- const result = await listPairs(ctx.service.memoryDir, {
1283
- filter: "all",
1284
- namespace: optStr(input.namespace),
1285
- includeUnscopedForNamespace: false,
1286
- limit: 1
1287
- });
1288
- return { result };
1289
- }
1290
- });
1291
- defineOperation({
1292
- name: "offline_sync_snapshot_stream",
1293
- description: "Stream offline-sync snapshot updates (SSE).",
1294
- schema: looseSchema,
1295
- handler: async (_input, ctx) => ({ result: await ctx.service.offlineSyncSnapshotStream() })
1296
- });
1297
- defineOperation({
1298
- name: "graph_events",
1299
- description: "Stream graph mutation events (SSE). Endpoint registration only.",
1300
- schema: looseSchema,
1301
- handler: async (_input, _ctx) => ({ result: { stream: "sse" } })
1302
- });
1303
- defineOperation({
1304
- name: "chat_message",
1305
- description: "Send a message to Remnic Chat (issue #1583). Endpoint registration only \u2014 the handler enforces the chat_disabled gate, message validation, and the confirmation protocol.",
1306
- schema: looseSchema,
1307
- handler: async (_input, _ctx) => ({ result: { ok: true } })
1308
- });
1309
- defineOperation({
1310
- name: "chat_events",
1311
- description: "Stream chat session transcript events (SSE, issue #1583). Endpoint registration only.",
1312
- schema: looseSchema,
1313
- handler: async (_input, _ctx) => ({ result: { stream: "sse" } })
1314
- });
1315
- //# sourceMappingURL=chunk-EM2LDXJ2.js.map