omp-fabric 1.26.14 → 1.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +0 -27
  3. package/dist/agents/handoff.d.ts +2 -3
  4. package/dist/agents/handoff.d.ts.map +1 -1
  5. package/dist/agents/manager.d.ts.map +1 -1
  6. package/dist/agents/types.d.ts +0 -7
  7. package/dist/agents/types.d.ts.map +1 -1
  8. package/dist/chunks/{chunk-5EZWERJY.js → chunk-2BOZMRT5.js} +25 -8
  9. package/dist/chunks/{chunk-5EZWERJY.js.map → chunk-2BOZMRT5.js.map} +3 -3
  10. package/dist/chunks/{chunk-TF3MK3TH.js → chunk-4PQDZ3AY.js} +13 -13
  11. package/dist/chunks/{chunk-5U6HKMJV.js → chunk-4XLJPEI4.js} +3 -5
  12. package/dist/chunks/{chunk-5U6HKMJV.js.map → chunk-4XLJPEI4.js.map} +1 -1
  13. package/dist/chunks/{chunk-O5SZML2M.js → chunk-5MH37C4Y.js} +14 -7
  14. package/dist/chunks/chunk-5MH37C4Y.js.map +7 -0
  15. package/dist/chunks/{chunk-YWEXP724.js → chunk-7OZDA7YP.js} +5 -5
  16. package/dist/chunks/{chunk-673LUJCK.js → chunk-7QKSPNXQ.js} +7 -7
  17. package/dist/chunks/{chunk-PTYCFQEH.js → chunk-ABFK2RPI.js} +2 -2
  18. package/dist/chunks/{chunk-S3URDR4K.js → chunk-ANHZ3SWB.js} +8 -9
  19. package/dist/chunks/chunk-ANHZ3SWB.js.map +7 -0
  20. package/dist/chunks/{chunk-YLMDFMXM.js → chunk-BQ2U44IL.js} +2 -2
  21. package/dist/chunks/{chunk-RGE6MBYP.js → chunk-CNCRWY4Q.js} +27 -69
  22. package/dist/chunks/chunk-CNCRWY4Q.js.map +7 -0
  23. package/dist/chunks/{chunk-HWOL2YVU.js → chunk-CT23CX67.js} +48 -7
  24. package/dist/chunks/chunk-CT23CX67.js.map +7 -0
  25. package/dist/chunks/{chunk-3QPIB3H2.js → chunk-EV36BIIO.js} +8 -690
  26. package/dist/chunks/chunk-EV36BIIO.js.map +7 -0
  27. package/dist/chunks/{chunk-CA2P7NLW.js → chunk-FA7TNLOV.js} +2 -88
  28. package/dist/chunks/chunk-FA7TNLOV.js.map +7 -0
  29. package/dist/chunks/{chunk-BV3EDWSX.js → chunk-FVGI5PSL.js} +4 -1
  30. package/dist/chunks/chunk-FVGI5PSL.js.map +7 -0
  31. package/dist/chunks/{chunk-6IPXBDCA.js → chunk-FWFET65L.js} +211 -4
  32. package/dist/chunks/chunk-FWFET65L.js.map +7 -0
  33. package/dist/chunks/{chunk-ESPCTYVX.js → chunk-IPI4UOTC.js} +352 -1
  34. package/dist/chunks/chunk-IPI4UOTC.js.map +7 -0
  35. package/dist/chunks/{chunk-HCUDF34P.js → chunk-K7IN6FTM.js} +17 -17
  36. package/dist/chunks/chunk-K7IN6FTM.js.map +7 -0
  37. package/dist/commands/fabric.d.ts.map +1 -1
  38. package/dist/compaction/branch-details.d.ts +3 -9
  39. package/dist/compaction/branch-details.d.ts.map +1 -1
  40. package/dist/compaction/instructions.d.ts +4 -29
  41. package/dist/compaction/instructions.d.ts.map +1 -1
  42. package/dist/compaction/trace-events.d.ts +1 -1
  43. package/dist/compaction/trace-events.d.ts.map +1 -1
  44. package/dist/config-migrations.d.ts +1 -1
  45. package/dist/config-migrations.d.ts.map +1 -1
  46. package/dist/config.d.ts +0 -18
  47. package/dist/config.d.ts.map +1 -1
  48. package/dist/core/action-registry.d.ts.map +1 -1
  49. package/dist/core/action-registry.js +3 -3
  50. package/dist/core/action-repair.d.ts +1 -0
  51. package/dist/core/action-repair.d.ts.map +1 -1
  52. package/dist/core/compact-controller.d.ts +0 -7
  53. package/dist/core/compact-controller.d.ts.map +1 -1
  54. package/dist/entropy/index.js +6 -7
  55. package/dist/execution-service.d.ts.map +1 -1
  56. package/dist/fabric-runtime-state.d.ts +0 -64
  57. package/dist/fabric-runtime-state.d.ts.map +1 -1
  58. package/dist/fabric-runtime-state.js +260 -141
  59. package/dist/fabric-runtime-state.js.map +4 -4
  60. package/dist/fabric-state.d.ts +0 -3
  61. package/dist/fabric-state.d.ts.map +1 -1
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +131 -247
  64. package/dist/index.js.map +3 -3
  65. package/dist/memory/discovery.js +2 -3
  66. package/dist/memory/normalize.js +1 -2
  67. package/dist/memory/search.js +2 -3
  68. package/dist/providers/agents-actions.d.ts.map +1 -1
  69. package/dist/providers/agents-provider.d.ts.map +1 -1
  70. package/dist/providers/compact-provider.d.ts.map +1 -1
  71. package/dist/providers/image-provider.d.ts +1 -0
  72. package/dist/providers/image-provider.d.ts.map +1 -1
  73. package/dist/providers/memory-provider.d.ts +0 -11
  74. package/dist/providers/memory-provider.d.ts.map +1 -1
  75. package/dist/providers/memory-provider.js +4 -7
  76. package/dist/residency/host.js +6 -14
  77. package/dist/residency/omp-entry.js +6 -14
  78. package/dist/residency/omp-entry.js.map +1 -1
  79. package/dist/runtime/core-override-guest-types.js +1 -1
  80. package/dist/runtime/guest-types.d.ts +1 -1
  81. package/dist/runtime/guest-types.d.ts.map +1 -1
  82. package/dist/runtime/guest-types.js +1 -1
  83. package/dist/runtime/node-process-runtime.js +8 -8
  84. package/dist/runtime/quickjs-runtime.d.ts +1 -1
  85. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  86. package/dist/runtime/quickjs-runtime.js +2 -2
  87. package/dist/runtime/type-checker.js +1 -1
  88. package/dist/type-error-guidance.d.ts.map +1 -1
  89. package/dist/ui/controller.d.ts +0 -1
  90. package/dist/ui/controller.d.ts.map +1 -1
  91. package/dist/ui/conversation.js +5 -5
  92. package/dist/ui/dashboard.d.ts.map +1 -1
  93. package/dist/ui/dashboard.js +13 -18
  94. package/dist/ui/dashboard.js.map +2 -2
  95. package/dist/ui/settings.d.ts.map +1 -1
  96. package/dist/ui/settings.js +9 -203
  97. package/dist/ui/settings.js.map +2 -2
  98. package/docs/agents.md +1 -3
  99. package/docs/audit-trace.md +3 -3
  100. package/docs/configuration.md +14 -6
  101. package/docs/entropy.md +1 -2
  102. package/docs/image.md +24 -3
  103. package/docs/interface.md +0 -35
  104. package/docs/memory-recall.md +6 -11
  105. package/docs/programmatic-compaction.md +14 -32
  106. package/package.json +8 -11
  107. package/dist/chunks/chunk-3J7BKUNG.js +0 -354
  108. package/dist/chunks/chunk-3J7BKUNG.js.map +0 -7
  109. package/dist/chunks/chunk-3QPIB3H2.js.map +0 -7
  110. package/dist/chunks/chunk-6IPXBDCA.js.map +0 -7
  111. package/dist/chunks/chunk-BV3EDWSX.js.map +0 -7
  112. package/dist/chunks/chunk-CA2P7NLW.js.map +0 -7
  113. package/dist/chunks/chunk-ESPCTYVX.js.map +0 -7
  114. package/dist/chunks/chunk-G3VKU6GZ.js +0 -1681
  115. package/dist/chunks/chunk-G3VKU6GZ.js.map +0 -7
  116. package/dist/chunks/chunk-HCUDF34P.js.map +0 -7
  117. package/dist/chunks/chunk-HWOL2YVU.js.map +0 -7
  118. package/dist/chunks/chunk-JL3KVPFJ.js +0 -291
  119. package/dist/chunks/chunk-JL3KVPFJ.js.map +0 -7
  120. package/dist/chunks/chunk-O5SZML2M.js.map +0 -7
  121. package/dist/chunks/chunk-QD2B5FUE.js +0 -15
  122. package/dist/chunks/chunk-QD2B5FUE.js.map +0 -7
  123. package/dist/chunks/chunk-QSRTEINF.js +0 -469
  124. package/dist/chunks/chunk-QSRTEINF.js.map +0 -7
  125. package/dist/chunks/chunk-QZJB7QTM.js +0 -248
  126. package/dist/chunks/chunk-QZJB7QTM.js.map +0 -7
  127. package/dist/chunks/chunk-RGE6MBYP.js.map +0 -7
  128. package/dist/chunks/chunk-S3URDR4K.js.map +0 -7
  129. package/dist/chunks/chunk-SMNOQLKU.js +0 -53
  130. package/dist/chunks/chunk-SMNOQLKU.js.map +0 -7
  131. package/dist/chunks/chunk-TQQPXV3I.js +0 -58
  132. package/dist/chunks/chunk-TQQPXV3I.js.map +0 -7
  133. package/dist/chunks/chunk-UAP6IQIR.js +0 -76
  134. package/dist/chunks/chunk-UAP6IQIR.js.map +0 -7
  135. package/dist/chunks/chunk-VE3FWDRH.js +0 -221
  136. package/dist/chunks/chunk-VE3FWDRH.js.map +0 -7
  137. package/dist/chunks/chunk-ZHDN5ESL.js +0 -130
  138. package/dist/chunks/chunk-ZHDN5ESL.js.map +0 -7
  139. package/dist/compaction/bounds.d.ts +0 -25
  140. package/dist/compaction/bounds.d.ts.map +0 -1
  141. package/dist/compaction/branch-summary.d.ts +0 -9
  142. package/dist/compaction/branch-summary.d.ts.map +0 -1
  143. package/dist/compaction/enrichers.d.ts +0 -10
  144. package/dist/compaction/enrichers.d.ts.map +0 -1
  145. package/dist/compaction/hook.d.ts +0 -117
  146. package/dist/compaction/hook.d.ts.map +0 -1
  147. package/dist/compaction/hook.js +0 -21
  148. package/dist/compaction/hook.js.map +0 -7
  149. package/dist/compaction/lcm-addresses.d.ts +0 -10
  150. package/dist/compaction/lcm-addresses.d.ts.map +0 -1
  151. package/dist/compaction/lcm-doctor.d.ts +0 -60
  152. package/dist/compaction/lcm-doctor.d.ts.map +0 -1
  153. package/dist/compaction/lcm-loader.d.ts +0 -12
  154. package/dist/compaction/lcm-loader.d.ts.map +0 -1
  155. package/dist/compaction/lcm-maintenance.d.ts +0 -152
  156. package/dist/compaction/lcm-maintenance.d.ts.map +0 -1
  157. package/dist/compaction/lcm-model.d.ts +0 -44
  158. package/dist/compaction/lcm-model.d.ts.map +0 -1
  159. package/dist/compaction/lcm-recovery.d.ts +0 -7
  160. package/dist/compaction/lcm-recovery.d.ts.map +0 -1
  161. package/dist/compaction/lcm-runtime.d.ts +0 -233
  162. package/dist/compaction/lcm-runtime.d.ts.map +0 -1
  163. package/dist/compaction/lcm-runtime.js +0 -2863
  164. package/dist/compaction/lcm-runtime.js.map +0 -7
  165. package/dist/compaction/lcm-status.d.ts +0 -5
  166. package/dist/compaction/lcm-status.d.ts.map +0 -1
  167. package/dist/compaction/normalize.d.ts +0 -83
  168. package/dist/compaction/normalize.d.ts.map +0 -1
  169. package/dist/compaction/projections.d.ts +0 -26
  170. package/dist/compaction/projections.d.ts.map +0 -1
  171. package/dist/compaction/render.d.ts +0 -11
  172. package/dist/compaction/render.d.ts.map +0 -1
  173. package/dist/core/event-loop-slice.d.ts +0 -11
  174. package/dist/core/event-loop-slice.d.ts.map +0 -1
  175. package/dist/memory/lcm-adapter.d.ts +0 -111
  176. package/dist/memory/lcm-adapter.d.ts.map +0 -1
  177. package/dist/storage/lcm-directory.d.ts +0 -17
  178. package/dist/storage/lcm-directory.d.ts.map +0 -1
  179. package/dist/storage/lcm-identity.d.ts +0 -48
  180. package/dist/storage/lcm-identity.d.ts.map +0 -1
  181. package/dist/storage/lcm-ledger.d.ts +0 -159
  182. package/dist/storage/lcm-ledger.d.ts.map +0 -1
  183. package/dist/storage/lcm-migration.d.ts +0 -87
  184. package/dist/storage/lcm-migration.d.ts.map +0 -1
  185. package/dist/storage/lcm-offthread.d.ts +0 -9
  186. package/dist/storage/lcm-offthread.d.ts.map +0 -1
  187. package/dist/storage/sqlite.d.ts +0 -19
  188. package/dist/storage/sqlite.d.ts.map +0 -1
  189. package/dist/ui/frame.d.ts +0 -7
  190. package/dist/ui/frame.d.ts.map +0 -1
  191. package/dist/ui/lcm-dashboard.d.ts +0 -43
  192. package/dist/ui/lcm-dashboard.d.ts.map +0 -1
  193. package/dist/ui/lcm-dashboard.js +0 -395
  194. package/dist/ui/lcm-dashboard.js.map +0 -7
  195. package/dist/ui/lcm-panel.d.ts +0 -37
  196. package/dist/ui/lcm-panel.d.ts.map +0 -1
  197. package/dist/ui/lcm-panel.js +0 -23
  198. package/dist/ui/lcm-panel.js.map +0 -7
  199. package/docs/adr/0001-lcm-durable-context-ledger.md +0 -6
  200. package/docs/certification.md +0 -134
  201. package/docs/compaction.md +0 -188
  202. /package/dist/chunks/{chunk-TF3MK3TH.js.map → chunk-4PQDZ3AY.js.map} +0 -0
  203. /package/dist/chunks/{chunk-YWEXP724.js.map → chunk-7OZDA7YP.js.map} +0 -0
  204. /package/dist/chunks/{chunk-673LUJCK.js.map → chunk-7QKSPNXQ.js.map} +0 -0
  205. /package/dist/chunks/{chunk-PTYCFQEH.js.map → chunk-ABFK2RPI.js.map} +0 -0
  206. /package/dist/chunks/{chunk-YLMDFMXM.js.map → chunk-BQ2U44IL.js.map} +0 -0
