omp-fabric 1.2.0 → 1.3.1

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 (70) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/actors/global-registry.d.ts.map +1 -1
  3. package/dist/actors/manager.d.ts.map +1 -1
  4. package/dist/actors/types.d.ts +1 -0
  5. package/dist/actors/types.d.ts.map +1 -1
  6. package/dist/agents/manager.d.ts.map +1 -1
  7. package/dist/agents/types.d.ts +1 -0
  8. package/dist/agents/types.d.ts.map +1 -1
  9. package/dist/chunks/{chunk-3TWC6XOS.js → chunk-2WDZT27Q.js} +36 -13
  10. package/dist/chunks/chunk-2WDZT27Q.js.map +7 -0
  11. package/dist/chunks/{chunk-UOSJZXJV.js → chunk-3LI7YO4M.js} +1 -1
  12. package/dist/chunks/chunk-3LI7YO4M.js.map +7 -0
  13. package/dist/chunks/{chunk-TQL7FKMG.js → chunk-45URY66G.js} +15 -15
  14. package/dist/chunks/chunk-45URY66G.js.map +7 -0
  15. package/dist/chunks/{chunk-B2SQR2JY.js → chunk-BMIE4PIL.js} +2 -2
  16. package/dist/chunks/{chunk-NX4SNIMR.js → chunk-FX3XLQYI.js} +36 -7
  17. package/dist/chunks/chunk-FX3XLQYI.js.map +7 -0
  18. package/dist/chunks/{chunk-EQNNENN6.js → chunk-PYXBHMSL.js} +3 -3
  19. package/dist/chunks/{chunk-2GQC324T.js → chunk-TSU4AEPZ.js} +2 -2
  20. package/dist/chunks/{chunk-5YGOVBOZ.js → chunk-VSSC4IDU.js} +2 -2
  21. package/dist/chunks/{chunk-HDJBUXDX.js → chunk-WQUMHDOS.js} +2 -2
  22. package/dist/chunks/{chunk-XRJYPNTI.js → chunk-WZAH7BO2.js} +8 -1
  23. package/dist/chunks/chunk-WZAH7BO2.js.map +7 -0
  24. package/dist/chunks/{chunk-WGFHMECI.js → chunk-Z5AP4M6K.js} +24 -6
  25. package/dist/chunks/chunk-Z5AP4M6K.js.map +7 -0
  26. package/dist/codemap/symbols.d.ts.map +1 -1
  27. package/dist/codemap/types.d.ts +1 -0
  28. package/dist/codemap/types.d.ts.map +1 -1
  29. package/dist/config.d.ts +1 -0
  30. package/dist/config.d.ts.map +1 -1
  31. package/dist/entropy/index.js +2 -2
  32. package/dist/fabric-runtime-state.js +320 -123
  33. package/dist/fabric-runtime-state.js.map +3 -3
  34. package/dist/index.js +8 -8
  35. package/dist/memory/discovery.d.ts +10 -0
  36. package/dist/memory/discovery.d.ts.map +1 -1
  37. package/dist/memory/discovery.js +3 -1
  38. package/dist/providers/agents-actions.d.ts.map +1 -1
  39. package/dist/providers/agents-provider.d.ts.map +1 -1
  40. package/dist/providers/codemap-provider.d.ts.map +1 -1
  41. package/dist/providers/mcp-provider.d.ts.map +1 -1
  42. package/dist/providers/memory-provider.d.ts.map +1 -1
  43. package/dist/providers/memory-provider.js +2 -2
  44. package/dist/providers/mesh-provider.d.ts.map +1 -1
  45. package/dist/providers/omp-tools-provider.d.ts.map +1 -1
  46. package/dist/providers/write-preview.d.ts.map +1 -1
  47. package/dist/residency/host.js +4 -4
  48. package/dist/residency/omp-entry.js +4 -4
  49. package/dist/runtime/core-override-guest-types.js +1 -1
  50. package/dist/runtime/guest-types.d.ts +1 -1
  51. package/dist/runtime/guest-types.d.ts.map +1 -1
  52. package/dist/runtime/guest-types.js +1 -1
  53. package/dist/ui/dashboard.js +3 -3
  54. package/dist/ui/settings.d.ts.map +1 -1
  55. package/dist/ui/settings.js +10 -2
  56. package/dist/ui/settings.js.map +2 -2
  57. package/docs/codemap.md +9 -0
  58. package/docs/configuration.md +1 -1
  59. package/package.json +1 -1
  60. package/dist/chunks/chunk-3TWC6XOS.js.map +0 -7
  61. package/dist/chunks/chunk-NX4SNIMR.js.map +0 -7
  62. package/dist/chunks/chunk-TQL7FKMG.js.map +0 -7
  63. package/dist/chunks/chunk-UOSJZXJV.js.map +0 -7
  64. package/dist/chunks/chunk-WGFHMECI.js.map +0 -7
  65. package/dist/chunks/chunk-XRJYPNTI.js.map +0 -7
  66. /package/dist/chunks/{chunk-B2SQR2JY.js.map → chunk-BMIE4PIL.js.map} +0 -0
  67. /package/dist/chunks/{chunk-EQNNENN6.js.map → chunk-PYXBHMSL.js.map} +0 -0
  68. /package/dist/chunks/{chunk-2GQC324T.js.map → chunk-TSU4AEPZ.js.map} +0 -0
  69. /package/dist/chunks/{chunk-5YGOVBOZ.js.map → chunk-VSSC4IDU.js.map} +0 -0
  70. /package/dist/chunks/{chunk-HDJBUXDX.js.map → chunk-WQUMHDOS.js.map} +0 -0
@@ -11,7 +11,7 @@ import {
11
11
  MemoryProvider,
12
12
  actionArgNormalizer,
13
13
  uniqueDeclaredKeyForSpelling
14
- } from "./chunks/chunk-3TWC6XOS.js";
14
+ } from "./chunks/chunk-2WDZT27Q.js";
15
15
  import "./chunks/chunk-2KEWFW56.js";
16
16
  import "./chunks/chunk-U5FYOMG5.js";
17
17
  import {
@@ -33,7 +33,7 @@ import {
33
33
  repairFabricGuestCode,
34
34
  resolveFabricIdentity,
35
35
  runFabricHandoffAtBoundary
36
- } from "./chunks/chunk-5YGOVBOZ.js";
36
+ } from "./chunks/chunk-VSSC4IDU.js";
37
37
  import "./chunks/chunk-7VIQNUPS.js";
38
38
  import {
39
39
  AgentTranscriptReader,
@@ -41,7 +41,7 @@ import {
41
41
  countContentLines,
42
42
  recentTranscriptTools,
43
43
  writeContentForPreview
44
- } from "./chunks/chunk-HDJBUXDX.js";
44
+ } from "./chunks/chunk-WQUMHDOS.js";
45
45
  import "./chunks/chunk-DLXPTBPL.js";
46
46
  import {
47
47
  ActionRegistry,
@@ -63,7 +63,7 @@ import {
63
63
  withExclusiveFileLockAsync
64
64
  } from "./chunks/chunk-YWEXP724.js";
65
65
  import "./chunks/chunk-4A4MVZQW.js";
66
- import "./chunks/chunk-NX4SNIMR.js";
66
+ import "./chunks/chunk-FX3XLQYI.js";
67
67
  import "./chunks/chunk-6QBPSZJ5.js";
68
68
  import {
69
69
  FABRIC_COMPONENT_DISCOVER_EVENT,
@@ -94,7 +94,7 @@ import {
94
94
  resolveAgentCwd,
95
95
  resolveOmpBinary,
96
96
  validateAgentCwdRequest
97
- } from "./chunks/chunk-TQL7FKMG.js";
97
+ } from "./chunks/chunk-45URY66G.js";
98
98
  import "./chunks/chunk-VPPIJRNZ.js";
99
99
  import {
100
100
  executeFile,
@@ -114,12 +114,12 @@ import {
114
114
  resolveAgentDir,
115
115
  resolveAvailableOmpModel,
116
116
  resolveFabricModel
117
- } from "./chunks/chunk-XRJYPNTI.js";
117
+ } from "./chunks/chunk-WZAH7BO2.js";
118
118
  import {
119
119
  FABRIC_ACTOR_HOST_EVENTS,
120
120
  isFabricActorHostEvent,
121
121
  readJsonlPage
122
- } from "./chunks/chunk-UOSJZXJV.js";
122
+ } from "./chunks/chunk-3LI7YO4M.js";
123
123
  import {
124
124
  isFabricThinking
125
125
  } from "./chunks/chunk-JSBTB3P6.js";
@@ -172,7 +172,7 @@ import {
172
172
  } from "./chunks/chunk-6N4XGAZY.js";
173
173
 
174
174
  // src/fabric-runtime-state.ts
175
- import path18 from "node:path";
175
+ import path19 from "node:path";
176
176
  import { fileURLToPath as fileURLToPath2 } from "node:url";
177
177
 
178
178
  // src/actors/global-registry.ts
