omp-fabric 1.25.0 → 1.25.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.
@@ -1,5 +1,11 @@
1
- export declare const MINIMUM_OMP_HOST_VERSION = "18.1.10";
1
+ export declare const MINIMUM_OMP_HOST_VERSION = "18.3.0";
2
2
  export declare const compareVersions: (left: string, right: string) => number | undefined;
3
3
  export declare const detectOmpHostVersion: (cliPath?: string | undefined) => string | undefined;
4
+ export interface HostVersionWitnesses {
5
+ argvPath?: string | undefined;
6
+ execPath?: string | undefined;
7
+ hostVersion?: () => Promise<string | undefined>;
8
+ }
9
+ export declare const resolveHostVersion: (witnesses?: HostVersionWitnesses) => Promise<string | undefined>;
4
10
  export declare const ompHostCompatibilityWarning: (version?: string | undefined) => string | undefined;
5
11
  //# sourceMappingURL=host-compatibility.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"host-compatibility.d.ts","sourceRoot":"","sources":["../src/host-compatibility.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,wBAAwB,YAAY,CAAC;AAoBlD,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAAM,GAAG,SAYtE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,UAAS,MAAM,GAAG,SAA2B,KAC5C,MAAM,GAAG,SA8BX,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,UAAS,MAAM,GAAG,SAAkC,KACnD,MAAM,GAAG,SAKX,CAAC"}