@@ -8,11 +8,10 @@ import {
8
8
  loadTieredIndex,
9
9
  reconstructSessionLineage,
10
10
  searchMemoryIndex
11
- } from "./chunk-PTYCFQEH.js";
11
+ } from "./chunk-ABFK2RPI.js";
12
12
  import {
13
13
  compareLexical,
14
14
  normalizeMemoryPhrase,
15
- planMemoryQuery,
16
15
  tokenizeLexical
17
16
  } from "./chunk-U5FYOMG5.js";
18
17
  import {
@@ -23,17 +22,11 @@ import {
23
22
  overrideSessionDir,
24
23
  resolveScope,
25
24
  resolveSessionTarget
26
- } from "./chunk-YLMDFMXM.js";
25
+ } from "./chunk-BQ2U44IL.js";
27
26
  import {
28
27
  expandSessionEntriesChecked,
29
28
  normalizeSession
30
- } from "./chunk-6IPXBDCA.js";
31
- import {
32
- hash,
33
- hashLcmPayload,
34
- lcmRawAddress,
35
- lcmSummaryAddress
36
- } from "./chunk-ZHDN5ESL.js";
29
+ } from "./chunk-FWFET65L.js";
37
30
 
38
31
  // src/providers/memory-provider.ts
39
32
  import fs from "node:fs";
