omp-fabric 1.25.24 → 1.25.26

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EAEb,MAAM,2BAA2B,CAAC;AAwKnC,wBAA8B,SAAS,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAg0BxE;AAaD,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,EAEb,MAAM,2BAA2B,CAAC;AAyKnC,wBAA8B,SAAS,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA61BxE;AAaD,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ import {
33
33
  spinnerFrame,
34
34
  updateSpinner,
35
35
  wrapRowLimitFor
36
- } from "./chunks/chunk-7NWMFYD3.js";
36
+ } from "./chunks/chunk-5U6HKMJV.js";
37
37
  import {
38
38
  formatCost,
39
39
  formatDuration,
@@ -5605,10 +5605,6 @@ async function ompFabric(omp) {
5605
5605
  const decorateShell = withCodePreviewShell;
5606
5606
  let compatibilityWarningShown = false;
5607
5607
  let updateCheckStarted = false;
5608
- configureHighlighting(
5609
- codePreviewSettings.shikiTheme,
5610
- codePreviewSettings.syntaxHighlighting
5611
- );
5612
5608
  const capturedTools = new CapturedToolCatalog();
5613
5609
  const proxyContract = new ProxyContractLedger();
5614
5610
  const state = new FabricState(omp, capturedTools, {
@@ -5709,19 +5705,30 @@ async function ompFabric(omp) {
5709
5705
  hideFromModel: false
5710
5706
  };
5711
5707
  const hostMcpTools = createHostMcpToolSource();
5712
- await hostMcpTools.load();
5713
5708
  let hostMcpSignature = "";
5714
- const toolCapture = await installRegisteredToolCapture({
5715
- anchorDefinition: fabricTool,
5716
- catalog: capturedTools,
5717
- initialPolicy: inactiveCapturePolicy,
5718
- hostMcpTools: () => {
5719
- hostMcpSignature = hostMcpTools.signature();
5720
- return hostMcpTools.tools();
5721
- },
5722
- onCatalogRefresh: () => {
5723
- scheduleOwnershipReassert();
5724
- }
5709
+ let toolCapture;
5710
+ let requestedCapturePolicy;
5711
+ void (async () => {
5712
+ await hostMcpTools.load();
5713
+ const capture = await installRegisteredToolCapture({
5714
+ anchorDefinition: fabricTool,
5715
+ catalog: capturedTools,
5716
+ initialPolicy: inactiveCapturePolicy,
5717
+ hostMcpTools: () => {
5718
+ hostMcpSignature = hostMcpTools.signature();
5719
+ return hostMcpTools.tools();
5720
+ },
5721
+ onCatalogRefresh: () => {
5722
+ scheduleOwnershipReassert();
5723
+ }
5724
+ });
5725
+ toolCapture = capture;
5726
+ if (requestedCapturePolicy) capture.setPolicy(requestedCapturePolicy);
5727
+ capturedTools.refresh();
5728
+ })().catch((error) => {
5729
+ console.warn(
5730
+ `[omp-fabric] tool capture unavailable: ${error instanceof Error ? error.message : String(error)}`
5731
+ );
5725
5732
  });
5726
5733
  const refreshHostMcpCapture = () => {
5727
5734
  if (hostMcpTools.signature() !== hostMcpSignature) capturedTools.refresh();
@@ -5729,14 +5736,16 @@ async function ompFabric(omp) {
5729
5736
  omp.registerTool(fabricTool);
5730
5737
  const applyFabricMode = () => {
5731
5738
  capturedTools.markResumed();
5732
- toolCapture.setPolicy(capturePolicy());
5739
+ requestedCapturePolicy = capturePolicy();
5740
+ toolCapture?.setPolicy(requestedCapturePolicy);
5733
5741
  omp.registerTool(fabricTool);
5734
5742
  toolOwnership.apply(ownershipPolicy(), hiddenCapturedToolNames());
5735
5743
  capturedTools.refresh();
5736
5744
  };
5737
5745
  const suspendToolCapture = () => {
5738
5746
  capturedTools.markSuspended();
5739
- toolCapture.setPolicy(inactiveCapturePolicy);
5747
+ requestedCapturePolicy = inactiveCapturePolicy;
5748
+ toolCapture?.setPolicy(inactiveCapturePolicy);
5740
5749
  };
5741
5750
  let haltOnEscapeUnsubscribe;
5742
5751
  const uninstallHaltOnEscape = () => {
@@ -5909,42 +5918,6 @@ async function ompFabric(omp) {
5909
5918
  }
5910
5919
  }
5911
5920
  await state.bootstrap(context);
5912
- const recordedCwd = context.sessionManager.getRecordedCwd?.() || context.cwd;
5913
- const projectKey = canonicalProjectIdentity({ liveCwd: recordedCwd }).key;
5914
- if (lcmRuntime && (lcmCwd !== context.cwd || lcmProjectKey !== projectKey || state.config.compaction.engine !== "lcm")) {
5915
- await lcmRuntime.shutdown();
5916
- lcmRuntime = void 0;
5917
- lcmCwd = void 0;
5918
- lcmProjectKey = void 0;
5919
- }
5920
- if (state.config.compaction.engine === "lcm" && !lcmRuntime) {
5921
- const LcmRuntimeClass = await lcmLoader.load(context);
5922
- if (LcmRuntimeClass) lcmRuntime = new LcmRuntimeClass(context, () => ({
5923
- ...state.config.compaction.summaryModel ? { summaryModel: state.config.compaction.summaryModel } : {},
5924
- maxLeafEntries: state.config.compaction.lcmMaxLeafEntries,
5925
- maxCondenseChildren: state.config.compaction.lcmMaxCondenseChildren,
5926
- maxMaintenancePasses: state.config.compaction.lcmMaintenancePasses,
5927
- maintenanceConcurrency: state.config.compaction.lcmMaintenanceConcurrency,
5928
- maintenanceRunSeconds: state.config.compaction.lcmMaintenanceRunSeconds,
5929
- modelSummaries: state.config.compaction.lcmModelSummaries,
5930
- modelTimeoutSeconds: state.config.compaction.lcmModelTimeoutSeconds,
5931
- maxDailyModelCalls: state.config.compaction.lcmMaxDailyModelCalls,
5932
- maxSessionModelCalls: state.config.compaction.lcmMaxSessionModelCalls,
5933
- maxDailyModelSeconds: state.config.compaction.lcmMaxDailyModelSeconds,
5934
- lcmMaxInputChars: state.config.compaction.lcmMaxInputChars,
5935
- lcmMaxOutputTokens: state.config.compaction.lcmMaxOutputTokens,
5936
- lcmMaxOutputChars: state.config.compaction.lcmMaxOutputChars,
5937
- softThresholdRatio: state.config.compaction.softThresholdRatio
5938
- }));
5939
- lcmCwd = lcmRuntime ? context.cwd : void 0;
5940
- lcmProjectKey = lcmRuntime?.projectKey;
5941
- }
5942
- if (state.config.compaction.engine === "lcm" && lcmRuntime) {
5943
- await lcmRuntime.reconcileSelectedSession();
5944
- await lcmRuntime.syncAndSchedule().catch(() => {
5945
- });
5946
- lcmRuntime.sweepLedgers();
5947
- }
5948
5921
  refreshCodePreviewSettings();
5949
5922
  applyFabricMode();
5950
5923
  if (!updateCheckStarted) {
@@ -5954,7 +5927,61 @@ async function ompFabric(omp) {
5954
5927
  agentDir: resolveAgentDir()
5955
5928
  });
5956
5929
  }
5930
+ const prepareLcmRuntime = async () => {
5931
+ const recordedCwd = context.sessionManager.getRecordedCwd?.() || context.cwd;
5932
+ const projectKey = canonicalProjectIdentity({ liveCwd: recordedCwd }).key;
5933
+ if (lcmRuntime && (lcmCwd !== context.cwd || lcmProjectKey !== projectKey || state.config.compaction.engine !== "lcm")) {
5934
+ await lcmRuntime.shutdown();
5935
+ lcmRuntime = void 0;
5936
+ lcmCwd = void 0;
5937
+ lcmProjectKey = void 0;
5938
+ }
5939
+ if (state.config.compaction.engine === "lcm" && !lcmRuntime) {
5940
+ const LcmRuntimeClass = await lcmLoader.load(context);
5941
+ if (LcmRuntimeClass) lcmRuntime = new LcmRuntimeClass(context, () => ({
5942
+ ...state.config.compaction.summaryModel ? { summaryModel: state.config.compaction.summaryModel } : {},
5943
+ maxLeafEntries: state.config.compaction.lcmMaxLeafEntries,
5944
+ maxCondenseChildren: state.config.compaction.lcmMaxCondenseChildren,
5945
+ maxMaintenancePasses: state.config.compaction.lcmMaintenancePasses,
5946
+ maintenanceConcurrency: state.config.compaction.lcmMaintenanceConcurrency,
5947
+ maintenanceRunSeconds: state.config.compaction.lcmMaintenanceRunSeconds,
5948
+ modelSummaries: state.config.compaction.lcmModelSummaries,
5949
+ modelTimeoutSeconds: state.config.compaction.lcmModelTimeoutSeconds,
5950
+ maxDailyModelCalls: state.config.compaction.lcmMaxDailyModelCalls,
5951
+ maxSessionModelCalls: state.config.compaction.lcmMaxSessionModelCalls,
5952
+ maxDailyModelSeconds: state.config.compaction.lcmMaxDailyModelSeconds,
5953
+ lcmMaxInputChars: state.config.compaction.lcmMaxInputChars,
5954
+ lcmMaxOutputTokens: state.config.compaction.lcmMaxOutputTokens,
5955
+ lcmMaxOutputChars: state.config.compaction.lcmMaxOutputChars,
5956
+ softThresholdRatio: state.config.compaction.softThresholdRatio
5957
+ }));
5958
+ lcmCwd = lcmRuntime ? context.cwd : void 0;
5959
+ lcmProjectKey = lcmRuntime?.projectKey;
5960
+ }
5961
+ };
5962
+ try {
5963
+ await prepareLcmRuntime();
5964
+ } catch (error) {
5965
+ console.warn(
5966
+ `[omp-fabric] LCM runtime unavailable: ${error instanceof Error ? error.message : String(error)}`
5967
+ );
5968
+ }
5957
5969
  if (state.shouldEagerlyActivate(context)) await state.ensure(context);
5970
+ const warmupEpoch = entropyLifecycleEpoch;
5971
+ const warmupCurrent = () => warmupEpoch === entropyLifecycleEpoch;
5972
+ void (async () => {
5973
+ if (state.config.compaction.engine !== "lcm" || !lcmRuntime) return;
5974
+ await lcmRuntime.reconcileSelectedSession();
5975
+ if (!warmupCurrent()) return;
5976
+ await lcmRuntime.syncAndSchedule().catch(() => {
5977
+ });
5978
+ if (!warmupCurrent()) return;
5979
+ lcmRuntime.sweepLedgers();
5980
+ })().catch((error) => {
5981
+ console.warn(
5982
+ `[omp-fabric] LCM ledger warmup failed: ${error instanceof Error ? error.message : String(error)}`
5983
+ );
5984
+ });
5958
5985
  });
5959
5986
  omp.on("session_tree", async (_event, context) => {
5960
5987
  proxyContract.reset();
@@ -6096,7 +6123,7 @@ async function ompFabric(omp) {
6096
6123
  await state.publishHostLifecycle("omp.session_compact", event);
6097
6124
  });
6098
6125
  registerCompactionHook(omp, {
6099
- getEngine: () => lcmLoader.unavailable ? "omp" : state.cwd ? state.config.compaction.engine : DEFAULT_FABRIC_CONFIG.compaction.engine,
6126
+ getEngine: () => lcmLoader.unavailable || !lcmRuntime ? "omp" : state.cwd ? state.config.compaction.engine : DEFAULT_FABRIC_CONFIG.compaction.engine,
6100
6127
  getTargetContextRatio: () => state.cwd ? state.config.compaction.targetContextRatio : DEFAULT_FABRIC_CONFIG.compaction.targetContextRatio,
6101
6128
  lcm: {
6102
6129
  compact: (input) => lcmRuntime?.compact(input)
@@ -6253,7 +6280,7 @@ ${guidance}`],
6253
6280
  suspendToolCapture();
6254
6281
  toolOwnership.release();
6255
6282
  fabricToolLifecycle.clear();
6256
- toolCapture.dispose();
6283
+ toolCapture?.dispose();
6257
6284
  }
6258
6285
  });
6259
6286
  omp.on("before_agent_start", () => {