omp-fabric 1.25.13 → 1.25.15

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.
package/dist/index.js CHANGED
@@ -72,7 +72,7 @@ import {
72
72
  resolveFabricIdentity,
73
73
  settleInPlacePrewalk,
74
74
  streamedToolCallName
75
- } from "./chunks/chunk-JJ6DFMCK.js";
75
+ } from "./chunks/chunk-BD6FHI24.js";
76
76
  import "./chunks/chunk-7VIQNUPS.js";
77
77
  import {
78
78
  AgentTranscriptReader
@@ -583,6 +583,48 @@ var registerFabricActorHostEventObservers = (omp, observer) => {
583
583
  }
584
584
  };
585
585
 
586
+ // src/capture/host-mcp-tools.ts
587
+ var createHostMcpToolSource = () => {
588
+ let modules;
589
+ let cachedFrom;
590
+ let cached = [];
591
+ const current = () => {
592
+ try {
593
+ return modules?.instance()?.getTools() ?? [];
594
+ } catch {
595
+ return [];
596
+ }
597
+ };
598
+ return {
599
+ async load() {
600
+ if (modules) return;
601
+ try {
602
+ const [mcp, sdk] = await Promise.all([
603
+ import("@oh-my-pi/pi-coding-agent/mcp"),
604
+ import("@oh-my-pi/pi-coding-agent")
605
+ ]);
606
+ const manager = mcp.MCPManager;
607
+ const toDefinition = sdk.customToolToDefinition;
608
+ if (typeof manager?.instance === "function" && typeof toDefinition === "function") {
609
+ modules = { instance: () => manager.instance?.(), toDefinition };
610
+ }
611
+ } catch {
612
+ modules = void 0;
613
+ }
614
+ },
615
+ tools() {
616
+ const raw = current();
617
+ if (raw === cachedFrom) return cached;
618
+ cachedFrom = raw;
619
+ cached = modules ? raw.map((tool) => modules.toDefinition(tool)) : [];
620
+ return cached;
621
+ },
622
+ signature() {
623
+ return current().map((tool) => tool.name ?? "").join("\0");
624
+ }
625
+ };
626
+ };
627
+
586
628
  // src/capture/interceptor.ts
587
629
  import { existsSync, readdirSync, readFileSync, realpathSync } from "node:fs";
588
630
  import path from "node:path";
@@ -734,7 +776,7 @@ var installRegisteredToolCapture = async (options) => {
734
776
  (tool) => tool.definition[ANCHOR_SYMBOL] === anchorToken || definitionDelegatesTo(tool.definition, options.anchorDefinition)
735
777
  );
736
778
  if (!anchor) return tools;
737
- options.catalog.replace(tools, runner, policy, anchor.extensionPath);
779
+ options.catalog.replace(tools, runner, policy, anchor.extensionPath, options.hostMcpTools?.() ?? []);
738
780
  options.onCatalogRefresh?.();
739
781
  return tools;
740
782
  };
@@ -5652,14 +5694,24 @@ async function ompFabric(omp) {
5652
5694
  enabled: false,
5653
5695
  hideFromModel: false
5654
5696
  };
5697
+ const hostMcpTools = createHostMcpToolSource();
5698
+ await hostMcpTools.load();
5699
+ let hostMcpSignature = "";
5655
5700
  const toolCapture = await installRegisteredToolCapture({
5656
5701
  anchorDefinition: fabricTool,
5657
5702
  catalog: capturedTools,
5658
5703
  initialPolicy: inactiveCapturePolicy,
5704
+ hostMcpTools: () => {
5705
+ hostMcpSignature = hostMcpTools.signature();
5706
+ return hostMcpTools.tools();
5707
+ },
5659
5708
  onCatalogRefresh: () => {
5660
5709
  scheduleOwnershipReassert();
5661
5710
  }
5662
5711
  });
5712
+ const refreshHostMcpCapture = () => {
5713
+ if (hostMcpTools.signature() !== hostMcpSignature) capturedTools.refresh();
5714
+ };
5663
5715
  omp.registerTool(fabricTool);
5664
5716
  const applyFabricMode = () => {
5665
5717
  capturedTools.markResumed();
@@ -6067,6 +6119,7 @@ async function ompFabric(omp) {
6067
6119
  omp.on("before_agent_start", async (event, context) => {
6068
6120
  const fullCodeMode = state.cwd ? state.config.fullCodeMode : DEFAULT_FABRIC_CONFIG.fullCodeMode;
6069
6121
  const schemaMode = state.cwd ? state.config.schema.mode : DEFAULT_FABRIC_CONFIG.schema.mode;
6122
+ refreshHostMcpCapture();
6070
6123
  reassertToolOwnership();
6071
6124
  const effectiveFullCodeMode = fullCodeMode || schemaMode === "enforce";
6072
6125
  if (!omp.getActiveTools().includes("fabric_exec")) return;