omp-fabric 1.1.0 → 1.3.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 (101) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +1 -0
  3. package/dist/actors/global-registry.d.ts.map +1 -1
  4. package/dist/actors/manager.d.ts.map +1 -1
  5. package/dist/actors/types.d.ts +1 -0
  6. package/dist/actors/types.d.ts.map +1 -1
  7. package/dist/agents/handoff.d.ts +1 -1
  8. package/dist/agents/handoff.d.ts.map +1 -1
  9. package/dist/agents/manager.d.ts.map +1 -1
  10. package/dist/agents/types.d.ts +2 -1
  11. package/dist/agents/types.d.ts.map +1 -1
  12. package/dist/chunks/{chunk-3TWC6XOS.js → chunk-2WDZT27Q.js} +36 -13
  13. package/dist/chunks/chunk-2WDZT27Q.js.map +7 -0
  14. package/dist/chunks/{chunk-UOSJZXJV.js → chunk-3LI7YO4M.js} +1 -1
  15. package/dist/chunks/chunk-3LI7YO4M.js.map +7 -0
  16. package/dist/chunks/{chunk-WXZP5VWP.js → chunk-7MFYALJI.js} +16 -16
  17. package/dist/chunks/chunk-7MFYALJI.js.map +7 -0
  18. package/dist/chunks/{chunk-B2SQR2JY.js → chunk-BMIE4PIL.js} +2 -2
  19. package/dist/chunks/{chunk-NX4SNIMR.js → chunk-FX3XLQYI.js} +36 -7
  20. package/dist/chunks/chunk-FX3XLQYI.js.map +7 -0
  21. package/dist/chunks/{chunk-CVLO4GNW.js → chunk-GDZDWKJS.js} +3 -3
  22. package/dist/chunks/{chunk-YPYVUGON.js → chunk-JOWMM3EX.js} +6 -6
  23. package/dist/chunks/chunk-JOWMM3EX.js.map +7 -0
  24. package/dist/chunks/{chunk-L2FNMIOW.js → chunk-QNRGTJGE.js} +2 -1
  25. package/dist/chunks/chunk-QNRGTJGE.js.map +7 -0
  26. package/dist/chunks/{chunk-2GQC324T.js → chunk-TSU4AEPZ.js} +2 -2
  27. package/dist/chunks/{chunk-TLSJXU4F.js → chunk-VSSC4IDU.js} +180 -11
  28. package/dist/chunks/chunk-VSSC4IDU.js.map +7 -0
  29. package/dist/chunks/{chunk-HDJBUXDX.js → chunk-WQUMHDOS.js} +2 -2
  30. package/dist/chunks/{chunk-EZPERYEG.js → chunk-XRJYPNTI.js} +56 -2
  31. package/dist/chunks/chunk-XRJYPNTI.js.map +7 -0
  32. package/dist/chunks/{chunk-Z6HEQPXX.js → chunk-Z5AP4M6K.js} +70 -6
  33. package/dist/chunks/chunk-Z5AP4M6K.js.map +7 -0
  34. package/dist/chunks/{chunk-KIREBD2V.js → chunk-ZP3S74LW.js} +2 -1
  35. package/dist/codemap/budget.d.ts +3 -0
  36. package/dist/codemap/budget.d.ts.map +1 -0
  37. package/dist/codemap/cascade.d.ts +3 -0
  38. package/dist/codemap/cascade.d.ts.map +1 -0
  39. package/dist/codemap/symbols.d.ts +3 -0
  40. package/dist/codemap/symbols.d.ts.map +1 -0
  41. package/dist/codemap/types.d.ts +58 -0
  42. package/dist/codemap/types.d.ts.map +1 -0
  43. package/dist/compaction/hook.js +1 -1
  44. package/dist/config.d.ts +11 -0
  45. package/dist/config.d.ts.map +1 -1
  46. package/dist/core/system-guidance.d.ts.map +1 -1
  47. package/dist/entropy/index.js +2 -2
  48. package/dist/fabric-runtime-state.d.ts.map +1 -1
  49. package/dist/fabric-runtime-state.js +1806 -378
  50. package/dist/fabric-runtime-state.js.map +4 -4
  51. package/dist/index.js +12 -12
  52. package/dist/index.js.map +1 -1
  53. package/dist/memory/discovery.d.ts +10 -0
  54. package/dist/memory/discovery.d.ts.map +1 -1
  55. package/dist/memory/discovery.js +3 -1
  56. package/dist/prewalk/handoff.d.ts +2 -1
  57. package/dist/prewalk/handoff.d.ts.map +1 -1
  58. package/dist/prewalk/retirement.d.ts +35 -0
  59. package/dist/prewalk/retirement.d.ts.map +1 -0
  60. package/dist/providers/agents-actions.d.ts.map +1 -1
  61. package/dist/providers/agents-provider.d.ts.map +1 -1
  62. package/dist/providers/codemap-provider.d.ts +14 -0
  63. package/dist/providers/codemap-provider.d.ts.map +1 -0
  64. package/dist/providers/mcp-provider.d.ts.map +1 -1
  65. package/dist/providers/memory-provider.d.ts.map +1 -1
  66. package/dist/providers/memory-provider.js +2 -2
  67. package/dist/providers/mesh-provider.d.ts.map +1 -1
  68. package/dist/providers/omp-tools-provider.d.ts.map +1 -1
  69. package/dist/providers/write-preview.d.ts.map +1 -1
  70. package/dist/residency/host.js +6 -6
  71. package/dist/residency/omp-entry.js +6 -6
  72. package/dist/runtime/core-override-guest-types.js +1 -1
  73. package/dist/runtime/guest-types.d.ts +1 -1
  74. package/dist/runtime/guest-types.d.ts.map +1 -1
  75. package/dist/runtime/guest-types.js +1 -1
  76. package/dist/runtime/node-process-runtime.js +1 -1
  77. package/dist/runtime/quickjs-runtime.d.ts +1 -1
  78. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  79. package/dist/runtime/quickjs-runtime.js +1 -1
  80. package/dist/ui/dashboard.js +3 -3
  81. package/dist/ui/settings.d.ts.map +1 -1
  82. package/dist/ui/settings.js +90 -1
  83. package/dist/ui/settings.js.map +2 -2
  84. package/docs/architecture.md +1 -1
  85. package/docs/codemap.md +95 -0
  86. package/docs/configuration.md +1 -1
  87. package/package.json +4 -1
  88. package/dist/chunks/chunk-3TWC6XOS.js.map +0 -7
  89. package/dist/chunks/chunk-EZPERYEG.js.map +0 -7
  90. package/dist/chunks/chunk-L2FNMIOW.js.map +0 -7
  91. package/dist/chunks/chunk-NX4SNIMR.js.map +0 -7
  92. package/dist/chunks/chunk-TLSJXU4F.js.map +0 -7
  93. package/dist/chunks/chunk-UOSJZXJV.js.map +0 -7
  94. package/dist/chunks/chunk-WXZP5VWP.js.map +0 -7
  95. package/dist/chunks/chunk-YPYVUGON.js.map +0 -7
  96. package/dist/chunks/chunk-Z6HEQPXX.js.map +0 -7
  97. /package/dist/chunks/{chunk-B2SQR2JY.js.map → chunk-BMIE4PIL.js.map} +0 -0
  98. /package/dist/chunks/{chunk-CVLO4GNW.js.map → chunk-GDZDWKJS.js.map} +0 -0
  99. /package/dist/chunks/{chunk-2GQC324T.js.map → chunk-TSU4AEPZ.js.map} +0 -0
  100. /package/dist/chunks/{chunk-HDJBUXDX.js.map → chunk-WQUMHDOS.js.map} +0 -0
  101. /package/dist/chunks/{chunk-KIREBD2V.js.map → chunk-ZP3S74LW.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-7VIQNUPS.js";
4
4
  import {
5
5
  headlineArg
6
- } from "./chunk-HDJBUXDX.js";
6
+ } from "./chunk-WQUMHDOS.js";
7
7
  import {
8
8
  NESTED_TOOL_CALL_ID_PREFIX
9
9
  } from "./chunk-2LGLDM34.js";