@@ -294,6 +294,7 @@ var GlobalActorRegistry = class {
294
294
  ...patch.thinking !== void 0 ? { thinking: patch.thinking } : existing.thinking ? { thinking: existing.thinking } : {},
295
295
  ...patch.tools !== void 0 ? { tools: patch.tools } : existing.tools ? { tools: existing.tools } : {},
296
296
  ...patch.transport !== void 0 ? { transport: patch.transport } : existing.transport ? { transport: existing.transport } : {},
297
+ ...patch.cwd !== void 0 ? { cwd: patch.cwd } : existing.cwd ? { cwd: existing.cwd } : {},
297
298
  ...patch.timeoutMs !== void 0 ? { timeoutMs: patch.timeoutMs } : existing.timeoutMs ? { timeoutMs: existing.timeoutMs } : {},
298
299
  ...patch.extensions !== void 0 ? { extensions: patch.extensions } : typeof existing.extensions === "boolean" ? { extensions: existing.extensions } : {},
299
300
  ...patch.validWhile !== void 0 ? { validWhile: patch.validWhile } : existing.validWhile ? { validWhile: existing.validWhile } : {}
@@ -347,6 +348,7 @@ var GlobalActorRegistry = class {
347
348
  ...def.thinking ? { thinking: def.thinking } : {},
348
349
  ...def.tools ? { tools: [...def.tools] } : {},
349
350
  ...def.transport ? { transport: def.transport } : {},
351
+ ...def.cwd ? { cwd: def.cwd } : {},
350
352
  ...def.timeoutMs ? { timeoutMs: def.timeoutMs } : {},
351
353
  ...typeof def.extensions === "boolean" ? { extensions: def.extensions } : {},
352
354
  ...def.validWhile ? { validWhile: clone(def.validWhile) } : {}
@@ -387,6 +389,7 @@ var GlobalActorRegistry = class {
387
389
  const thinking = def.thinking !== void 0 && isFabricThinking(def.thinking) ? def.thinking : void 0;
388
390
  const tools = Array.isArray(def.tools) ? [...new Set(def.tools.filter((tool) => typeof tool === "string"))] : void 0;
389
391
  const transport = def.transport !== void 0 && TRANSPORTS.has(def.transport) ? def.transport : void 0;
392
+ const cwd = typeof def.cwd === "string" && def.cwd.trim().length > 0 ? def.cwd : void 0;
390
393
  const timeoutMs = typeof def.timeoutMs === "number" ? def.timeoutMs : void 0;
391
394
  const extensions = typeof def.extensions === "boolean" ? def.extensions : void 0;
392
395
  const requires = normalizeRequirements(def.requires);
@@ -407,6 +410,7 @@ var GlobalActorRegistry = class {
407
410
  ...thinking ? { thinking } : {},
408
411
  ...tools ? { tools } : {},
409
412
  ...transport ? { transport } : {},
413
+ ...cwd ? { cwd } : {},
410
414
  ...timeoutMs ? { timeoutMs } : {},
411
415
  ...extensions !== void 0 ? { extensions } : {},
412
416
  ...requires && requires.length > 0 ? { requires } : {},
@@ -443,6 +447,7 @@ var GlobalActorRegistry = class {
443
447
  const thinking = isFabricThinking(record2.thinking) ? record2.thinking : void 0;
444
448
  const tools = Array.isArray(record2.tools) ? record2.tools.filter((tool) => typeof tool === "string") : void 0;
445
449
  const transport = record2.transport !== void 0 && TRANSPORTS.has(record2.transport) ? record2.transport : void 0;
450
+ const cwd = typeof record2.cwd === "string" && record2.cwd.trim().length > 0 ? record2.cwd : void 0;
446
451
  const timeoutMs = typeof record2.timeoutMs === "number" ? record2.timeoutMs : void 0;
447
452
  const extensions = typeof record2.extensions === "boolean" ? record2.extensions : void 0;
448
453
  let requires;
@@ -470,6 +475,7 @@ var GlobalActorRegistry = class {
470
475
  ...thinking ? { thinking } : {},
471
476
  ...tools ? { tools } : {},
472
477
  ...transport ? { transport } : {},
478
+ ...cwd ? { cwd } : {},
473
479
  ...timeoutMs ? { timeoutMs } : {},
474
480
  ...extensions !== void 0 ? { extensions } : {},
475
481
  ...requires && requires.length > 0 ? { requires } : {},
@@ -2219,10 +2225,10 @@ var FabricComponentSupervisor = class {
2219
2225
  adjacent.set(edge.from, targets);
2220
2226
  }
2221
2227
  const cycles = /* @__PURE__ */ new Map();
2222
- const visit = (node, path19, positions) => {
2228
+ const visit = (node, path20, positions) => {
2223
2229
  const position = positions.get(node);
2224
2230
  if (position !== void 0) {
2225
- const cycle = path19.slice(position);
2231
+ const cycle = path20.slice(position);
2226
2232
  const rotations = cycle.map((_, index) => [
2227
2233
  ...cycle.slice(index),
2228
2234
  ...cycle.slice(0, index)
@@ -2232,10 +2238,10 @@ var FabricComponentSupervisor = class {
2232
2238
  cycles.set(canonical.join("\0"), canonical);
2233
2239
  return;
2234
2240
  }
2235
- if (path19.length > this.#components.size) return;
2236
- const nextPositions = new Map(positions).set(node, path19.length);
2241
+ if (path20.length > this.#components.size) return;
2242
+ const nextPositions = new Map(positions).set(node, path20.length);
2237
2243
  for (const target of adjacent.get(node) ?? []) {
2238
- visit(target, [...path19, node], nextPositions);
2244
+ visit(target, [...path20, node], nextPositions);
2239
2245
  }
2240
2246
  };
2241
2247
  for (const id of this.#components.keys()) visit(id, [], /* @__PURE__ */ new Map());
@@ -4198,9 +4204,28 @@ var runProperties = {
4198
4204
  enum: ["off", "minimal", "low", "medium", "high", "xhigh", "max"]
4199
4205
  },
4200
4206
  tools: { type: "array", items: { type: "string" } },
4207
+ addTools: {
4208
+ type: "array",
4209
+ items: { type: "string" },
4210
+ description: "Extra tools merged onto the resolved tool list instead of replacing it; use with or without tools."
4211
+ },
4212
+ images: {
4213
+ type: "array",
4214
+ description: "Image blocks delivered with the task on the child agent's first turn.",
4215
+ items: {
4216
+ type: "object",
4217
+ properties: {
4218
+ type: { const: "image" },
4219
+ data: { type: "string", description: "Base64-encoded image bytes." },
4220
+ mimeType: { type: "string" }
4221
+ },
4222
+ required: ["type", "data", "mimeType"],
4223
+ additionalProperties: false
4224
+ }
4225
+ },
4201
4226
  timeoutMs: {
4202
4227
  type: "number",
4203
- description: "Optional longer wall-clock limit in milliseconds. Omit to use agents.timeoutMs (60 minutes by default); values below the configured default are ignored."
4228
+ description: "Optional wall-clock limit in milliseconds, raising or lowering agents.timeoutMs (60 minutes by default). Clamped to the supported range of 1 second to 24 hours."
4204
4229
  },
4205
4230
  extensions: { type: "boolean" },
4206
4231
  recursive: { type: "boolean" },
@@ -4493,6 +4518,10 @@ var AGENTS_ACTION_DESCRIPTORS = [
4493
4518
  thinking: runProperties.thinking,
4494
4519
  tools: runProperties.tools,
4495
4520
  transport: runProperties.transport,
4521
+ cwd: {
4522
+ ...runProperties.cwd,
4523
+ description: "Filesystem execution directory for every activation; relative paths resolve from the host cwd. An OMP actor must also pass extensions: false, because recursive Fabric activations do not support cwd."
4524
+ },
4496
4525
  timeoutMs: runProperties.timeoutMs,
4497
4526
  extensions: runProperties.extensions,
4498
4527
  requires: {
@@ -5287,27 +5316,37 @@ var actorRunBinding = (args) => ({
5287
5316
  ...typeof args.model === "string" && args.model.trim() ? { model: args.model.trim() } : {},
5288
5317
  ...isFabricThinking(args.thinking) ? { thinking: args.thinking } : {}
5289
5318
  });
5290
- var longerTimeoutOverride = (value, manager) => {
5319
+ var imageContents = (value) => {
5320
+ if (!Array.isArray(value)) return void 0;
5321
+ const images = value.filter(
5322
+ (entry) => typeof entry === "object" && entry !== null && !Array.isArray(entry) && entry.type === "image" && typeof entry.data === "string" && typeof entry.mimeType === "string"
5323
+ );
5324
+ return images.length > 0 ? images : void 0;
5325
+ };
5326
+ var boundedTimeoutOverride = (value, manager) => {
5291
5327
  if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
5292
- const effective = effectiveAgentTimeoutMs(manager.config.timeoutMs, value);
5293
- return effective > manager.config.timeoutMs ? effective : void 0;
5328
+ return effectiveAgentTimeoutMs(manager.config.timeoutMs, value);
5294
5329
  };
5295
5330
  var runRequest = (args, context, manager, options = {}) => {
5296
5331
  const transport = args.transport === "auto" || args.transport === "process" || args.transport === "tmux" || args.transport === "screen" || args.transport === "localterm" || args.transport === "herdr" ? args.transport : void 0;
5297
5332
  const thinking = isFabricThinking(args.thinking) ? args.thinking : void 0;
5298
5333
  const tools = stringArray(args.tools);
5299
- const timeoutMs = longerTimeoutOverride(args.timeoutMs, manager);
5334
+ const addTools = stringArray(args.addTools);
5335
+ const images = imageContents(args.images);
5336
+ const timeoutMs = boundedTimeoutOverride(args.timeoutMs, manager);
5300
5337
  const runner = args.runner === "omp" || args.runner === "claude" || args.runner === "veda" ? args.runner : manager.config.runner;
5301
5338
  const inheritedModel = runner === "omp" && !manager.config.model && context.extensionContext.model ? `${context.extensionContext.model.provider}/${context.extensionContext.model.id}` : void 0;
5302
5339
  return {
5303
5340
  task: String(args.task),
5304
5341
  runner,
5342
+ ...images ? { images } : {},
5305
5343
  ...typeof args.name === "string" ? { name: args.name } : {},
5306
5344
  ...transport ? { transport } : {},
5307
5345
  ...typeof args.model === "string" ? { model: args.model } : inheritedModel ? { model: inheritedModel } : {},
5308
5346
  ...typeof args.persona === "string" && args.persona.trim() ? { persona: args.persona.trim() } : {},
5309
5347
  ...thinking ? { thinking } : {},
5310
5348
  ...tools ? { tools } : {},
5349
+ ...addTools ? { addTools } : {},
5311
5350
  ...timeoutMs !== void 0 ? { timeoutMs } : {},
5312
5351
  ...typeof args.extensions === "boolean" ? { extensions: args.extensions } : {},
5313
5352
  ...typeof args.recursive === "boolean" ? { recursive: args.recursive } : {},
@@ -5365,7 +5404,7 @@ var actorRequest = (args, context, manager, inheritModel = true) => {
5365
5404
  },
5366
5405
  []
5367
5406
  ) : void 0;
5368
- const timeoutMs = longerTimeoutOverride(args.timeoutMs, manager);
5407
+ const timeoutMs = boundedTimeoutOverride(args.timeoutMs, manager);
5369
5408
  const validWhile = typeof args.validWhile === "object" && args.validWhile !== null && !Array.isArray(args.validWhile) && args.validWhile.version === 1 && typeof args.validWhile.source === "string" ? { version: 1, source: args.validWhile.source } : void 0;
5370
5409
  const runner = args.runner === "omp" || args.runner === "claude" || args.runner === "veda" ? args.runner : manager.config.runner;
5371
5410
  if (runner === "veda") {
@@ -5373,6 +5412,12 @@ var actorRequest = (args, context, manager, inheritModel = true) => {
5373
5412
  'The Veda runner does not support persistent actors: Veda executes one headless prompt per invocation. Use an OMP or Claude actor, or agents.run({ runner: "veda" }).'
5374
5413
  );
5375
5414
  }
5415
+ const requestedCwd = typeof args.cwd === "string" ? args.cwd : void 0;
5416
+ validateAgentCwdRequest({
5417
+ ...requestedCwd === void 0 ? {} : { cwd: requestedCwd },
5418
+ recursive: (typeof args.extensions === "boolean" ? args.extensions : true) && runner === "omp"
5419
+ });
5420
+ const cwd = requestedCwd === void 0 ? void 0 : manager.resolveCwd(requestedCwd);
5376
5421
  const inheritedModel = inheritModel && runner === "omp" && !manager.config.model && context.extensionContext.model ? `${context.extensionContext.model.provider}/${context.extensionContext.model.id}` : void 0;
5377
5422
  return {
5378
5423
  ...args.scope === "session" || args.scope === "project" ? { scope: args.scope } : {},
@@ -5390,6 +5435,7 @@ var actorRequest = (args, context, manager, inheritModel = true) => {
5390
5435
  ...isFabricThinking(args.thinking) ? { thinking: args.thinking } : {},
5391
5436
  ...tools ? { tools } : {},
5392
5437
  ...args.transport === "auto" || args.transport === "process" || args.transport === "tmux" || args.transport === "screen" || args.transport === "localterm" || args.transport === "herdr" ? { transport: args.transport } : {},
5438
+ ...cwd ? { cwd } : {},
5393
5439
  ...timeoutMs !== void 0 ? { timeoutMs } : {},
5394
5440
  ...typeof args.extensions === "boolean" ? { extensions: args.extensions } : {},
5395
5441
  ...requires ? { requires } : {},
@@ -6764,6 +6810,8 @@ var CapturedToolsProvider = class {
6764
6810
  };
6765
6811
 
6766
6812
  // src/providers/codemap-provider.ts
6813
+ import { statSync as statSync2 } from "node:fs";
6814
+ import path9 from "node:path";
6767
6815
  import { Type } from "@oh-my-pi/pi-coding-agent/extensibility/legacy-typebox";
6768
6816
  import { validateJsonSchemaValue } from "@oh-my-pi/pi-ai/utils/schema";
6769
6817
 
@@ -7457,6 +7505,12 @@ var KIND_RANK = {
7457
7505
  const: 1
7458
7506
  };
7459
7507
  var MATCH_TIMEOUT_MS = 12e4;
7508
+ var isBudgetTimeout = (error, budgetMs, startedAt) => {
7509
+ if (budgetMs === void 0) return false;
7510
+ if (Date.now() - startedAt >= budgetMs) return true;
7511
+ const message2 = error instanceof Error ? error.message : String(error);
7512
+ return /timeout/i.test(message2);
7513
+ };
7460
7514
  var MAX_FALLBACK_BYTES = 2e6;
7461
7515
  var extensionOf = (file) => {
7462
7516
  const slash = file.lastIndexOf("/");
@@ -7557,12 +7611,13 @@ var gitTrackedFiles = async (root, matcher, signal) => {
7557
7611
  }
7558
7612
  return found;
7559
7613
  };
7560
- var walkFiles = async (root, matcher, signal) => {
7614
+ var walkFiles = async (root, matcher, signal, expired) => {
7561
7615
  const found = [];
7562
7616
  const pending = [""];
7563
7617
  while (pending.length > 0) {
7564
7618
  const directory = pending.pop() ?? "";
7565
7619
  throwIfAborted(signal);
7620
+ if (expired?.() === true) break;
7566
7621
  let entries;
7567
7622
  try {
7568
7623
  entries = await readdir(directory === "" ? root : path8.join(root, directory), {
@@ -7587,7 +7642,7 @@ var walkFiles = async (root, matcher, signal) => {
7587
7642
  }
7588
7643
  return found;
7589
7644
  };
7590
- var discoverFiles = async (root, matcher, signal) => await gitTrackedFiles(root, matcher, signal) ?? await walkFiles(root, matcher, signal);
7645
+ var discoverFiles = async (root, matcher, signal, expired) => await gitTrackedFiles(root, matcher, signal) ?? await walkFiles(root, matcher, signal, expired);
7591
7646
  var COMMENT_HEAD = /^(?:\/\/|\/\*|\*|#|--|<!--|;|%)/;
7592
7647
  var IMPORT_HEAD = /^(?:import|from|require|include|use|using|package|open|load|source)\b/;
7593
7648
  var DECLARATION_HEAD = /^(?:export|pub|public|private|protected|internal|static|final|abstract|override|virtual|inline|async|unsafe|extern|shared|readonly|declare|local|def|defp|defmodule|defstruct|defmacro|class|module|namespace|record|object|data|struct|enum|union|interface|trait|protocol|actor|impl|extension|fn|func|function|sub|procedure|method|const|let|var|val|type|typedef|typealias|template|operator|constructor|init|property|event|signal|macro|task)\b/;
@@ -7749,13 +7804,19 @@ var compareSymbols = (left, right) => {
7749
7804
  };
7750
7805
  async function buildSymbolIndex(request) {
7751
7806
  const startedAt = Date.now();
7807
+ const budgetMs = request.maxMs !== void 0 && request.maxMs > 0 ? request.maxMs : void 0;
7808
+ const remainingMs = () => budgetMs === void 0 ? void 0 : Math.max(0, budgetMs - (Date.now() - startedAt));
7809
+ const outOfTime = () => {
7810
+ const left = remainingMs();
7811
+ return left !== void 0 && left <= 0;
7812
+ };
7752
7813
  const signal = request.signal;
7753
7814
  throwIfAborted(signal);
7754
7815
  const root = path8.resolve(request.root);
7755
7816
  const matcher = request.glob === void 0 ? void 0 : globToRegExp(request.glob);
7756
- const discovered = await discoverFiles(root, matcher, signal);
7817
+ const discovered = await discoverFiles(root, matcher, signal, outOfTime);
7757
7818
  discovered.sort();
7758
- let truncated = false;
7819
+ let truncated = outOfTime();
7759
7820
  let files = discovered;
7760
7821
  if (files.length > request.maxFiles) {
7761
7822
  files = discovered.slice(0, request.maxFiles);
@@ -7784,19 +7845,31 @@ async function buildSymbolIndex(request) {
7784
7845
  for (const spec of LANGUAGE_SPECS) {
7785
7846
  if (!activeSpecs.has(spec.id)) continue;
7786
7847
  throwIfAborted(signal);
7848
+ if (outOfTime()) {
7849
+ truncated = true;
7850
+ break;
7851
+ }
7787
7852
  const scoped = [];
7788
7853
  for (const [file, id] of assigned) if (id === spec.id) scoped.push(file);
7789
7854
  const prefix = commonDirectory(scoped);
7790
- const result = await natives.astGrep({
7791
- patterns: spec.patterns,
7792
- lang: spec.lang,
7793
- path: prefix === "" ? root : path8.join(root, prefix),
7794
- glob: spec.glob,
7795
- includeMeta: true,
7796
- limit: matchLimit,
7797
- timeoutMs: MATCH_TIMEOUT_MS,
7798
- ...signal ? { signal } : {}
7799
- });
7855
+ let result;
7856
+ try {
7857
+ result = await natives.astGrep({
7858
+ patterns: spec.patterns,
7859
+ lang: spec.lang,
7860
+ path: prefix === "" ? root : path8.join(root, prefix),
7861
+ glob: spec.glob,
7862
+ includeMeta: true,
7863
+ limit: matchLimit,
7864
+ timeoutMs: Math.min(MATCH_TIMEOUT_MS, remainingMs() ?? MATCH_TIMEOUT_MS),
7865
+ ...signal ? { signal } : {}
7866
+ });
7867
+ } catch (error) {
7868
+ throwIfAborted(signal);
7869
+ if (!isBudgetTimeout(error, budgetMs, startedAt)) throw error;
7870
+ truncated = true;
7871
+ break;
7872
+ }
7800
7873
  if (result.limitReached) truncated = true;
7801
7874
  for (const match of result.matches) {
7802
7875
  const relative = toPosix2(match.path);
@@ -7816,6 +7889,10 @@ async function buildSymbolIndex(request) {
7816
7889
  }
7817
7890
  for (const file of fallbackFiles) {
7818
7891
  throwIfAborted(signal);
7892
+ if (outOfTime()) {
7893
+ truncated = true;
7894
+ break;
7895
+ }
7819
7896
  let code;
7820
7897
  try {
7821
7898
  code = await readFile(path8.join(root, file), "utf8");
@@ -7861,7 +7938,12 @@ async function buildSymbolIndex(request) {
7861
7938
 
7862
7939
  // src/providers/codemap-provider.ts
7863
7940
  var INDEX_TTL_MS = 3e4;
7941
+ var pathField = Type.Optional(Type.String({
7942
+ maxLength: 4096,
7943
+ description: "Directory to index. Relative paths resolve against the session directory; defaults to it. Point this at a project root when the session runs elsewhere."
7944
+ }));
7864
7945
  var mapSchema = Type.Object({
7946
+ path: pathField,
7865
7947
  maxTokens: Type.Optional(Type.Number({
7866
7948
  minimum: 200,
7867
7949
  maximum: 2e5,
@@ -7884,6 +7966,7 @@ var mapSchema = Type.Object({
7884
7966
  }))
7885
7967
  }, { additionalProperties: false });
7886
7968
  var cascadeSchema = Type.Object({
7969
+ path: pathField,
7887
7970
  seeds: Type.Array(Type.String({ maxLength: 1024 }), {
7888
7971
  minItems: 1,
7889
7972
  maxItems: 32,
@@ -7900,6 +7983,24 @@ var checked = (action, schema, args) => {
7900
7983
  }
7901
7984
  return args;
7902
7985
  };
7986
+ var resolveRoot = (requested, cwd) => {
7987
+ if (requested === void 0) return cwd;
7988
+ const trimmed = requested.trim();
7989
+ if (trimmed.length === 0) {
7990
+ throw new Error("Invalid codemap path: expected a non-empty directory");
7991
+ }
7992
+ const resolved = path9.isAbsolute(trimmed) ? trimmed : path9.resolve(cwd, trimmed);
7993
+ let stats;
7994
+ try {
7995
+ stats = statSync2(resolved);
7996
+ } catch {
7997
+ throw new Error(`Invalid codemap path: ${resolved} does not exist`);
7998
+ }
7999
+ if (!stats.isDirectory()) {
8000
+ throw new Error(`Invalid codemap path: ${resolved} is not a directory`);
8001
+ }
8002
+ return resolved;
8003
+ };
7903
8004
  var descriptors = [
7904
8005
  {
7905
8006
  name: "map",
@@ -7943,6 +8044,7 @@ var CodemapProvider = class {
7943
8044
  ...glob !== void 0 ? { glob } : {},
7944
8045
  maxFiles: this.config.maxFiles,
7945
8046
  maxSymbols: this.config.maxSymbols,
8047
+ maxMs: this.config.maxMs,
7946
8048
  ...signal !== void 0 ? { signal } : {}
7947
8049
  });
7948
8050
  this.#cache.set(key, { index, at: Date.now() });
@@ -7952,11 +8054,12 @@ var CodemapProvider = class {
7952
8054
  switch (actionName) {
7953
8055
  case "map": {
7954
8056
  const input = checked("map", mapSchema, args);
7955
- const index = await this.#index(context.cwd, input.glob, input.refresh === true, context.signal);
8057
+ const target = resolveRoot(input.path, context.cwd);
8058
+ const index = await this.#index(target, input.glob, input.refresh === true, context.signal);
7956
8059
  let cascade;
7957
8060
  if (input.seeds && input.seeds.length > 0) {
7958
8061
  cascade = await coChange({
7959
- root: context.cwd,
8062
+ root: target,
7960
8063
  seeds: input.seeds,
7961
8064
  maxCommits: this.config.cascadeCommits,
7962
8065
  limit: this.config.cascadeLimit
@@ -7974,6 +8077,7 @@ var CodemapProvider = class {
7974
8077
  });
7975
8078
  return {
7976
8079
  ...budgeted,
8080
+ root: index.root,
7977
8081
  indexed: {
7978
8082
  files: index.files.length,
7979
8083
  symbols: index.symbols.length,
@@ -7988,7 +8092,7 @@ var CodemapProvider = class {
7988
8092
  case "cascade": {
7989
8093
  const input = checked("cascade", cascadeSchema, args);
7990
8094
  const graph = await coChange({
7991
- root: context.cwd,
8095
+ root: resolveRoot(input.path, context.cwd),
7992
8096
  seeds: input.seeds,
7993
8097
  maxCommits: input.maxCommits ?? this.config.cascadeCommits,
7994
8098
  limit: input.limit ?? this.config.cascadeLimit
@@ -8219,7 +8323,7 @@ var ComponentsProvider = class {
8219
8323
  import fs5 from "node:fs/promises";
8220
8324
  import fsSync from "node:fs";
8221
8325
  import os from "node:os";
8222
- import path9 from "node:path";
8326
+ import path10 from "node:path";
8223
8327
  var MCP_DESCRIPTOR_CACHE_VERSION = 1;
8224
8328
  var homeDir = () => {
8225
8329
  const home = process.env.HOME;
@@ -8230,25 +8334,25 @@ var expandHome = (input) => {
8230
8334
  const home = homeDir();
8231
8335
  if (input === "~") return home;
8232
8336
  if (input.startsWith("~/") || input.startsWith("~\\")) {
8233
- return path9.join(home, input.slice(2));
8337
+ return path10.join(home, input.slice(2));
8234
8338
  }
8235
8339
  return input;
8236
8340
  };
8237
- var legacyMcporterDir = () => path9.join(homeDir(), ".mcporter");
8341
+ var legacyMcporterDir = () => path10.join(homeDir(), ".mcporter");
8238
8342
  var mcporterConfigDir = () => {
8239
8343
  const raw = process.env.XDG_CONFIG_HOME;
8240
8344
  if (raw && raw.trim().length > 0) {
8241
8345
  const resolved = expandHome(raw.trim());
8242
- if (path9.isAbsolute(resolved)) return path9.join(resolved, "mcporter");
8346
+ if (path10.isAbsolute(resolved)) return path10.join(resolved, "mcporter");
8243
8347
  }
8244
8348
  return legacyMcporterDir();
8245
8349
  };
8246
8350
  var mcporterConfigCandidates = () => {
8247
8351
  const base = mcporterConfigDir();
8248
- const candidates = [path9.join(base, "mcporter.json"), path9.join(base, "mcporter.jsonc")];
8352
+ const candidates = [path10.join(base, "mcporter.json"), path10.join(base, "mcporter.jsonc")];
8249
8353
  const legacy = legacyMcporterDir();
8250
8354
  if (base !== legacy) {
8251
- candidates.push(path9.join(legacy, "mcporter.json"), path9.join(legacy, "mcporter.jsonc"));
8355
+ candidates.push(path10.join(legacy, "mcporter.json"), path10.join(legacy, "mcporter.jsonc"));
8252
8356
  }
8253
8357
  return candidates;
8254
8358
  };
@@ -8263,12 +8367,12 @@ var pathExists = (filePath) => {
8263
8367
  var mcpConfigLayerPaths = (rootDir, configPath) => {
8264
8368
  const explicitRaw = configPath ?? process.env.MCPORTER_CONFIG;
8265
8369
  if (explicitRaw && explicitRaw.trim().length > 0) {
8266
- return [path9.resolve(expandHome(explicitRaw.trim()))];
8370
+ return [path10.resolve(expandHome(explicitRaw.trim()))];
8267
8371
  }
8268
8372
  const paths = [];
8269
8373
  const home = mcporterConfigCandidates().find(pathExists);
8270
8374
  if (home) paths.push(home);
8271
- const projectPath = path9.resolve(rootDir, "config", "mcporter.json");
8375
+ const projectPath = path10.resolve(rootDir, "config", "mcporter.json");
8272
8376
  if (pathExists(projectPath)) paths.push(projectPath);
8273
8377
  return paths;
8274
8378
  };
@@ -8319,8 +8423,8 @@ var parseCacheFile = (value) => {
8319
8423
  servers: value.servers
8320
8424
  };
8321
8425
  };
8322
- var projectMcpCachePath = (projectRoot) => path9.join(projectRoot, ".omp", "fabric", "mcp-cache.json");
8323
- var globalMcpCachePath = (agentDir) => path9.join(agentDir, "fabric", "mcp-descriptors.json");
8426
+ var projectMcpCachePath = (projectRoot) => path10.join(projectRoot, ".omp", "fabric", "mcp-cache.json");
8427
+ var globalMcpCachePath = (agentDir) => path10.join(agentDir, "fabric", "mcp-descriptors.json");
8324
8428
  var tempCounter = 0;
8325
8429
  var McpDescriptorCacheStore = class {
8326
8430
  constructor(filePath) {
@@ -8337,9 +8441,9 @@ var McpDescriptorCacheStore = class {
8337
8441
  // Atomic-ish write: temp file then rename, so a concurrent reader either
8338
8442
  // sees the previous cache or the next one, never a torn document.
8339
8443
  async save(file) {
8340
- const directory = path9.dirname(this.filePath);
8444
+ const directory = path10.dirname(this.filePath);
8341
8445
  await fs5.mkdir(directory, { recursive: true });
8342
- const tempPath = path9.join(
8446
+ const tempPath = path10.join(
8343
8447
  directory,
8344
8448
  `.mcp-cache-${process.pid}-${Date.now()}-${tempCounter++}.tmp`
8345
8449
  );
@@ -8354,7 +8458,7 @@ var McpDescriptorCacheStore = class {
8354
8458
  };
8355
8459
 
8356
8460
  // src/providers/mcp-provider.ts
8357
- import path10 from "node:path";
8461
+ import path11 from "node:path";
8358
8462
  var TOOL_METADATA_TTL_MS = 6e4;
8359
8463
  var REVALIDATE_CONCURRENCY = 3;
8360
8464
  var REVALIDATE_SERVER_TIMEOUT_MS = 2e4;
@@ -8362,6 +8466,7 @@ var MIN_REVALIDATE_SERVER_TIMEOUT_MS = 5e3;
8362
8466
  var NOTIFY_DEBOUNCE_MS = 100;
8363
8467
  var PERSIST_DEBOUNCE_MS = 150;
8364
8468
  var COLD_LIST_WAIT_MS = 2500;
8469
+ var MAX_CALL_TIMEOUT_MS = 9e5;
8365
8470
  var emptyObjectSchema = {
8366
8471
  type: "object",
8367
8472
  properties: {},
@@ -8412,7 +8517,12 @@ var managementDescriptors = [
8412
8517
  properties: {
8413
8518
  server: { type: "string" },
8414
8519
  tool: { type: "string" },
8415
- args: { type: "object", additionalProperties: true }
8520
+ args: { type: "object", additionalProperties: true },
8521
+ timeoutMs: {
8522
+ type: "number",
8523
+ minimum: 1,
8524
+ description: `Per-call timeout overriding mcp.callTimeoutMs, clamped to ${MAX_CALL_TIMEOUT_MS}ms.`
8525
+ }
8416
8526
  },
8417
8527
  required: ["server", "tool"],
8418
8528
  additionalProperties: false
@@ -8421,6 +8531,7 @@ var managementDescriptors = [
8421
8531
  namespace: "management"
8422
8532
  }
8423
8533
  ];
8534
+ var resolveMcpCallTimeoutMs = (value, fallback) => typeof value === "number" && Number.isFinite(value) && value >= 1 ? Math.min(Math.floor(value), MAX_CALL_TIMEOUT_MS) : fallback;
8424
8535
  var normalizeSchema = (schema) => typeof schema === "object" && schema !== null && !Array.isArray(schema) ? schema : emptyObjectSchema;
8425
8536
  var normalizeMcpResult = (result) => {
8426
8537
  if (typeof result !== "object" || result === null || Array.isArray(result)) return result;
@@ -8608,7 +8719,13 @@ var McpProvider = class {
8608
8719
  const server = String(args.server);
8609
8720
  const tool = String(args.tool);
8610
8721
  const toolArgs = typeof args.args === "object" && args.args !== null && !Array.isArray(args.args) ? args.args : {};
8611
- return this.#call(server, tool, toolArgs, context.signal);
8722
+ return this.#call(
8723
+ server,
8724
+ tool,
8725
+ toolArgs,
8726
+ context.signal,
8727
+ resolveMcpCallTimeoutMs(args.timeoutMs, this.config.callTimeoutMs)
8728
+ );
8612
8729
  }
8613
8730
  const parsed = this.#parseToolName(actionName);
8614
8731
  if (!parsed) throw new Error(`Invalid MCP action: ${actionName}`);
@@ -8681,8 +8798,8 @@ var McpProvider = class {
8681
8798
  }
8682
8799
  if (this.#dirtyPersist) await this.#persistNow().catch(() => void 0);
8683
8800
  }
8684
- async #call(serverName, toolName, args, signal) {
8685
- if (!this.#cacheOn) return this.#callLegacy(serverName, toolName, args, signal);
8801
+ async #call(serverName, toolName, args, signal, timeoutMs) {
8802
+ if (!this.#cacheOn) return this.#callLegacy(serverName, toolName, args, signal, timeoutMs);
8686
8803
  if (signal?.aborted) throw new Error("MCP call cancelled");
8687
8804
  await this.#hydrate();
8688
8805
  const server = await this.#resolveKnownServer(serverName);
@@ -8700,7 +8817,7 @@ var McpProvider = class {
8700
8817
  if (firstContact) this.#recontacted.add(server);
8701
8818
  const operation = runtime.callTool(server, tool.name, {
8702
8819
  args,
8703
- timeoutMs: this.config.callTimeoutMs,
8820
+ timeoutMs: timeoutMs ?? this.config.callTimeoutMs,
8704
8821
  disableOAuth: this.config.disableOAuth
8705
8822
  });
8706
8823
  try {
@@ -9065,7 +9182,7 @@ var McpProvider = class {
9065
9182
  kind: "stdio",
9066
9183
  command: args.command,
9067
9184
  args: commandArgs,
9068
- cwd: path10.resolve(this.cwd, typeof args.cwd === "string" ? args.cwd : ".")
9185
+ cwd: path11.resolve(this.cwd, typeof args.cwd === "string" ? args.cwd : ".")
9069
9186
  },
9070
9187
  ...env ? { env } : {}
9071
9188
  };
@@ -9148,7 +9265,7 @@ var McpProvider = class {
9148
9265
  const tool = await this.#findToolLegacy(runtime, server, parsed.tool);
9149
9266
  return tool ? this.#toolDescriptor(server, tool) : void 0;
9150
9267
  }
9151
- async #callLegacy(serverName, toolName, args, signal) {
9268
+ async #callLegacy(serverName, toolName, args, signal, timeoutMs) {
9152
9269
  if (signal?.aborted) throw new Error("MCP call cancelled");
9153
9270
  const runtime = await this.#getRuntime();
9154
9271
  const server = this.#resolveServerName(runtime, serverName);
@@ -9158,7 +9275,7 @@ var McpProvider = class {
9158
9275
  if (!tool) throw new Error(`Unknown MCP tool: ${serverName}.${toolName}`);
9159
9276
  const operation = runtime.callTool(server, tool.name, {
9160
9277
  args,
9161
- timeoutMs: this.config.callTimeoutMs,
9278
+ timeoutMs: timeoutMs ?? this.config.callTimeoutMs,
9162
9279
  disableOAuth: this.config.disableOAuth
9163
9280
  });
9164
9281
  try {
@@ -9262,7 +9379,11 @@ var descriptors4 = [
9262
9379
  items: { type: "string", enum: ["root", "agent", "actor"] }
9263
9380
  },
9264
9381
  includeStale: { type: "boolean" },
9265
- limit: { type: "number", minimum: 1 }
9382
+ limit: { type: "number", minimum: 1 },
9383
+ withTotal: {
9384
+ type: "boolean",
9385
+ description: "Return { members, total, truncated } instead of a bare array, so a clipped page is distinguishable from a complete one."
9386
+ }
9266
9387
  },
9267
9388
  additionalProperties: false
9268
9389
  },
@@ -9288,7 +9409,11 @@ var descriptors4 = [
9288
9409
  type: "object",
9289
9410
  properties: {
9290
9411
  prefix: { type: "string" },
9291
- limit: { type: "number", minimum: 1 }
9412
+ limit: { type: "number", minimum: 1 },
9413
+ withTotal: {
9414
+ type: "boolean",
9415
+ description: "Return { entries, total, truncated } instead of a bare array, so a clipped page is distinguishable from a complete one."
9416
+ }
9292
9417
  },
9293
9418
  additionalProperties: false
9294
9419
  },
@@ -9379,11 +9504,13 @@ var MeshProvider = class {
9379
9504
  ) : void 0;
9380
9505
  const scope = args.scope === "local" || args.scope === "lineage" || args.scope === "project" ? args.scope : "project";
9381
9506
  const limit = Math.max(1, Math.floor(typeof args.limit === "number" ? args.limit : 100));
9382
- return this.participants.list({
9507
+ const matched = this.participants.list({
9383
9508
  scope,
9384
9509
  ...kinds ? { kinds } : {},
9385
9510
  ...args.includeStale === true ? { includeStale: true } : {}
9386
- }).slice(0, limit);
9511
+ });
9512
+ const members = matched.slice(0, limit);
9513
+ return args.withTotal === true ? { members, total: matched.length, truncated: matched.length > members.length } : members;
9387
9514
  }
9388
9515
  case "get": {
9389
9516
  const key = String(args.key);
@@ -9400,11 +9527,13 @@ var MeshProvider = class {
9400
9527
  this.store.maxReadEvents
9401
9528
  )
9402
9529
  );
9403
- return this.store.listAll(prefix).filter(
9530
+ const matched = this.store.listAll(prefix).filter(
9404
9531
  (entry) => !PRIVATE_STATE_PREFIXES.some(
9405
9532
  (privatePrefix) => entry.key.startsWith(privatePrefix)
9406
9533
  )
9407
- ).slice(0, limit);
9534
+ );
9535
+ const entries = matched.slice(0, limit);
9536
+ return args.withTotal === true ? { entries, total: matched.length, truncated: matched.length > entries.length } : entries;
9408
9537
  }
9409
9538
  case "put": {
9410
9539
  const key = String(args.key);
@@ -9431,13 +9560,14 @@ var MeshProvider = class {
9431
9560
  };
9432
9561
 
9433
9562
  // src/providers/omp-tools-provider.ts
9434
- import { mkdirSync as mkdirSync2, mkdtempSync, readFileSync as readFileSync2, statSync as statSync3, writeFileSync as writeFileSync2 } from "node:fs";
9563
+ import { mkdirSync as mkdirSync2, mkdtempSync, readFileSync as readFileSync2, statSync as statSync4, writeFileSync as writeFileSync2 } from "node:fs";
9435
9564
  import { AsyncLocalStorage } from "node:async_hooks";
9436
9565
  import os2 from "node:os";
9437
- import path13 from "node:path";
9566
+ import path14 from "node:path";
9438
9567
  import { randomUUID as randomUUID3 } from "node:crypto";
9439
9568
  import { BashTool } from "@oh-my-pi/pi-coding-agent/tools/bash";
9440
9569
  import { EditTool } from "@oh-my-pi/pi-coding-agent/edit";
9570
+ import { GlobTool } from "@oh-my-pi/pi-coding-agent/tools/glob";
9441
9571
  import { GrepTool, MULTI_FILE_PER_FILE_MATCHES, SINGLE_FILE_MATCHES } from "@oh-my-pi/pi-coding-agent/tools/grep";
9442
9572
  import { ReadTool } from "@oh-my-pi/pi-coding-agent/tools/read";
9443
9573
  import { piEscapeRegexLiteral, piJoinPath } from "@oh-my-pi/pi-ai/providers/cursor-pi-args";
@@ -9450,7 +9580,7 @@ import {
9450
9580
 
9451
9581
  // src/agents/bash-worktree-add.ts
9452
9582
  import fs6 from "node:fs";
9453
- import path11 from "node:path";
9583
+ import path12 from "node:path";
9454
9584
  var BARE_SAFE = /^[A-Za-z0-9_./:@%+=,-]+$/;
9455
9585
  var parseGitWorktreeAdd = (command) => {
9456
9586
  const trimmed = command.trim();
@@ -9513,8 +9643,8 @@ var tryExecuteGitWorktreeAdd = async (args, sessionCwd) => {
9513
9643
  if (typeof command !== "string") return void 0;
9514
9644
  const parsed = parseGitWorktreeAdd(command);
9515
9645
  if (!parsed) return void 0;
9516
- const gitCwd = parsed.gitCwd ? path11.resolve(sessionCwd, parsed.gitCwd) : typeof args.cwd === "string" ? args.cwd : sessionCwd;
9517
- const dest = path11.resolve(gitCwd, parsed.dest);
9646
+ const gitCwd = parsed.gitCwd ? path12.resolve(sessionCwd, parsed.gitCwd) : typeof args.cwd === "string" ? args.cwd : sessionCwd;
9647
+ const dest = path12.resolve(gitCwd, parsed.dest);
9518
9648
  let gitRoot;
9519
9649
  try {
9520
9650
  const root = await executeFile("git", ["rev-parse", "--show-toplevel"], {
@@ -9542,8 +9672,8 @@ var tryExecuteGitWorktreeAdd = async (args, sessionCwd) => {
9542
9672
  };
9543
9673
 
9544
9674
  // src/providers/omp-bash-cwd.ts
9545
- import { accessSync, constants, statSync as statSync2 } from "node:fs";
9546
- import path12 from "node:path";
9675
+ import { accessSync, constants, statSync as statSync3 } from "node:fs";
9676
+ import path13 from "node:path";
9547
9677
  import { createBashToolDefinition } from "@oh-my-pi/pi-coding-agent/extensibility/legacy-pi-coding-agent-shim";
9548
9678
  import { Type as Type3 } from "@oh-my-pi/pi-coding-agent/extensibility/legacy-typebox";
9549
9679
  var OMP_BASH_CWD_KEY = "cwd";
@@ -9553,9 +9683,9 @@ var resolveOmpShellCwd = (toolName, sessionCwd, requested) => {
9553
9683
  `Invalid omp.${toolName} cwd ${JSON.stringify(requested)}: path must be a non-empty string`
9554
9684
  );
9555
9685
  }
9556
- const resolved = path12.isAbsolute(requested) ? path12.resolve(requested) : path12.resolve(sessionCwd, requested);
9686
+ const resolved = path13.isAbsolute(requested) ? path13.resolve(requested) : path13.resolve(sessionCwd, requested);
9557
9687
  try {
9558
- if (!statSync2(resolved).isDirectory()) throw new Error("path is not a directory");
9688
+ if (!statSync3(resolved).isDirectory()) throw new Error("path is not a directory");
9559
9689
  accessSync(resolved, constants.R_OK | constants.X_OK);
9560
9690
  } catch (error) {
9561
9691
  const reason = error instanceof Error ? error.message : String(error);
@@ -9628,28 +9758,49 @@ var BashCwdDefinitions = class extends ShellCwdDefinitions {
9628
9758
 
9629
9759
  // src/providers/write-preview.ts
9630
9760
  import { homedir } from "node:os";
9631
- import { dirname, isAbsolute, resolve } from "node:path";
9761
+ import { dirname, isAbsolute, resolve, win32 } from "node:path";
9632
9762
  import { mkdir, readFile as readFile2, stat, writeFile } from "node:fs/promises";
9633
9763
  import { Type as Type4 } from "@oh-my-pi/pi-coding-agent/extensibility/legacy-typebox";
9634
9764
  var mutationQueues = /* @__PURE__ */ new Map();
9635
- var withFileMutationQueue = async (path19, operation) => {
9636
- const previous = mutationQueues.get(path19) ?? Promise.resolve();
9765
+ var withFileMutationQueue = async (path20, operation) => {
9766
+ const previous = mutationQueues.get(path20) ?? Promise.resolve();
9637
9767
  let release;
9638
9768
  const current = new Promise((resolve2) => {
9639
9769
  release = resolve2;
9640
9770
  });
9641
- mutationQueues.set(path19, current);
9771
+ mutationQueues.set(path20, current);
9642
9772
  await previous;
9643
9773
  try {
9644
9774
  return await operation();
9645
9775
  } finally {
9646
9776
  release();
9647
- if (mutationQueues.get(path19) === current) mutationQueues.delete(path19);
9777
+ if (mutationQueues.get(path20) === current) mutationQueues.delete(path20);
9648
9778
  }
9649
9779
  };
9780
+ var URI_LIKE_WRITE_TARGET_RE = /^([a-z][a-z0-9+.-]*):\/{1,2}/i;
9781
+ var OmpWriteUriTargetError = class extends Error {
9782
+ path;
9783
+ constructor(message2, path20) {
9784
+ super(message2);
9785
+ this.name = "OmpWriteUriTargetError";
9786
+ this.path = path20;
9787
+ }
9788
+ };
9789
+ var assertFilesystemWriteTarget = (candidate, reported) => {
9790
+ const trimmed = candidate.trim();
9791
+ if (win32.isAbsolute(trimmed)) return;
9792
+ const scheme = URI_LIKE_WRITE_TARGET_RE.exec(trimmed)?.[1]?.toLowerCase();
9793
+ if (scheme === void 0) return;
9794
+ const guidance = scheme === "xd" ? "Tool devices are dispatched by the top-level `write` tool, which carries the xd:// transport; omp.write writes files." : "omp.write resolves filesystem paths only.";
9795
+ throw new OmpWriteUriTargetError(
9796
+ `Refusing to write '${reported}': '${scheme}://' is a URI scheme, not a directory. ${guidance} Prefix the path with './' to create a literal file by that name.`,
9797
+ reported
9798
+ );
9799
+ };
9650
9800
  var resolvePreviewPath = (filePath, cwd) => {
9651
9801
  let expanded = filePath.startsWith("@") ? filePath.slice(1) : filePath;
9652
9802
  expanded = expanded.replace(/[\u00a0\u2000-\u200a\u202f\u205f\u3000]/g, " ");
9803
+ assertFilesystemWriteTarget(expanded, filePath);
9653
9804
  if (expanded === "~") expanded = homedir();
9654
9805
  else if (expanded.startsWith("~/")) expanded = homedir() + expanded.slice(1);
9655
9806
  return isAbsolute(expanded) ? expanded : resolve(cwd, expanded);
@@ -9697,14 +9848,14 @@ var createPreviewWriteToolDefinition = (cwd) => {
9697
9848
  return {
9698
9849
  ...original,
9699
9850
  async execute(_toolCallId, params, signal) {
9700
- const { path: path19, content } = params;
9701
- const absolutePath = resolvePreviewPath(path19, cwd);
9851
+ const { path: path20, content } = params;
9852
+ const absolutePath = resolvePreviewPath(path20, cwd);
9702
9853
  return withFileMutationQueue(absolutePath, async () => {
9703
9854
  const throwIfAborted2 = () => {
9704
9855
  if (signal?.aborted) throw new Error("Operation aborted");
9705
9856
  };
9706
9857
  throwIfAborted2();
9707
- const before = await readExistingFileForPreview(path19, cwd, content);
9858
+ const before = await readExistingFileForPreview(path20, cwd, content);
9708
9859
  throwIfAborted2();
9709
9860
  await mkdir(dirname(absolutePath), { recursive: true });
9710
9861
  throwIfAborted2();
@@ -9714,7 +9865,7 @@ var createPreviewWriteToolDefinition = (cwd) => {
9714
9865
  content: [
9715
9866
  {
9716
9867
  type: "text",
9717
- text: `Successfully wrote ${Buffer.byteLength(content, "utf8")} bytes to ${path19}`
9868
+ text: `Successfully wrote ${Buffer.byteLength(content, "utf8")} bytes to ${path20}`
9718
9869
  }
9719
9870
  ],
9720
9871
  details: { codePreviewBeforeWrite: before }
@@ -9729,7 +9880,7 @@ var MAX_RENDERER_ARGUMENT_CHARS = 2e5;
9729
9880
  var GUEST_READ_LINE_LIMIT = 1e5;
9730
9881
  var MAX_REPLACE_ALL_FILE_CHARS = 2e6;
9731
9882
  var createNativeSession = (cwd, artifactPaths) => {
9732
- const artifactRoot = artifactPaths ? mkdtempSync(path13.join(os2.tmpdir(), "omp-fabric-bash-")) : void 0;
9883
+ const artifactRoot = artifactPaths ? mkdtempSync(path14.join(os2.tmpdir(), "omp-fabric-bash-")) : void 0;
9733
9884
  return {
9734
9885
  cwd,
9735
9886
  hasUI: false,
@@ -9746,7 +9897,7 @@ var createNativeSession = (cwd, artifactPaths) => {
9746
9897
  try {
9747
9898
  mkdirSync2(artifactRoot, { recursive: true, mode: 448 });
9748
9899
  const id = randomUUID3();
9749
- const artifactPath = path13.join(artifactRoot, `${toolType}-${id}.log`);
9900
+ const artifactPath = path14.join(artifactRoot, `${toolType}-${id}.log`);
9750
9901
  writeFileSync2(artifactPath, "", { mode: 384 });
9751
9902
  artifactPaths.set(id, artifactPath);
9752
9903
  artifactAllocations.getStore()?.push(artifactPath);
@@ -9787,12 +9938,28 @@ var GREP_SKIP_PROPERTY = {
9787
9938
  type: "number",
9788
9939
  description: "Files to skip before collecting results \u2014 paginate when a search hit the file limit"
9789
9940
  };
9790
- var withGrepSkipSchema = (document) => {
9791
- const schema = asRecord(document);
9941
+ var GITIGNORE_PROPERTY = {
9942
+ type: "boolean",
9943
+ description: "Respect gitignore rules; pass false to search ignored files such as build output or .env"
9944
+ };
9945
+ var HIDDEN_PROPERTY = {
9946
+ type: "boolean",
9947
+ description: "Include dotfiles and hidden directories"
9948
+ };
9949
+ var withExtraProperties = (document, extras) => {
9950
+ const source = typeof document === "function" && "toJsonSchema" in document ? document.toJsonSchema() : document;
9951
+ const schema = asRecord(source);
9792
9952
  const properties = asRecord(schema?.properties);
9793
- if (!schema || !properties || Object.hasOwn(properties, "skip")) return document;
9794
- return { ...schema, properties: { ...properties, skip: GREP_SKIP_PROPERTY } };
9953
+ if (!schema || !properties) return document;
9954
+ const additions = {};
9955
+ for (const [name, property] of Object.entries(extras)) {
9956
+ if (!Object.hasOwn(properties, name)) additions[name] = property;
9957
+ }
9958
+ if (Object.keys(additions).length === 0) return document;
9959
+ return { ...schema, properties: { ...properties, ...additions } };
9795
9960
  };
9961
+ var withGrepSkipSchema = (document) => withExtraProperties(document, { skip: GREP_SKIP_PROPERTY, gitignore: GITIGNORE_PROPERTY });
9962
+ var withFindFilterSchema = (document) => withExtraProperties(document, { gitignore: GITIGNORE_PROPERTY, hidden: HIDDEN_PROPERTY });
9796
9963
  var grepSession = (cwd, context) => ({
9797
9964
  cwd,
9798
9965
  hasUI: false,
@@ -9822,7 +9989,37 @@ var createGrepDefinitionWithSkip = (cwd) => {
9822
9989
  pattern: record2.literal === true ? piEscapeRegexLiteral(rawPattern) : rawPattern,
9823
9990
  path: glob ? piJoinPath(searchPath, glob) : searchPath,
9824
9991
  case: record2.ignoreCase === true ? false : void 0,
9825
- ...skip === void 0 ? {} : { skip }
9992
+ ...skip === void 0 ? {} : { skip },
9993
+ ...typeof record2.gitignore === "boolean" ? { gitignore: record2.gitignore } : {}
9994
+ },
9995
+ signal,
9996
+ onUpdate,
9997
+ context
9998
+ );
9999
+ }
10000
+ };
10001
+ };
10002
+ var createFindDefinitionWithFilters = (cwd) => {
10003
+ const legacy = createFindToolDefinition(cwd);
10004
+ const tool = new GlobTool(grepSession(cwd));
10005
+ return {
10006
+ ...legacy,
10007
+ parameters: withFindFilterSchema(legacy.parameters),
10008
+ execute: (toolCallId, params, signal, onUpdate, context) => {
10009
+ const record2 = asRecord(params) ?? {};
10010
+ if (typeof record2.gitignore !== "boolean" && typeof record2.hidden !== "boolean") {
10011
+ return legacy.execute(toolCallId, params, signal, onUpdate, context);
10012
+ }
10013
+ const pattern = typeof record2.pattern === "string" ? record2.pattern : void 0;
10014
+ const searchPath = typeof record2.path === "string" ? record2.path : void 0;
10015
+ const limit = typeof record2.limit === "number" ? record2.limit : void 0;
10016
+ return tool.execute(
10017
+ toolCallId,
10018
+ {
10019
+ path: piJoinPath(searchPath ?? ".", pattern ?? "*"),
10020
+ ...limit === void 0 ? {} : { limit },
10021
+ ...typeof record2.gitignore === "boolean" ? { gitignore: record2.gitignore } : {},
10022
+ ...typeof record2.hidden === "boolean" ? { hidden: record2.hidden } : {}
9826
10023
  },
9827
10024
  signal,
9828
10025
  onUpdate,
@@ -9853,7 +10050,7 @@ var normalizeEditArguments = (args, replaceAll, cwd) => {
9853
10050
  ...replaceAll || record2.all === true || record2.replace_all === true ? { replace_all: true } : {}
9854
10051
  };
9855
10052
  });
9856
- const resolvedPath = path13.resolve(cwd, filePath.startsWith("@") ? filePath.slice(1) : filePath);
10053
+ const resolvedPath = path14.resolve(cwd, filePath.startsWith("@") ? filePath.slice(1) : filePath);
9857
10054
  const current = readFileSync2(resolvedPath, "utf8");
9858
10055
  if (current.length > MAX_REPLACE_ALL_FILE_CHARS) {
9859
10056
  throw new Error(`omp.edit refuses files over ${MAX_REPLACE_ALL_FILE_CHARS} characters`);
@@ -10007,7 +10204,7 @@ var restoreBashOutput = (artifactPath, maxChars, delivered) => {
10007
10204
  if (!artifactPath || maxChars <= 0) return void 0;
10008
10205
  let size;
10009
10206
  try {
10010
- size = statSync3(artifactPath).size;
10207
+ size = statSync4(artifactPath).size;
10011
10208
  } catch {
10012
10209
  return void 0;
10013
10210
  }
@@ -10249,7 +10446,7 @@ var OmpToolsProvider = class _OmpToolsProvider {
10249
10446
  edit: createNativeReplaceEditToolDefinition(cwd),
10250
10447
  write: createPreviewWriteToolDefinition(cwd),
10251
10448
  grep: createGrepDefinitionWithSkip(cwd),
10252
- find: createFindToolDefinition(cwd),
10449
+ find: createFindDefinitionWithFilters(cwd),
10253
10450
  ls: createLsToolDefinition(cwd)
10254
10451
  };
10255
10452
  this.#catalog = catalog;
@@ -10654,7 +10851,7 @@ var OmpToolsProvider = class _OmpToolsProvider {
10654
10851
  import { spawn } from "node:child_process";
10655
10852
  import { createHash as createHash3, randomBytes, randomUUID as randomUUID4 } from "node:crypto";
10656
10853
  import fs8 from "node:fs";
10657
- import path15 from "node:path";
10854
+ import path16 from "node:path";
10658
10855
 
10659
10856
  // src/schema/types.ts
10660
10857
  var stateBinding = (head) => head ? { transitionId: head.transitionId, version: head.version, to: head.to } : null;
@@ -10663,7 +10860,7 @@ var stateBinding = (head) => head ? { transitionId: head.transitionId, version:
10663
10860
  import { execFileSync } from "node:child_process";
10664
10861
  import { createHash as createHash2 } from "node:crypto";
10665
10862
  import fs7 from "node:fs";
10666
- import path14 from "node:path";
10863
+ import path15 from "node:path";
10667
10864
  var SNAPSHOT_MAX_FILES = 2e4;
10668
10865
  var SNAPSHOT_MAX_BYTES = 512 * 1024 * 1024;
10669
10866
  var FALLBACK_SKIPPED_DIRECTORIES = /* @__PURE__ */ new Set([
@@ -10681,10 +10878,10 @@ var git = (cwd, args) => execFileSync("git", ["-C", cwd, ...args], {
10681
10878
  stdio: ["ignore", "pipe", "ignore"]
10682
10879
  });
10683
10880
  var nulPaths = (buffer) => buffer.toString("utf8").split("\0").filter((item) => item.length > 0);
10684
- var normalizeRelative = (value) => value.split(path14.sep).join("/");
10881
+ var normalizeRelative = (value) => value.split(path15.sep).join("/");
10685
10882
  var isInside = (root, candidate) => {
10686
- const relative = path14.relative(root, candidate);
10687
- return relative === "" || !path14.isAbsolute(relative) && relative !== ".." && !relative.startsWith(`..${path14.sep}`);
10883
+ const relative = path15.relative(root, candidate);
10884
+ return relative === "" || !path15.isAbsolute(relative) && relative !== ".." && !relative.startsWith(`..${path15.sep}`);
10688
10885
  };
10689
10886
  var excluded = (absolute, exclusions) => exclusions.some((root) => isInside(root, absolute));
10690
10887
  var entryDigest = (absolute) => {
@@ -10710,12 +10907,12 @@ var buildSnapshot = (cwd, paths, metadata, exclusions) => {
10710
10907
  let bytes = 0;
10711
10908
  const unique = [...new Set(paths)].sort((left, right) => left.localeCompare(right));
10712
10909
  for (const relativeInput of unique) {
10713
- const absolute = path14.resolve(cwd, relativeInput);
10910
+ const absolute = path15.resolve(cwd, relativeInput);
10714
10911
  if (!isInside(cwd, absolute) || excluded(absolute, exclusions)) continue;
10715
10912
  if (Object.keys(entries).length >= SNAPSHOT_MAX_FILES) {
10716
10913
  throw new Error(`Schema workspace snapshot exceeds ${SNAPSHOT_MAX_FILES} files`);
10717
10914
  }
10718
- const relative = normalizeRelative(path14.relative(cwd, absolute));
10915
+ const relative = normalizeRelative(path15.relative(cwd, absolute));
10719
10916
  const entry = entryDigest(absolute);
10720
10917
  bytes += entry.bytes;
10721
10918
  if (bytes > SNAPSHOT_MAX_BYTES) {
@@ -10744,9 +10941,9 @@ var fallbackPaths = (cwd, exclusions) => {
10744
10941
  const entries = fs7.readdirSync(directory, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name));
10745
10942
  for (const entry of entries) {
10746
10943
  if (FALLBACK_SKIPPED_DIRECTORIES.has(entry.name)) continue;
10747
- const absolute = path14.join(directory, entry.name);
10944
+ const absolute = path15.join(directory, entry.name);
10748
10945
  if (excluded(absolute, exclusions)) continue;
10749
- const relative = normalizeRelative(path14.relative(cwd, absolute));
10946
+ const relative = normalizeRelative(path15.relative(cwd, absolute));
10750
10947
  if (entry.isDirectory()) visit(absolute);
10751
10948
  else paths.push(relative);
10752
10949
  if (paths.length > SNAPSHOT_MAX_FILES) {
@@ -10760,7 +10957,7 @@ var fallbackPaths = (cwd, exclusions) => {
10760
10957
  var snapshotWorkspace = (cwdInput, excludedRoots = []) => {
10761
10958
  const cwd = fs7.realpathSync(cwdInput);
10762
10959
  const exclusions = excludedRoots.map((root) => {
10763
- const absolute = path14.resolve(root);
10960
+ const absolute = path15.resolve(root);
10764
10961
  try {
10765
10962
  return fs7.realpathSync(absolute);
10766
10963
  } catch {
@@ -10798,18 +10995,18 @@ var snapshotWorkspace = (cwdInput, excludedRoots = []) => {
10798
10995
  );
10799
10996
  };
10800
10997
  var resolveWorkspaceFile = (cwdInput, requestedPath, options) => {
10801
- if (!requestedPath.trim() || path14.isAbsolute(requestedPath)) {
10998
+ if (!requestedPath.trim() || path15.isAbsolute(requestedPath)) {
10802
10999
  throw new Error(`Schema paths must be non-empty project-relative paths: ${requestedPath}`);
10803
11000
  }
10804
11001
  const cwd = fs7.realpathSync(cwdInput);
10805
- const absolute = path14.resolve(cwd, requestedPath);
11002
+ const absolute = path15.resolve(cwd, requestedPath);
10806
11003
  if (!isInside(cwd, absolute) || absolute === cwd) {
10807
11004
  throw new Error(`Schema path escapes the project workspace: ${requestedPath}`);
10808
11005
  }
10809
- const relativeParts = path14.relative(cwd, absolute).split(path14.sep);
11006
+ const relativeParts = path15.relative(cwd, absolute).split(path15.sep);
10810
11007
  let cursor = cwd;
10811
11008
  for (let index = 0; index < relativeParts.length; index++) {
10812
- cursor = path14.join(cursor, relativeParts[index]);
11009
+ cursor = path15.join(cursor, relativeParts[index]);
10813
11010
  let stat2;
10814
11011
  try {
10815
11012
  stat2 = fs7.lstatSync(cursor);
@@ -10818,9 +11015,9 @@ var resolveWorkspaceFile = (cwdInput, requestedPath, options) => {
10818
11015
  if (index !== relativeParts.length - 1 || !options.allowAbsent) {
10819
11016
  throw new Error(`Schema path does not exist: ${requestedPath}`);
10820
11017
  }
10821
- const parentReal = fs7.realpathSync(path14.dirname(cursor));
11018
+ const parentReal = fs7.realpathSync(path15.dirname(cursor));
10822
11019
  if (!isInside(cwd, parentReal)) throw new Error(`Schema path parent escapes the workspace: ${requestedPath}`);
10823
- return { absolute, relative: normalizeRelative(path14.relative(cwd, absolute)), exists: false };
11020
+ return { absolute, relative: normalizeRelative(path15.relative(cwd, absolute)), exists: false };
10824
11021
  }
10825
11022
  throw error;
10826
11023
  }
@@ -10832,7 +11029,7 @@ var resolveWorkspaceFile = (cwdInput, requestedPath, options) => {
10832
11029
  throw new Error(`Schema transaction paths must name regular files: ${requestedPath}`);
10833
11030
  }
10834
11031
  }
10835
- return { absolute, relative: normalizeRelative(path14.relative(cwd, absolute)), exists: true };
11032
+ return { absolute, relative: normalizeRelative(path15.relative(cwd, absolute)), exists: true };
10836
11033
  };
10837
11034
  var sha256File = (absolute) => `sha256:${digest(fs7.readFileSync(absolute))}`;
10838
11035
 
@@ -10883,8 +11080,8 @@ var SchemaController = class {
10883
11080
  this.identity = identity;
10884
11081
  this.state = state;
10885
11082
  this.cwd = fs8.realpathSync(cwd);
10886
- this.#journalRoot = path15.join(mesh.root, "schema-transactions");
10887
- this.#lockPath = path15.join(this.#journalRoot, ".commit.lock");
11083
+ this.#journalRoot = path16.join(mesh.root, "schema-transactions");
11084
+ this.#lockPath = path16.join(this.#journalRoot, ".commit.lock");
10888
11085
  this.#recoverJournals();
10889
11086
  }
10890
11087
  #activeHypotheses = /* @__PURE__ */ new Map();
@@ -11083,7 +11280,7 @@ var SchemaController = class {
11083
11280
  this.#assertPayloadBound(input);
11084
11281
  const release = this.#acquireCommitLock();
11085
11282
  const transactionId = randomUUID4();
11086
- const journalPath = path15.join(this.#journalRoot, `${transactionId}.json`);
11283
+ const journalPath = path16.join(this.#journalRoot, `${transactionId}.json`);
11087
11284
  let journal;
11088
11285
  let consumed = false;
11089
11286
  let committed = false;
@@ -11564,7 +11761,7 @@ ${Date.now()}
11564
11761
  }
11565
11762
  for (const name of fs8.readdirSync(this.#journalRoot)) {
11566
11763
  if (!name.endsWith(".json")) continue;
11567
- const filePath = path15.join(this.#journalRoot, name);
11764
+ const filePath = path16.join(this.#journalRoot, name);
11568
11765
  try {
11569
11766
  const journal = JSON.parse(fs8.readFileSync(filePath, "utf8"));
11570
11767
  if (journal.format !== 1 || journal.status !== "applying" || !Array.isArray(journal.before)) continue;
@@ -11818,11 +12015,11 @@ var SchemaProvider = class {
11818
12015
 
11819
12016
  // src/state/store.ts
11820
12017
  import { createHash as createHash5 } from "node:crypto";
11821
- import path17 from "node:path";
12018
+ import path18 from "node:path";
11822
12019
 
11823
12020
  // src/state/complexity.ts
11824
12021
  import fs9 from "node:fs";
11825
- import path16 from "node:path";
12022
+ import path17 from "node:path";
11826
12023
  var isWordStart = (character) => character !== void 0 && (character >= "a" && character <= "z" || character >= "A" && character <= "Z" || character === "_" || character === "$");
11827
12024
  var isWordPart = (character) => isWordStart(character) || character !== void 0 && character >= "0" && character <= "9";
11828
12025
  var regularExpressionPrefixWords = /* @__PURE__ */ new Set([
@@ -12054,7 +12251,7 @@ var languageComplexities = [
12054
12251
  typeScriptJavaScriptComplexity
12055
12252
  ];
12056
12253
  var complexityForFile = (file, languages = languageComplexities) => {
12057
- const extension = path16.extname(file).toLowerCase();
12254
+ const extension = path17.extname(file).toLowerCase();
12058
12255
  return languages.find((language) => language.extensions.includes(extension));
12059
12256
  };
12060
12257
  var countFileComplexity = (file) => {
@@ -12945,7 +13142,7 @@ var StateStore = class {
12945
13142
  const files = [];
12946
13143
  let netDelta = 0;
12947
13144
  for (const file of this.normalizeComplexityFiles(requestedFiles, input.cwd)) {
12948
- const measured = countFileComplexity(path17.resolve(input.cwd, file));
13145
+ const measured = countFileComplexity(path18.resolve(input.cwd, file));
12949
13146
  if (!measured) {
12950
13147
  files.push({ file, supported: false });
12951
13148
  continue;
@@ -12972,7 +13169,7 @@ var StateStore = class {
12972
13169
  const updates = [];
12973
13170
  let netDelta = 0;
12974
13171
  for (const file of this.normalizeComplexityFiles(files, cwd)) {
12975
- const measured = countFileComplexity(path17.resolve(cwd, file));
13172
+ const measured = countFileComplexity(path18.resolve(cwd, file));
12976
13173
  if (!measured) {
12977
13174
  deltas.push({ file, supported: false });
12978
13175
  continue;
@@ -13022,11 +13219,11 @@ var StateStore = class {
13022
13219
  const normalized = /* @__PURE__ */ new Set();
13023
13220
  for (const file of files) {
13024
13221
  if (!file.trim()) continue;
13025
- const relative = path17.relative(cwd, path17.resolve(cwd, file));
13026
- if (relative === ".." || relative.startsWith(`..${path17.sep}`) || path17.isAbsolute(relative)) {
13222
+ const relative = path18.relative(cwd, path18.resolve(cwd, file));
13223
+ if (relative === ".." || relative.startsWith(`..${path18.sep}`) || path18.isAbsolute(relative)) {
13027
13224
  throw new Error(`State complexity file must be inside the project cwd: ${file}`);
13028
13225
  }
13029
- normalized.add(relative.split(path17.sep).join("/"));
13226
+ normalized.add(relative.split(path18.sep).join("/"));
13030
13227
  }
13031
13228
  return [...normalized];
13032
13229
  }
@@ -14020,7 +14217,7 @@ var FabricRuntimeState = class {
14020
14217
  this.#mainAgent = mainAgent;
14021
14218
  const projectRoot = process.env.OMP_FABRIC_PROJECT_ROOT ?? context.cwd;
14022
14219
  const configuredMeshRoot = this.#config.mesh.root;
14023
- const meshRoot = process.env.OMP_FABRIC_MESH_ROOT ?? (configuredMeshRoot ? path18.resolve(projectRoot, configuredMeshRoot) : path18.join(projectRoot, ".omp", "fabric", "mesh"));
14220
+ const meshRoot = process.env.OMP_FABRIC_MESH_ROOT ?? (configuredMeshRoot ? path19.resolve(projectRoot, configuredMeshRoot) : path19.join(projectRoot, ".omp", "fabric", "mesh"));
14024
14221
  this.#mesh = new MeshStore(
14025
14222
  meshRoot,
14026
14223
  this.#config.mesh.maxEventBytes,
@@ -14194,8 +14391,8 @@ var FabricRuntimeState = class {
14194
14391
  };
14195
14392
  const lineageAlive = (rootId) => this.#participants?.get(rootId) !== void 0;
14196
14393
  const actorRoots = {
14197
- project: path18.join(meshRoot, "actors"),
14198
- session: path18.join(meshRoot, "actors", fabricSessionId)
14394
+ project: path19.join(meshRoot, "actors"),
14395
+ session: path19.join(meshRoot, "actors", fabricSessionId)
14199
14396
  };
14200
14397
  const acquireActorCapabilityView = (requirements, signal) => this.#registry.acquireCapabilityView(requirements, {
14201
14398
  cwd: context.cwd,