omp-fabric 0.85.0 → 1.0.2

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 (115) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/agents/manager.d.ts.map +1 -1
  3. package/dist/agents/transports/process-transport.d.ts.map +1 -1
  4. package/dist/agents/transports/process-utils.d.ts +6 -1
  5. package/dist/agents/transports/process-utils.d.ts.map +1 -1
  6. package/dist/agents/types.d.ts +1 -0
  7. package/dist/agents/types.d.ts.map +1 -1
  8. package/dist/audit/details.d.ts +10 -0
  9. package/dist/audit/details.d.ts.map +1 -1
  10. package/dist/chunks/{chunk-GKOFZ76R.js → chunk-2LGLDM34.js} +22 -4
  11. package/dist/chunks/chunk-2LGLDM34.js.map +7 -0
  12. package/dist/chunks/{chunk-T6OAX4FO.js → chunk-3TWC6XOS.js} +37 -9
  13. package/dist/chunks/chunk-3TWC6XOS.js.map +7 -0
  14. package/dist/chunks/{chunk-ZNAJDPT7.js → chunk-B2SQR2JY.js} +32 -24
  15. package/dist/chunks/{chunk-ZNAJDPT7.js.map → chunk-B2SQR2JY.js.map} +2 -2
  16. package/dist/chunks/{chunk-SXMWV447.js → chunk-DOKANNFC.js} +206 -3
  17. package/dist/chunks/chunk-DOKANNFC.js.map +7 -0
  18. package/dist/chunks/{chunk-UPCARIJP.js → chunk-FFWALVBN.js} +20 -9
  19. package/dist/chunks/chunk-FFWALVBN.js.map +7 -0
  20. package/dist/chunks/{chunk-4LEDA76O.js → chunk-HAJPYJPY.js} +3 -3
  21. package/dist/chunks/{chunk-ROKMBLGN.js → chunk-IFNDRFW7.js} +34 -14
  22. package/dist/chunks/chunk-IFNDRFW7.js.map +7 -0
  23. package/dist/chunks/{chunk-ZTM45GH5.js → chunk-JZWLICMS.js} +125 -42
  24. package/dist/chunks/chunk-JZWLICMS.js.map +7 -0
  25. package/dist/chunks/{chunk-5GTPD4BA.js → chunk-L2FNMIOW.js} +66 -22
  26. package/dist/chunks/chunk-L2FNMIOW.js.map +7 -0
  27. package/dist/chunks/chunk-NX4SNIMR.js +226 -0
  28. package/dist/chunks/chunk-NX4SNIMR.js.map +7 -0
  29. package/dist/chunks/{chunk-YZZIKJX6.js → chunk-RBA54WC7.js} +1 -1
  30. package/dist/chunks/{chunk-YZZIKJX6.js.map → chunk-RBA54WC7.js.map} +1 -1
  31. package/dist/chunks/{chunk-OPTP4PSE.js → chunk-YPYVUGON.js} +3 -23
  32. package/dist/chunks/chunk-YPYVUGON.js.map +7 -0
  33. package/dist/chunks/{chunk-JP4LIZFT.js → chunk-Z6HEQPXX.js} +23 -6
  34. package/dist/chunks/chunk-Z6HEQPXX.js.map +7 -0
  35. package/dist/commands/fabric.d.ts.map +1 -1
  36. package/dist/core/action-registry.d.ts +2 -1
  37. package/dist/core/action-registry.d.ts.map +1 -1
  38. package/dist/core/action-registry.js +2 -2
  39. package/dist/core/compact-controller.d.ts +28 -3
  40. package/dist/core/compact-controller.d.ts.map +1 -1
  41. package/dist/core/compact-outcome-store.d.ts +3 -0
  42. package/dist/core/compact-outcome-store.d.ts.map +1 -0
  43. package/dist/entropy/index.js +2 -2
  44. package/dist/entropy/sessions.d.ts.map +1 -1
  45. package/dist/execution-service.d.ts.map +1 -1
  46. package/dist/fabric-exec-tool.d.ts.map +1 -1
  47. package/dist/fabric-runtime-state.d.ts.map +1 -1
  48. package/dist/fabric-runtime-state.js +883 -367
  49. package/dist/fabric-runtime-state.js.map +4 -4
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +116 -18
  52. package/dist/index.js.map +3 -3
  53. package/dist/memory/discovery.d.ts +28 -14
  54. package/dist/memory/discovery.d.ts.map +1 -1
  55. package/dist/memory/discovery.js +9 -5
  56. package/dist/protocol.d.ts +5 -0
  57. package/dist/protocol.d.ts.map +1 -1
  58. package/dist/protocol.js +1 -1
  59. package/dist/providers/mcp-descriptor-cache.d.ts +2 -0
  60. package/dist/providers/mcp-descriptor-cache.d.ts.map +1 -1
  61. package/dist/providers/mcp-provider.d.ts +4 -2
  62. package/dist/providers/mcp-provider.d.ts.map +1 -1
  63. package/dist/providers/memory-provider.d.ts.map +1 -1
  64. package/dist/providers/memory-provider.js +2 -2
  65. package/dist/providers/omp-tools-provider.d.ts +1 -0
  66. package/dist/providers/omp-tools-provider.d.ts.map +1 -1
  67. package/dist/residency/host.js +5 -5
  68. package/dist/residency/omp-entry.js +5 -5
  69. package/dist/runtime/core-override-guest-types.js +1 -1
  70. package/dist/runtime/guest-types.d.ts +2 -2
  71. package/dist/runtime/guest-types.d.ts.map +1 -1
  72. package/dist/runtime/guest-types.js +1 -1
  73. package/dist/runtime/node-process-child-source.d.ts.map +1 -1
  74. package/dist/runtime/node-process-runtime.d.ts.map +1 -1
  75. package/dist/runtime/node-process-runtime.js +4 -2
  76. package/dist/runtime/node-process-runtime.js.map +2 -2
  77. package/dist/runtime/quickjs-runtime.d.ts +6 -1
  78. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  79. package/dist/runtime/quickjs-runtime.js +1 -1
  80. package/dist/speculation/guest-args.d.ts +2 -0
  81. package/dist/speculation/guest-args.d.ts.map +1 -0
  82. package/dist/speculation/scanner.d.ts.map +1 -1
  83. package/dist/speculation/scanner.js +312 -14
  84. package/dist/speculation/scanner.js.map +3 -3
  85. package/dist/speculation/store.d.ts +2 -0
  86. package/dist/speculation/store.d.ts.map +1 -1
  87. package/dist/speculation/stream-tap.d.ts +1 -0
  88. package/dist/speculation/stream-tap.d.ts.map +1 -1
  89. package/dist/speculation/summary.d.ts +4 -0
  90. package/dist/speculation/summary.d.ts.map +1 -0
  91. package/dist/speculation/types.d.ts +4 -0
  92. package/dist/speculation/types.d.ts.map +1 -1
  93. package/dist/speculation/warmup.d.ts +17 -0
  94. package/dist/speculation/warmup.d.ts.map +1 -0
  95. package/dist/ui/settings.d.ts.map +1 -1
  96. package/dist/ui/settings.js +6 -6
  97. package/dist/ui/settings.js.map +2 -2
  98. package/docs/agents.md +1 -1
  99. package/docs/compaction.md +2 -2
  100. package/docs/configuration.md +26 -12
  101. package/docs/interface.md +2 -2
  102. package/docs/speculation.md +11 -6
  103. package/package.json +3 -2
  104. package/dist/chunks/chunk-5GTPD4BA.js.map +0 -7
  105. package/dist/chunks/chunk-7BIA5BJN.js +0 -112
  106. package/dist/chunks/chunk-7BIA5BJN.js.map +0 -7
  107. package/dist/chunks/chunk-GKOFZ76R.js.map +0 -7
  108. package/dist/chunks/chunk-JP4LIZFT.js.map +0 -7
  109. package/dist/chunks/chunk-OPTP4PSE.js.map +0 -7
  110. package/dist/chunks/chunk-ROKMBLGN.js.map +0 -7
  111. package/dist/chunks/chunk-SXMWV447.js.map +0 -7
  112. package/dist/chunks/chunk-T6OAX4FO.js.map +0 -7
  113. package/dist/chunks/chunk-UPCARIJP.js.map +0 -7
  114. package/dist/chunks/chunk-ZTM45GH5.js.map +0 -7
  115. /package/dist/chunks/{chunk-4LEDA76O.js.map → chunk-HAJPYJPY.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,2BAA2B,CAAC;AA2JnC,wBAA8B,SAAS,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgsBxE;AAED,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,2BAA2B,CAAC;AA4JnC,wBAA8B,SAAS,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA4sBxE;AAED,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -65,8 +65,9 @@ import {
65
65
  prewalkArmedPrompt,
66
66
  repairFabricGuestCode,
67
67
  resolveFabricIdentity,
68
- settleInPlacePrewalk
69
- } from "./chunks/chunk-SXMWV447.js";
68
+ settleInPlacePrewalk,
69
+ streamedToolCallName
70
+ } from "./chunks/chunk-DOKANNFC.js";
70
71
  import "./chunks/chunk-7VIQNUPS.js";