1
+ {"version":3,"file":"host-compatibility.d.ts","sourceRoot":"","sources":["../src/host-compatibility.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,wBAAwB,WAAW,CAAC;AAoBjD,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAAM,GAAG,SAYtE,CAAC;AAsCF,eAAO,MAAM,oBAAoB,GAC/B,UAAS,MAAM,GAAG,SAA2B,KAC5C,MAAM,GAAG,SAAgE,CAAC;AAE7E,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACjD;AAQD,eAAO,MAAM,kBAAkB,GAC7B,YAAW,oBAAyB,KACnC,OAAO,CAAC,MAAM,GAAG,SAAS,CAM5B,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,UAAS,MAAM,GAAG,SAAkC,KACnD,MAAM,GAAG,SAKX,CAAC"}
@@ -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;AAsKnC,wBAA8B,SAAS,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA8yBxE;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,EAEb,MAAM,2BAA2B,CAAC;AAsKnC,wBAA8B,SAAS,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA+yBxE;AAED,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -2199,7 +2199,7 @@ var fabricExecutionKernelGuidance = (fullCodeMode, deniedCoreTools = []) => [
2199
2199
  ...fullCodeMode && !deniedCoreTools.includes("edit") && !deniedCoreTools.includes("write") ? ["Prefer `omp.edit`/`omp.write` for source edits over hand-assembled shell or Node string literals, where nested escaping breaks; running a formatter or codemod through `omp.bash` is a different case."] : [],
2200
2200
  ...fullCodeMode && deniedCoreTools.length > 0 ? [`OMP has these core tools turned off, so ${deniedCoreTools.map((name) => `\`omp.${name}\``).join(", ")} ${deniedCoreTools.length === 1 ? "is" : "are"} unavailable and calling ${deniedCoreTools.length === 1 ? "it" : "them"} fails.`] : []
2201
2201
  ].join(" ");
2202
- var defaultFabricExecutionGuidance = (fullCodeMode) => fullCodeMode ? "Examples and returns: `omp.read('/x')`, `omp.grep('TODO','src')` / `omp.grep({pattern:'TODO', path:'src', ignoreCase:true, context:2})`, `omp.find({pattern:'*.ts', path:'src', limit:20})`, and `omp.ls('src')` return strings; `omp.bash({cmd:'ls'})`, `omp.edit({path:'/x', old:'a', new:'b'})`, and `omp.write({path:'/y', text:'z'})` return `{ok, output, details}` (read `.output`); failed core calls reject, including shell tools on an ordinary nonzero exit; pass `settle: true` to `omp.bash` to get `{ ok: false, exitCode, output, error }` instead. Timeout, cancellation, approval, and security failures still reject.\n`tools` is discovery + generic calls only (`providers`/`catalog`/`list`/`search`/`describe`/`call`/`models`). Call known MCP tools as `mcp.<sanitized_server>.<sanitized_tool>(args)`, captured tools as `extensions.<tool>(args)`, and stable providers as `memory.*`, `state.*`, `schema.*`, `compact.*`, or `judgment.*` (calibrated choice/bool/score answers about one state). Use `tools.call({ref,args})` for computed refs. Use `judge.filter(items, instructions)` or `judge.bool(state, instructions)` for fast semantic triage in one request without subagents (e.g. `await judge.filter(logs, 'fatal error')`). `omp` is the core tools; `omp.<key>` reads a named `payloads` value (not a tool)." : "Call known actions through `mcp.<sanitized_server>.<sanitized_tool>(args)`, `memory.*`, `state.*`, `schema.*`, `components.*`, `compact.*`, `codemap.*`, `judgment.*`, `agents.*`, or `mesh.*`; use `tools.catalog`/`search`/`describe`/`list` for discovery and `tools.call({ref,args})` for computed refs. Other surfaces are opt-in via user-loaded skills.";
2202
+ var defaultFabricExecutionGuidance = (fullCodeMode, deniedCoreTools = []) => fullCodeMode ? "Examples and returns: `omp.read('/x')`, `omp.grep('TODO','src')` / `omp.grep({pattern:'TODO', path:'src', ignoreCase:true, context:2})`, `omp.find({pattern:'*.ts', path:'src', limit:20})`" + (deniedCoreTools.includes("ls") ? "" : ", and `omp.ls('src')`") + " return strings; `omp.bash({cmd:'ls'})`, `omp.edit({path:'/x', old:'a', new:'b'})`, and `omp.write({path:'/y', text:'z'})` return `{ok, output, details}` (read `.output`); failed core calls reject, including shell tools on an ordinary nonzero exit; pass `settle: true` to `omp.bash` to get `{ ok: false, exitCode, output, error }` instead. Timeout, cancellation, approval, and security failures still reject.\n`tools` is discovery + generic calls only (`providers`/`catalog`/`list`/`search`/`describe`/`call`/`models`). Call known MCP tools as `mcp.<sanitized_server>.<sanitized_tool>(args)`, captured tools as `extensions.<tool>(args)`, and stable providers as `memory.*`, `state.*`, `schema.*`, `compact.*`, or `judgment.*` (calibrated choice/bool/score answers about one state). Use `tools.call({ref,args})` for computed refs. Use `judge.filter(items, instructions)` or `judge.bool(state, instructions)` for fast semantic triage in one request without subagents (e.g. `await judge.filter(logs, 'fatal error')`). `omp` is the core tools; `omp.<key>` reads a named `payloads` value (not a tool)." : "Call known actions through `mcp.<sanitized_server>.<sanitized_tool>(args)`, `memory.*`, `state.*`, `schema.*`, `components.*`, `compact.*`, `codemap.*`, `judgment.*`, `agents.*`, or `mesh.*`; use `tools.catalog`/`search`/`describe`/`list` for discovery and `tools.call({ref,args})` for computed refs. Other surfaces are opt-in via user-loaded skills.";
2203
2203
  var manifestNameCache = /* @__PURE__ */ new Map();
2204
2204
  var packageNameFromManifest = (startPath) => {
2205
2205
  if (!startPath) return void 0;
@@ -2594,7 +2594,7 @@ Relevant to the current request: ${suggestion.name}. Ignore this if it does not
2594
2594
 
2595
2595
  // src/fabric-exec-tool.ts
2596
2596
  import { Container as Container2, Text as Text2 } from "@oh-my-pi/pi-tui";
2597
- import { Type } from "@oh-my-pi/omptype/typebox";
2597
+ import { Type } from "@oh-my-pi/pi-coding-agent/extensibility/legacy-typebox";
2598
2598
 
2599
2599
  // src/speculation/summary.ts
2600
2600
  var fabricSpeculationSummary = (stats) => {
@@ -4249,7 +4249,7 @@ var classifyToolResult = (input) => {
4249
4249
  // src/host-compatibility.ts
4250
4250
  import { existsSync as existsSync3, readFileSync as readFileSync4, realpathSync as realpathSync2 } from "node:fs";
4251
4251
  import path6 from "node:path";
4252
- var MINIMUM_OMP_HOST_VERSION = "18.1.10";
4252
+ var MINIMUM_OMP_HOST_VERSION = "18.3.0";
4253
4253
  var OMP_HOST_PACKAGE_NAMES = {
4254
4254
  "@oh-my-pi/pi-coding-agent": true
4255
4255
  };
@@ -4274,30 +4274,43 @@ var compareVersions = (left, right) => {
4274
4274
  if (a.prerelease === b.prerelease) return 0;
4275
4275
  return (a.prerelease ?? "").localeCompare(b.prerelease ?? "");
4276
4276
  };
4277
- var detectOmpHostVersion = (cliPath = process.argv[1]) => {
4278
- if (!cliPath) return void 0;
4277
+ var manifestHostVersion = (directory) => {
4278
+ const manifestPath = path6.join(directory, "package.json");
4279
+ if (!existsSync3(manifestPath)) return void 0;
4280
+ try {
4281
+ const manifest = JSON.parse(readFileSync4(manifestPath, "utf8"));
4282
+ if (typeof manifest.name === "string" && OMP_HOST_PACKAGE_NAMES[manifest.name] === true && typeof manifest.version === "string") {
4283
+ return manifest.version;
4284
+ }
4285
+ } catch {
4286
+ }
4287
+ return void 0;
4288
+ };
4289
+ var walkForHostVersion = (startPath) => {
4279
4290
  let directory;
4280
4291
  try {
4281
- directory = path6.dirname(realpathSync2(cliPath));
4292
+ directory = path6.dirname(realpathSync2(startPath));
4282
4293
  } catch {
4283
4294
  return void 0;
4284
4295
  }
4285
4296
  while (true) {
4286
- const manifestPath = path6.join(directory, "package.json");
4287
- if (existsSync3(manifestPath)) {
4288
- try {
4289
- const manifest = JSON.parse(readFileSync4(manifestPath, "utf8"));
4290
- if (typeof manifest.name === "string" && OMP_HOST_PACKAGE_NAMES[manifest.name] === true && typeof manifest.version === "string") {
4291
- return manifest.version;
4292
- }
4293
- } catch {
4294
- }
4295
- }
4297
+ const version = manifestHostVersion(directory);
4298
+ if (version) return version;
4296
4299
  const parent = path6.dirname(directory);
4297
4300
  if (parent === directory) return void 0;
4298
4301
  directory = parent;
4299
4302
  }
4300
4303
  };
4304
+ var detectOmpHostVersion = (cliPath = process.argv[1]) => cliPath ? walkForHostVersion(cliPath) : void 0;
4305
+ var hostModuleVersion = async () => await import("@oh-my-pi/pi-coding-agent").then(
4306
+ (host) => typeof host.VERSION === "string" ? host.VERSION : void 0,
4307
+ () => void 0
4308
+ );
4309
+ var resolveHostVersion = async (witnesses = {}) => {
4310
+ const argvPath = "argvPath" in witnesses ? witnesses.argvPath : process.argv[1];
4311
+ const execPath = "execPath" in witnesses ? witnesses.execPath : process.execPath;
4312
+ return (argvPath ? walkForHostVersion(argvPath) : void 0) ?? (execPath ? walkForHostVersion(execPath) : void 0) ?? await (witnesses.hostVersion ?? hostModuleVersion)();
4313
+ };
4301
4314
  var ompHostCompatibilityWarning = (version = detectOmpHostVersion()) => {
4302
4315
  if (!version) return void 0;
4303
4316
  const comparison = compareVersions(version, MINIMUM_OMP_HOST_VERSION);
@@ -5812,7 +5825,7 @@ async function ompFabric(omp) {
5812
5825
  refreshProxyLedger(context);
5813
5826
  if (!compatibilityWarningShown) {
5814
5827
  compatibilityWarningShown = true;
5815
- const warning = ompHostCompatibilityWarning();
5828
+ const warning = ompHostCompatibilityWarning(await resolveHostVersion());
5816
5829
  if (warning) {
5817
5830
  console.warn(`[omp-fabric] ${warning}`);
5818
5831
  if (context.hasUI) context.ui.notify(warning, "warning");
@@ -5896,8 +5909,9 @@ async function ompFabric(omp) {
5896
5909
  omp.on("agent_end", async (event, context) => {
5897
5910
  if (event.willContinue === true) return;
5898
5911
  await lcmRuntime?.syncAndSchedule();
5899
- if (!state.initialized) {
5900
- await compactAtConfiguredThreshold(context, state.config);
5912
+ const config = state.bootstrapped ? state.config : void 0;
5913
+ if (!state.initialized || !config) {
5914
+ if (config) await compactAtConfiguredThreshold(context, config);
5901
5915
  return;
5902
5916
  }
5903
5917
  const sessionId = context.sessionManager.getSessionId();
@@ -6064,21 +6078,19 @@ async function ompFabric(omp) {
6064
6078
  { signal: AbortSignal.timeout(SKILL_GATE_BUDGET_MS) }
6065
6079
  ) : void 0;
6066
6080
  const currentModel = context.model ? `${context.model.provider}/${context.model.id}` : void 0;
6081
+ const deniedCoreTools = effectiveFullCodeMode ? deniedOmpCoreTools(toolOwnership.hostActiveTools()) : [];
6067
6082
  const resolvedGuidance = resolveFabricModelGuidance(state.modelGuidance(), {
6068
6083
  ...currentModel ? { model: currentModel } : {},
6069
6084
  target: process.env.OMP_FABRIC_PARENT_RUN ? "participant" : "main",
6070
6085
  defaults: [{
6071
6086
  slot: FABRIC_EXECUTION_GUIDANCE_SLOT,
6072
- content: defaultFabricExecutionGuidance(effectiveFullCodeMode)
6087
+ content: defaultFabricExecutionGuidance(effectiveFullCodeMode, deniedCoreTools)
6073
6088
  }]
6074
6089
  });
6075
6090
  const overrideGuidance = effectiveFullCodeMode ? coreOverridePromptGuidance(capturedTools).trim() : void 0;
6076
6091
  const extensionRoster = effectiveFullCodeMode ? extensionToolRosterGuidance(capturedTools.list(), new Set(OMP_CORE_TOOL_NAMES)) : void 0;
6077
6092
  const guidance = [
6078
- fabricExecutionKernelGuidance(
6079
- effectiveFullCodeMode,
6080
- effectiveFullCodeMode ? deniedOmpCoreTools(toolOwnership.hostActiveTools()) : []
6081
- ),
6093
+ fabricExecutionKernelGuidance(effectiveFullCodeMode, deniedCoreTools),
6082
6094
  resolvedGuidance.slotText,
6083
6095
  fabricSchemaGuidance(schemaMode),
6084
6096
  overrideGuidance,