@@ -12,7 +12,7 @@ import {
12
12
  buildThinkingDigest,
13
13
  snapshotHandoffSession,
14
14
  thinkingTransferPolicy
15
- } from "./chunk-YPYVUGON.js";
15
+ } from "./chunk-JOWMM3EX.js";
16
16
  import {
17
17
  isFabricThinking
18
18
  } from "./chunk-JSBTB3P6.js";
@@ -161,6 +161,159 @@ var CapturedToolCatalog = class {
161
161
 
162
162
  // src/prewalk/handoff.ts
163
163
  import { randomUUID } from "node:crypto";
164
+
165
+ // src/prewalk/retirement.ts
166
+ var RETIREMENT_RECENCY_WINDOW = 3;
167
+ var RETIREMENT_MIN_BYTES = 512;
168
+ var RETIREABLE_TOOLS = /* @__PURE__ */ new Set(["read", "grep", "find", "ls"]);
169
+ var MAX_TARGET_CHARS = 200;
170
+ var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
171
+ var textBytes = (value) => Buffer.byteLength(value, "utf8");
172
+ var jsonBytes = (value) => {
173
+ if (value === void 0) return 0;
174
+ try {
175
+ const encoded = JSON.stringify(value);
176
+ return typeof encoded === "string" ? textBytes(encoded) : 0;
177
+ } catch {
178
+ return 0;
179
+ }
180
+ };
181
+ var emptyPlan = (enabled) => ({
182
+ enabled,
183
+ candidates: 0,
184
+ retired: [],
185
+ bytesRetired: 0,
186
+ markerBytes: 0
187
+ });
188
+ var isTextBlock = (block) => isRecord(block) && block.type === "text" && typeof block.text === "string";
189
+ var textOnlyContent = (content) => Array.isArray(content) && content.every(isTextBlock);
190
+ var resultBytes = (message) => {
191
+ let bytes = 0;
192
+ const content = message.content;
193
+ if (Array.isArray(content)) {
194
+ for (const block of content) if (isTextBlock(block)) bytes += textBytes(block.text);
195
+ }
196
+ return bytes + jsonBytes(message.details);
197
+ };
198
+ var retireableToolName = (name) => {
199
+ if (typeof name !== "string") return void 0;
200
+ const bare = name.startsWith("omp.") ? name.slice(4) : name;
201
+ return RETIREABLE_TOOLS.has(bare) ? bare : void 0;
202
+ };
203
+ var clipTarget = (value) => value.length > MAX_TARGET_CHARS ? `${value.slice(0, MAX_TARGET_CHARS)}\u2026` : value;
204
+ var targetFromArguments = (args) => {
205
+ if (!isRecord(args)) return void 0;
206
+ const path3 = typeof args.path === "string" ? args.path.trim() : "";
207
+ const needle = ["pattern", "glob", "query"].map((key) => typeof args[key] === "string" ? args[key].trim() : "").find((value) => value.length > 0);
208
+ if (needle && path3) return clipTarget(`${needle} @ ${path3}`);
209
+ const target = path3 || needle;
210
+ return target ? clipTarget(target) : void 0;
211
+ };
212
+ var retirementMarker = (toolName, target, bytes) => target ? `[omp-fabric] retired ${toolName} result for ${target} (${bytes} bytes) \u2014 re-run ${toolName} on ${target} to recover it.` : `[omp-fabric] retired ${toolName} result (${bytes} bytes) \u2014 re-run ${toolName} to recover it.`;
213
+ var collectToolCallArguments = (message, into) => {
214
+ const content = message.content;
215
+ if (!Array.isArray(content)) return;
216
+ for (const block of content) {
217
+ if (!isRecord(block) || block.type !== "toolCall") continue;
218
+ if (typeof block.id !== "string") continue;
219
+ into.set(block.id, block.arguments);
220
+ }
221
+ };
222
+ var positiveInteger = (value, fallback) => typeof value === "number" && Number.isInteger(value) && value >= 0 ? value : fallback;
223
+ var planRetirement = (entries, options = {}) => {
224
+ const enabled = options.handoffRetirement === true;
225
+ if (!enabled || !Array.isArray(entries)) return emptyPlan(enabled);
226
+ const recencyWindow = positiveInteger(
227
+ options.recencyWindow,
228
+ positiveInteger(options.handoffRetirementKeep, RETIREMENT_RECENCY_WINDOW)
229
+ );
230
+ const minBytes = positiveInteger(options.minBytes, RETIREMENT_MIN_BYTES);
231
+ try {
232
+ const callArguments = /* @__PURE__ */ new Map();
233
+ const candidates = [];
234
+ for (const entry of entries) {
235
+ if (!isRecord(entry) || entry.type !== "message") continue;
236
+ const message = entry.message;
237
+ if (!isRecord(message)) continue;
238
+ if (message.role === "assistant") {
239
+ collectToolCallArguments(message, callArguments);
240
+ continue;
241
+ }
242
+ if (message.role !== "toolResult") continue;
243
+ if (message.isError !== false) continue;
244
+ if (message.prunedAt !== void 0) continue;
245
+ const toolName = retireableToolName(message.toolName);
246
+ if (!toolName) continue;
247
+ if (!textOnlyContent(message.content)) continue;
248
+ const entryId = typeof entry.id === "string" ? entry.id : void 0;
249
+ const toolCallId = typeof message.toolCallId === "string" ? message.toolCallId : void 0;
250
+ if (!entryId || !toolCallId) continue;
251
+ const bytes = resultBytes(message);
252
+ if (bytes < minBytes) continue;
253
+ const target = targetFromArguments(callArguments.get(toolCallId));
254
+ candidates.push({
255
+ entryId,
256
+ toolCallId,
257
+ toolName,
258
+ ...target ? { target } : {},
259
+ bytes,
260
+ marker: retirementMarker(toolName, target, bytes)
261
+ });
262
+ }
263
+ const retired = candidates.slice(0, Math.max(0, candidates.length - recencyWindow));
264
+ let bytesRetired = 0;
265
+ let markerBytes = 0;
266
+ for (const item of retired) {
267
+ bytesRetired += item.bytes;
268
+ markerBytes += textBytes(item.marker);
269
+ }
270
+ return { enabled, candidates: candidates.length, retired, bytesRetired, markerBytes };
271
+ } catch {
272
+ return emptyPlan(enabled);
273
+ }
274
+ };
275
+ var withoutDetails = (message) => {
276
+ if (message.details === void 0) return { ...message };
277
+ const copy = { ...message };
278
+ delete copy.details;
279
+ return copy;
280
+ };
281
+ var applyRetirement = (entries, plan, prunedAt = Date.now()) => {
282
+ if (!Array.isArray(entries) || plan.retired.length === 0) return entries;
283
+ try {
284
+ const byEntryId = new Map(plan.retired.map((item) => [item.entryId, item]));
285
+ return entries.map((entry) => {
286
+ if (!isRecord(entry)) return entry;
287
+ const retired = typeof entry.id === "string" ? byEntryId.get(entry.id) : void 0;
288
+ if (!retired || !isRecord(entry.message)) return entry;
289
+ return {
290
+ ...entry,
291
+ message: {
292
+ ...withoutDetails(entry.message),
293
+ content: [{ type: "text", text: retired.marker }],
294
+ prunedAt
295
+ }
296
+ };
297
+ });
298
+ } catch {
299
+ return entries;
300
+ }
301
+ };
302
+ var retireHandoffSeed = (seed, options = {}) => {
303
+ try {
304
+ const branch = seed.sourceBranch;
305
+ if (options.handoffRetirement !== true || !Array.isArray(branch)) {
306
+ return { seed, plan: planRetirement(void 0, options) };
307
+ }
308
+ const plan = planRetirement(branch, options);
309
+ if (plan.retired.length === 0) return { seed, plan };
310
+ return { seed: { ...seed, sourceBranch: applyRetirement(branch, plan) }, plan };
311
+ } catch {
312
+ return { seed, plan: emptyPlan(false) };
313
+ }
314
+ };
315
+
316
+ // src/prewalk/handoff.ts
164
317
  var PREWALK_CONTINUE_PROMPT = [
165
318
  "Continue the existing task in this same session under the new executor model.",
166
319
  "Do not stop merely because the model changed or because the first mutation succeeded.",
@@ -479,7 +632,7 @@ var settleInPlacePrewalk = async (controller, extension, context, options) => {
479
632
  );
480
633
  return true;
481
634
  };
482
- var runFabricHandoffAtBoundary = async (controller, runner, extension, pending, outerToolResult, context, activity) => {
635
+ var runFabricHandoffAtBoundary = async (controller, runner, extension, pending, outerToolResult, context, activity, retirement = {}) => {
483
636
  const model = String(pending.args.model ?? "");
484
637
  const inPlace = pending.kind === "prewalk-in-place";
485
638
  context.ui.setStatus(
@@ -495,11 +648,15 @@ var runFabricHandoffAtBoundary = async (controller, runner, extension, pending,
495
648
  activity?.({ type: "progress", message: `Main continuing in place with ${model}` });
496
649
  return result2;
497
650
  }
498
- const seed = snapshotHandoffSession(
499
- context.sessionManager,
500
- context.model,
501
- outerToolResult,
502
- outerToolResult.toolCallId
651
+ const retired = retireHandoffSeed(
652
+ snapshotHandoffSession(
653
+ context.sessionManager,
654
+ context.model,
655
+ outerToolResult,
656
+ outerToolResult.toolCallId,
657
+ retirement.handoffRetirement === true
658
+ ),
659
+ retirement
503
660
  );
504
661
  const invocation = {
505
662
  cwd: context.cwd,
@@ -516,7 +673,8 @@ var runFabricHandoffAtBoundary = async (controller, runner, extension, pending,
516
673
  pending.audit.preview = preview;
517
674
  }
518
675
  };
519
- const result = await runner.executeHandoff(pending.args, invocation, seed);
676
+ const executorSeed = retired.plan.retired.length > 0 ? { ...retired.seed, sourceBranchRetired: true } : retired.seed;
677
+ const result = await runner.executeHandoff(pending.args, invocation, executorSeed);
520
678
  const completed = result.completed === true;
521
679
  pending.audit.success = completed;
522
680
  pending.audit.result = result;
@@ -549,7 +707,18 @@ var runFabricHandoffAtBoundary = async (controller, runner, extension, pending,
549
707
  completed ? "trajectory executor implemented" : `trajectory ${String(result.status ?? "failed")}`
550
708
  );
551
709
  return {
552
- ...pending.kind === "prewalk-trajectory" ? { prewalk: true, mode: "trajectory", trigger: prewalkTriggerField(pending) } : {},
710
+ ...pending.kind === "prewalk-trajectory" ? {
711
+ prewalk: true,
712
+ mode: "trajectory",
713
+ trigger: prewalkTriggerField(pending),
714
+ ...retired.plan.retired.length > 0 ? {
715
+ retirement: {
716
+ results: retired.plan.retired.length,
717
+ bytes: retired.plan.bytesRetired,
718
+ markerBytes: retired.plan.markerBytes
719
+ }
720
+ } : {}
721
+ } : {},
553
722
  ...result
554
723
  };
555
724
  } catch (error) {
@@ -2634,4 +2803,4 @@ export {
2634
2803
  resolveFabricIdentity,
2635
2804
  MainAgentController
2636
2805
  };
2637
- //# sourceMappingURL=chunk-TLSJXU4F.js.map
2806
+ //# sourceMappingURL=chunk-VSSC4IDU.js.map