71
72
  import {
72
73
  AgentTranscriptReader
@@ -75,12 +76,12 @@ import "./chunks/chunk-DLXPTBPL.js";
75
76
  import {
76
77
  GUEST_TYPE_DECLARATIONS,
77
78
  OMP_CORE_COMPATIBILITY_ARGUMENT_TYPE_NAMES
78
- } from "./chunks/chunk-JP4LIZFT.js";
79
+ } from "./chunks/chunk-Z6HEQPXX.js";
79
80
  import {
80
81
  NESTED_TOOL_CALL_ID_PREFIX,
81
82
  getActiveRepairCompiler,
82
83
  setActiveCompiledSurface
83
- } from "./chunks/chunk-GKOFZ76R.js";
84
+ } from "./chunks/chunk-2LGLDM34.js";
84
85
  import "./chunks/chunk-LMAVZN7J.js";
85
86
  import "./chunks/chunk-7TB7NXSL.js";
86
87
  import {
@@ -145,7 +146,7 @@ import {
145
146
  staticFreedomFromSchema,
146
147
  surfaceFreedomReport,
147
148
  trendFromScores
148
- } from "./chunks/chunk-ZNAJDPT7.js";
149
+ } from "./chunks/chunk-B2SQR2JY.js";
149
150
  import {
150
151
  compiledSurfaceDirectory,
151
152
  loadCompiledSurface,
@@ -167,7 +168,7 @@ import {
167
168
  replaySuccessfulCallsAsync,
168
169
  schemaDigest
169
170
  } from "./chunks/chunk-4A4MVZQW.js";
170
- import "./chunks/chunk-7BIA5BJN.js";
171
+ import "./chunks/chunk-NX4SNIMR.js";
171
172
  import "./chunks/chunk-6QBPSZJ5.js";
172
173
  import {
173
174
  FABRIC_COMPONENT_DISCOVER_EVENT,
@@ -183,19 +184,19 @@ import {
183
184
  readFabricPeerCardsRequestV1,
184
185
  readFabricPrewalkRequestV1,
185
186
  readFabricToolResultProxyDetailsV1
186
- } from "./chunks/chunk-YZZIKJX6.js";
187
+ } from "./chunks/chunk-RBA54WC7.js";
187
188
  import {
188
189
  awaitPeerSettle,
189
- buildPeerCards,
190
- resolveAgentDir
191
- } from "./chunks/chunk-OPTP4PSE.js";
190
+ buildPeerCards
191
+ } from "./chunks/chunk-YPYVUGON.js";
192
192
  import {
193
193
  DEFAULT_FABRIC_CONFIG,
194
194
  effectiveToolCaptureConfig,
195
195
  loadFabricConfig,
196
196
  loadFabricConfigForScope,
197
+ resolveAgentDir,
197
198
  saveFabricConfig
198
- } from "./chunks/chunk-ROKMBLGN.js";
199
+ } from "./chunks/chunk-IFNDRFW7.js";
199
200
  import {
200
201
  FABRIC_ACTOR_OMP_HOST_EVENTS
201
202
  } from "./chunks/chunk-UOSJZXJV.js";