@@ -233,602 +226,6 @@ var presentRecall = (input) => {
233
226
  return response;
234
227
  };
235
228
 
236
- // src/memory/lcm-adapter.ts
237
- var SUMMARY_EXPAND_DEFAULT_ENTRIES = 10;
238
- var SUMMARY_EXPAND_MAX_ENTRIES = 20;
239
- var SUMMARY_EXPAND_DEFAULT_CHARS = 2e4;
240
- var SUMMARY_EXPAND_MAX_CHARS = 24e3;
241
- var SUMMARY_EXPAND_MAX_CONTEXT = 100;
242
- var SUMMARY_DESCENT_CACHE_LIMIT = 8;
243
- var queryPredicate = (query, mode, match) => {
244
- const plan = planMemoryQuery(query, mode, match);
245
- if (plan.kind === "browse") {
246
- return { matches: () => true, scoreOf: () => 0 };
247
- }
248
- if (plan.kind === "regex") {
249
- if (Buffer.byteLength(plan.pattern, "utf8") > DEFAULT_REGEX_MAX_PATTERN_BYTES) {
250
- return { matches: () => false, scoreOf: () => 0, failure: "regex_pattern_too_large" };
251
- }
252
- let regex;
253
- try {
254
- regex = new RegExp(plan.pattern, "iu");
255
- } catch {
256
- return { matches: () => false, scoreOf: () => 0, failure: "invalid_regex" };
257
- }
258
- return { matches: (text) => regex.test(text), scoreOf: (text) => regex.test(text) ? 1 : 0 };
259
- }
260
- if (plan.kind === "phrase") {
261
- const phrase = plan.phrase;
262
- const hit = (text) => normalizeMemoryPhrase(text).includes(phrase);
263
- return { matches: hit, scoreOf: (text) => hit(text) ? 1 : 0 };
264
- }
265
- const terms = plan.terms;
266
- if (terms.length === 0) return { matches: () => true, scoreOf: () => 0 };
267
- const overlap = (text) => {
268
- const available = new Set(tokenizeLexical(text));
269
- return terms.reduce((total, term) => total + (available.has(term) ? 1 : 0), 0);
270
- };
271
- return plan.match === "all" ? { matches: (text) => overlap(text) === terms.length, scoreOf: overlap } : { matches: (text) => overlap(text) > 0, scoreOf: overlap };
272
- };
273
- var excerpt = (text, max = 480) => ({
274
- snippet: text.length <= max ? text : text.slice(0, max),
275
- truncated: text.length > max
276
- });
277
- var isLowSurrogate = (code) => code >= 56320 && code <= 57343;
278
- var sourceKey = (entryId, contentHash) => `${entryId}:${contentHash}`;
279
- var activeBinding = (options, sessionId) => options.branchForSession?.(sessionId);
280
- var activeSourceSet = (binding) => binding?.activeSourceKeys === void 0 ? void 0 : new Set(binding.activeSourceKeys);
281
- var parseLcmRawAddress = (address) => {
282
- const parts = address.split(":");
283
- if (parts.length < 4 || parts[0] !== "lcm.raw") return void 0;
284
- const revision = Number(parts.at(-1));
285
- const entryId = parts.slice(2, -1).join(":");
286
- const sessionId = parts[1];
287
- if (!sessionId || !entryId || !Number.isSafeInteger(revision) || revision < 1) return void 0;
288
- return { sessionId, entryId, revision };
289
- };
290
- var readTime = (value) => typeof value === "number" && Number.isFinite(value) ? value : void 0;
291
- var rawFilter = (args, query, mode) => {
292
- const role = typeof args.role === "string" && args.role.length > 0 ? args.role : void 0;
293
- const since = readTime(args.since);
294
- const until = readTime(args.until);
295
- const ranked = (query?.trim().length ?? 0) > 0 && mode !== "regex";
296
- return {
297
- search: {
298
- ...role === void 0 ? { excludeRoles: ["custom"] } : { roles: [role] },
299
- ...since === void 0 ? {} : { since },
300
- ...until === void 0 ? {} : { until },
301
- order: ranked ? "relevance" : "recent"
302
- },
303
- includeSummaries: role === void 0 || role === "compactionSummary",
304
- ...since === void 0 ? {} : { since },
305
- ...until === void 0 ? {} : { until }
306
- };
307
- };
308
- var sessionScope = (args, currentSessionId) => {
309
- const scope = typeof args.scope === "string" && args.scope.startsWith("session:") ? args.scope.slice("session:".length) : void 0;
310
- return scope ?? currentSessionId;
311
- };
312
- var activeAllowed = (branches, binding, key) => {
313
- if (branches === "all") return { allowed: true };
314
- if (!binding) return { allowed: false, reason: "active_branch_unbound" };
315
- if (!binding.ready) return { allowed: false, reason: "session_incomplete" };
316
- if (binding.activeSourceKeys !== void 0 && !activeSourceSet(binding)?.has(key)) {
317
- return { allowed: false, reason: "source_off_active_branch" };
318
- }
319
- return { allowed: true };
320
- };
321
- var readMode = (value) => value === "phrase" ? "phrase" : value === "regex" ? "regex" : "literal";
322
- var readMatch = (value) => value === "all" ? "all" : "any";
323
- var clampInteger = (value, min, max, fallback) => typeof value === "number" && Number.isFinite(value) ? Math.min(max, Math.max(min, Math.floor(value))) : fallback;
324
- var addressList = (value) => Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && entry.length > 0) : [];
325
- var unresolvedAddress = (addresses, items, addressType, read) => {
326
- for (const address of addresses) {
327
- const matches = items.reduce((count, item) => count + (read(item) === address ? 1 : 0), 0);
328
- if (matches === 1) continue;
329
- return {
330
- code: matches === 0 ? "address_not_found" : "ambiguous_address",
331
- message: matches === 0 ? `Entry address ${JSON.stringify(address)} was not found.` : `Entry address ${JSON.stringify(address)} resolves to ${matches} records.`,
332
- addressType,
333
- address,
334
- matches
335
- };
336
- }
337
- return void 0;
338
- };
339
- var resolveDescentSelection = (items, args) => {
340
- const total = items.length;
341
- const outOfRange = (message) => ({ error: { code: "index_out_of_bounds", message, entryCount: total } });
342
- const positioned = () => items.map((item, index) => ({ item, index }));
343
- const requested = args.indices;
344
- if (requested !== void 0 && !Array.isArray(requested)) {
345
- throw new Error("memory.expand indices must be an array");
346
- }
347
- const candidates = requested ?? [];
348
- if (!candidates.every((index) => typeof index === "number" && Number.isSafeInteger(index) && index >= 0)) {
349
- return outOfRange("Every entry index must be a non-negative safe integer.");
350
- }
351
- const indices = candidates;
352
- const beyond = indices.find((index) => index >= total);
353
- if (beyond !== void 0) {
354
- return outOfRange(`Entry index ${beyond} is outside 0..${Math.max(0, total - 1)}.`);
355
- }
356
- const entryIds = addressList(args.entryIds);
357
- const addresses = addressList(args.operationAddresses);
358
- const range = args.entryRange && typeof args.entryRange === "object" && !Array.isArray(args.entryRange) ? args.entryRange : void 0;
359
- const first = range?.first;
360
- const last = range?.last;
361
- if (first === void 0 !== (last === void 0)) {
362
- throw new Error("memory.expand entryRange requires both first and last");
363
- }
364
- if (first !== void 0 && (typeof first !== "number" || typeof last !== "number" || !Number.isSafeInteger(first) || !Number.isSafeInteger(last) || first < 0 || last < first)) {
365
- return outOfRange("Entry range requires safe integers with 0 <= first <= last.");
366
- }
367
- if (typeof last === "number" && last >= total) {
368
- return outOfRange(`Entry range ends at ${last}, but the summary descends into ${total} entries.`);
369
- }
370
- const before = clampInteger(args.before, 0, SUMMARY_EXPAND_MAX_CONTEXT, 0);
371
- const after = clampInteger(args.after, 0, SUMMARY_EXPAND_MAX_CONTEXT, 0);
372
- if (indices.length === 0 && entryIds.length === 0 && addresses.length === 0 && first === void 0) {
373
- if (before > 0 || after > 0) {
374
- throw new Error("memory.expand before/after requires one selected anchor");
375
- }
376
- return { selected: positioned() };
377
- }
378
- const missingEntryId = unresolvedAddress(entryIds, items, "entry_id", (item) => item.entryId);
379
- if (missingEntryId) return { error: missingEntryId };
380
- const missingAddress = unresolvedAddress(addresses, items, "operation_address", (item) => item.address);
381
- if (missingAddress) return { error: missingAddress };
382
- const indexSet = new Set(indices);
383
- const entryIdSet = new Set(entryIds);
384
- const addressSet = new Set(addresses);
385
- const selected = positioned().filter(({ item, index }) => indexSet.has(index) || entryIdSet.has(item.entryId) || addressSet.has(item.address) || typeof first === "number" && typeof last === "number" && index >= first && index <= last);
386
- if (before === 0 && after === 0) return { selected };
387
- if (selected.length !== 1) {
388
- throw new Error("memory.expand before/after requires exactly one resolved anchor");
389
- }
390
- const anchor = selected[0].index;
391
- const from = Math.max(0, anchor - before);
392
- const to = Math.min(Math.max(0, total - 1), anchor + after);
393
- return { selected: positioned().filter(({ index }) => index >= from && index <= to) };
394
- };
395
- var LcmMemoryAdapter = class {
396
- constructor(options) {
397
- this.options = options;
398
- this.projectKey = options.projectKey ?? options.ledger.projectKey;
399
- this.maxRaw = Math.max(1, Math.min(options.maxRawEntries ?? 1e3, 1e4));
400
- this.maxSummary = Math.max(1, Math.min(options.maxSummaryNodes ?? 1e3, 1e4));
401
- }
402
- projectKey;
403
- maxRaw;
404
- maxSummary;
405
- descents = /* @__PURE__ */ new Map();
406
- recall(args) {
407
- const query = typeof args.query === "string" ? args.query : void 0;
408
- const mode = readMode(args.queryMode);
409
- const match = readMatch(args.queryMatch);
410
- const predicate = queryPredicate(query, mode, match);
411
- const branches = args.branches === "all" ? "all" : "active";
412
- const offset = typeof args.offset === "number" && args.offset >= 0 ? Math.floor(args.offset) : 0;
413
- const pageSize = typeof args.pageSize === "number" && args.pageSize >= 1 ? Math.min(50, Math.floor(args.pageSize)) : 10;
414
- const selectedSession = sessionScope(args, this.options.getCurrentSessionId?.());
415
- const filter = rawFilter(args, query, mode);
416
- const reasons = /* @__PURE__ */ new Set();
417
- if (predicate.failure) reasons.add(predicate.failure);
418
- const summaryHits = filter.includeSummaries ? this.summaryHits(selectedSession, branches, predicate, filter, reasons) : [];
419
- const page = this.mergedPage({
420
- search: {
421
- ...selectedSession === void 0 ? {} : { sessionId: selectedSession },
422
- ...query === void 0 ? {} : { query },
423
- mode,
424
- match,
425
- ...filter.search
426
- },
427
- branches,
428
- predicate,
429
- summaryHits,
430
- offset,
431
- pageSize,
432
- reasons
433
- });
434
- const total = page.rawTotal + summaryHits.length;
435
- const sessions = new Set(page.hits.map((hit) => hit.sessionId)).size;
436
- return {
437
- total,
438
- hits: page.hits,
439
- next: !page.exhausted && page.position < total ? { ref: "memory.recall", args: { ...args, offset: page.position } } : null,
440
- coverage: {
441
- complete: reasons.size === 0,
442
- indexedSessions: sessions,
443
- eligibleSessions: sessions,
444
- staleSessions: 0,
445
- incompleteSessions: reasons.size === 0 ? 0 : 1,
446
- reasons: [...reasons].sort()
447
- }
448
- };
449
- }
450
- mergedPage(input) {
451
- const { search, branches, predicate, summaryHits, offset, pageSize, reasons } = input;
452
- let batch = [];
453
- let batchStart = 0;
454
- let rawEnd = Number.POSITIVE_INFINITY;
455
- let rawTotal = 0;
456
- const rawAt = (position2) => {
457
- if (position2 >= batchStart && position2 < batchStart + batch.length) return batch[position2 - batchStart];
458
- if (position2 >= rawEnd) return void 0;
459
- const limit = Math.max(pageSize, 32);
460
- const page = this.options.ledger.searchRaw({ ...search, offset: position2, limit, scanLimit: this.maxRaw });
461
- rawTotal = page.total;
462
- if (!page.complete) reasons.add("raw_search_incomplete");
463
- batch = page.rows;
464
- batchStart = position2;
465
- if (page.rows.length < limit) rawEnd = position2 + page.rows.length;
466
- return batch[0];
467
- };
468
- const hits = [];
469
- let rawPosition = summaryHits.length === 0 ? offset : 0;
470
- let summaryPosition = 0;
471
- let position = rawPosition;
472
- let emittedRaw = 0;
473
- let headPosition = -1;
474
- let headScore = 0;
475
- let exhausted = false;
476
- while (hits.length < pageSize) {
477
- if (position >= offset && emittedRaw >= this.maxRaw) {
478
- if (rawAt(rawPosition) !== void 0) reasons.add("raw_scan_limit");
479
- break;
480
- }
481
- const entry = rawAt(rawPosition);
482
- const summary = summaryHits[summaryPosition];
483
- if (entry === void 0 && summary === void 0) {
484
- exhausted = true;
485
- break;
486
- }
487
- if (entry !== void 0 && headPosition !== rawPosition) {
488
- headScore = predicate.scoreOf(entry.content);
489
- headPosition = rawPosition;
490
- }
491
- const emit = position >= offset;
492
- position += 1;
493
- if (summary !== void 0 && (entry === void 0 || summary.score > headScore)) {
494
- summaryPosition += 1;
495
- if (emit) hits.push(summary);
496
- continue;
497
- }
498
- rawPosition += 1;
499
- if (!emit) continue;
500
- emittedRaw += 1;
501
- const allowed = activeAllowed(branches, activeBinding(this.options, entry.sessionId), sourceKey(entry.entryId, entry.contentHash));
502
- if (!allowed.allowed) {
503
- if (allowed.reason) reasons.add(allowed.reason);
504
- continue;
505
- }
506
- hits.push(this.rawHit(entry, headScore, branches));
507
- }
508
- return { hits, position, rawTotal, exhausted };
509
- }
510
- rawHit(entry, score, branches) {
511
- const preview = excerpt(entry.content);
512
- const address = lcmRawAddress(entry);
513
- return {
514
- kind: "lcm.raw",
515
- sessionId: entry.sessionId,
516
- score,
517
- snippet: preview.snippet,
518
- truncated: preview.truncated,
519
- source: {
520
- kind: "raw",
521
- projectKey: entry.projectKey,
522
- sessionId: entry.sessionId,
523
- entryId: entry.entryId,
524
- revision: entry.revision,
525
- contentHash: entry.payloadHash,
526
- sourceHash: entry.payloadHash
527
- },
528
- follow: {
529
- ref: "memory.expand",
530
- args: { session: address, branches, expectedSourceHash: entry.payloadHash }
531
- }
532
- };
533
- }
534
- summaryHits(selectedSession, branches, predicate, filter, reasons) {
535
- const nodes = selectedSession === void 0 ? this.options.summaries.listNodes({ limit: this.maxSummary + 1 }) : this.options.summaries.listNodes({ sessionId: selectedSession, limit: this.maxSummary + 1 });
536
- if (nodes.length > this.maxSummary) reasons.add("summary_node_limit");
537
- const hits = [];
538
- for (const node of nodes.slice(0, this.maxSummary)) {
539
- if (node.state !== "ready") {
540
- reasons.add(`summary_${node.state}`);
541
- continue;
542
- }
543
- const binding = activeBinding(this.options, node.sessionId);
544
- if (branches === "active") {
545
- if (!binding) {
546
- reasons.add("active_branch_unbound");
547
- continue;
548
- }
549
- if (!binding.ready) {
550
- reasons.add("session_incomplete");
551
- continue;
552
- }
553
- const active = activeSourceSet(binding);
554
- if (active && node.sources.some((source) => !active.has(sourceKey(source.entryId, source.contentHash)))) {
555
- reasons.add("summary_off_active_branch");
556
- continue;
557
- }
558
- }
559
- if (filter.since !== void 0 && node.createdAt < filter.since) continue;
560
- if (filter.until !== void 0 && node.createdAt > filter.until) continue;
561
- if (!predicate.matches(node.text)) continue;
562
- const preview = excerpt(node.text);
563
- hits.push({
564
- createdAt: node.createdAt,
565
- nodeId: node.nodeId,
566
- hit: {
567
- kind: "lcm.summary",
568
- sessionId: node.sessionId,
569
- score: predicate.scoreOf(node.text),
570
- snippet: preview.snippet,
571
- truncated: preview.truncated,
572
- source: {
573
- kind: "summary",
574
- projectKey: node.projectKey,
575
- sessionId: node.sessionId,
576
- nodeId: node.nodeId,
577
- sourceHash: node.sourceHash
578
- },
579
- follow: {
580
- ref: "memory.expand",
581
- args: { session: lcmSummaryAddress(node.nodeId), branches, expectedSourceHash: node.sourceHash }
582
- }
583
- }
584
- });
585
- }
586
- hits.sort((left, right) => right.hit.score - left.hit.score || right.createdAt - left.createdAt || left.nodeId.localeCompare(right.nodeId));
587
- return hits.map((entry) => entry.hit);
588
- }
589
- expand(args) {
590
- const address = typeof args.session === "string" ? args.session : "";
591
- const branches = args.branches === "all" ? "all" : "active";
592
- if (address.startsWith("lcm.summary:")) return this.expandSummary(address, args, branches);
593
- return this.expandRaw(address, args, branches);
594
- }
595
- expandSummary(address, args, branches) {
596
- const node = this.options.summaries.getNode(address.slice("lcm.summary:".length));
597
- if (!node) return { entries: [], next: null, error: { code: "stale_pointer", message: "summary node is unavailable" } };
598
- if (node.state !== "ready") return { entries: [], next: null, error: { code: "incomplete_coverage", message: `summary node is ${node.state}` } };
599
- const binding = activeBinding(this.options, node.sessionId);
600
- const active = activeSourceSet(binding);
601
- if (branches === "active") {
602
- if (!binding || !binding.ready) return { entries: [], next: null, error: { code: "incomplete_coverage", message: "summary lineage is not ready" } };
603
- if (active && node.sources.some((source) => !active.has(sourceKey(source.entryId, source.contentHash)))) {
604
- return { entries: [], next: null, error: { code: "stale_pointer", message: "summary is outside the active branch" } };
605
- }
606
- }
607
- const expected = typeof args.expectedSourceHash === "string" ? args.expectedSourceHash : void 0;
608
- if (expected && expected !== node.sourceHash) {
609
- return { entries: [], next: null, error: { code: "stale_pointer", message: "summary source hash changed", expectedSourceHash: expected, actualSourceHash: node.sourceHash } };
610
- }
611
- const expectedLineage = typeof args.expectedLineageFingerprint === "string" ? args.expectedLineageFingerprint : void 0;
612
- const actualLineage = node.lineageFingerprint ?? null;
613
- if (expectedLineage !== void 0 && expectedLineage !== actualLineage) {
614
- return { entries: [], next: null, error: { code: "stale_pointer", message: "summary active lineage changed", expectedLineageFingerprint: expectedLineage, actualLineageFingerprint: actualLineage } };
615
- }
616
- const offset = clampInteger(args.entryOffset, 0, Number.MAX_SAFE_INTEGER, 0);
617
- const textOffset = clampInteger(args.textOffset, 0, Number.MAX_SAFE_INTEGER, 0);
618
- const maxEntries = clampInteger(args.maxEntries, 1, SUMMARY_EXPAND_MAX_ENTRIES, SUMMARY_EXPAND_DEFAULT_ENTRIES);
619
- const maxChars = clampInteger(args.maxChars, 256, SUMMARY_EXPAND_MAX_CHARS, SUMMARY_EXPAND_DEFAULT_CHARS);
620
- const descent = node.sources.length > 0 ? this.constituentEntries(node, branches, active) : this.childEntries(node, branches);
621
- const total = descent.items.length;
622
- const refused = (error) => ({
623
- session: address,
624
- sourceHash: node.sourceHash,
625
- branches,
626
- lineageFingerprint: actualLineage,
627
- total,
628
- entryCount: total,
629
- entries: [],
630
- next: null,
631
- error
632
- });
633
- const selection = resolveDescentSelection(descent.items, args);
634
- if ("error" in selection) return refused(selection.error);
635
- const selected = selection.selected;
636
- if (offset > selected.length) {
637
- return refused({
638
- code: "index_out_of_bounds",
639
- message: `Entry offset ${offset} is outside 0..${selected.length}.`,
640
- entryCount: total
641
- });
642
- }
643
- if (offset < selected.length && textOffset > selected[offset].item.text.length) {
644
- return refused({
645
- code: "text_offset_out_of_bounds",
646
- message: `Text offset ${textOffset} exceeds entry #${selected[offset].index} length ${selected[offset].item.text.length}.`,
647
- textLength: selected[offset].item.text.length
648
- });
649
- }
650
- const entries = [];
651
- let cursor = offset;
652
- let start = textOffset;
653
- let budget = maxChars;
654
- while (cursor < selected.length && entries.length < maxEntries && budget > 0) {
655
- const { item, index } = selected[cursor];
656
- let stop = Math.min(item.text.length, start + budget);
657
- if (stop < item.text.length && isLowSurrogate(item.text.charCodeAt(stop))) {
658
- stop = stop - 1 > start ? stop - 1 : Math.min(item.text.length, stop + 1);
659
- }
660
- const text = item.text.slice(start, stop);
661
- const end = start + text.length;
662
- const complete = end >= item.text.length;
663
- entries.push({
664
- index,
665
- entryId: item.entryId,
666
- parentId: item.parentId,
667
- type: item.type,
668
- role: item.role,
669
- timestamp: item.timestamp,
670
- isError: false,
671
- text,
672
- textRange: { start, end, total: item.text.length, complete },
673
- anchor: true,
674
- address: item.address,
675
- sourceHash: item.sourceHash,
676
- follow: {
677
- ref: "memory.expand",
678
- args: { session: item.address, branches, expectedSourceHash: item.sourceHash }
679
- }
680
- });
681
- budget -= text.length;
682
- if (!complete) {
683
- start = end;
684
- break;
685
- }
686
- cursor += 1;
687
- start = 0;
688
- }
689
- return {
690
- session: address,
691
- sourceHash: node.sourceHash,
692
- branches,
693
- lineageFingerprint: actualLineage,
694
- node: {
695
- nodeId: node.nodeId,
696
- sessionId: node.sessionId,
697
- kind: node.kind ?? (node.sources.length > 0 ? "leaf" : "condensed"),
698
- state: node.state,
699
- text: node.text,
700
- sourceHash: node.sourceHash,
701
- children: node.children,
702
- sources: node.sources,
703
- createdAt: node.createdAt
704
- },
705
- total,
706
- entryCount: total,
707
- entries,
708
- next: cursor < selected.length ? { ref: "memory.expand", args: { ...args, entryOffset: cursor, textOffset: start } } : null,
709
- ...descent.unavailable === 0 ? {} : { error: { code: "incomplete_coverage", message: `${descent.unavailable} constituent source(s) are unavailable` } }
710
- };
711
- }
712
- rememberDescent(key, items) {
713
- this.descents.delete(key);
714
- this.descents.set(key, items);
715
- while (this.descents.size > SUMMARY_DESCENT_CACHE_LIMIT) {
716
- const oldest = this.descents.keys().next().value;
717
- if (oldest === void 0) break;
718
- this.descents.delete(oldest);
719
- }
720
- }
721
- constituentEntries(node, branches, active) {
722
- const reachable = [];
723
- let unavailable = 0;
724
- for (const source of node.sources) {
725
- const key = sourceKey(source.entryId, source.contentHash);
726
- if (branches === "active" && active && !active.has(key)) {
727
- unavailable += 1;
728
- continue;
729
- }
730
- reachable.push(source);
731
- }
732
- const descentKey = hash([
733
- node.nodeId,
734
- node.sessionId,
735
- node.sourceHash,
736
- ...reachable.map((source) => `${source.entryId}:${source.revision}:${source.contentHash}`)
737
- ].join("|"));
738
- const memoized = this.descents.get(descentKey);
739
- if (memoized) return { items: memoized, unavailable };
740
- const items = [];
741
- let missing = 0;
742
- for (const source of reachable) {
743
- const entry = this.options.ledger.readRawEntry(node.sessionId, source.entryId, source.revision);
744
- if (!entry) {
745
- missing += 1;
746
- continue;
747
- }
748
- items.push({
749
- entryId: entry.entryId,
750
- parentId: entry.parentEntryId ?? null,
751
- type: "raw",
752
- role: entry.role,
753
- timestamp: entry.createdAt,
754
- text: entry.content,
755
- address: lcmRawAddress(entry),
756
- sourceHash: entry.payloadHash
757
- });
758
- }
759
- items.sort((left, right) => left.timestamp - right.timestamp || left.entryId.localeCompare(right.entryId) || left.address.localeCompare(right.address));
760
- if (missing === 0) this.rememberDescent(descentKey, items);
761
- return { items, unavailable: unavailable + missing };
762
- }
763
- childEntries(node, branches) {
764
- const items = [];
765
- let unavailable = 0;
766
- for (const childId of node.children) {
767
- const child = this.options.summaries.getNode(childId);
768
- if (!child || child.state !== "ready") {
769
- unavailable += 1;
770
- continue;
771
- }
772
- if (branches === "active" && child.sources.some((source) => !activeAllowed(branches, activeBinding(this.options, child.sessionId), sourceKey(source.entryId, source.contentHash)).allowed)) {
773
- unavailable += 1;
774
- continue;
775
- }
776
- items.push({
777
- entryId: child.nodeId,
778
- parentId: node.nodeId,
779
- type: "summary",
780
- role: "compactionSummary",
781
- timestamp: child.createdAt,
782
- text: child.text,
783
- address: lcmSummaryAddress(child.nodeId),
784
- sourceHash: child.sourceHash
785
- });
786
- }
787
- items.sort((left, right) => left.timestamp - right.timestamp || left.entryId.localeCompare(right.entryId));
788
- return { items, unavailable };
789
- }
790
- expandRaw(address, args, branches) {
791
- const parsed = parseLcmRawAddress(address);
792
- if (!parsed) return { entries: [], next: null, error: { code: "invalid_address", message: "invalid LCM raw address" } };
793
- const { sessionId, entryId, revision } = parsed;
794
- const entry = this.options.ledger.readRawEntry(sessionId, entryId, revision);
795
- if (!entry) return { entries: [], next: null, error: { code: "stale_pointer", message: "raw source is unavailable" } };
796
- const binding = activeBinding(this.options, sessionId);
797
- const allowed = activeAllowed(branches, binding, sourceKey(entryId, entry.contentHash));
798
- if (!allowed.allowed) return { entries: [], next: null, error: { code: allowed.reason === "source_off_active_branch" ? "stale_pointer" : "incomplete_coverage", message: allowed.reason ?? "raw lineage is unavailable" } };
799
- const payload = JSON.parse(entry.payloadJson);
800
- const sourceHash = hashLcmPayload(payload);
801
- const expected = typeof args.expectedSourceHash === "string" ? args.expectedSourceHash : void 0;
802
- if (expected && expected !== sourceHash) return { entries: [], next: null, error: { code: "stale_pointer", message: "raw source hash changed", expectedSourceHash: expected, actualSourceHash: sourceHash } };
803
- const max = typeof args.maxChars === "number" ? Math.min(24e3, Math.max(256, Math.floor(args.maxChars))) : 2e4;
804
- const start = typeof args.textOffset === "number" ? Math.max(0, Math.floor(args.textOffset)) : 0;
805
- const text = entry.content.slice(start, start + max);
806
- const complete = start + text.length >= entry.content.length;
807
- return {
808
- session: address,
809
- sourceHash,
810
- branches,
811
- entryCount: 1,
812
- entries: [{
813
- index: 0,
814
- entryId: entry.entryId,
815
- parentId: entry.parentEntryId,
816
- type: "raw",
817
- role: entry.role,
818
- timestamp: entry.createdAt,
819
- isError: false,
820
- text,
821
- textRange: { start, end: start + text.length, total: entry.content.length, complete },
822
- anchor: true,
823
- address,
824
- sourceHash,
825
- structuredContent: payload
826
- }],
827
- next: complete ? null : { ref: "memory.expand", args: { ...args, textOffset: start + text.length } }
828
- };
829
- }
830
- };
831
-
832
229
  // src/providers/arg-normalization.ts