@@ -1177,13 +1178,12 @@ ${top}` : "fingerprints: (none this session)"
1177
1178
  if (option === "--disable" || option === "--enable") {
1178
1179
  const enabled = option === "--enable";
1179
1180
  try {
1180
- const projectTrusted = context.isProjectTrusted();
1181
1181
  const saved = saveFabricConfig(
1182
1182
  {
1183
1183
  cwd: context.cwd,
1184
1184
  agentDir: resolveAgentDir(),
1185
- projectTrusted,
1186
- scope: projectTrusted ? "project" : "global"
1185
+ projectTrusted: context.isProjectTrusted(),
1186
+ scope: "global"
1187
1187
  },
1188
1188
  { prewalk: { enabled } }
1189
1189
  );
@@ -1771,6 +1771,76 @@ Inspect LLM I/O: /fabric log ${shortId} \xB7 Export: /fabric export-log ${actor.
1771
1771
  });
1772
1772
  }
1773
1773
 
1774
+ // src/speculation/warmup.ts
1775
+ var DEFAULT_MAX_BUFFERED_EVENTS = 4096;
1776
+ var DEFAULT_MAX_BUFFERED_CHARS = 2 * 1024 * 1024;
1777
+ var FabricSpeculationWarmup = class {
1778
+ #options;
1779
+ #buffered = [];
1780
+ #bufferedChars = 0;
1781
+ #activating = false;
1782
+ #overflowed = false;
1783
+ constructor(options) {
1784
+ this.#options = options;
1785
+ }
1786
+ get pending() {
1787
+ return this.#buffered.length;
1788
+ }
1789
+ reset() {
1790
+ this.#buffered.length = 0;
1791
+ this.#bufferedChars = 0;
1792
+ this.#overflowed = false;
1793
+ }
1794
+ handleMessageUpdate(event, context) {
1795
+ try {
1796
+ const tap = this.#options.tap();
1797
+ if (tap) {
1798
+ this.#drain(tap, context);
1799
+ tap.handleMessageUpdate(event, context);
1800
+ return;
1801
+ }
1802
+ if (!this.#options.enabled()) return;
1803
+ const assistantEvent = event.assistantMessageEvent;
1804
+ if (assistantEvent.type !== "toolcall_start" && assistantEvent.type !== "toolcall_delta" && assistantEvent.type !== "toolcall_end") {
1805
+ return;
1806
+ }
1807
+ const name = streamedToolCallName(event);
1808
+ if (name !== void 0 && name !== "fabric_exec") return;
1809
+ this.#buffer(event, assistantEvent.type === "toolcall_delta" ? assistantEvent.delta.length : 0);
1810
+ if (this.#activating) return;
1811
+ this.#activating = true;
1812
+ void this.#options.activate(context).then(
1813
+ () => {
1814
+ const activated = this.#options.tap();
1815
+ if (activated) this.#drain(activated, context);
1816
+ },
1817
+ () => void 0
1818
+ ).finally(() => {
1819
+ this.#activating = false;
1820
+ });
1821
+ } catch {
1822
+ return;
1823
+ }
1824
+ }
1825
+ #buffer(event, chars) {
1826
+ if (this.#overflowed) return;
1827
+ if (this.#buffered.length >= (this.#options.maxBufferedEvents ?? DEFAULT_MAX_BUFFERED_EVENTS) || this.#bufferedChars + chars > (this.#options.maxBufferedChars ?? DEFAULT_MAX_BUFFERED_CHARS)) {
1828
+ this.#overflowed = true;
1829
+ this.#buffered.length = 0;
1830
+ this.#bufferedChars = 0;
1831
+ return;
1832
+ }
1833
+ this.#buffered.push(event);
1834
+ this.#bufferedChars += chars;
1835
+ }
1836
+ #drain(tap, context) {
1837
+ if (this.#buffered.length === 0) return;
1838
+ const replay = this.#buffered.splice(0);
1839
+ this.#bufferedChars = 0;
1840
+ for (const event of replay) tap.handleMessageUpdate(event, context);
1841
+ }
1842
+ };
1843
+
1774
1844
  // src/core/tool-ownership.ts
1775
1845
  import path3 from "node:path";
1776
1846
 
@@ -1789,7 +1859,8 @@ var persistableAudit = (audit) => structuredClone({
1789
1859
  ...audit.resultTruncated !== void 0 ? { resultTruncated: audit.resultTruncated } : {},
1790
1860
  ...audit.preview !== void 0 ? { preview: audit.preview } : {},
1791
1861
  ...audit.startedAt !== void 0 ? { startedAt: audit.startedAt } : {},
1792
- ...audit.endedAt !== void 0 ? { endedAt: audit.endedAt } : {}
1862
+ ...audit.endedAt !== void 0 ? { endedAt: audit.endedAt } : {},
1863
+ ...audit.speculated === true ? { speculated: true } : {}
1793
1864
  });
1794
1865
  var createFabricPersistedExecutionDetails = (input) => {
1795
1866
  const details = {
@@ -1797,6 +1868,7 @@ var createFabricPersistedExecutionDetails = (input) => {
1797
1868
  trace: cloneTrace(input.trace),
1798
1869
  audits: (input.audits ?? []).map(persistableAudit),
1799
1870
  phases: (input.phases ?? []).filter((phase) => typeof phase === "string"),
1871
+ ...input.speculation ? { speculation: input.speculation } : {},
1800
1872
  ...typeof input.error === "string" && input.error ? { error: input.error } : {},
1801
1873
  ...input.outputFormat ? { outputFormat: input.outputFormat } : {},
1802
1874
  ...input.outputFormatStartLine !== void 0 ? { outputFormatStartLine: Math.max(0, Math.floor(input.outputFormatStartLine)) } : {},
@@ -1836,7 +1908,8 @@ var legacyAudit = (value) => {
1836
1908
  ...typeof value.resultTruncated === "boolean" ? { resultTruncated: value.resultTruncated } : {},
1837
1909
  ...value.preview !== void 0 ? { preview: value.preview } : {},
1838
1910
  ...typeof value.startedAt === "number" ? { startedAt: value.startedAt } : {},
1839
- ...typeof value.endedAt === "number" ? { endedAt: value.endedAt } : {}
1911
+ ...typeof value.endedAt === "number" ? { endedAt: value.endedAt } : {},
1912
+ ...value.speculated === true ? { speculated: true } : {}
1840
1913
  };
1841
1914
  };
1842
1915
  var auditFromOperation = (operation) => ({
@@ -2289,6 +2362,18 @@ var buildSkillReferenceGuidance = (prompt, skills) => {
2289
2362
  import { Container as Container2, Text as Text2 } from "@oh-my-pi/pi-tui";
2290
2363
  import { Type } from "@oh-my-pi/omptype/typebox";
2291
2364
 
2365
+ // src/speculation/summary.ts
2366
+ var fabricSpeculationSummary = (stats) => {
2367
+ if (!stats) return void 0;
2368
+ const summary = {
2369
+ launched: stats.launched,
2370
+ hit: stats.served,
2371
+ missed: stats.absent + stats.epochInvalidated + stats.freshnessInvalidated + stats.failed,
2372
+ discarded: stats.wasted + stats.skipped
2373
+ };
2374
+ return summary.launched === 0 && summary.missed === 0 ? void 0 : summary;
2375
+ };
2376
+
2292
2377
  // src/failure-progress.ts
2293
2378
  var MAX_COMPLETED_CALLS = 8;
2294
2379
  var MAX_PATH_CHARS = 100;
@@ -3333,8 +3418,10 @@ ${preview}` : ""}${hiddenHint}`,
3333
3418
  const rawOutput = sections.join("\n\n");
3334
3419
  const outputFormat = formattedValue.language && formattedValue.text && (result.logs.length === 0 || !outputWillTruncate) ? formattedValue.language : void 0;
3335
3420
  const outputFormatStartLine = result.logs.length > 0 ? countNewlines(logPrefix) + 2 : 0;
3421
+ const speculationSummary = fabricSpeculationSummary(state.registry.speculationStats());
3336
3422
  const persistedRenderDetails = () => createFabricPersistedExecutionDetails({
3337
3423
  ...result,
3424
+ ...speculationSummary ? { speculation: speculationSummary } : {},
3338
3425
  ...outputFormat ? { outputFormat, outputFormatStartLine } : {},
3339
3426
  ...outputFormat ? {
3340
3427
  outputFormatLines: formattedValue.highlightedLineCount ?? countNewlines(formattedValue.text) + 1
@@ -5392,12 +5479,23 @@ async function ompFabric(omp) {
5392
5479
  await compactAtConfiguredThreshold(context, state.config);
5393
5480
  await state.publishHostLifecycle("omp.agent_end", event);
5394
5481
  });
5482
+ const speculationWarmup = new FabricSpeculationWarmup({
5483
+ enabled: () => {
5484
+ try {
5485
+ return state.config.speculation.enabled === true;
5486
+ } catch {
5487
+ return false;
5488
+ }
5489
+ },
5490
+ tap: () => state.speculationTap,
5491
+ activate: (context) => state.ensure(context)
5492
+ });
5395
5493
  omp.on("message_start", () => {
5494
+ speculationWarmup.reset();
5396
5495
  state.speculationTap?.reset();
5397
5496
  });
5398
5497
  omp.on("message_update", (event, context) => {
5399
- if (!state.initialized) return;
5400
- state.speculationTap?.handleMessageUpdate(event, context);
5498
+ speculationWarmup.handleMessageUpdate(event, context);
5401
5499
  });
5402
5500
  omp.on("tool_call", (event, context) => fabricToolLifecycle.toolCall(event, context));
5403
5501
  omp.on("tool_result", (event) => fabricToolLifecycle.toolResult(event));