833
230
  var normalizeForm = (key) => key.toLowerCase().replace(/[^a-z0-9]/g, "");
834
231
  var KEY_SYNONYM_CLASSES = [
@@ -1230,19 +627,6 @@ var recallSessionOutputSchema = {
1230
627
  "follow"
1231
628
  ]
1232
629
  };
1233
- var lcmRecallOutputSchema = {
1234
- type: "object",
1235
- properties: {
1236
- kind: { type: "string", enum: ["lcm.raw", "lcm.summary"] },
1237
- sessionId: { type: "string" },
1238
- score: { type: "number" },
1239
- snippet: { type: "string" },
1240
- truncated: { type: "boolean" },
1241
- source: { type: "object" },
1242
- follow: callOutputSchema("memory.expand")
1243
- },
1244
- required: ["kind", "sessionId", "score", "snippet", "truncated", "source", "follow"]
1245
- };
1246
630
  var recallOutputSchema = {
1247
631
  type: "object",
1248
632
  description: "Bounded ranked memory hits with uniform follow and pagination calls.",
@@ -1251,7 +635,7 @@ var recallOutputSchema = {
1251
635
  hits: {
1252
636
  type: "array",
1253
637
  description: "Call tools.call(hit.follow) to expand an entry or resolve a cold session.",
1254
- items: { oneOf: [recallEntryOutputSchema, recallSessionOutputSchema, lcmRecallOutputSchema] }
638
+ items: { oneOf: [recallEntryOutputSchema, recallSessionOutputSchema] }
1255
639
  },
1256
640
  next: {
1257
641
  oneOf: [callOutputSchema("memory.recall"), { type: "null" }],
@@ -1270,10 +654,6 @@ var expandOutputSchema = {
1270
654
  sourceHash: { type: "string" },
1271
655
  branches: { type: "string", enum: ["active", "all"] },
1272
656
  lineageFingerprint: { type: ["string", "null"] },
1273
- node: {
1274
- type: "object",
1275
- description: "The expanded LCM summary node itself: its own text, kind, sourceHash, children, and sources."
1276
- },
1277
657
  total: { type: "number" },
1278
658
  entryCount: { type: "number" },
1279
659
  entries: {
@@ -1370,7 +750,7 @@ var sessionsOutputSchema = {
1370
750
  var descriptors = [
1371
751
  {
1372
752
  name: "recall",
1373
- description: "Search session memory as bounded snippets. An empty query browses entries newest first; a literal or phrase query ranks by relevance, then recency. Literal queries accept any matching term by default; queryMatch all narrows to co-located terms. role:'user' finds the user's requests; since/until bound entry time in epoch ms. When the LCM ledger is active, recall reads it together with its summaries and skips tool bookkeeping entries (role custom) unless role:'custom' is given; entryRange, ref, provider, action, outcome, or tool switch recall to the session-file engine. Call tools.call(hit.follow) for either an exact entry or a cold-session candidate, and tools.call(next) to continue.",
753
+ description: "Search session memory as bounded snippets. An empty query browses entries newest first; a literal or phrase query ranks by relevance, then recency. Literal queries accept any matching term by default; queryMatch all narrows to co-located terms. role:'user' finds the user's requests; since/until bound entry time in epoch ms. Call tools.call(hit.follow) for either an exact entry or a cold-session candidate, and tools.call(next) to continue.",
1374
754
  inputSchema: {
1375
755
  type: "object",
1376
756
  properties: {
@@ -1478,11 +858,11 @@ var descriptors = [
1478
858
  },
1479
859
  {
1480
860
  name: "expand",
1481
- description: "Read exact normalized session entries and nearby context as bounded lossless chunks. An lcm.raw: address reads that ledger entry; before/after add its neighbouring entries from the session file. An lcm.summary: address returns the entries that summary was built from, each addressed for further expansion. A bare session id or file path with indices, entryIds, entryRange, or operationAddresses reads absolute entry indices. Call tools.call(next) to continue, or use guest-side memory.walk(args, visitor) to traverse complete reassembled entries.",
861
+ description: "Read exact normalized session entries and nearby context as bounded lossless chunks. A bare session id or file path with indices, entryIds, entryRange, or operationAddresses reads absolute entry indices. Call tools.call(next) to continue, or use guest-side memory.walk(args, visitor) to traverse complete reassembled entries.",
1482
862
  inputSchema: {
1483
863
  type: "object",
1484
864
  properties: {
1485
- session: { type: "string", description: "Exact session file path, unambiguous session id, or an lcm.raw:/lcm.summary: address." },
865
+ session: { type: "string", description: "Exact session file path or unambiguous session id." },
1486
866
  expectedSourceHash: {
1487
867
  type: "string",
1488
868
  description: "SHA-256 from a prior pointer; stale sources are refused."
@@ -1603,8 +983,6 @@ var normalizeMemoryArgs = actionArgNormalizer(
1603
983
  () => descriptors,
1604
984
  MEMORY_ARG_NORMALIZATION
1605
985
  );
1606
- var SESSION_ENGINE_RECALL_KEYS = ["entryRange", "ref", "provider", "action", "outcome", "tool"];
1607
- var isLcmAddress = (session) => typeof session === "string" && (session.startsWith("lcm.raw:") || session.startsWith("lcm.summary:"));
1608
986
  var parseBranches = (value, action) => {
1609
987
  if (value === void 0) return "active";
1610
988
  if (value === "active" || value === "all") return value;
@@ -1705,14 +1083,7 @@ var MemoryProvider = class {
1705
1083
  name = "memory";
1706
1084
  description = "Cross-session memory: a search engine over every OMP session timeline on this machine";
1707
1085
  recallContinuation;
1708
- lcmAdapter;
1709
1086
  expansionSnapshots = /* @__PURE__ */ new Map();
1710
- lcmMemoryAdapter(source) {
1711
- if (this.lcmAdapter?.source !== source) {
1712
- this.lcmAdapter = { source, adapter: new LcmMemoryAdapter(source) };
1713
- }
1714
- return this.lcmAdapter.adapter;
1715
- }
1716
1087
  cachedRecallContinuation(key, observations) {
1717
1088
  const cached = this.recallContinuation;
1718
1089
  if (!cached || cached.key !== key) return void 0;
@@ -1781,15 +1152,6 @@ var MemoryProvider = class {
1781
1152
  }
1782
1153
  async invoke(actionName, args, invocationContext) {
1783
1154
  try {
1784
- const lcm = this.context.lcm;
1785
- if (lcm && actionName === "expand" && isLcmAddress(args.session)) {
1786
- return await this.expandLcm(this.lcmMemoryAdapter(lcm), args);
1787
- }
1788
- if (lcm && actionName === "recall" && !SESSION_ENGINE_RECALL_KEYS.some((key) => args[key] !== void 0)) {
1789
- const queryMode = parseQueryMode(args.queryMode, "memory.recall");
1790
- const queryMatch = parseQueryMatch(args.queryMatch, queryMode, "memory.recall");
1791
- return this.lcmMemoryAdapter(lcm).recall({ ...args, queryMode, queryMatch });
1792
- }
1793
1155
  switch (actionName) {
1794
1156
  case "recall":
1795
1157
  return await this.recall(args, invocationContext);
@@ -1821,50 +1183,6 @@ var MemoryProvider = class {
1821
1183
  throw error;
1822
1184
  }
1823
1185
  }
1824
- async expandLcm(adapter, args) {
1825
- const single = adapter.expand(args);
1826
- const raw = parseLcmRawAddress(String(args.session));
1827
- const context = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? Math.min(value, EXPAND_MAX_CONTEXT) : 0;
1828
- const before = context(args.before);
1829
- const after = context(args.after);
1830
- if (!raw || before === 0 && after === 0 || single.error !== void 0) return single;
1831
- const unavailable = (message) => ({
1832
- ...single,
1833
- error: { code: "context_unavailable", message }
1834
- });
1835
- let ref;
1836
- try {
1837
- ref = resolveSessionTarget(this.context.agentDir, raw.sessionId, overrideSessionDir(this.context.sessionFile));
1838
- } catch (error) {
1839
- return unavailable(`Session ${raw.sessionId} did not resolve: ${error instanceof Error ? error.message : String(error)}`);
1840
- }
1841
- if (!ref) {
1842
- return unavailable(`Session file for ${raw.sessionId} is unavailable; returned the single ledger entry.`);
1843
- }
1844
- const {
1845
- session: _session,
1846
- expectedSourceHash: _expectedSourceHash,
1847
- expectedLineageFingerprint: _expectedLineageFingerprint,
1848
- indices: _indices,
1849
- entryIds: _entryIds,
1850
- operationAddresses: _operationAddresses,
1851
- entryRange: _entryRange,
1852
- entryOffset: _entryOffset,
1853
- textOffset: _textOffset,
1854
- ...rest
1855
- } = args;
1856
- let widened;
1857
- try {
1858
- widened = await this.expand({ ...rest, session: ref.file, entryIds: [raw.entryId], before, after });
1859
- } catch (error) {
1860
- return unavailable(`Context read failed: ${error instanceof Error ? error.message : String(error)}`);
1861
- }
1862
- if (widened.error !== void 0) {
1863
- const detail = widened.error;
1864
- return unavailable(`Entry ${raw.entryId} has no context in ${ref.file}: ${String(detail.message ?? "unreadable")}`);
1865
- }
1866
- return widened;
1867
- }
1868
1186
  async recall(args, invocationContext) {
1869
1187
  const query = typeof args.query === "string" ? args.query : void 0;
1870
1188
  const queryMode = parseQueryMode(args.queryMode, "memory.recall");
@@ -2569,4 +1887,4 @@ export {
2569
1887
  normalizeMemoryArgs,
2570
1888
  MemoryProvider
2571
1889
  };
2572
- //# sourceMappingURL=chunk-3QPIB3H2.js.map
1890
+ //# sourceMappingURL=chunk-EV36BIIO.js.map