poe-code 3.0.237 → 3.0.238

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
@@ -1492,11 +1492,11 @@ function mergeLayers(layers) {
1492
1492
  }
1493
1493
  return mergeObjectLayers(layers, []);
1494
1494
  }
1495
- function mergeObjectLayers(layers, path154) {
1495
+ function mergeObjectLayers(layers, path155) {
1496
1496
  const data = {};
1497
1497
  const sources = {};
1498
1498
  for (const key2 of collectKeys(layers)) {
1499
- const resolved = resolveKey(layers, key2, path154);
1499
+ const resolved = resolveKey(layers, key2, path155);
1500
1500
  if (resolved === void 0) {
1501
1501
  continue;
1502
1502
  }
@@ -1516,7 +1516,7 @@ function collectKeys(layers) {
1516
1516
  }
1517
1517
  return [...keys];
1518
1518
  }
1519
- function resolveKey(layers, key2, path154) {
1519
+ function resolveKey(layers, key2, path155) {
1520
1520
  let winningSource;
1521
1521
  let winningValue;
1522
1522
  const objectLayers = [];
@@ -1546,9 +1546,9 @@ function resolveKey(layers, key2, path154) {
1546
1546
  if (winningSource === void 0) {
1547
1547
  return void 0;
1548
1548
  }
1549
- const fullPath = buildPath(path154, key2);
1549
+ const fullPath = buildPath(path155, key2);
1550
1550
  if (isPlainObject(winningValue)) {
1551
- const merged = mergeObjectLayers(objectLayers, [...path154, key2]);
1551
+ const merged = mergeObjectLayers(objectLayers, [...path155, key2]);
1552
1552
  return {
1553
1553
  value: merged.data,
1554
1554
  sources: {
@@ -1573,8 +1573,8 @@ function isWinningCandidate(key2, value) {
1573
1573
  }
1574
1574
  return true;
1575
1575
  }
1576
- function buildPath(path154, key2) {
1577
- return [...path154, key2].map(escapePathSegment).join(".");
1576
+ function buildPath(path155, key2) {
1577
+ return [...path155, key2].map(escapePathSegment).join(".");
1578
1578
  }
1579
1579
  function escapePathSegment(segment) {
1580
1580
  return segment.replaceAll("\\", "\\\\").replaceAll(".", "\\.");
@@ -13231,16 +13231,16 @@ function getConfigFormat(pathOrFormat) {
13231
13231
  }
13232
13232
  return formatRegistry[formatName];
13233
13233
  }
13234
- function detectFormat2(path154) {
13235
- const ext = getExtension(path154);
13234
+ function detectFormat2(path155) {
13235
+ const ext = getExtension(path155);
13236
13236
  return extensionMap[ext];
13237
13237
  }
13238
- function getExtension(path154) {
13239
- const lastDot = path154.lastIndexOf(".");
13238
+ function getExtension(path155) {
13239
+ const lastDot = path155.lastIndexOf(".");
13240
13240
  if (lastDot === -1) {
13241
13241
  return "";
13242
13242
  }
13243
- return path154.slice(lastDot).toLowerCase();
13243
+ return path155.slice(lastDot).toLowerCase();
13244
13244
  }
13245
13245
  var formatRegistry, extensionMap;
13246
13246
  var init_formats = __esm({
@@ -14516,7 +14516,7 @@ function mergeScope(scope, baseScope, overrideScope) {
14516
14516
  ...Object.fromEntries(scopeEntries)
14517
14517
  };
14518
14518
  }
14519
- function mergeRuntimeScope(baseScope, overrideScope, path154 = []) {
14519
+ function mergeRuntimeScope(baseScope, overrideScope, path155 = []) {
14520
14520
  const merged = {};
14521
14521
  const keys = /* @__PURE__ */ new Set([...Object.keys(baseScope), ...Object.keys(overrideScope)]);
14522
14522
  for (const key2 of keys) {
@@ -14528,20 +14528,20 @@ function mergeRuntimeScope(baseScope, overrideScope, path154 = []) {
14528
14528
  }
14529
14529
  continue;
14530
14530
  }
14531
- if (isRuntimeConcatenativeArray([...path154, key2]) && Array.isArray(baseValue) && Array.isArray(overrideValue)) {
14531
+ if (isRuntimeConcatenativeArray([...path155, key2]) && Array.isArray(baseValue) && Array.isArray(overrideValue)) {
14532
14532
  merged[key2] = [...baseValue, ...overrideValue];
14533
14533
  continue;
14534
14534
  }
14535
14535
  if (isRecord4(baseValue) && isRecord4(overrideValue)) {
14536
- merged[key2] = mergeRuntimeScope(baseValue, overrideValue, [...path154, key2]);
14536
+ merged[key2] = mergeRuntimeScope(baseValue, overrideValue, [...path155, key2]);
14537
14537
  continue;
14538
14538
  }
14539
14539
  merged[key2] = overrideValue;
14540
14540
  }
14541
14541
  return merged;
14542
14542
  }
14543
- function isRuntimeConcatenativeArray(path154) {
14544
- return path154.join(".") === "mounts" || path154.join(".") === "runner.workspace.exclude";
14543
+ function isRuntimeConcatenativeArray(path155) {
14544
+ return path155.join(".") === "mounts" || path155.join(".") === "runner.workspace.exclude";
14545
14545
  }
14546
14546
  function isRecord4(value) {
14547
14547
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
@@ -15864,53 +15864,53 @@ import { createTwoFilesPatch } from "diff";
15864
15864
  import chalk from "chalk";
15865
15865
  function createDryRunFileSystem(base, recorder) {
15866
15866
  const proxy = {
15867
- async readFile(path154, encoding) {
15867
+ async readFile(path155, encoding) {
15868
15868
  if (encoding) {
15869
- return base.readFile(path154, encoding);
15869
+ return base.readFile(path155, encoding);
15870
15870
  }
15871
- return base.readFile(path154);
15871
+ return base.readFile(path155);
15872
15872
  },
15873
- async writeFile(path154, data, options) {
15874
- const previousContent = await tryReadText(base, path154);
15873
+ async writeFile(path155, data, options) {
15874
+ const previousContent = await tryReadText(base, path155);
15875
15875
  const nextContent = formatData(data, options?.encoding);
15876
15876
  recorder.record({
15877
15877
  type: "writeFile",
15878
- path: path154,
15878
+ path: path155,
15879
15879
  nextContent,
15880
15880
  previousContent
15881
15881
  });
15882
15882
  },
15883
- async symlink(target, path154) {
15884
- recorder.record({ type: "symlink", target, path: path154 });
15883
+ async symlink(target, path155) {
15884
+ recorder.record({ type: "symlink", target, path: path155 });
15885
15885
  },
15886
- async readlink(path154) {
15887
- return base.readlink(path154);
15886
+ async readlink(path155) {
15887
+ return base.readlink(path155);
15888
15888
  },
15889
- async realpath(path154) {
15890
- return base.realpath(path154);
15889
+ async realpath(path155) {
15890
+ return base.realpath(path155);
15891
15891
  },
15892
- async mkdir(path154, options) {
15893
- recorder.record({ type: "mkdir", path: path154, options });
15892
+ async mkdir(path155, options) {
15893
+ recorder.record({ type: "mkdir", path: path155, options });
15894
15894
  },
15895
- async stat(path154) {
15896
- return base.stat(path154);
15895
+ async stat(path155) {
15896
+ return base.stat(path155);
15897
15897
  },
15898
- async lstat(path154) {
15899
- return base.lstat(path154);
15898
+ async lstat(path155) {
15899
+ return base.lstat(path155);
15900
15900
  },
15901
15901
  async rename(from, to) {
15902
15902
  recorder.record({ type: "rename", from, to });
15903
15903
  },
15904
- async unlink(path154) {
15905
- recorder.record({ type: "unlink", path: path154 });
15904
+ async unlink(path155) {
15905
+ recorder.record({ type: "unlink", path: path155 });
15906
15906
  },
15907
- async readdir(path154) {
15908
- return base.readdir(path154);
15907
+ async readdir(path155) {
15908
+ return base.readdir(path155);
15909
15909
  }
15910
15910
  };
15911
15911
  if (typeof base.rm === "function") {
15912
- proxy.rm = async (path154, options) => {
15913
- recorder.record({ type: "rm", path: path154, options });
15912
+ proxy.rm = async (path155, options) => {
15913
+ recorder.record({ type: "rm", path: path155, options });
15914
15914
  };
15915
15915
  }
15916
15916
  if (typeof base.copyFile === "function") {
@@ -16012,8 +16012,8 @@ function describeWriteChange(previous, next) {
16012
16012
  }
16013
16013
  return "update";
16014
16014
  }
16015
- function renderWriteCommand(path154, change) {
16016
- const command = `cat > ${path154}`;
16015
+ function renderWriteCommand(path155, change) {
16016
+ const command = `cat > ${path155}`;
16017
16017
  if (change === "create") {
16018
16018
  return renderOperationCommand(command, chalk.green, "# create");
16019
16019
  }
@@ -16175,9 +16175,9 @@ function redactTomlLine(line) {
16175
16175
  }
16176
16176
  return line;
16177
16177
  }
16178
- async function tryReadText(base, path154) {
16178
+ async function tryReadText(base, path155) {
16179
16179
  try {
16180
- return await base.readFile(path154, "utf8");
16180
+ return await base.readFile(path155, "utf8");
16181
16181
  } catch (error3) {
16182
16182
  if (isNotFound(error3)) {
16183
16183
  return null;
@@ -24085,7 +24085,7 @@ function shellQuote4(value) {
24085
24085
  return `'${value.replaceAll("'", "'\\''")}'`;
24086
24086
  }
24087
24087
  function createE2bWorkspaceFileSystem(sandbox) {
24088
- async function readFile56(targetPath, encoding) {
24088
+ async function readFile57(targetPath, encoding) {
24089
24089
  const contents = Buffer.from(await sandbox.files.read(targetPath, { format: "bytes" }));
24090
24090
  return encoding === void 0 ? contents : contents.toString(encoding);
24091
24091
  }
@@ -24100,7 +24100,7 @@ function createE2bWorkspaceFileSystem(sandbox) {
24100
24100
  isDirectory: () => entry.type === "dir"
24101
24101
  }));
24102
24102
  },
24103
- readFile: readFile56,
24103
+ readFile: readFile57,
24104
24104
  async writeFile(targetPath, data) {
24105
24105
  await sandbox.files.write(targetPath, typeof data === "string" ? data : toArrayBuffer(data));
24106
24106
  },
@@ -27322,21 +27322,21 @@ async function* adaptClaude(lines) {
27322
27322
  if (blockType !== "tool_result") continue;
27323
27323
  const kind = toolKindsById.get(item.tool_use_id);
27324
27324
  toolKindsById.delete(item.tool_use_id);
27325
- let path154;
27325
+ let path155;
27326
27326
  if (typeof item.content === "string") {
27327
- path154 = item.content;
27327
+ path155 = item.content;
27328
27328
  } else {
27329
27329
  try {
27330
- path154 = JSON.stringify(item.content);
27330
+ path155 = JSON.stringify(item.content);
27331
27331
  } catch {
27332
- path154 = String(item.content);
27332
+ path155 = String(item.content);
27333
27333
  }
27334
27334
  }
27335
27335
  yield {
27336
27336
  event: "tool_complete",
27337
27337
  id: item.tool_use_id,
27338
27338
  kind,
27339
- path: path154
27339
+ path: path155
27340
27340
  };
27341
27341
  }
27342
27342
  }
@@ -27459,10 +27459,10 @@ async function* adaptCodex(lines) {
27459
27459
  const kindFromStart = toolKindById.get(item.id);
27460
27460
  const kind = kindFromStart ?? (itemType === "command_execution" ? "exec" : itemType === "file_edit" ? "edit" : "other");
27461
27461
  const titleFromEvent = isNonEmptyString(item.path) ? item.path : itemType === "mcp_tool_call" ? `${isNonEmptyString(item.server) ? item.server : "unknown"}.${isNonEmptyString(item.tool) ? item.tool : "unknown"}` : void 0;
27462
- const path154 = titleFromEvent ?? toolTitleById.get(item.id) ?? "";
27462
+ const path155 = titleFromEvent ?? toolTitleById.get(item.id) ?? "";
27463
27463
  toolTitleById.delete(item.id);
27464
27464
  toolKindById.delete(item.id);
27465
- yield { event: "tool_complete", id: item.id, kind, path: path154 };
27465
+ yield { event: "tool_complete", id: item.id, kind, path: path155 };
27466
27466
  }
27467
27467
  }
27468
27468
  }
@@ -29688,8 +29688,8 @@ function resourceNotFound(resource) {
29688
29688
  `Resource not found: ${resource}`
29689
29689
  );
29690
29690
  }
29691
- function assertAbsolutePath(path154) {
29692
- if (!isAbsolute(path154)) {
29691
+ function assertAbsolutePath(path155) {
29692
+ if (!isAbsolute(path155)) {
29693
29693
  throw invalidParams('"path" must be an absolute path');
29694
29694
  }
29695
29695
  }
@@ -30925,7 +30925,7 @@ function updateSessionFromEvent(ctx, event, toolCallsById) {
30925
30925
  }
30926
30926
  const id = readString2(event.id);
30927
30927
  const kind = readString2(event.kind);
30928
- const path154 = readString2(event.path);
30928
+ const path155 = readString2(event.path);
30929
30929
  let toolCall = id ? toolCallsById.get(id) : void 0;
30930
30930
  if (!toolCall) {
30931
30931
  toolCall = {};
@@ -30940,8 +30940,8 @@ function updateSessionFromEvent(ctx, event, toolCallsById) {
30940
30940
  if (kind) {
30941
30941
  toolCall.kind = kind;
30942
30942
  }
30943
- if (path154) {
30944
- toolCall.path = path154;
30943
+ if (path155) {
30944
+ toolCall.path = path155;
30945
30945
  }
30946
30946
  }
30947
30947
  var sessionCapture;
@@ -43204,17 +43204,17 @@ function validate(schema2, value) {
43204
43204
  }
43205
43205
  return { ok: true, value: result.present ? result.value : void 0 };
43206
43206
  }
43207
- function walkSchema(schema2, value, path154, state) {
43207
+ function walkSchema(schema2, value, path155, state) {
43208
43208
  if (schema2.kind === "optional") {
43209
- return walkOptional(schema2, value, path154, state);
43209
+ return walkOptional(schema2, value, path155, state);
43210
43210
  }
43211
43211
  if (value === missingValue) {
43212
43212
  addIssue(
43213
43213
  state,
43214
- path154,
43214
+ path155,
43215
43215
  expectedFor(schema2),
43216
43216
  "missing",
43217
- `Expected ${expectedFor(schema2)} at ${formatPath(path154)}`
43217
+ `Expected ${expectedFor(schema2)} at ${formatPath(path155)}`
43218
43218
  );
43219
43219
  return { present: false };
43220
43220
  }
@@ -43223,149 +43223,149 @@ function walkSchema(schema2, value, path154, state) {
43223
43223
  }
43224
43224
  switch (schema2.kind) {
43225
43225
  case "string":
43226
- return walkString(schema2, value, path154, state);
43226
+ return walkString(schema2, value, path155, state);
43227
43227
  case "number":
43228
- return walkNumber(schema2, value, path154, state);
43228
+ return walkNumber(schema2, value, path155, state);
43229
43229
  case "boolean":
43230
- return walkBoolean(value, path154, state);
43230
+ return walkBoolean(value, path155, state);
43231
43231
  case "enum":
43232
- return walkEnum(schema2, value, path154, state);
43232
+ return walkEnum(schema2, value, path155, state);
43233
43233
  case "array":
43234
- return walkArray(schema2, value, path154, state);
43234
+ return walkArray(schema2, value, path155, state);
43235
43235
  case "object":
43236
- return walkObject(schema2, value, path154, state);
43236
+ return walkObject(schema2, value, path155, state);
43237
43237
  case "oneOf":
43238
- return walkOneOf(schema2, value, path154, state);
43238
+ return walkOneOf(schema2, value, path155, state);
43239
43239
  case "union":
43240
- return walkUnion(schema2, value, path154, state);
43240
+ return walkUnion(schema2, value, path155, state);
43241
43241
  case "record":
43242
- return walkRecord(schema2, value, path154, state);
43242
+ return walkRecord(schema2, value, path155, state);
43243
43243
  case "json":
43244
- return walkJson(value, path154, state);
43244
+ return walkJson(value, path155, state);
43245
43245
  }
43246
43246
  }
43247
- function walkOptional(schema2, value, path154, state) {
43247
+ function walkOptional(schema2, value, path155, state) {
43248
43248
  if (value === missingValue || value === void 0) {
43249
43249
  const defaultValue = getDefault(schema2.inner);
43250
43250
  if (defaultValue.present) {
43251
- return walkSchema(schema2.inner, cloneDefault(defaultValue.value), path154, state);
43251
+ return walkSchema(schema2.inner, cloneDefault(defaultValue.value), path155, state);
43252
43252
  }
43253
43253
  return { present: false };
43254
43254
  }
43255
- return walkSchema(schema2.inner, value, path154, state);
43255
+ return walkSchema(schema2.inner, value, path155, state);
43256
43256
  }
43257
- function walkString(schema2, value, path154, state) {
43257
+ function walkString(schema2, value, path155, state) {
43258
43258
  if (typeof value !== "string") {
43259
- addExpectedIssue(state, path154, "string", value);
43259
+ addExpectedIssue(state, path155, "string", value);
43260
43260
  return { present: true, value };
43261
43261
  }
43262
43262
  if (schema2.minLength !== void 0 && value.length < schema2.minLength) {
43263
43263
  const expected = `string with length at least ${schema2.minLength}`;
43264
43264
  addIssue(
43265
43265
  state,
43266
- path154,
43266
+ path155,
43267
43267
  expected,
43268
43268
  `string with length ${value.length}`,
43269
- `Expected ${expected} at ${formatPath(path154)}`
43269
+ `Expected ${expected} at ${formatPath(path155)}`
43270
43270
  );
43271
43271
  }
43272
43272
  if (schema2.maxLength !== void 0 && value.length > schema2.maxLength) {
43273
43273
  const expected = `string with length at most ${schema2.maxLength}`;
43274
43274
  addIssue(
43275
43275
  state,
43276
- path154,
43276
+ path155,
43277
43277
  expected,
43278
43278
  `string with length ${value.length}`,
43279
- `Expected ${expected} at ${formatPath(path154)}`
43279
+ `Expected ${expected} at ${formatPath(path155)}`
43280
43280
  );
43281
43281
  }
43282
43282
  if (schema2.pattern !== void 0) {
43283
43283
  const pattern = compilePattern(schema2.pattern);
43284
43284
  if (pattern === void 0 || !pattern.test(value)) {
43285
43285
  const expected = `string matching pattern ${schema2.pattern}`;
43286
- addIssue(state, path154, expected, value, `Expected ${expected} at ${formatPath(path154)}`);
43286
+ addIssue(state, path155, expected, value, `Expected ${expected} at ${formatPath(path155)}`);
43287
43287
  }
43288
43288
  }
43289
43289
  return { present: true, value };
43290
43290
  }
43291
- function walkNumber(schema2, value, path154, state) {
43291
+ function walkNumber(schema2, value, path155, state) {
43292
43292
  if (typeof value !== "number" || !Number.isFinite(value)) {
43293
- addExpectedIssue(state, path154, schema2.jsonType === "integer" ? "integer" : "number", value);
43293
+ addExpectedIssue(state, path155, schema2.jsonType === "integer" ? "integer" : "number", value);
43294
43294
  return { present: true, value };
43295
43295
  }
43296
43296
  if (schema2.jsonType === "integer" && !Number.isInteger(value)) {
43297
- addExpectedIssue(state, path154, "integer", value);
43297
+ addExpectedIssue(state, path155, "integer", value);
43298
43298
  }
43299
43299
  if (schema2.minimum !== void 0 && value < schema2.minimum) {
43300
43300
  const expected = `number greater than or equal to ${schema2.minimum}`;
43301
- addIssue(state, path154, expected, String(value), `Expected ${expected} at ${formatPath(path154)}`);
43301
+ addIssue(state, path155, expected, String(value), `Expected ${expected} at ${formatPath(path155)}`);
43302
43302
  }
43303
43303
  if (schema2.maximum !== void 0 && value > schema2.maximum) {
43304
43304
  const expected = `number less than or equal to ${schema2.maximum}`;
43305
- addIssue(state, path154, expected, String(value), `Expected ${expected} at ${formatPath(path154)}`);
43305
+ addIssue(state, path155, expected, String(value), `Expected ${expected} at ${formatPath(path155)}`);
43306
43306
  }
43307
43307
  return { present: true, value };
43308
43308
  }
43309
- function walkBoolean(value, path154, state) {
43309
+ function walkBoolean(value, path155, state) {
43310
43310
  if (typeof value !== "boolean") {
43311
- addExpectedIssue(state, path154, "boolean", value);
43311
+ addExpectedIssue(state, path155, "boolean", value);
43312
43312
  }
43313
43313
  return { present: true, value };
43314
43314
  }
43315
- function walkEnum(schema2, value, path154, state) {
43315
+ function walkEnum(schema2, value, path155, state) {
43316
43316
  if (!schema2.values.includes(value)) {
43317
43317
  const expected = `one of ${schema2.values.join(", ")}`;
43318
43318
  addIssue(
43319
43319
  state,
43320
- path154,
43320
+ path155,
43321
43321
  expected,
43322
43322
  receivedValue(value),
43323
- `Expected ${expected} at ${formatPath(path154)}`
43323
+ `Expected ${expected} at ${formatPath(path155)}`
43324
43324
  );
43325
43325
  }
43326
43326
  return { present: true, value };
43327
43327
  }
43328
- function walkArray(schema2, value, path154, state) {
43328
+ function walkArray(schema2, value, path155, state) {
43329
43329
  if (!Array.isArray(value)) {
43330
- addExpectedIssue(state, path154, "array", value);
43330
+ addExpectedIssue(state, path155, "array", value);
43331
43331
  return { present: true, value };
43332
43332
  }
43333
43333
  if (schema2.minItems !== void 0 && value.length < schema2.minItems) {
43334
43334
  const expected = `array with at least ${schema2.minItems} items`;
43335
43335
  addIssue(
43336
43336
  state,
43337
- path154,
43337
+ path155,
43338
43338
  expected,
43339
43339
  `array with ${value.length} items`,
43340
- `Expected ${expected} at ${formatPath(path154)}`
43340
+ `Expected ${expected} at ${formatPath(path155)}`
43341
43341
  );
43342
43342
  }
43343
43343
  if (schema2.maxItems !== void 0 && value.length > schema2.maxItems) {
43344
43344
  const expected = `array with at most ${schema2.maxItems} items`;
43345
43345
  addIssue(
43346
43346
  state,
43347
- path154,
43347
+ path155,
43348
43348
  expected,
43349
43349
  `array with ${value.length} items`,
43350
- `Expected ${expected} at ${formatPath(path154)}`
43350
+ `Expected ${expected} at ${formatPath(path155)}`
43351
43351
  );
43352
43352
  }
43353
43353
  const nextValue = value.map((item, index) => {
43354
- const result = walkSchema(schema2.item, item, [...path154, String(index)], state);
43354
+ const result = walkSchema(schema2.item, item, [...path155, String(index)], state);
43355
43355
  return result.present ? result.value : item;
43356
43356
  });
43357
43357
  return { present: true, value: nextValue };
43358
43358
  }
43359
- function walkObject(schema2, value, path154, state, injectedProperties = {}) {
43359
+ function walkObject(schema2, value, path155, state, injectedProperties = {}) {
43360
43360
  if (!isPlainRecord(value)) {
43361
- addExpectedIssue(state, path154, "object", value);
43361
+ addExpectedIssue(state, path155, "object", value);
43362
43362
  return { present: true, value };
43363
43363
  }
43364
43364
  const nextValue = {};
43365
43365
  const allowedKeys = /* @__PURE__ */ new Set([...Object.keys(schema2.shape), ...Object.keys(injectedProperties)]);
43366
43366
  for (const [key2, propertySchema] of Object.entries(schema2.shape)) {
43367
43367
  const propertyValue = Object.hasOwn(value, key2) ? value[key2] : missingValue;
43368
- const result = walkSchema(propertySchema, propertyValue, [...path154, key2], state);
43368
+ const result = walkSchema(propertySchema, propertyValue, [...path155, key2], state);
43369
43369
  if (result.present) {
43370
43370
  setOwnValue2(nextValue, key2, result.value);
43371
43371
  }
@@ -43384,18 +43384,18 @@ function walkObject(schema2, value, path154, state, injectedProperties = {}) {
43384
43384
  if (schema2.additionalProperties === true) {
43385
43385
  setOwnValue2(nextValue, key2, propertyValue);
43386
43386
  } else {
43387
- addUnexpectedPropertyIssue(state, [...path154, key2]);
43387
+ addUnexpectedPropertyIssue(state, [...path155, key2]);
43388
43388
  }
43389
43389
  }
43390
43390
  return { present: true, value: nextValue };
43391
43391
  }
43392
- function walkOneOf(schema2, value, path154, state) {
43392
+ function walkOneOf(schema2, value, path155, state) {
43393
43393
  if (!isPlainRecord(value)) {
43394
- addExpectedIssue(state, path154, "object", value);
43394
+ addExpectedIssue(state, path155, "object", value);
43395
43395
  return { present: true, value };
43396
43396
  }
43397
43397
  const discriminatorValue = value[schema2.discriminator];
43398
- const discriminatorPath = [...path154, schema2.discriminator];
43398
+ const discriminatorPath = [...path155, schema2.discriminator];
43399
43399
  const branchValues = Object.keys(schema2.branches);
43400
43400
  const expected = `one of ${branchValues.join(", ")}`;
43401
43401
  if (!Object.hasOwn(value, schema2.discriminator)) {
@@ -43404,7 +43404,7 @@ function walkOneOf(schema2, value, path154, state) {
43404
43404
  discriminatorPath,
43405
43405
  expected,
43406
43406
  "missing",
43407
- `Missing discriminator "${schema2.discriminator}" at ${formatPath(path154)}. Expected one of: ${branchValues.join(", ")}.`
43407
+ `Missing discriminator "${schema2.discriminator}" at ${formatPath(path155)}. Expected one of: ${branchValues.join(", ")}.`
43408
43408
  );
43409
43409
  return { present: true, value };
43410
43410
  }
@@ -43418,21 +43418,21 @@ function walkOneOf(schema2, value, path154, state) {
43418
43418
  );
43419
43419
  return { present: true, value };
43420
43420
  }
43421
- return walkObject(schema2.branches[discriminatorValue], value, path154, state, {
43421
+ return walkObject(schema2.branches[discriminatorValue], value, path155, state, {
43422
43422
  [schema2.discriminator]: discriminatorValue
43423
43423
  });
43424
43424
  }
43425
- function walkUnion(schema2, value, path154, state) {
43425
+ function walkUnion(schema2, value, path155, state) {
43426
43426
  if (isPlainRecord(value)) {
43427
43427
  const candidateBranches = schema2.branches.filter((branch) => hasRequiredKeys(branch, value));
43428
43428
  if (candidateBranches.length === 1) {
43429
- return walkObject(candidateBranches[0], value, path154, state);
43429
+ return walkObject(candidateBranches[0], value, path155, state);
43430
43430
  }
43431
43431
  }
43432
43432
  const matches = [];
43433
43433
  for (const branch of schema2.branches) {
43434
43434
  const branchState = { issues: [] };
43435
- const result = walkObject(branch, value, path154, branchState);
43435
+ const result = walkObject(branch, value, path155, branchState);
43436
43436
  if (branchState.issues.length === 0 && result.present) {
43437
43437
  matches.push({ fingerprint: getRequiredKeyFingerprint(branch), value: result.value });
43438
43438
  }
@@ -43444,19 +43444,19 @@ function walkUnion(schema2, value, path154, state) {
43444
43444
  const branchDescriptions = schema2.branches.map((branch) => getRequiredKeyFingerprint(branch));
43445
43445
  addIssueWithMessage(
43446
43446
  state,
43447
- path154,
43447
+ path155,
43448
43448
  "exactly one union branch",
43449
43449
  "0 matching branches",
43450
- `No union branch matched at ${formatPath(path154)}. Tried ${schema2.branches.length} branches. Expected one of: ${branchDescriptions.join(" | ")}.`
43450
+ `No union branch matched at ${formatPath(path155)}. Tried ${schema2.branches.length} branches. Expected one of: ${branchDescriptions.join(" | ")}.`
43451
43451
  );
43452
43452
  return { present: true, value };
43453
43453
  }
43454
43454
  addIssueWithMessage(
43455
43455
  state,
43456
- path154,
43456
+ path155,
43457
43457
  "exactly one union branch",
43458
43458
  `${matches.length} matching branches`,
43459
- `Expected exactly one union branch at ${formatPath(path154)}, but matched more than one branch: ${matches.map((match) => match.fingerprint).join(" | ")}`
43459
+ `Expected exactly one union branch at ${formatPath(path155)}, but matched more than one branch: ${matches.map((match) => match.fingerprint).join(" | ")}`
43460
43460
  );
43461
43461
  return { present: true, value };
43462
43462
  }
@@ -43468,25 +43468,25 @@ function hasRequiredKeys(schema2, value) {
43468
43468
  }
43469
43469
  return true;
43470
43470
  }
43471
- function walkRecord(schema2, value, path154, state) {
43471
+ function walkRecord(schema2, value, path155, state) {
43472
43472
  if (!isPlainRecord(value)) {
43473
- addExpectedIssue(state, path154, "object", value);
43473
+ addExpectedIssue(state, path155, "object", value);
43474
43474
  return { present: true, value };
43475
43475
  }
43476
43476
  const nextValue = {};
43477
43477
  for (const [key2, propertyValue] of Object.entries(value)) {
43478
- const result = walkSchema(schema2.value, propertyValue, [...path154, key2], state);
43478
+ const result = walkSchema(schema2.value, propertyValue, [...path155, key2], state);
43479
43479
  if (result.present) {
43480
43480
  setOwnValue2(nextValue, key2, result.value);
43481
43481
  }
43482
43482
  }
43483
43483
  return { present: true, value: nextValue };
43484
43484
  }
43485
- function walkJson(value, path154, state) {
43485
+ function walkJson(value, path155, state) {
43486
43486
  if (isJsonValue(value)) {
43487
43487
  return { present: true, value };
43488
43488
  }
43489
- addExpectedIssue(state, path154, "JSON value", value);
43489
+ addExpectedIssue(state, path155, "JSON value", value);
43490
43490
  return { present: true, value };
43491
43491
  }
43492
43492
  function getDefault(schema2) {
@@ -43564,45 +43564,45 @@ function expectedFor(schema2) {
43564
43564
  return expectedFor(schema2.inner);
43565
43565
  }
43566
43566
  }
43567
- function addExpectedIssue(state, path154, expected, value) {
43567
+ function addExpectedIssue(state, path155, expected, value) {
43568
43568
  addIssue(
43569
43569
  state,
43570
- path154,
43570
+ path155,
43571
43571
  expected,
43572
43572
  receivedType(value),
43573
- `Expected ${expected} at ${formatPath(path154)}`
43573
+ `Expected ${expected} at ${formatPath(path155)}`
43574
43574
  );
43575
43575
  }
43576
- function addUnexpectedPropertyIssue(state, path154) {
43576
+ function addUnexpectedPropertyIssue(state, path155) {
43577
43577
  addIssue(
43578
43578
  state,
43579
- path154,
43579
+ path155,
43580
43580
  "no additional properties",
43581
43581
  "unknown property",
43582
- `Unexpected property ${formatPath(path154)}`
43582
+ `Unexpected property ${formatPath(path155)}`
43583
43583
  );
43584
43584
  }
43585
- function addIssue(state, path154, expected, received, _message) {
43585
+ function addIssue(state, path155, expected, received, _message) {
43586
43586
  state.issues.push({
43587
- path: path154,
43587
+ path: path155,
43588
43588
  expected,
43589
43589
  received,
43590
- message: formatIssueMessage(expected, path154, received)
43590
+ message: formatIssueMessage(expected, path155, received)
43591
43591
  });
43592
43592
  }
43593
- function addIssueWithMessage(state, path154, expected, received, message2) {
43593
+ function addIssueWithMessage(state, path155, expected, received, message2) {
43594
43594
  state.issues.push({
43595
- path: path154,
43595
+ path: path155,
43596
43596
  expected,
43597
43597
  received,
43598
43598
  message: message2
43599
43599
  });
43600
43600
  }
43601
- function formatIssueMessage(expected, path154, received) {
43602
- return `Expected ${expected} at ${formatPath(path154)}, got ${received}`;
43601
+ function formatIssueMessage(expected, path155, received) {
43602
+ return `Expected ${expected} at ${formatPath(path155)}, got ${received}`;
43603
43603
  }
43604
- function formatPath(path154) {
43605
- return path154.length === 0 ? "value" : path154.join(".");
43604
+ function formatPath(path155) {
43605
+ return path155.length === 0 ? "value" : path155.join(".");
43606
43606
  }
43607
43607
  function compilePattern(pattern) {
43608
43608
  try {
@@ -47714,10 +47714,10 @@ function parseReviewDiff(diffText) {
47714
47714
  finalizeFile();
47715
47715
  const paths = parseDiffGitPaths(line);
47716
47716
  const previousPath = paths?.previousPath ?? "";
47717
- const path154 = paths?.path ?? previousPath;
47717
+ const path155 = paths?.path ?? previousPath;
47718
47718
  currentFile = {
47719
- path: path154,
47720
- previousPath: previousPath && previousPath !== path154 ? previousPath : null,
47719
+ path: path155,
47720
+ previousPath: previousPath && previousPath !== path155 ? previousPath : null,
47721
47721
  status: "modified",
47722
47722
  hunks: [],
47723
47723
  reviewableLines: [],
@@ -47745,9 +47745,9 @@ function parseReviewDiff(diffText) {
47745
47745
  continue;
47746
47746
  }
47747
47747
  if (line.startsWith("+++ ")) {
47748
- const path154 = normalizeDiffPath(line.slice(4).trim());
47749
- if (path154) {
47750
- currentFile.path = path154;
47748
+ const path155 = normalizeDiffPath(line.slice(4).trim());
47749
+ if (path155) {
47750
+ currentFile.path = path155;
47751
47751
  }
47752
47752
  continue;
47753
47753
  }
@@ -47802,20 +47802,20 @@ function validateInlineComments(comments, context) {
47802
47802
  const accepted = [];
47803
47803
  const seen = /* @__PURE__ */ new Set();
47804
47804
  for (const comment of comments) {
47805
- const path154 = comment.path.trim();
47805
+ const path155 = comment.path.trim();
47806
47806
  const body = comment.body.trim();
47807
- if (!path154 || !body || !Number.isInteger(comment.line) || comment.line < 1) {
47807
+ if (!path155 || !body || !Number.isInteger(comment.line) || comment.line < 1) {
47808
47808
  throw new Error("Inline review comments require path, positive line, and body.");
47809
47809
  }
47810
- if (!context.reviewableLinesByPath.get(path154)?.has(comment.line)) {
47810
+ if (!context.reviewableLinesByPath.get(path155)?.has(comment.line)) {
47811
47811
  throw new Error(
47812
- `Inline comment target ${path154}:${comment.line} is not a valid right-side diff target.`
47812
+ `Inline comment target ${path155}:${comment.line} is not a valid right-side diff target.`
47813
47813
  );
47814
47814
  }
47815
- const key2 = `${path154}\0${comment.line}\0${body}`;
47815
+ const key2 = `${path155}\0${comment.line}\0${body}`;
47816
47816
  if (!seen.has(key2)) {
47817
47817
  seen.add(key2);
47818
- accepted.push({ path: path154, line: comment.line, body });
47818
+ accepted.push({ path: path155, line: comment.line, body });
47819
47819
  }
47820
47820
  }
47821
47821
  accepted.sort((left, right) => {
@@ -48586,10 +48586,10 @@ var init_review_history = __esm({
48586
48586
  kind,
48587
48587
  body
48588
48588
  };
48589
- const path154 = text5(record, "path");
48589
+ const path155 = text5(record, "path");
48590
48590
  const line = integer(record, "line") ?? integer(record, "original_line");
48591
48591
  const diffHunk = text5(record, "diff_hunk");
48592
- if (path154) normalized.path = path154;
48592
+ if (path155) normalized.path = path155;
48593
48593
  if (line !== null) normalized.line = line;
48594
48594
  if (diffHunk) normalized.diffHunk = diffHunk;
48595
48595
  return normalized;
@@ -49533,9 +49533,9 @@ function containedPath(directory, name) {
49533
49533
  }
49534
49534
  return target;
49535
49535
  }
49536
- async function pathExists7(path154) {
49536
+ async function pathExists7(path155) {
49537
49537
  try {
49538
- await access(path154);
49538
+ await access(path155);
49539
49539
  return true;
49540
49540
  } catch (error3) {
49541
49541
  if (isMissingFileError2(error3)) {
@@ -52182,13 +52182,13 @@ function convertJsonSchema(schema2) {
52182
52182
  }
52183
52183
  return convertSchema(schema2, schema2, []);
52184
52184
  }
52185
- function convertSchema(schema2, root, path154) {
52186
- const resolvedSchema = resolveReferencedSchema(schema2, root, path154);
52185
+ function convertSchema(schema2, root, path155) {
52186
+ const resolvedSchema = resolveReferencedSchema(schema2, root, path155);
52187
52187
  const normalizedSchema = normalizeNullability(resolvedSchema);
52188
52188
  const composition = getComposition(normalizedSchema.schema);
52189
52189
  if (Array.isArray(normalizedSchema.schema.type)) {
52190
52190
  throw new Error(
52191
- `JSON Schema "${formatJsonSchemaPath(path154)}" has an unsupported type "${formatJsonSchemaType(
52191
+ `JSON Schema "${formatJsonSchemaPath(path155)}" has an unsupported type "${formatJsonSchemaType(
52192
52192
  normalizedSchema.schema.type
52193
52193
  )}". Supported: string, number, integer, boolean, array, object.`
52194
52194
  );
@@ -52200,13 +52200,13 @@ function convertSchema(schema2, root, path154) {
52200
52200
  return convertEnumSchema(resolvedSchema, normalizedSchema.nullable);
52201
52201
  }
52202
52202
  if (composition !== void 0) {
52203
- return convertCompositionSchema(normalizedSchema.schema, root, normalizedSchema.nullable, path154);
52203
+ return convertCompositionSchema(normalizedSchema.schema, root, normalizedSchema.nullable, path155);
52204
52204
  }
52205
52205
  if (isRecordSchema(normalizedSchema.schema)) {
52206
52206
  return applyMetadata(
52207
52207
  S.Record(
52208
52208
  convertSchema(normalizedSchema.schema.additionalProperties, root, [
52209
- ...path154,
52209
+ ...path155,
52210
52210
  "additionalProperties"
52211
52211
  ])
52212
52212
  ),
@@ -52255,12 +52255,12 @@ function convertSchema(schema2, root, path154) {
52255
52255
  if (normalizedSchema.schema.items === void 0) {
52256
52256
  throw new Error(
52257
52257
  `JSON Schema "${formatJsonSchemaPath(
52258
- path154
52258
+ path155
52259
52259
  )}" is an array but is missing the "items" field. Add "items": { ... } to declare the element type.`
52260
52260
  );
52261
52261
  }
52262
52262
  return S.Array(
52263
- convertSchema(normalizedSchema.schema.items, root, [...path154, "items"]),
52263
+ convertSchema(normalizedSchema.schema.items, root, [...path155, "items"]),
52264
52264
  createCommonOptions(
52265
52265
  normalizedSchema.schema,
52266
52266
  normalizedSchema.nullable,
@@ -52270,7 +52270,7 @@ function convertSchema(schema2, root, path154) {
52270
52270
  case "object":
52271
52271
  return convertObjectSchema(normalizedSchema.schema, root, {
52272
52272
  nullable: normalizedSchema.nullable,
52273
- path: path154
52273
+ path: path155
52274
52274
  });
52275
52275
  case "null":
52276
52276
  return applyMetadata(S.Json(), normalizedSchema.schema, {
@@ -52285,12 +52285,12 @@ function convertSchema(schema2, root, path154) {
52285
52285
  }
52286
52286
  throw new Error(
52287
52287
  `JSON Schema "${formatJsonSchemaPath(
52288
- path154
52288
+ path155
52289
52289
  )}" must declare one of: "type", "enum", "const", "oneOf", "anyOf", or "allOf".`
52290
52290
  );
52291
52291
  }
52292
52292
  throw new Error(
52293
- `JSON Schema "${formatJsonSchemaPath(path154)}" has an unsupported type "${formatJsonSchemaType(
52293
+ `JSON Schema "${formatJsonSchemaPath(path155)}" has an unsupported type "${formatJsonSchemaType(
52294
52294
  normalizedSchema.schema.type
52295
52295
  )}". Supported: string, number, integer, boolean, array, object.`
52296
52296
  );
@@ -52334,21 +52334,21 @@ function convertEnumSchema(schema2, nullable) {
52334
52334
  )
52335
52335
  });
52336
52336
  }
52337
- function convertCompositionSchema(schema2, root, nullable, path154) {
52337
+ function convertCompositionSchema(schema2, root, nullable, path155) {
52338
52338
  const composition = getComposition(schema2);
52339
52339
  const branchSchemas = composition?.branches ?? [];
52340
52340
  const keyword = composition?.keyword ?? "oneOf";
52341
52341
  const branches = branchSchemas.map(
52342
- (branch, index) => resolveReferencedSchema(branch, root, [...path154, keyword, String(index)])
52342
+ (branch, index) => resolveReferencedSchema(branch, root, [...path155, keyword, String(index)])
52343
52343
  );
52344
- const discriminator = findDiscriminator(branches, root, path154);
52344
+ const discriminator = findDiscriminator(branches, root, path155);
52345
52345
  if (discriminator !== void 0) {
52346
52346
  const convertedBranches = Object.fromEntries(
52347
52347
  branches.map((branch, index) => [
52348
52348
  getDiscriminatorLiteral(branch, discriminator, root),
52349
52349
  convertObjectSchema(branch, root, {
52350
52350
  omitProperty: discriminator,
52351
- path: [...path154, keyword, String(index)]
52351
+ path: [...path155, keyword, String(index)]
52352
52352
  })
52353
52353
  ])
52354
52354
  );
@@ -52367,7 +52367,7 @@ function convertCompositionSchema(schema2, root, nullable, path154) {
52367
52367
  S.Union(
52368
52368
  branches.map(
52369
52369
  (branch, index) => convertObjectSchema(branch, root, {
52370
- path: [...path154, keyword, String(index)]
52370
+ path: [...path155, keyword, String(index)]
52371
52371
  })
52372
52372
  )
52373
52373
  ),
@@ -52469,11 +52469,11 @@ function getComposition(schema2) {
52469
52469
  }
52470
52470
  return void 0;
52471
52471
  }
52472
- function formatJsonSchemaPath(path154) {
52473
- if (path154.length === 0) {
52472
+ function formatJsonSchemaPath(path155) {
52473
+ if (path155.length === 0) {
52474
52474
  return "#";
52475
52475
  }
52476
- return `#/${path154.map(escapeJsonPointerSegment).join("/")}`;
52476
+ return `#/${path155.map(escapeJsonPointerSegment).join("/")}`;
52477
52477
  }
52478
52478
  function formatJsonSchemaType(type2) {
52479
52479
  return Array.isArray(type2) ? JSON.stringify(type2) : String(type2);
@@ -52489,11 +52489,11 @@ function isRecordSchema(schema2) {
52489
52489
  const propertyKeys = Object.keys(schema2.properties ?? {});
52490
52490
  return schema2.type === "object" && propertyKeys.length === 0 && typeof schema2.additionalProperties === "object" && schema2.additionalProperties !== null;
52491
52491
  }
52492
- function findDiscriminator(branches, root, path154) {
52492
+ function findDiscriminator(branches, root, path155) {
52493
52493
  const [firstBranch] = branches;
52494
52494
  if (firstBranch === void 0) {
52495
52495
  throw new Error(
52496
- `JSON Schema "${formatJsonSchemaPath(path154)}" uses oneOf/anyOf/allOf but has no branches.`
52496
+ `JSON Schema "${formatJsonSchemaPath(path155)}" uses oneOf/anyOf/allOf but has no branches.`
52497
52497
  );
52498
52498
  }
52499
52499
  const candidateKeys = Object.keys(firstBranch.properties ?? {});
@@ -52533,19 +52533,19 @@ function getDiscriminatorLiteral(branch, key2, root) {
52533
52533
  }
52534
52534
  return void 0;
52535
52535
  }
52536
- function resolveReferencedSchema(schema2, root, path154) {
52536
+ function resolveReferencedSchema(schema2, root, path155) {
52537
52537
  if (schema2.$ref === void 0) {
52538
52538
  return schema2;
52539
52539
  }
52540
52540
  const resolvedTarget = resolveLocalRef(root, schema2.$ref);
52541
52541
  if (resolvedTarget === void 0) {
52542
52542
  throw new Error(
52543
- `JSON Schema "${formatJsonSchemaPath(path154)}" uses "$ref": ${schema2.$ref}. toolcraft only supports internal refs like "#/components/schemas/Foo".`
52543
+ `JSON Schema "${formatJsonSchemaPath(path155)}" uses "$ref": ${schema2.$ref}. toolcraft only supports internal refs like "#/components/schemas/Foo".`
52544
52544
  );
52545
52545
  }
52546
52546
  const { $ref: ignoredRef, ...siblingKeywords } = schema2;
52547
52547
  void ignoredRef;
52548
- const resolvedSchema = resolveReferencedSchema(resolvedTarget, root, path154);
52548
+ const resolvedSchema = resolveReferencedSchema(resolvedTarget, root, path155);
52549
52549
  if (Object.keys(siblingKeywords).length === 0) {
52550
52550
  return resolvedSchema;
52551
52551
  }
@@ -52569,9 +52569,9 @@ function mergeJsonSchemas(base, overlay) {
52569
52569
  ...mergedRequired === void 0 ? {} : { required: mergedRequired }
52570
52570
  };
52571
52571
  }
52572
- function hasSelfReferencingRef(schema2, root, path154 = "#", activePaths = /* @__PURE__ */ new Set()) {
52572
+ function hasSelfReferencingRef(schema2, root, path155 = "#", activePaths = /* @__PURE__ */ new Set()) {
52573
52573
  const nextActivePaths = new Set(activePaths);
52574
- nextActivePaths.add(path154);
52574
+ nextActivePaths.add(path155);
52575
52575
  const localRefPath = getLocalRefPath(schema2.$ref);
52576
52576
  if (localRefPath !== void 0) {
52577
52577
  if (nextActivePaths.has(localRefPath)) {
@@ -52582,13 +52582,13 @@ function hasSelfReferencingRef(schema2, root, path154 = "#", activePaths = /* @_
52582
52582
  return true;
52583
52583
  }
52584
52584
  }
52585
- if (schema2.items !== void 0 && hasSelfReferencingRef(schema2.items, root, `${path154}/items`, nextActivePaths)) {
52585
+ if (schema2.items !== void 0 && hasSelfReferencingRef(schema2.items, root, `${path155}/items`, nextActivePaths)) {
52586
52586
  return true;
52587
52587
  }
52588
52588
  if (typeof schema2.additionalProperties === "object" && schema2.additionalProperties !== null && hasSelfReferencingRef(
52589
52589
  schema2.additionalProperties,
52590
52590
  root,
52591
- `${path154}/additionalProperties`,
52591
+ `${path155}/additionalProperties`,
52592
52592
  nextActivePaths
52593
52593
  )) {
52594
52594
  return true;
@@ -52597,7 +52597,7 @@ function hasSelfReferencingRef(schema2, root, path154 = "#", activePaths = /* @_
52597
52597
  if (hasSelfReferencingRef(
52598
52598
  childSchema,
52599
52599
  root,
52600
- `${path154}/properties/${escapeJsonPointerSegment(key2)}`,
52600
+ `${path155}/properties/${escapeJsonPointerSegment(key2)}`,
52601
52601
  nextActivePaths
52602
52602
  )) {
52603
52603
  return true;
@@ -52607,24 +52607,24 @@ function hasSelfReferencingRef(schema2, root, path154 = "#", activePaths = /* @_
52607
52607
  if (hasSelfReferencingRef(
52608
52608
  childSchema,
52609
52609
  root,
52610
- `${path154}/$defs/${escapeJsonPointerSegment(key2)}`,
52610
+ `${path155}/$defs/${escapeJsonPointerSegment(key2)}`,
52611
52611
  nextActivePaths
52612
52612
  )) {
52613
52613
  return true;
52614
52614
  }
52615
52615
  }
52616
52616
  for (const [index, childSchema] of (schema2.oneOf ?? []).entries()) {
52617
- if (hasSelfReferencingRef(childSchema, root, `${path154}/oneOf/${index}`, nextActivePaths)) {
52617
+ if (hasSelfReferencingRef(childSchema, root, `${path155}/oneOf/${index}`, nextActivePaths)) {
52618
52618
  return true;
52619
52619
  }
52620
52620
  }
52621
52621
  for (const [index, childSchema] of (schema2.anyOf ?? []).entries()) {
52622
- if (hasSelfReferencingRef(childSchema, root, `${path154}/anyOf/${index}`, nextActivePaths)) {
52622
+ if (hasSelfReferencingRef(childSchema, root, `${path155}/anyOf/${index}`, nextActivePaths)) {
52623
52623
  return true;
52624
52624
  }
52625
52625
  }
52626
52626
  for (const [index, childSchema] of (schema2.allOf ?? []).entries()) {
52627
- if (hasSelfReferencingRef(childSchema, root, `${path154}/allOf/${index}`, nextActivePaths)) {
52627
+ if (hasSelfReferencingRef(childSchema, root, `${path155}/allOf/${index}`, nextActivePaths)) {
52628
52628
  return true;
52629
52629
  }
52630
52630
  }
@@ -52640,14 +52640,14 @@ function getLocalRefPath(ref) {
52640
52640
  return ref.startsWith("#/") ? ref : void 0;
52641
52641
  }
52642
52642
  function resolveLocalRef(root, ref) {
52643
- const path154 = getLocalRefPath(ref);
52644
- if (path154 === void 0) {
52643
+ const path155 = getLocalRefPath(ref);
52644
+ if (path155 === void 0) {
52645
52645
  return void 0;
52646
52646
  }
52647
- if (path154 === "#") {
52647
+ if (path155 === "#") {
52648
52648
  return root;
52649
52649
  }
52650
- const segments = path154.slice(2).split("/").map(unescapeJsonPointerSegment);
52650
+ const segments = path155.slice(2).split("/").map(unescapeJsonPointerSegment);
52651
52651
  let current = root;
52652
52652
  for (const segment of segments) {
52653
52653
  if (Array.isArray(current)) {
@@ -54112,13 +54112,13 @@ function formatAvailableApprovalCommandPaths(root) {
54112
54112
  }
54113
54113
  function enumerateApprovalCommandPaths(root) {
54114
54114
  const paths = [];
54115
- const visit = (node, path154) => {
54115
+ const visit = (node, path155) => {
54116
54116
  if (node.kind === "command") {
54117
- paths.push(path154.join("."));
54117
+ paths.push(path155.join("."));
54118
54118
  return;
54119
54119
  }
54120
54120
  for (const child of getVisibleCliChildren(node)) {
54121
- visit(child, [...path154, child.name]);
54121
+ visit(child, [...path155, child.name]);
54122
54122
  }
54123
54123
  };
54124
54124
  if (root.kind === "command") {
@@ -54153,21 +54153,21 @@ function createHandlerContext(command, params) {
54153
54153
  }
54154
54154
  function createFs() {
54155
54155
  return {
54156
- readFile: async (path154, encoding = "utf8") => readFile12(path154, { encoding }),
54157
- writeFile: async (path154, contents) => {
54158
- await writeFile9(path154, contents);
54156
+ readFile: async (path155, encoding = "utf8") => readFile12(path155, { encoding }),
54157
+ writeFile: async (path155, contents) => {
54158
+ await writeFile9(path155, contents);
54159
54159
  },
54160
- exists: async (path154) => {
54160
+ exists: async (path155) => {
54161
54161
  try {
54162
- await access2(path154);
54162
+ await access2(path155);
54163
54163
  return true;
54164
54164
  } catch {
54165
54165
  return false;
54166
54166
  }
54167
54167
  },
54168
- lstat: async (path154) => lstat11(path154),
54168
+ lstat: async (path155) => lstat11(path155),
54169
54169
  rename: async (fromPath, toPath) => rename10(fromPath, toPath),
54170
- unlink: async (path154) => unlink7(path154)
54170
+ unlink: async (path155) => unlink7(path155)
54171
54171
  };
54172
54172
  }
54173
54173
  function createEnv(values = process.env) {
@@ -54696,21 +54696,21 @@ function isPlainObject5(value) {
54696
54696
  }
54697
54697
  function createFs2() {
54698
54698
  return {
54699
- readFile: async (path154, encoding = "utf8") => readFile13(path154, { encoding }),
54700
- writeFile: async (path154, contents) => {
54701
- await writeFile10(path154, contents);
54699
+ readFile: async (path155, encoding = "utf8") => readFile13(path155, { encoding }),
54700
+ writeFile: async (path155, contents) => {
54701
+ await writeFile10(path155, contents);
54702
54702
  },
54703
- exists: async (path154) => {
54703
+ exists: async (path155) => {
54704
54704
  try {
54705
- await access3(path154);
54705
+ await access3(path155);
54706
54706
  return true;
54707
54707
  } catch {
54708
54708
  return false;
54709
54709
  }
54710
54710
  },
54711
- lstat: async (path154) => lstat12(path154),
54711
+ lstat: async (path155) => lstat12(path155),
54712
54712
  rename: async (fromPath, toPath) => rename11(fromPath, toPath),
54713
- unlink: async (path154) => unlink8(path154)
54713
+ unlink: async (path155) => unlink8(path155)
54714
54714
  };
54715
54715
  }
54716
54716
  function createEnv2(values = process.env) {
@@ -54755,11 +54755,11 @@ function applySchemaCasing(schema2, casing) {
54755
54755
  ...required === void 0 ? {} : { required }
54756
54756
  };
54757
54757
  }
54758
- function collectParamSummaries(schema2, casing, path154 = [], inheritedOptional = false) {
54758
+ function collectParamSummaries(schema2, casing, path155 = [], inheritedOptional = false) {
54759
54759
  const summaries = [];
54760
54760
  for (const [key2, rawChildSchema] of Object.entries(schema2.shape)) {
54761
54761
  const childSchema = unwrapOptional3(rawChildSchema);
54762
- const nextPath = [...path154, formatSegment(key2, casing)];
54762
+ const nextPath = [...path155, formatSegment(key2, casing)];
54763
54763
  const optional = inheritedOptional || isOptional(rawChildSchema);
54764
54764
  if (childSchema.kind === "object") {
54765
54765
  summaries.push(...collectParamSummaries(childSchema, casing, nextPath, optional));
@@ -54788,8 +54788,8 @@ function matchesAllowlist(toolName, allowlist) {
54788
54788
  const candidates = segments.map((_segment, index) => segments.slice(0, index + 1).join("__"));
54789
54789
  return candidates.some((candidate) => allowlist.includes(candidate));
54790
54790
  }
54791
- function formatToolName(path154) {
54792
- return path154.map((segment) => formatSegment(segment, "snake")).join("__");
54791
+ function formatToolName(path155) {
54792
+ return path155.map((segment) => formatSegment(segment, "snake")).join("__");
54793
54793
  }
54794
54794
  function validateUniqueMCPParameterFields(schema2, casing) {
54795
54795
  const sourceKeysByField = /* @__PURE__ */ new Map();
@@ -56824,14 +56824,14 @@ function parseDockerLocator(input) {
56824
56824
  throw new Error(`Invalid docker workspace locator "${input}".`);
56825
56825
  }
56826
56826
  const container = input.slice(0, slashIndex);
56827
- const path154 = input.slice(slashIndex);
56828
- if (container.length === 0 || path154.length === 0) {
56827
+ const path155 = input.slice(slashIndex);
56828
+ if (container.length === 0 || path155.length === 0) {
56829
56829
  throw new Error(`Invalid docker workspace locator "${input}".`);
56830
56830
  }
56831
56831
  return {
56832
56832
  scheme: "docker",
56833
56833
  container,
56834
- path: path154
56834
+ path: path155
56835
56835
  };
56836
56836
  }
56837
56837
  function splitOnce(input, separator) {
@@ -57562,8 +57562,8 @@ async function checkAuth(options) {
57562
57562
  }
57563
57563
  function createCurrentBalanceUrl(baseUrl) {
57564
57564
  const url = new URL(baseUrl);
57565
- const path154 = url.pathname.endsWith("/") ? url.pathname.slice(0, -1) : url.pathname;
57566
- url.pathname = `${path154}/usage/current_balance`;
57565
+ const path155 = url.pathname.endsWith("/") ? url.pathname.slice(0, -1) : url.pathname;
57566
+ url.pathname = `${path155}/usage/current_balance`;
57567
57567
  return url.toString();
57568
57568
  }
57569
57569
  function isCurrentBalanceResponse(value) {
@@ -59135,26 +59135,26 @@ function createSdkContainer(options) {
59135
59135
  });
59136
59136
  loggerFactory.setErrorLogger(errorLogger);
59137
59137
  const asyncFs = {
59138
- readFile: ((path154, encoding) => {
59138
+ readFile: ((path155, encoding) => {
59139
59139
  if (encoding) {
59140
- return fs7.readFile(path154, encoding);
59140
+ return fs7.readFile(path155, encoding);
59141
59141
  }
59142
- return fs7.readFile(path154);
59142
+ return fs7.readFile(path155);
59143
59143
  }),
59144
- symlink: (target, path154) => fs7.symlink(target, path154),
59145
- readlink: (path154) => fs7.readlink(path154, { encoding: "utf8" }),
59146
- realpath: (path154) => fs7.realpath(path154),
59147
- writeFile: (path154, data, opts) => fs7.writeFile(path154, data, opts),
59148
- mkdir: (path154, opts) => fs7.mkdir(path154, opts).then(() => {
59144
+ symlink: (target, path155) => fs7.symlink(target, path155),
59145
+ readlink: (path155) => fs7.readlink(path155, { encoding: "utf8" }),
59146
+ realpath: (path155) => fs7.realpath(path155),
59147
+ writeFile: (path155, data, opts) => fs7.writeFile(path155, data, opts),
59148
+ mkdir: (path155, opts) => fs7.mkdir(path155, opts).then(() => {
59149
59149
  }),
59150
- stat: (path154) => fs7.stat(path154),
59151
- lstat: (path154) => fs7.lstat(path154),
59150
+ stat: (path155) => fs7.stat(path155),
59151
+ lstat: (path155) => fs7.lstat(path155),
59152
59152
  rename: (oldPath, newPath) => fs7.rename(oldPath, newPath),
59153
- rm: (path154, opts) => fs7.rm(path154, opts),
59154
- unlink: (path154) => fs7.unlink(path154),
59155
- readdir: (path154) => fs7.readdir(path154),
59153
+ rm: (path155, opts) => fs7.rm(path155, opts),
59154
+ unlink: (path155) => fs7.unlink(path155),
59155
+ readdir: (path155) => fs7.readdir(path155),
59156
59156
  copyFile: (src, dest) => fs7.copyFile(src, dest),
59157
- chmod: (path154, mode) => fs7.chmod(path154, mode)
59157
+ chmod: (path155, mode) => fs7.chmod(path155, mode)
59158
59158
  };
59159
59159
  const contextFactory = createCommandContextFactory({ fs: asyncFs });
59160
59160
  const authFs = {
@@ -60835,7 +60835,7 @@ function selectNextExecution(plan, taskId) {
60835
60835
  function describeExecutionContext(selection) {
60836
60836
  return selection.stepName ? `task "${selection.task.id}" step "${selection.stepName}"` : `task "${selection.task.id}"`;
60837
60837
  }
60838
- async function resolveFileIncludes(template2, cwd, readFile56) {
60838
+ async function resolveFileIncludes(template2, cwd, readFile57) {
60839
60839
  const matches = [...template2.matchAll(FILE_INCLUDE_PATTERN)];
60840
60840
  if (matches.length === 0) {
60841
60841
  return template2;
@@ -60847,7 +60847,7 @@ async function resolveFileIncludes(template2, cwd, readFile56) {
60847
60847
  if (relativePath === ".." || relativePath.startsWith(`..${path70.sep}`) || path70.isAbsolute(relativePath)) {
60848
60848
  throw new Error(`Pipeline file include resolves outside the project root: ${match[1]}`);
60849
60849
  }
60850
- const content = await readFile56(absolutePath, "utf8");
60850
+ const content = await readFile57(absolutePath, "utf8");
60851
60851
  result = result.replace(match[0], content);
60852
60852
  }
60853
60853
  return result;
@@ -60915,15 +60915,15 @@ async function resolveDocVarFromPath(options) {
60915
60915
  );
60916
60916
  }
60917
60917
  }
60918
- async function resolvePipelineVars(vars, cwd, readFile56) {
60918
+ async function resolvePipelineVars(vars, cwd, readFile57) {
60919
60919
  const resolved = {};
60920
60920
  for (const [key2, value] of Object.entries(vars)) {
60921
60921
  if (key2.endsWith("_doc") && looksLikeDocPath(value)) {
60922
- const docContent = await resolveDocVarFromPath({ key: key2, value, cwd, readFile: readFile56 });
60923
- defineRecordEntry2(resolved, key2, await resolveFileIncludes(docContent, cwd, readFile56));
60922
+ const docContent = await resolveDocVarFromPath({ key: key2, value, cwd, readFile: readFile57 });
60923
+ defineRecordEntry2(resolved, key2, await resolveFileIncludes(docContent, cwd, readFile57));
60924
60924
  continue;
60925
60925
  }
60926
- defineRecordEntry2(resolved, key2, await resolveFileIncludes(value, cwd, readFile56));
60926
+ defineRecordEntry2(resolved, key2, await resolveFileIncludes(value, cwd, readFile57));
60927
60927
  }
60928
60928
  return resolved;
60929
60929
  }
@@ -69839,7 +69839,7 @@ var init_frontmatter4 = __esm({
69839
69839
  });
69840
69840
 
69841
69841
  // packages/github-workflows/src/discover.ts
69842
- import { readdir as readdir21, readFile as readFile26 } from "node:fs/promises";
69842
+ import { readdir as readdir21, readFile as readFile27 } from "node:fs/promises";
69843
69843
  import { join as join5 } from "node:path";
69844
69844
  async function discoverAutomations(builtInDir, ...projectDirs) {
69845
69845
  const directories = [builtInDir, ...projectDirs];
@@ -69883,7 +69883,7 @@ async function listMarkdownFiles(dir) {
69883
69883
  }
69884
69884
  async function readAutomation(dir, fileName, baseName, baseDirs) {
69885
69885
  const filePath = join5(dir, fileName);
69886
- const content = await readFile26(filePath, "utf8");
69886
+ const content = await readFile27(filePath, "utf8");
69887
69887
  const resolved = await resolve(
69888
69888
  [
69889
69889
  {
@@ -69904,7 +69904,7 @@ async function readAutomation(dir, fileName, baseName, baseDirs) {
69904
69904
  }
69905
69905
  ],
69906
69906
  {
69907
- fs: { readFile: readFile26 }
69907
+ fs: { readFile: readFile27 }
69908
69908
  }
69909
69909
  );
69910
69910
  const name = stripPrefix(fileName.slice(0, -3));
@@ -70126,7 +70126,7 @@ var init_require_comment_prefix = __esm({
70126
70126
  });
70127
70127
 
70128
70128
  // packages/github-workflows/src/exec/trufflehog-pr-scan.ts
70129
- import { appendFile as appendFile4, lstat as lstat22, readFile as readFile27, rename as rename19, rm as rm5, writeFile as writeFile18 } from "node:fs/promises";
70129
+ import { appendFile as appendFile4, lstat as lstat22, readFile as readFile28, rename as rename19, rm as rm5, writeFile as writeFile18 } from "node:fs/promises";
70130
70130
  import { randomUUID as randomUUID11 } from "node:crypto";
70131
70131
  async function runTruffleHogPrScanCommand(command, env, options = {}) {
70132
70132
  if (options.dryRun === true) {
@@ -70357,15 +70357,15 @@ async function publishFiles(fs27, files) {
70357
70357
  await Promise.all(stagedFiles.map((file) => fs27.rm(file.stagedPath, { force: true })));
70358
70358
  }
70359
70359
  }
70360
- async function assertNotSymbolicLinkIfSet(fs27, path154) {
70361
- if (path154 !== void 0 && path154 !== "") {
70362
- await assertNotSymbolicLink2(fs27, path154);
70360
+ async function assertNotSymbolicLinkIfSet(fs27, path155) {
70361
+ if (path155 !== void 0 && path155 !== "") {
70362
+ await assertNotSymbolicLink2(fs27, path155);
70363
70363
  }
70364
70364
  }
70365
- async function assertNotSymbolicLink2(fs27, path154) {
70365
+ async function assertNotSymbolicLink2(fs27, path155) {
70366
70366
  try {
70367
- if ((await fs27.lstat(path154)).isSymbolicLink()) {
70368
- throw new UserError(`Refusing to use symbolic link path: ${path154}`);
70367
+ if ((await fs27.lstat(path155)).isSymbolicLink()) {
70368
+ throw new UserError(`Refusing to use symbolic link path: ${path155}`);
70369
70369
  }
70370
70370
  } catch (error3) {
70371
70371
  if (isMissingFileError6(error3)) {
@@ -70479,7 +70479,7 @@ var init_trufflehog_pr_scan = __esm({
70479
70479
  DEFAULT_STDERR_FILE = "/tmp/trufflehog-stderr.log";
70480
70480
  COMMENT_MARKER = "<!-- trufflehog-pr-scan -->";
70481
70481
  FIX_MESSAGE = "Fix: remove the value, rotate it if it was real, and push a cleanup commit.";
70482
- defaultFileSystem = { appendFile: appendFile4, lstat: lstat22, readFile: readFile27, rename: rename19, rm: rm5, writeFile: writeFile18 };
70482
+ defaultFileSystem = { appendFile: appendFile4, lstat: lstat22, readFile: readFile28, rename: rename19, rm: rm5, writeFile: writeFile18 };
70483
70483
  }
70484
70484
  });
70485
70485
 
@@ -70550,8 +70550,8 @@ var init_setup_agent = __esm({
70550
70550
  });
70551
70551
 
70552
70552
  // packages/github-workflows/src/variables.ts
70553
- import path97 from "node:path";
70554
- import { readFile as readFile28 } from "node:fs/promises";
70553
+ import path98 from "node:path";
70554
+ import { readFile as readFile29 } from "node:fs/promises";
70555
70555
  import { isMap as isMap4, parseDocument as parseDocument10, stringify as stringify6 } from "yaml";
70556
70556
  function isRecord33(value) {
70557
70557
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -70642,7 +70642,7 @@ function extractUserOverrideBlocks(filePath, content) {
70642
70642
  }
70643
70643
  async function readOptionalVariablesContent(filePath) {
70644
70644
  try {
70645
- return await readFile28(filePath, "utf8");
70645
+ return await readFile29(filePath, "utf8");
70646
70646
  } catch (error3) {
70647
70647
  if (error3 instanceof Error && error3.code === "ENOENT") {
70648
70648
  return void 0;
@@ -70670,9 +70670,9 @@ function formatCommentedBlock(name, value) {
70670
70670
  return formatVariableBlock(name, value).split("\n").map((line) => `# ${line}`).join("\n");
70671
70671
  }
70672
70672
  async function loadVariableSources(builtInDir, projectDir) {
70673
- const builtInPath = path97.join(builtInDir, VARIABLES_FILE_NAME);
70674
- const builtInVariables = parseVariables(builtInPath, await readFile28(builtInPath, "utf8"));
70675
- const projectVariablesPath = projectDir === void 0 ? void 0 : path97.join(projectDir, VARIABLES_FILE_NAME);
70673
+ const builtInPath = path98.join(builtInDir, VARIABLES_FILE_NAME);
70674
+ const builtInVariables = parseVariables(builtInPath, await readFile29(builtInPath, "utf8"));
70675
+ const projectVariablesPath = projectDir === void 0 ? void 0 : path98.join(projectDir, VARIABLES_FILE_NAME);
70676
70676
  const projectVariablesContent = projectVariablesPath === void 0 ? void 0 : await readOptionalVariablesContent(projectVariablesPath);
70677
70677
  if (projectVariablesPath === void 0 || projectVariablesContent === void 0) {
70678
70678
  return { builtInVariables, extendsBuiltIns: true, projectVariables: {} };
@@ -70684,13 +70684,13 @@ async function loadVariableSources(builtInDir, projectDir) {
70684
70684
  return { builtInVariables, extendsBuiltIns, projectVariables };
70685
70685
  }
70686
70686
  async function loadVariables(builtInDir, projectDir) {
70687
- const builtInPath = path97.join(builtInDir, VARIABLES_FILE_NAME);
70688
- const builtInContent = await readFile28(builtInPath, "utf8");
70687
+ const builtInPath = path98.join(builtInDir, VARIABLES_FILE_NAME);
70688
+ const builtInContent = await readFile29(builtInPath, "utf8");
70689
70689
  const builtInVariables = parseVariables(builtInPath, builtInContent);
70690
70690
  if (projectDir === void 0) {
70691
70691
  return filterDisabledVariables(builtInVariables);
70692
70692
  }
70693
- const projectVariablesPath = path97.join(projectDir, VARIABLES_FILE_NAME);
70693
+ const projectVariablesPath = path98.join(projectDir, VARIABLES_FILE_NAME);
70694
70694
  const projectVariablesContent = await readOptionalVariablesContent(projectVariablesPath);
70695
70695
  if (projectVariablesContent === void 0) {
70696
70696
  return filterDisabledVariables(builtInVariables);
@@ -70709,7 +70709,7 @@ async function loadVariables(builtInDir, projectDir) {
70709
70709
  }
70710
70710
  ],
70711
70711
  {
70712
- fs: { readFile: readFile28 },
70712
+ fs: { readFile: readFile29 },
70713
70713
  autoExtend: true
70714
70714
  }
70715
70715
  );
@@ -70723,7 +70723,7 @@ async function loadVariableStatuses(builtInDir, projectDir) {
70723
70723
  (key2) => !extendsBuiltIns || !Object.prototype.hasOwnProperty.call(builtInVariables, key2)
70724
70724
  )
70725
70725
  ];
70726
- const projectVariablesPath = projectDir === void 0 ? void 0 : path97.join(projectDir, VARIABLES_FILE_NAME);
70726
+ const projectVariablesPath = projectDir === void 0 ? void 0 : path98.join(projectDir, VARIABLES_FILE_NAME);
70727
70727
  return orderedNames.map((name) => {
70728
70728
  if (!Object.prototype.hasOwnProperty.call(projectVariables, name)) {
70729
70729
  return {
@@ -70788,8 +70788,8 @@ var init_variables2 = __esm({
70788
70788
  });
70789
70789
 
70790
70790
  // packages/github-workflows/src/commands.ts
70791
- import { access as access4, lstat as lstat23, mkdir as mkdir23, readFile as readFile29, unlink as unlink15, writeFile as writeFile19 } from "node:fs/promises";
70792
- import path98 from "node:path";
70791
+ import { access as access4, lstat as lstat23, mkdir as mkdir23, readFile as readFile30, unlink as unlink15, writeFile as writeFile19 } from "node:fs/promises";
70792
+ import path99 from "node:path";
70793
70793
  import { fileURLToPath as fileURLToPath8 } from "node:url";
70794
70794
  function formatLabel(name) {
70795
70795
  const capitalize2 = (s) => s.charAt(0).toUpperCase() + s.slice(1);
@@ -70811,7 +70811,7 @@ async function loadNamedAutomation(name, cwd) {
70811
70811
  }
70812
70812
  async function readBuiltInPromptFile(name) {
70813
70813
  try {
70814
- return await readFile29(path98.join(await resolveBuiltInPromptsDir(), `${name}.md`), "utf8");
70814
+ return await readFile30(path99.join(await resolveBuiltInPromptsDir(), `${name}.md`), "utf8");
70815
70815
  } catch (error3) {
70816
70816
  if (isMissingPathError3(error3)) {
70817
70817
  throw new UserError(`Automation "${name}" was not found.`);
@@ -70820,11 +70820,11 @@ async function readBuiltInPromptFile(name) {
70820
70820
  }
70821
70821
  }
70822
70822
  async function readBuiltInWorkflowTemplate(name, variant, automationName = name, promptPath) {
70823
- const templatePath = path98.join(await resolveBuiltInWorkflowTemplatesDir(), `${name}.${variant}.yml`);
70823
+ const templatePath = path99.join(await resolveBuiltInWorkflowTemplatesDir(), `${name}.${variant}.yml`);
70824
70824
  try {
70825
- const content = await readFile29(templatePath, "utf8");
70825
+ const content = await readFile30(templatePath, "utf8");
70826
70826
  const header = promptPath !== void 0 ? `# Auto-generated by: poe-code github-workflows install ${name}
70827
- # Edit ${path98.relative(process.cwd(), promptPath)} to customize the prompt.
70827
+ # Edit ${path99.relative(process.cwd(), promptPath)} to customize the prompt.
70828
70828
  ` : `# Auto-generated by: poe-code github-workflows install ${name}
70829
70829
  `;
70830
70830
  const processedContent = content.replaceAll(` ${name}`, ` ${automationName}`).replaceAll("__UPSTREAM_REPO__", UPSTREAM_REPO);
@@ -70853,7 +70853,7 @@ function projectPromptDirs(cwd) {
70853
70853
  return [projectWorkflowDir(cwd)];
70854
70854
  }
70855
70855
  function projectWorkflowDir(cwd) {
70856
- return path98.join(cwd, ".github", "workflows");
70856
+ return path99.join(cwd, ".github", "workflows");
70857
70857
  }
70858
70858
  function projectGitHubWorkflowsDir(cwd) {
70859
70859
  return projectWorkflowDir(cwd);
@@ -70872,7 +70872,7 @@ async function resolveBuiltInPromptsDir() {
70872
70872
  return builtInPromptsDirCandidates[0];
70873
70873
  }
70874
70874
  async function resolveBuiltInAssetsDir() {
70875
- return path98.dirname(await resolveBuiltInPromptsDir());
70875
+ return path99.dirname(await resolveBuiltInPromptsDir());
70876
70876
  }
70877
70877
  function resolveCwd(cwd) {
70878
70878
  return cwd ?? process.cwd();
@@ -71049,19 +71049,19 @@ function addPromptHeader(content, name) {
71049
71049
  async function installAutomation(name, cwd, isEject, dryRun = false, writtenFiles = []) {
71050
71050
  const variant = isEject ? "ejected" : "caller";
71051
71051
  const localAutomationName = isEject ? `poe-code-${name}` : name;
71052
- const promptPath = isEject ? path98.join(projectWorkflowDir(cwd), `${localAutomationName}.md`) : void 0;
71052
+ const promptPath = isEject ? path99.join(projectWorkflowDir(cwd), `${localAutomationName}.md`) : void 0;
71053
71053
  const [workflowTemplate, rawPrompt] = await Promise.all([
71054
71054
  readBuiltInWorkflowTemplate(name, variant, localAutomationName, promptPath),
71055
71055
  readBuiltInPromptFile(name)
71056
71056
  ]);
71057
- const workflowPath = path98.join(cwd, ".github", "workflows", `poe-code-${name}.yml`);
71057
+ const workflowPath = path99.join(cwd, ".github", "workflows", `poe-code-${name}.yml`);
71058
71058
  if (!dryRun) {
71059
- await mkdir23(path98.dirname(workflowPath), { recursive: true });
71059
+ await mkdir23(path99.dirname(workflowPath), { recursive: true });
71060
71060
  await assertWritableWorkflowDestination(workflowPath);
71061
71061
  await writeTrackedFile(workflowPath, workflowTemplate, writtenFiles);
71062
71062
  }
71063
71063
  if (promptPath !== void 0 && !dryRun) {
71064
- await mkdir23(path98.dirname(promptPath), { recursive: true });
71064
+ await mkdir23(path99.dirname(promptPath), { recursive: true });
71065
71065
  await assertWritableWorkflowDestination(promptPath);
71066
71066
  await writeTrackedFile(promptPath, addPromptHeader(rawPrompt, name), writtenFiles);
71067
71067
  }
@@ -71076,14 +71076,14 @@ async function installAutomation(name, cwd, isEject, dryRun = false, writtenFile
71076
71076
  function resolveProjectSupportFilePaths(cwd) {
71077
71077
  const projectDir = projectGitHubWorkflowsDir(cwd);
71078
71078
  return {
71079
- variablesPath: path98.join(projectDir, "variables.yaml"),
71080
- readmePath: path98.join(projectDir, "README.md")
71079
+ variablesPath: path99.join(projectDir, "variables.yaml"),
71080
+ readmePath: path99.join(projectDir, "README.md")
71081
71081
  };
71082
71082
  }
71083
71083
  async function ensureProjectSupportFiles(cwd, builtInVariables, writtenFiles = []) {
71084
71084
  const projectDir = projectGitHubWorkflowsDir(cwd);
71085
- const variablesPath = path98.join(projectDir, "variables.yaml");
71086
- const readmePath = path98.join(projectDir, "README.md");
71085
+ const variablesPath = path99.join(projectDir, "variables.yaml");
71086
+ const readmePath = path99.join(projectDir, "README.md");
71087
71087
  await mkdir23(projectDir, { recursive: true });
71088
71088
  await assertWritableWorkflowDestination(variablesPath);
71089
71089
  await assertWritableWorkflowDestination(readmePath);
@@ -71129,7 +71129,7 @@ async function assertWritableWorkflowDestination(filePath) {
71129
71129
  }
71130
71130
  async function readOptionalFile3(filePath) {
71131
71131
  try {
71132
- return await readFile29(filePath, "utf8");
71132
+ return await readFile30(filePath, "utf8");
71133
71133
  } catch (error3) {
71134
71134
  if (isMissingPathError3(error3)) {
71135
71135
  return void 0;
@@ -71451,7 +71451,7 @@ var init_commands2 = __esm({
71451
71451
  scope: ["cli"],
71452
71452
  handler: async ({ params }) => {
71453
71453
  const name = params.name;
71454
- const workflowPath = path98.join(resolveCwd(), ".github", "workflows", `poe-code-${name}.yml`);
71454
+ const workflowPath = path99.join(resolveCwd(), ".github", "workflows", `poe-code-${name}.yml`);
71455
71455
  if (params.dryRun !== true) {
71456
71456
  try {
71457
71457
  await unlink15(workflowPath);
@@ -71580,7 +71580,7 @@ var init_commands2 = __esm({
71580
71580
  return (await loadVariableStatuses(await resolveBuiltInAssetsDir(), projectGitHubWorkflowsDir(cwd))).map(
71581
71581
  (status) => ({
71582
71582
  ...status,
71583
- source: status.source === "built-in" ? status.source : path98.relative(cwd, status.source)
71583
+ source: status.source === "built-in" ? status.source : path99.relative(cwd, status.source)
71584
71584
  })
71585
71585
  );
71586
71586
  },
@@ -71636,7 +71636,7 @@ var init_src37 = __esm({
71636
71636
  });
71637
71637
 
71638
71638
  // packages/agent-eval/src/schema.ts
71639
- import path99 from "node:path";
71639
+ import path100 from "node:path";
71640
71640
  function validateEvalYaml(value, filePath = "eval.yaml") {
71641
71641
  const result = validate(evalYamlSchema, value);
71642
71642
  if (result.ok) {
@@ -71653,12 +71653,12 @@ function validateEvalYaml(value, filePath = "eval.yaml") {
71653
71653
  }
71654
71654
  function validateTarget(target) {
71655
71655
  const destination = target.plan_dest ?? "docs/plans/eval-task.md";
71656
- if (path99.isAbsolute(destination)) {
71656
+ if (path100.isAbsolute(destination)) {
71657
71657
  return [invalidPlanDestination(destination)];
71658
71658
  }
71659
- const resolved = path99.resolve("/clone", destination);
71660
- const relative6 = path99.relative("/clone", resolved);
71661
- return relative6 === ".." || relative6.startsWith(`..${path99.sep}`) ? [invalidPlanDestination(destination)] : [];
71659
+ const resolved = path100.resolve("/clone", destination);
71660
+ const relative6 = path100.relative("/clone", resolved);
71661
+ return relative6 === ".." || relative6.startsWith(`..${path100.sep}`) ? [invalidPlanDestination(destination)] : [];
71662
71662
  }
71663
71663
  function invalidPlanDestination(destination) {
71664
71664
  return {
@@ -71699,8 +71699,8 @@ function validateMetrics(metrics) {
71699
71699
  function formatIssues(filePath, issues) {
71700
71700
  return issues.map((issue) => `${filePath} (${formatPath2(issue.path)}): ${issue.message}`).join("\n");
71701
71701
  }
71702
- function formatPath2(path154) {
71703
- return path154.join(".") || "value";
71702
+ function formatPath2(path155) {
71703
+ return path155.join(".") || "value";
71704
71704
  }
71705
71705
  var metricEvaluatorSchema, metricSchema, evalYamlSchema, EvalYamlValidationError;
71706
71706
  var init_schema4 = __esm({
@@ -71785,21 +71785,21 @@ var init_schema4 = __esm({
71785
71785
  });
71786
71786
 
71787
71787
  // packages/agent-eval/src/path-boundary.ts
71788
- import { realpath as realpath5 } from "node:fs/promises";
71789
- import path100 from "node:path";
71788
+ import { realpath as realpath6 } from "node:fs/promises";
71789
+ import path101 from "node:path";
71790
71790
  function resolveContainedPath(rootDir, configuredPath, field) {
71791
- const absoluteRootDir = path100.resolve(rootDir);
71792
- const resolved = path100.resolve(absoluteRootDir, configuredPath);
71791
+ const absoluteRootDir = path101.resolve(rootDir);
71792
+ const resolved = path101.resolve(absoluteRootDir, configuredPath);
71793
71793
  assertWithin(absoluteRootDir, resolved, field, false);
71794
71794
  return resolved;
71795
71795
  }
71796
71796
  async function assertCanonicalContainedPath(rootDir, targetPath, field) {
71797
- const canonicalRoot = await realpath5(path100.resolve(rootDir));
71798
- const canonicalTarget = await realpath5(targetPath);
71797
+ const canonicalRoot = await realpath6(path101.resolve(rootDir));
71798
+ const canonicalTarget = await realpath6(targetPath);
71799
71799
  assertWithin(canonicalRoot, canonicalTarget, field, true);
71800
71800
  }
71801
71801
  async function assertFsCanonicalContainedPath(fs27, rootDir, targetPath, field) {
71802
- const canonicalRoot = await fs27.realpath(path100.resolve(rootDir));
71802
+ const canonicalRoot = await fs27.realpath(path101.resolve(rootDir));
71803
71803
  const canonicalTarget = await fs27.realpath(targetPath);
71804
71804
  assertWithin(canonicalRoot, canonicalTarget, field, true);
71805
71805
  }
@@ -71815,11 +71815,11 @@ async function assertFsCanonicalContainedPathIfPresent(fs27, rootDir, targetPath
71815
71815
  }
71816
71816
  }
71817
71817
  async function assertCanonicalDestinationPath(rootDir, targetPath, field) {
71818
- const canonicalRoot = await realpath5(path100.resolve(rootDir));
71819
- let current = path100.resolve(targetPath);
71818
+ const canonicalRoot = await realpath6(path101.resolve(rootDir));
71819
+ let current = path101.resolve(targetPath);
71820
71820
  while (true) {
71821
71821
  try {
71822
- const canonicalAncestor = await realpath5(current);
71822
+ const canonicalAncestor = await realpath6(current);
71823
71823
  assertWithin(canonicalRoot, canonicalAncestor, field, true);
71824
71824
  return;
71825
71825
  } catch (error3) {
@@ -71827,7 +71827,7 @@ async function assertCanonicalDestinationPath(rootDir, targetPath, field) {
71827
71827
  throw error3;
71828
71828
  }
71829
71829
  }
71830
- const parent = path100.dirname(current);
71830
+ const parent = path101.dirname(current);
71831
71831
  if (parent === current) {
71832
71832
  throw new Error(`${field} must stay within the canonical ${fieldRootDescription(field)}.`);
71833
71833
  }
@@ -71835,8 +71835,8 @@ async function assertCanonicalDestinationPath(rootDir, targetPath, field) {
71835
71835
  }
71836
71836
  }
71837
71837
  function assertWithin(rootDir, targetPath, field, canonical) {
71838
- const relative6 = path100.relative(rootDir, targetPath);
71839
- if (relative6 === ".." || relative6.startsWith(`..${path100.sep}`)) {
71838
+ const relative6 = path101.relative(rootDir, targetPath);
71839
+ if (relative6 === ".." || relative6.startsWith(`..${path101.sep}`)) {
71840
71840
  const prefix = canonical ? "canonical " : "";
71841
71841
  throw new Error(`${field} must stay within the ${prefix}${fieldRootDescription(field)}.`);
71842
71842
  }
@@ -72037,9 +72037,9 @@ async function loadEval(source, id, fs27 = nodeFs12) {
72037
72037
  plan
72038
72038
  };
72039
72039
  }
72040
- async function isFile2(path154, fs27) {
72040
+ async function isFile2(path155, fs27) {
72041
72041
  try {
72042
- const stat33 = await fs27.stat(path154);
72042
+ const stat33 = await fs27.stat(path155);
72043
72043
  return typeof stat33.isFile === "function" ? stat33.isFile() : !stat33.isDirectory();
72044
72044
  } catch (error3) {
72045
72045
  if (isMissingPath4(error3)) {
@@ -72389,7 +72389,7 @@ var init_aggregate = __esm({
72389
72389
  // packages/agent-eval/src/run/clone.ts
72390
72390
  import { createHash as createHash7 } from "node:crypto";
72391
72391
  import { access as access5, mkdir as mkdir24, rm as rm6 } from "node:fs/promises";
72392
- import path101 from "node:path";
72392
+ import path102 from "node:path";
72393
72393
  import { simpleGit } from "simple-git";
72394
72394
  async function cloneTarget(input) {
72395
72395
  throwIfAborted6(input.signal);
@@ -72421,7 +72421,7 @@ async function cloneDirect(input) {
72421
72421
  }
72422
72422
  async function cloneFromCache(input) {
72423
72423
  await mkdir24(input.cacheDir, { recursive: true });
72424
- const cachedRepo = path101.join(input.cacheDir, `${hashRepo(input.repo)}.git`);
72424
+ const cachedRepo = path102.join(input.cacheDir, `${hashRepo(input.repo)}.git`);
72425
72425
  if (await exists2(cachedRepo)) {
72426
72426
  await git(cachedRepo, input.signal).raw([
72427
72427
  "fetch",
@@ -72463,7 +72463,7 @@ var init_clone2 = __esm({
72463
72463
  });
72464
72464
 
72465
72465
  // packages/agent-eval/src/types.ts
72466
- import path102 from "node:path";
72466
+ import path103 from "node:path";
72467
72467
  function resolveScorer(evalDef) {
72468
72468
  if (evalDef.scorer !== void 0) {
72469
72469
  return {
@@ -72473,7 +72473,7 @@ function resolveScorer(evalDef) {
72473
72473
  }
72474
72474
  return {
72475
72475
  kind: "vitest",
72476
- testsDir: path102.resolve(path102.join(evalDef.rootDir, evalDef.oracle.path, "tests"))
72476
+ testsDir: path103.resolve(path103.join(evalDef.rootDir, evalDef.oracle.path, "tests"))
72477
72477
  };
72478
72478
  }
72479
72479
  var init_types9 = __esm({
@@ -72484,15 +72484,15 @@ var init_types9 = __esm({
72484
72484
 
72485
72485
  // packages/agent-eval/src/run/vitest-runner.ts
72486
72486
  import { randomUUID as randomUUID12 } from "node:crypto";
72487
- import { readFile as readFile30, unlink as unlink16 } from "node:fs/promises";
72487
+ import { readFile as readFile31, unlink as unlink16 } from "node:fs/promises";
72488
72488
  import { tmpdir as tmpdir2 } from "node:os";
72489
- import path103 from "node:path";
72489
+ import path104 from "node:path";
72490
72490
  import { createRequire } from "node:module";
72491
72491
  async function runVitest(input) {
72492
72492
  return runVitestWithRunner(createHostRunner(), input);
72493
72493
  }
72494
72494
  async function runVitestWithRunner(runner, input) {
72495
- const outputFile = path103.join(tmpdir2(), `poe-code-vitest-${process.pid}-${randomUUID12()}.json`);
72495
+ const outputFile = path104.join(tmpdir2(), `poe-code-vitest-${process.pid}-${randomUUID12()}.json`);
72496
72496
  const timeoutMs = input.timeoutMs ?? defaultTimeoutMs;
72497
72497
  assertValidTimeout2(timeoutMs);
72498
72498
  const handle = runner.exec(createVitestRunSpec(input, outputFile));
@@ -72501,8 +72501,8 @@ async function runVitestWithRunner(runner, input) {
72501
72501
  try {
72502
72502
  const runResult = await waitForVitest(handle, timeoutMs, input.signal);
72503
72503
  await Promise.all([stdout, stderr]);
72504
- const raw = await readFile30(outputFile, "utf8");
72505
- const cases = mapVitestCases(JSON.parse(raw), path103.resolve(input.testsDir));
72504
+ const raw = await readFile31(outputFile, "utf8");
72505
+ const cases = mapVitestCases(JSON.parse(raw), path104.resolve(input.testsDir));
72506
72506
  if (runResult.exitCode !== 0 && cases.every((result) => result.passed)) {
72507
72507
  throw new VitestError(`Vitest exited with code ${runResult.exitCode}.`);
72508
72508
  }
@@ -72528,13 +72528,13 @@ function createVitestRunSpec(input, outputFile) {
72528
72528
  resolveVitestBin(),
72529
72529
  "run",
72530
72530
  "--root",
72531
- path103.resolve(input.testsDir),
72531
+ path104.resolve(input.testsDir),
72532
72532
  "--reporter=json",
72533
72533
  "--outputFile",
72534
72534
  outputFile
72535
72535
  ],
72536
- cwd: path103.resolve(input.testsDir),
72537
- env: createVitestEnv(path103.resolve(input.cloneDir), path103.resolve(input.oracleDir)),
72536
+ cwd: path104.resolve(input.testsDir),
72537
+ env: createVitestEnv(path104.resolve(input.cloneDir), path104.resolve(input.oracleDir)),
72538
72538
  stdout: "pipe",
72539
72539
  stderr: "pipe",
72540
72540
  signal: input.signal
@@ -72542,7 +72542,7 @@ function createVitestRunSpec(input, outputFile) {
72542
72542
  }
72543
72543
  function resolveVitestBin() {
72544
72544
  const packageJsonPath = require2.resolve("vitest/package.json");
72545
- return path103.join(path103.dirname(path103.dirname(packageJsonPath)), ".bin", "vitest");
72545
+ return path104.join(path104.dirname(path104.dirname(packageJsonPath)), ".bin", "vitest");
72546
72546
  }
72547
72547
  function createVitestEnv(cloneDir, oracleDir) {
72548
72548
  const env = Object.fromEntries(
@@ -72618,8 +72618,8 @@ function formatFileName(fileName, testsDir) {
72618
72618
  if (typeof fileName !== "string" || fileName.length === 0) {
72619
72619
  return "<unknown>";
72620
72620
  }
72621
- const relative6 = path103.relative(testsDir, fileName);
72622
- if (relative6.length === 0 || relative6.startsWith("..") || path103.isAbsolute(relative6)) {
72621
+ const relative6 = path104.relative(testsDir, fileName);
72622
+ if (relative6.length === 0 || relative6.startsWith("..") || path104.isAbsolute(relative6)) {
72623
72623
  return normalizePath2(fileName);
72624
72624
  }
72625
72625
  return normalizePath2(relative6);
@@ -72640,7 +72640,7 @@ function failureMessage(assertion) {
72640
72640
  return typeof assertion.message === "string" && assertion.message.length > 0 ? assertion.message : void 0;
72641
72641
  }
72642
72642
  function normalizePath2(fileName) {
72643
- return fileName.split(path103.sep).join("/");
72643
+ return fileName.split(path104.sep).join("/");
72644
72644
  }
72645
72645
  function drainStream(stream) {
72646
72646
  if (stream === null) {
@@ -72684,17 +72684,17 @@ var init_vitest_runner = __esm({
72684
72684
  });
72685
72685
 
72686
72686
  // packages/agent-eval/src/run/scorer.ts
72687
- import { readFile as readFile31 } from "node:fs/promises";
72688
- import path104 from "node:path";
72687
+ import { readFile as readFile32 } from "node:fs/promises";
72688
+ import path105 from "node:path";
72689
72689
  async function runScorer(input) {
72690
72690
  const scorer = resolveScorer(input.evalDef);
72691
- const absoluteEvalDir = path104.resolve(input.evalDir);
72692
- const absoluteCloneDir = path104.resolve(input.cloneDir);
72691
+ const absoluteEvalDir = path105.resolve(input.evalDir);
72692
+ const absoluteCloneDir = path105.resolve(input.cloneDir);
72693
72693
  const oracleDir = resolveContainedPath(absoluteEvalDir, input.evalDef.oracle.path, "oracle.path");
72694
72694
  await assertCanonicalContainedPath(absoluteEvalDir, oracleDir, "oracle.path");
72695
72695
  if (scorer.kind === "vitest") {
72696
72696
  return runVitest({
72697
- testsDir: path104.join(oracleDir, "tests"),
72697
+ testsDir: path105.join(oracleDir, "tests"),
72698
72698
  cloneDir: absoluteCloneDir,
72699
72699
  oracleDir,
72700
72700
  timeoutMs: defaultVitestTimeoutMs,
@@ -72785,7 +72785,7 @@ function createScorerEnv(cloneDir, oracleDir) {
72785
72785
  }
72786
72786
  async function readScorerResult(resultPath, result) {
72787
72787
  try {
72788
- return await readFile31(resultPath, "utf8");
72788
+ return await readFile32(resultPath, "utf8");
72789
72789
  } catch (error3) {
72790
72790
  if (isMissingFileError7(error3)) {
72791
72791
  if (result.exitCode !== 0) {
@@ -72923,16 +72923,16 @@ var init_scorer = __esm({
72923
72923
 
72924
72924
  // packages/agent-eval/src/check/check.ts
72925
72925
  import { cp, mkdir as mkdir25, stat as stat21 } from "node:fs/promises";
72926
- import path105 from "node:path";
72926
+ import path106 from "node:path";
72927
72927
  async function evalCheck(opts) {
72928
72928
  const startedAt = Date.now();
72929
72929
  const source = await openSource(opts.sourceDir);
72930
72930
  const evalDef = await loadEval(source, opts.evalId);
72931
72931
  const config = await loadSourceConfig(source);
72932
72932
  const outDir = resolveOutputDirectory(source.rootDir, config.out);
72933
- const cloneDir = path105.join(outDir, ".check", opts.evalId, isoUtcSafe(/* @__PURE__ */ new Date()), "clone");
72933
+ const cloneDir = path106.join(outDir, ".check", opts.evalId, isoUtcSafe(/* @__PURE__ */ new Date()), "clone");
72934
72934
  opts.signal?.throwIfAborted();
72935
- await mkdir25(path105.dirname(cloneDir), { recursive: true });
72935
+ await mkdir25(path106.dirname(cloneDir), { recursive: true });
72936
72936
  await cloneTarget({
72937
72937
  repo: evalDef.target.repo,
72938
72938
  ref: evalDef.target.ref,
@@ -72940,12 +72940,12 @@ async function evalCheck(opts) {
72940
72940
  signal: opts.signal
72941
72941
  });
72942
72942
  opts.signal?.throwIfAborted();
72943
- const evalDir = path105.join(source.rootDir, opts.evalId);
72943
+ const evalDir = path106.join(source.rootDir, opts.evalId);
72944
72944
  const oracleDir = resolveContainedPath(evalDir, evalDef.oracle.path, "oracle.path");
72945
- await copyDirectoryIfPresent(path105.join(evalDir, "starter"), cloneDir);
72945
+ await copyDirectoryIfPresent(path106.join(evalDir, "starter"), cloneDir);
72946
72946
  opts.signal?.throwIfAborted();
72947
72947
  await copyOracleSolution({
72948
- solutionDir: path105.join(oracleDir, "solution"),
72948
+ solutionDir: path106.join(oracleDir, "solution"),
72949
72949
  cloneDir,
72950
72950
  solutionDest: evalDef.oracle.solutionDest
72951
72951
  });
@@ -72964,7 +72964,7 @@ async function evalCheck(opts) {
72964
72964
  };
72965
72965
  }
72966
72966
  function resolveOutputDirectory(sourceDir, outDir) {
72967
- return path105.isAbsolute(outDir) ? outDir : path105.resolve(sourceDir, outDir);
72967
+ return path106.isAbsolute(outDir) ? outDir : path106.resolve(sourceDir, outDir);
72968
72968
  }
72969
72969
  function isoUtcSafe(now) {
72970
72970
  return now.toISOString().replace(/[:.]/g, "-");
@@ -72996,12 +72996,12 @@ async function copyOracleSolution(input) {
72996
72996
  });
72997
72997
  }
72998
72998
  function resolveCloneRelativePath(cloneDir, relativePath) {
72999
- if (path105.isAbsolute(relativePath)) {
72999
+ if (path106.isAbsolute(relativePath)) {
73000
73000
  throw new Error(`oracle.solution_dest must be relative to the clone root.`);
73001
73001
  }
73002
- const resolved = path105.resolve(cloneDir, relativePath);
73003
- const relative6 = path105.relative(cloneDir, resolved);
73004
- if (relative6 === ".." || relative6.startsWith(`..${path105.sep}`)) {
73002
+ const resolved = path106.resolve(cloneDir, relativePath);
73003
+ const relative6 = path106.relative(cloneDir, resolved);
73004
+ if (relative6 === ".." || relative6.startsWith(`..${path106.sep}`)) {
73005
73005
  throw new Error(`oracle.solution_dest must stay within the clone root.`);
73006
73006
  }
73007
73007
  return resolved;
@@ -73023,15 +73023,15 @@ var init_check = __esm({
73023
73023
 
73024
73024
  // packages/agent-eval/src/init/init.ts
73025
73025
  import { lstat as lstat24, mkdir as mkdir26, rm as rm7, writeFile as writeFile20 } from "node:fs/promises";
73026
- import path106 from "node:path";
73026
+ import path107 from "node:path";
73027
73027
  import { stringify as stringifyYaml3 } from "yaml";
73028
73028
  async function evalInit(opts) {
73029
73029
  validateInitName(opts.name);
73030
- if (!path106.isAbsolute(opts.sourceDir)) {
73030
+ if (!path107.isAbsolute(opts.sourceDir)) {
73031
73031
  throw new Error("sourceDir must be absolute.");
73032
73032
  }
73033
73033
  await assertSafeSourceDirectory(opts.sourceDir);
73034
- const evalDir = path106.join(opts.sourceDir, opts.name);
73034
+ const evalDir = path107.join(opts.sourceDir, opts.name);
73035
73035
  try {
73036
73036
  await mkdir26(evalDir);
73037
73037
  } catch (error3) {
@@ -73041,15 +73041,15 @@ async function evalInit(opts) {
73041
73041
  throw error3;
73042
73042
  }
73043
73043
  try {
73044
- await mkdir26(path106.join(evalDir, "oracle", "tests"), { recursive: true });
73045
- await mkdir26(path106.join(evalDir, "oracle", "solution"), { recursive: true });
73046
- await mkdir26(path106.join(evalDir, "starter"), { recursive: true });
73044
+ await mkdir26(path107.join(evalDir, "oracle", "tests"), { recursive: true });
73045
+ await mkdir26(path107.join(evalDir, "oracle", "solution"), { recursive: true });
73046
+ await mkdir26(path107.join(evalDir, "starter"), { recursive: true });
73047
73047
  const writes = await Promise.allSettled([
73048
- writeFile20(path106.join(evalDir, "eval.yaml"), renderEvalYaml(opts)),
73049
- writeFile20(path106.join(evalDir, "plan.md"), renderPlanMarkdown(opts.kind)),
73050
- writeFile20(path106.join(evalDir, "oracle", "tests", "example.test.ts"), renderExampleTest()),
73051
- writeFile20(path106.join(evalDir, "oracle", "solution", "OUTPUT.md"), "ok\n"),
73052
- writeFile20(path106.join(evalDir, "starter", ".gitkeep"), "")
73048
+ writeFile20(path107.join(evalDir, "eval.yaml"), renderEvalYaml(opts)),
73049
+ writeFile20(path107.join(evalDir, "plan.md"), renderPlanMarkdown(opts.kind)),
73050
+ writeFile20(path107.join(evalDir, "oracle", "tests", "example.test.ts"), renderExampleTest()),
73051
+ writeFile20(path107.join(evalDir, "oracle", "solution", "OUTPUT.md"), "ok\n"),
73052
+ writeFile20(path107.join(evalDir, "starter", ".gitkeep"), "")
73053
73053
  ]);
73054
73054
  const failedWrite = writes.find((result) => result.status === "rejected");
73055
73055
  if (failedWrite !== void 0) {
@@ -73228,12 +73228,12 @@ var init_init = __esm({
73228
73228
 
73229
73229
  // packages/agent-eval/src/lint/lint.ts
73230
73230
  import nodeFs14 from "node:fs/promises";
73231
- import path107 from "node:path";
73231
+ import path108 from "node:path";
73232
73232
  import { parse as parseYaml6 } from "yaml";
73233
73233
  async function evalLint(input) {
73234
73234
  assertSafeEvalId(input.evalId);
73235
73235
  const fs27 = nodeFs14;
73236
- const evalDir = path107.join(input.sourceDir, input.evalId);
73236
+ const evalDir = path108.join(input.sourceDir, input.evalId);
73237
73237
  const issues = [];
73238
73238
  const parsedEvalYaml = await lintEvalYaml(evalDir, issues, fs27);
73239
73239
  const frontmatter = await lintPlan(evalDir, issues, fs27);
@@ -73243,10 +73243,10 @@ async function evalLint(input) {
73243
73243
  severity: "error",
73244
73244
  code: "E003",
73245
73245
  message: `plan.md frontmatter kind must be one of: ${allowedPlanKinds2.join(", ")}.`,
73246
- path: path107.join(evalDir, "plan.md")
73246
+ path: path108.join(evalDir, "plan.md")
73247
73247
  });
73248
73248
  }
73249
- const oracleDir = path107.join(evalDir, oraclePath);
73249
+ const oracleDir = path108.join(evalDir, oraclePath);
73250
73250
  if (!await isDirectory3(oracleDir, fs27)) {
73251
73251
  issues.push({
73252
73252
  severity: "error",
@@ -73256,24 +73256,24 @@ async function evalLint(input) {
73256
73256
  });
73257
73257
  }
73258
73258
  const hasScorerCommand = readScorerCommand(parsedEvalYaml.valid, parsedEvalYaml.raw) !== void 0;
73259
- const hasOracleTests = await hasDefaultOracleTests(path107.join(oracleDir, "tests"), fs27);
73259
+ const hasOracleTests = await hasDefaultOracleTests(path108.join(oracleDir, "tests"), fs27);
73260
73260
  if (!hasScorerCommand && !hasOracleTests) {
73261
73261
  issues.push({
73262
73262
  severity: "error",
73263
73263
  code: "E005",
73264
73264
  message: "No scorer.command and no oracle/tests/*.test.ts files found.",
73265
- path: path107.join(oracleDir, "tests")
73265
+ path: path108.join(oracleDir, "tests")
73266
73266
  });
73267
73267
  }
73268
- if (!await hasDirectoryEntries(path107.join(oracleDir, "solution"), fs27)) {
73268
+ if (!await hasDirectoryEntries(path108.join(oracleDir, "solution"), fs27)) {
73269
73269
  issues.push({
73270
73270
  severity: "warning",
73271
73271
  code: "W001",
73272
73272
  message: `${oraclePath}/solution/ is missing or empty; eval check will fail.`,
73273
- path: path107.join(oracleDir, "solution")
73273
+ path: path108.join(oracleDir, "solution")
73274
73274
  });
73275
73275
  }
73276
- const starterDir = path107.join(evalDir, "starter");
73276
+ const starterDir = path108.join(evalDir, "starter");
73277
73277
  if (await isDirectory3(starterDir, fs27) && !await hasDirectoryEntries(starterDir, fs27)) {
73278
73278
  issues.push({
73279
73279
  severity: "warning",
@@ -73288,7 +73288,7 @@ async function evalLint(input) {
73288
73288
  severity: "warning",
73289
73289
  code: "W003",
73290
73290
  message: "budget.wall_clock_ms is below 60000 and is likely too short.",
73291
- path: path107.join(evalDir, "eval.yaml")
73291
+ path: path108.join(evalDir, "eval.yaml")
73292
73292
  });
73293
73293
  }
73294
73294
  const targetRef = readTargetRef(parsedEvalYaml.valid, parsedEvalYaml.raw);
@@ -73297,7 +73297,7 @@ async function evalLint(input) {
73297
73297
  severity: "warning",
73298
73298
  code: "W004",
73299
73299
  message: `target.ref "${targetRef}" is not a full commit SHA; pin it to a commit SHA.`,
73300
- path: path107.join(evalDir, "eval.yaml")
73300
+ path: path108.join(evalDir, "eval.yaml")
73301
73301
  });
73302
73302
  }
73303
73303
  return {
@@ -73306,8 +73306,8 @@ async function evalLint(input) {
73306
73306
  };
73307
73307
  }
73308
73308
  async function lintEvalYaml(evalDir, issues, fs27) {
73309
- const evalYamlPath = path107.join(evalDir, "eval.yaml");
73310
- if (!await assertFsCanonicalContainedPathIfPresent(fs27, path107.dirname(evalDir), evalYamlPath, "eval.yaml")) {
73309
+ const evalYamlPath = path108.join(evalDir, "eval.yaml");
73310
+ if (!await assertFsCanonicalContainedPathIfPresent(fs27, path108.dirname(evalDir), evalYamlPath, "eval.yaml")) {
73311
73311
  issues.push({ severity: "error", code: "E001", message: "eval.yaml is missing.", path: evalYamlPath });
73312
73312
  return { raw: void 0, valid: void 0 };
73313
73313
  }
@@ -73339,8 +73339,8 @@ async function lintEvalYaml(evalDir, issues, fs27) {
73339
73339
  }
73340
73340
  }
73341
73341
  async function lintPlan(evalDir, issues, fs27) {
73342
- const planPath = path107.join(evalDir, "plan.md");
73343
- if (!await assertFsCanonicalContainedPathIfPresent(fs27, path107.dirname(evalDir), planPath, "plan.md")) {
73342
+ const planPath = path108.join(evalDir, "plan.md");
73343
+ if (!await assertFsCanonicalContainedPathIfPresent(fs27, path108.dirname(evalDir), planPath, "plan.md")) {
73344
73344
  issues.push({ severity: "error", code: "E002", message: "plan.md is missing.", path: planPath });
73345
73345
  return void 0;
73346
73346
  }
@@ -73527,11 +73527,11 @@ var init_lint = __esm({
73527
73527
  });
73528
73528
 
73529
73529
  // packages/agent-eval/src/report/load.ts
73530
- import { readdir as readdir22, readFile as readFile32, realpath as realpath6 } from "node:fs/promises";
73531
- import path108 from "node:path";
73530
+ import { readdir as readdir22, readFile as readFile33, realpath as realpath7 } from "node:fs/promises";
73531
+ import path109 from "node:path";
73532
73532
  async function loadRunResult(runId, outDir = defaultOutDir) {
73533
73533
  assertValidRunId(runId);
73534
- const directPath = path108.join(outDir, runId, resultFileName);
73534
+ const directPath = path109.join(outDir, runId, resultFileName);
73535
73535
  try {
73536
73536
  await assertCanonicalOutputFile(outDir, directPath);
73537
73537
  return enrichMatchedRunResult(runId, directPath);
@@ -73562,7 +73562,7 @@ async function loadLatestMatrix(outDir = defaultOutDir) {
73562
73562
  if (!entry.isDirectory() || !hasTimestampPrefix(entry.name)) {
73563
73563
  continue;
73564
73564
  }
73565
- const matrixDir = path108.join(outDir, entry.name);
73565
+ const matrixDir = path109.join(outDir, entry.name);
73566
73566
  const aggregateFiles = await listAggregateFiles(matrixDir);
73567
73567
  if (aggregateFiles.length > 0) {
73568
73568
  matrices.push({
@@ -73577,9 +73577,9 @@ async function loadLatestMatrix(outDir = defaultOutDir) {
73577
73577
  }
73578
73578
  const cells = await Promise.all(
73579
73579
  latest.aggregateFiles.map(async (fileName) => {
73580
- const filePath = path108.join(outDir, latest.matrixId, fileName);
73581
- const cell = parseJson2(await readFile32(filePath, "utf8"), filePath);
73582
- return enrichAggregatedCell(cell, path108.join(outDir, latest.matrixId));
73580
+ const filePath = path109.join(outDir, latest.matrixId, fileName);
73581
+ const cell = parseJson2(await readFile33(filePath, "utf8"), filePath);
73582
+ return enrichAggregatedCell(cell, path109.join(outDir, latest.matrixId));
73583
73583
  })
73584
73584
  );
73585
73585
  return {
@@ -73603,11 +73603,11 @@ async function enrichAggregatedCell(cell, outDir) {
73603
73603
  }
73604
73604
  }
73605
73605
  async function enrichMatchedRunResult(runId, resultPath) {
73606
- const result = parseJson2(await readFile32(resultPath, "utf8"), resultPath);
73606
+ const result = parseJson2(await readFile33(resultPath, "utf8"), resultPath);
73607
73607
  if (result.runId !== runId) {
73608
73608
  throw new Error(`Run result "${runId}" embeds mismatched runId "${result.runId}"`);
73609
73609
  }
73610
- return enrichRunResult(result, path108.dirname(resultPath));
73610
+ return enrichRunResult(result, path109.dirname(resultPath));
73611
73611
  }
73612
73612
  function matchesCell(result, cell) {
73613
73613
  return result.eval === cell.eval && result.agent === cell.agent && result.model === cell.model && result.planKind === cell.planKind;
@@ -73622,8 +73622,8 @@ async function collectRunResults(dir, entries, results) {
73622
73622
  const hasResult = entries.some((entry) => entry.isFile() && entry.name === resultFileName);
73623
73623
  if (hasResult) {
73624
73624
  results.push({
73625
- runId: path108.basename(dir),
73626
- resultPath: path108.join(dir, resultFileName)
73625
+ runId: path109.basename(dir),
73626
+ resultPath: path109.join(dir, resultFileName)
73627
73627
  });
73628
73628
  return;
73629
73629
  }
@@ -73631,7 +73631,7 @@ async function collectRunResults(dir, entries, results) {
73631
73631
  if (!entry.isDirectory()) {
73632
73632
  continue;
73633
73633
  }
73634
- const childDir = path108.join(dir, entry.name);
73634
+ const childDir = path109.join(dir, entry.name);
73635
73635
  const childEntries = await readDir(childDir);
73636
73636
  await collectRunResults(childDir, childEntries, results);
73637
73637
  }
@@ -73669,13 +73669,13 @@ async function enrichRunResult(result, runDir) {
73669
73669
  }
73670
73670
  return {
73671
73671
  ...result,
73672
- trace: await loadTraceSummary(path108.join(runDir, "trace.json"), path108.dirname(runDir))
73672
+ trace: await loadTraceSummary(path109.join(runDir, "trace.json"), path109.dirname(runDir))
73673
73673
  };
73674
73674
  }
73675
73675
  async function loadTraceSummary(tracePath, outDir) {
73676
73676
  try {
73677
73677
  await assertCanonicalOutputFile(outDir, tracePath);
73678
- const trace = parseJson2(await readFile32(tracePath, "utf8"), tracePath);
73678
+ const trace = parseJson2(await readFile33(tracePath, "utf8"), tracePath);
73679
73679
  return {
73680
73680
  available: true,
73681
73681
  eventCount: trace.events.length,
@@ -73690,15 +73690,15 @@ async function loadTraceSummary(tracePath, outDir) {
73690
73690
  }
73691
73691
  }
73692
73692
  async function assertCanonicalOutputFile(outDir, filePath) {
73693
- const canonicalOutDir = await realpath6(path108.resolve(outDir));
73694
- const canonicalFilePath = await realpath6(filePath);
73695
- const relative6 = path108.relative(canonicalOutDir, canonicalFilePath);
73696
- if (relative6 === ".." || relative6.startsWith(`..${path108.sep}`)) {
73693
+ const canonicalOutDir = await realpath7(path109.resolve(outDir));
73694
+ const canonicalFilePath = await realpath7(filePath);
73695
+ const relative6 = path109.relative(canonicalOutDir, canonicalFilePath);
73696
+ if (relative6 === ".." || relative6.startsWith(`..${path109.sep}`)) {
73697
73697
  throw new Error("run result must stay within the canonical output directory.");
73698
73698
  }
73699
73699
  }
73700
73700
  function assertValidRunId(runId) {
73701
- if (runId.length === 0 || runId === "." || runId === ".." || path108.isAbsolute(runId) || path108.win32.isAbsolute(runId) || runId.includes("/") || runId.includes("\\")) {
73701
+ if (runId.length === 0 || runId === "." || runId === ".." || path109.isAbsolute(runId) || path109.win32.isAbsolute(runId) || runId.includes("/") || runId.includes("\\")) {
73702
73702
  throw new Error(`Invalid run id "${runId}"`);
73703
73703
  }
73704
73704
  }
@@ -73867,14 +73867,14 @@ var init_budget = __esm({
73867
73867
 
73868
73868
  // packages/agent-eval/src/run/cheat.ts
73869
73869
  import os14 from "node:os";
73870
- import path109 from "node:path";
73870
+ import path110 from "node:path";
73871
73871
  function canContainNewEvidence(event) {
73872
73872
  return event.id !== void 0 || event.phase === "start" || event.paths.length > 0 || event.inspection !== void 0;
73873
73873
  }
73874
73874
  function defaultAllowedPaths() {
73875
73875
  const allowedPaths = [
73876
73876
  os14.tmpdir(),
73877
- path109.join(os14.homedir(), ".cache"),
73877
+ path110.join(os14.homedir(), ".cache"),
73878
73878
  "/usr/bin",
73879
73879
  "/usr/local/bin",
73880
73880
  "/bin"
@@ -73891,17 +73891,17 @@ function isUninspectableOperation(operation) {
73891
73891
  return isObservedOperation(operation);
73892
73892
  }
73893
73893
  function resolveAgainstClone(cloneDir, targetPath) {
73894
- if (path109.isAbsolute(targetPath)) {
73895
- return path109.resolve(targetPath);
73894
+ if (path110.isAbsolute(targetPath)) {
73895
+ return path110.resolve(targetPath);
73896
73896
  }
73897
- return path109.resolve(cloneDir, targetPath);
73897
+ return path110.resolve(cloneDir, targetPath);
73898
73898
  }
73899
73899
  function isUnderAny(targetPath, roots) {
73900
73900
  return roots.some((root) => isUnderPath(targetPath, root));
73901
73901
  }
73902
73902
  function isUnderPath(targetPath, rootPath) {
73903
- const relative6 = path109.relative(rootPath, targetPath);
73904
- return relative6 === "" || !relative6.startsWith("..") && !path109.isAbsolute(relative6);
73903
+ const relative6 = path110.relative(rootPath, targetPath);
73904
+ return relative6 === "" || !relative6.startsWith("..") && !path110.isAbsolute(relative6);
73905
73905
  }
73906
73906
  var CheatFilter;
73907
73907
  var init_cheat = __esm({
@@ -73914,8 +73914,8 @@ var init_cheat = __esm({
73914
73914
  uninspectable = [];
73915
73915
  observedEvidence = /* @__PURE__ */ new Set();
73916
73916
  constructor(input) {
73917
- this.cloneDir = path109.resolve(input.cloneDir);
73918
- this.allowedPaths = defaultAllowedPaths().concat(input.allowedPaths ?? []).map((allowedPath) => path109.resolve(allowedPath));
73917
+ this.cloneDir = path110.resolve(input.cloneDir);
73918
+ this.allowedPaths = defaultAllowedPaths().concat(input.allowedPaths ?? []).map((allowedPath) => path110.resolve(allowedPath));
73919
73919
  }
73920
73920
  onEvent(event) {
73921
73921
  if (!isObservedOperation(event.operation) || !canContainNewEvidence(event)) {
@@ -74032,7 +74032,7 @@ var init_dispatch = __esm({
74032
74032
 
74033
74033
  // packages/agent-eval/src/run/judge.ts
74034
74034
  import * as fs10 from "node:fs/promises";
74035
- import path110 from "node:path";
74035
+ import path111 from "node:path";
74036
74036
  async function judgeRun(input) {
74037
74037
  const judgeAgent = input.spec.agent === input.agentUnderTest ? "codex" : input.spec.agent;
74038
74038
  const rubric = [...input.spec.rubric];
@@ -74118,7 +74118,7 @@ async function buildMetricJudgePrompt(input) {
74118
74118
  ].join("\n");
74119
74119
  }
74120
74120
  async function listFilesWithSizes(cloneDir) {
74121
- const absoluteCloneDir = path110.resolve(cloneDir);
74121
+ const absoluteCloneDir = path111.resolve(cloneDir);
74122
74122
  const files = [];
74123
74123
  await collectFiles(absoluteCloneDir, absoluteCloneDir, files);
74124
74124
  return files.sort((left, right) => left.path.localeCompare(right.path));
@@ -74126,7 +74126,7 @@ async function listFilesWithSizes(cloneDir) {
74126
74126
  async function collectFiles(rootDir, currentDir2, files) {
74127
74127
  const entries = await fs10.readdir(currentDir2, { withFileTypes: true });
74128
74128
  for (const entry of entries) {
74129
- const absolutePath = path110.join(currentDir2, entry.name);
74129
+ const absolutePath = path111.join(currentDir2, entry.name);
74130
74130
  if (entry.isDirectory()) {
74131
74131
  await collectFiles(rootDir, absolutePath, files);
74132
74132
  continue;
@@ -74136,7 +74136,7 @@ async function collectFiles(rootDir, currentDir2, files) {
74136
74136
  }
74137
74137
  const stat33 = await fs10.stat(absolutePath);
74138
74138
  files.push({
74139
- path: path110.relative(rootDir, absolutePath),
74139
+ path: path111.relative(rootDir, absolutePath),
74140
74140
  bytes: stat33.size
74141
74141
  });
74142
74142
  }
@@ -74409,7 +74409,7 @@ var init_metrics = __esm({
74409
74409
  });
74410
74410
 
74411
74411
  // packages/agent-eval/src/run/oracle.ts
74412
- import path111 from "node:path";
74412
+ import path112 from "node:path";
74413
74413
  async function verifyOracle(source, id) {
74414
74414
  const evalDef = await loadEval(source, id);
74415
74415
  if (evalDef.verify === void 0) {
@@ -74418,8 +74418,8 @@ async function verifyOracle(source, id) {
74418
74418
  output: "no verify command configured"
74419
74419
  };
74420
74420
  }
74421
- const evalDir = path111.resolve(source.rootDir, id);
74422
- const oracleDir = path111.join(evalDir, "oracle");
74421
+ const evalDir = path112.resolve(source.rootDir, id);
74422
+ const oracleDir = path112.join(evalDir, "oracle");
74423
74423
  await assertCanonicalContainedPath(evalDir, oracleDir, "oracle.path");
74424
74424
  const result = await runVerifyCommand(createHostRunner(), {
74425
74425
  command: evalDef.verify.command,
@@ -74920,17 +74920,17 @@ var init_normalize = __esm({
74920
74920
 
74921
74921
  // packages/agent-eval/src/run/result-writer.ts
74922
74922
  import { randomUUID as randomUUID13 } from "node:crypto";
74923
- import { lstat as lstat25, mkdir as mkdir27, readFile as readFile33, rename as rename20, rm as rm8, writeFile as writeFile21 } from "node:fs/promises";
74924
- import path112 from "node:path";
74923
+ import { lstat as lstat25, mkdir as mkdir27, readFile as readFile34, rename as rename20, rm as rm8, writeFile as writeFile21 } from "node:fs/promises";
74924
+ import path113 from "node:path";
74925
74925
  async function writeRunEvidence(runDir, parts) {
74926
74926
  await assertSafeRunDirectory(runDir);
74927
74927
  await mkdir27(runDir, { recursive: true });
74928
74928
  const filePaths = [
74929
- path112.join(runDir, "events.jsonl"),
74930
- path112.join(runDir, "trace.json"),
74931
- path112.join(runDir, "cheat-report.json"),
74932
- path112.join(runDir, "plan.md"),
74933
- path112.join(runDir, "eval.yaml")
74929
+ path113.join(runDir, "events.jsonl"),
74930
+ path113.join(runDir, "trace.json"),
74931
+ path113.join(runDir, "cheat-report.json"),
74932
+ path113.join(runDir, "plan.md"),
74933
+ path113.join(runDir, "eval.yaml")
74934
74934
  ];
74935
74935
  const priorContents = await Promise.all(filePaths.map((filePath) => readExistingFile(filePath)));
74936
74936
  const committedPaths = [];
@@ -74967,12 +74967,12 @@ async function assertSafeRunDirectory(runDir) {
74967
74967
  }
74968
74968
  }
74969
74969
  async function writeRunCompletion(runDir, parts) {
74970
- const resultPath = path112.join(runDir, "result.json");
74970
+ const resultPath = path113.join(runDir, "result.json");
74971
74971
  const priorResult = await readExistingFile(resultPath);
74972
74972
  await writeRunResult(runDir, parts.result);
74973
74973
  try {
74974
74974
  if (parts.judge !== void 0) {
74975
- await atomicWrite(path112.join(runDir, "judge.json"), `${JSON.stringify(parts.judge, null, 2)}
74975
+ await atomicWrite(path113.join(runDir, "judge.json"), `${JSON.stringify(parts.judge, null, 2)}
74976
74976
  `);
74977
74977
  }
74978
74978
  } catch (error3) {
@@ -74981,13 +74981,13 @@ async function writeRunCompletion(runDir, parts) {
74981
74981
  }
74982
74982
  }
74983
74983
  async function writeRunResult(runDir, result) {
74984
- await atomicWrite(path112.join(runDir, "result.json"), `${JSON.stringify(result, null, 2)}
74984
+ await atomicWrite(path113.join(runDir, "result.json"), `${JSON.stringify(result, null, 2)}
74985
74985
  `);
74986
74986
  }
74987
74987
  async function atomicWrite(filePath, content) {
74988
- const tempPath = path112.join(
74989
- path112.dirname(filePath),
74990
- `.${path112.basename(filePath)}.${process.pid}.${randomUUID13()}.tmp`
74988
+ const tempPath = path113.join(
74989
+ path113.dirname(filePath),
74990
+ `.${path113.basename(filePath)}.${process.pid}.${randomUUID13()}.tmp`
74991
74991
  );
74992
74992
  try {
74993
74993
  await writeFile21(tempPath, content, "utf8");
@@ -75009,7 +75009,7 @@ function isMissingPath10(error3) {
75009
75009
  }
75010
75010
  async function readExistingFile(filePath) {
75011
75011
  try {
75012
- return await readFile33(filePath, "utf8");
75012
+ return await readFile34(filePath, "utf8");
75013
75013
  } catch (error3) {
75014
75014
  if (isMissingPath10(error3)) {
75015
75015
  return void 0;
@@ -75031,8 +75031,8 @@ var init_result_writer = __esm({
75031
75031
  });
75032
75032
 
75033
75033
  // packages/agent-eval/src/run/run.ts
75034
- import { cp as cp2, mkdir as mkdir28, readFile as readFile34, stat as stat23 } from "node:fs/promises";
75035
- import path113 from "node:path";
75034
+ import { cp as cp2, mkdir as mkdir28, readFile as readFile35, stat as stat23 } from "node:fs/promises";
75035
+ import path114 from "node:path";
75036
75036
  async function runEval(opts) {
75037
75037
  const startedAt = Date.now();
75038
75038
  const source = await openSource(opts.sourceDir);
@@ -75051,12 +75051,12 @@ ${oracleVerification.output}`);
75051
75051
  repeatIndex: opts.repeatIndex,
75052
75052
  now: /* @__PURE__ */ new Date()
75053
75053
  });
75054
- const runDir = path113.join(opts.outDir ?? "runs", runId);
75055
- await mkdir28(path113.dirname(runDir), { recursive: true });
75054
+ const runDir = path114.join(opts.outDir ?? "runs", runId);
75055
+ await mkdir28(path114.dirname(runDir), { recursive: true });
75056
75056
  {
75057
75057
  await mkdir28(runDir, { recursive: true });
75058
75058
  const controller = new AbortController();
75059
- const cloneDir = path113.join(runDir, "clone");
75059
+ const cloneDir = path114.join(runDir, "clone");
75060
75060
  await cloneTarget({
75061
75061
  repo: evalDef.target.repo,
75062
75062
  ref: evalDef.target.ref,
@@ -75064,13 +75064,13 @@ ${oracleVerification.output}`);
75064
75064
  cacheDir: opts.cloneCacheDir,
75065
75065
  signal: controller.signal
75066
75066
  });
75067
- await copyStarterIfPresent(path113.join(source.rootDir, opts.evalId, "starter"), cloneDir);
75068
- const sourcePlanPath = path113.join(source.rootDir, opts.evalId, "plan.md");
75069
- const sourceEvalYamlPath = path113.join(source.rootDir, opts.evalId, "eval.yaml");
75070
- const planMd = await readFile34(sourcePlanPath, "utf8");
75071
- const evalYaml = await readFile34(sourceEvalYamlPath, "utf8");
75072
- const clonedPlanPath = path113.join(cloneDir, evalDef.target.planDest);
75073
- await mkdir28(path113.dirname(clonedPlanPath), { recursive: true });
75067
+ await copyStarterIfPresent(path114.join(source.rootDir, opts.evalId, "starter"), cloneDir);
75068
+ const sourcePlanPath = path114.join(source.rootDir, opts.evalId, "plan.md");
75069
+ const sourceEvalYamlPath = path114.join(source.rootDir, opts.evalId, "eval.yaml");
75070
+ const planMd = await readFile35(sourcePlanPath, "utf8");
75071
+ const evalYaml = await readFile35(sourceEvalYamlPath, "utf8");
75072
+ const clonedPlanPath = path114.join(cloneDir, evalDef.target.planDest);
75073
+ await mkdir28(path114.dirname(clonedPlanPath), { recursive: true });
75074
75074
  await cp2(sourcePlanPath, clonedPlanPath);
75075
75075
  const events = [];
75076
75076
  const traceNormalizer = createTraceNormalizer();
@@ -75133,7 +75133,7 @@ ${oracleVerification.output}`);
75133
75133
  try {
75134
75134
  testsResult = await runScorer({
75135
75135
  evalDef,
75136
- evalDir: path113.join(source.rootDir, opts.evalId),
75136
+ evalDir: path114.join(source.rootDir, opts.evalId),
75137
75137
  cloneDir
75138
75138
  });
75139
75139
  } catch (error3) {
@@ -75153,7 +75153,7 @@ ${oracleVerification.output}`);
75153
75153
  judgeResult = await judgeRun({
75154
75154
  evalDef,
75155
75155
  cloneDir,
75156
- traceJsonPath: path113.join(runDir, "trace.json"),
75156
+ traceJsonPath: path114.join(runDir, "trace.json"),
75157
75157
  trace,
75158
75158
  testsResult,
75159
75159
  spec: judgeSpec,
@@ -75177,7 +75177,7 @@ ${oracleVerification.output}`);
75177
75177
  metricResults = await executeMetrics({
75178
75178
  evalDef,
75179
75179
  cloneDir,
75180
- traceJsonPath: path113.join(runDir, "trace.json"),
75180
+ traceJsonPath: path114.join(runDir, "trace.json"),
75181
75181
  trace,
75182
75182
  oracleOutcome: testsResult,
75183
75183
  agentUnderTest: opts.agent,
@@ -75572,7 +75572,7 @@ var init_run3 = __esm({
75572
75572
 
75573
75573
  // packages/agent-eval/src/run/matrix.ts
75574
75574
  import { mkdir as mkdir29, writeFile as writeFile22 } from "node:fs/promises";
75575
- import path114 from "node:path";
75575
+ import path115 from "node:path";
75576
75576
  async function* runMatrix(opts) {
75577
75577
  assertNonEmpty("agents", opts.agents);
75578
75578
  assertNonEmpty("models", opts.models);
@@ -75581,7 +75581,7 @@ async function* runMatrix(opts) {
75581
75581
  const evalIds = opts.evalIds ?? await listEvals(source);
75582
75582
  const repeats = opts.repeats ?? defaultRepeats;
75583
75583
  assertPositiveInteger("repeats", repeats);
75584
- const matrixDir = path114.join(opts.outDir ?? "runs", matrixId);
75584
+ const matrixDir = path115.join(opts.outDir ?? "runs", matrixId);
75585
75585
  await mkdir29(matrixDir, { recursive: true });
75586
75586
  for (const evalId of evalIds) {
75587
75587
  const evalDef = await loadEval(source, evalId);
@@ -75628,7 +75628,7 @@ async function runSingle(opts, context) {
75628
75628
  durationMs: Date.now() - startedAt,
75629
75629
  error: getErrorMessage5(error3)
75630
75630
  });
75631
- const runDir = path114.join(opts.outDir ?? "runs", result.runId);
75631
+ const runDir = path115.join(opts.outDir ?? "runs", result.runId);
75632
75632
  await mkdir29(runDir, { recursive: true });
75633
75633
  await writeRunResult(runDir, result);
75634
75634
  return result;
@@ -75688,7 +75688,7 @@ function createErrorResult(opts, context) {
75688
75688
  }
75689
75689
  async function writeAggregate(matrixDir, evalId, agent3, model, aggregate) {
75690
75690
  await writeFile22(
75691
- path114.join(
75691
+ path115.join(
75692
75692
  matrixDir,
75693
75693
  `aggregate-${evalId}-${safePathSegment(agent3)}-${safePathSegment(model)}.json`
75694
75694
  ),
@@ -75735,11 +75735,11 @@ var init_matrix = __esm({
75735
75735
  });
75736
75736
 
75737
75737
  // packages/agent-eval/src/cli/init.ts
75738
- import path115 from "node:path";
75738
+ import path116 from "node:path";
75739
75739
  async function runInitCli(input) {
75740
75740
  try {
75741
75741
  validateInitName(input.name);
75742
- const sourceDir = path115.resolve(input.sourceDir ?? process.cwd());
75742
+ const sourceDir = path116.resolve(input.sourceDir ?? process.cwd());
75743
75743
  const result = await evalInit({
75744
75744
  sourceDir,
75745
75745
  name: input.name,
@@ -75747,7 +75747,7 @@ async function runInitCli(input) {
75747
75747
  targetRepo: input.targetRepo,
75748
75748
  targetRef: input.targetRef
75749
75749
  });
75750
- process.stdout.write(`${path115.relative(sourceDir, result.evalDir)}
75750
+ process.stdout.write(`${path116.relative(sourceDir, result.evalDir)}
75751
75751
  `);
75752
75752
  process.stdout.write(`next: poe-code eval check ${input.name}
75753
75753
  `);
@@ -75766,18 +75766,18 @@ var init_init2 = __esm({
75766
75766
  });
75767
75767
 
75768
75768
  // packages/agent-eval/src/cli/target.ts
75769
- import path116 from "node:path";
75769
+ import path117 from "node:path";
75770
75770
  function resolveEvalCliTarget(input) {
75771
75771
  if (input.evalId !== ".") {
75772
75772
  return {
75773
- sourceDir: path116.resolve(input.sourceDir ?? process.cwd()),
75773
+ sourceDir: path117.resolve(input.sourceDir ?? process.cwd()),
75774
75774
  evalId: input.evalId
75775
75775
  };
75776
75776
  }
75777
- const evalDir = path116.resolve(input.sourceDir ?? process.cwd());
75777
+ const evalDir = path117.resolve(input.sourceDir ?? process.cwd());
75778
75778
  return {
75779
- sourceDir: path116.dirname(evalDir),
75780
- evalId: path116.basename(evalDir)
75779
+ sourceDir: path117.dirname(evalDir),
75780
+ evalId: path117.basename(evalDir)
75781
75781
  };
75782
75782
  }
75783
75783
  var init_target = __esm({
@@ -75865,7 +75865,7 @@ var init_check2 = __esm({
75865
75865
 
75866
75866
  // packages/agent-eval/src/cli/lint.ts
75867
75867
  import nodeFs15 from "node:fs/promises";
75868
- import path117 from "node:path";
75868
+ import path118 from "node:path";
75869
75869
  async function runLintCli(input) {
75870
75870
  try {
75871
75871
  const target = resolveEvalCliTarget(input);
@@ -75929,7 +75929,7 @@ function formatIssuePath(issuePath, sourceDir) {
75929
75929
  if (issuePath === void 0 || sourceDir === void 0) {
75930
75930
  return issuePath ?? "";
75931
75931
  }
75932
- const relative6 = path117.relative(sourceDir, issuePath);
75932
+ const relative6 = path118.relative(sourceDir, issuePath);
75933
75933
  if (relative6.length === 0) {
75934
75934
  return ".";
75935
75935
  }
@@ -76306,9 +76306,9 @@ var init_render_table = __esm({
76306
76306
  });
76307
76307
 
76308
76308
  // packages/agent-eval/src/cli/commands.ts
76309
- import path118 from "node:path";
76309
+ import path119 from "node:path";
76310
76310
  function resolveOutputDirectory2(sourceDir, outDir) {
76311
- return path118.isAbsolute(outDir) ? outDir : path118.resolve(sourceDir, outDir);
76311
+ return path119.isAbsolute(outDir) ? outDir : path119.resolve(sourceDir, outDir);
76312
76312
  }
76313
76313
  function readNoJudge(params) {
76314
76314
  return params.noJudge === true || params.judge === true;
@@ -76509,7 +76509,7 @@ var init_commands3 = __esm({
76509
76509
  );
76510
76510
  return null;
76511
76511
  }
76512
- const sourceDir = path118.resolve(params.cwd ?? process.cwd());
76512
+ const sourceDir = path119.resolve(params.cwd ?? process.cwd());
76513
76513
  const source = await openSource(sourceDir);
76514
76514
  const config = await loadSourceConfig(source);
76515
76515
  const evalIds = params.eval ?? [...await listEvals(source)];
@@ -76549,7 +76549,7 @@ var init_commands3 = __esm({
76549
76549
  if (params.runId !== void 0 && params.allRuns === true) {
76550
76550
  throw new UserError("Use either run-id or --all-runs, not both.");
76551
76551
  }
76552
- const sourceDir = path118.resolve(params.cwd ?? process.cwd());
76552
+ const sourceDir = path119.resolve(params.cwd ?? process.cwd());
76553
76553
  const source = await openSource(sourceDir);
76554
76554
  const config = await loadSourceConfig(source);
76555
76555
  const outDir = resolveOutputDirectory2(source.rootDir, params.out ?? config.out);
@@ -76852,7 +76852,7 @@ var init_execution_context = __esm({
76852
76852
  });
76853
76853
 
76854
76854
  // src/sdk/launch.ts
76855
- import path119 from "node:path";
76855
+ import path120 from "node:path";
76856
76856
  import { spawnSync as spawnSync3 } from "node:child_process";
76857
76857
  async function startLaunch(options) {
76858
76858
  const homeDir = resolveHomeDir(options.homeDir);
@@ -76958,7 +76958,7 @@ async function runLaunchDaemon(options) {
76958
76958
  });
76959
76959
  }
76960
76960
  function resolveLaunchBaseDir(homeDir) {
76961
- return path119.join(homeDir, ".poe-code", "launch");
76961
+ return path120.join(homeDir, ".poe-code", "launch");
76962
76962
  }
76963
76963
  function resolveHomeDir(homeDir) {
76964
76964
  if (homeDir) {
@@ -76974,7 +76974,7 @@ function normalizeLaunchSpec(spec10, baseDir) {
76974
76974
  if (locator.scheme !== "local") {
76975
76975
  return spec10;
76976
76976
  }
76977
- const cwd = path119.isAbsolute(locator.path) ? locator.path : path119.resolve(baseDir, locator.path);
76977
+ const cwd = path120.isAbsolute(locator.path) ? locator.path : path120.resolve(baseDir, locator.path);
76978
76978
  return {
76979
76979
  ...spec10,
76980
76980
  cwd
@@ -78140,8 +78140,8 @@ var init_source_snippet = __esm({
78140
78140
  });
78141
78141
 
78142
78142
  // packages/toolcraft/src/cli.ts
78143
- import { access as access6, lstat as lstat26, readFile as readFile35, rename as rename21, unlink as unlink17, writeFile as writeFile23 } from "node:fs/promises";
78144
- import path121 from "node:path";
78143
+ import { access as access6, lstat as lstat26, readFile as readFile36, rename as rename21, unlink as unlink17, writeFile as writeFile23 } from "node:fs/promises";
78144
+ import path122 from "node:path";
78145
78145
  import {
78146
78146
  Command as CommanderCommand,
78147
78147
  CommanderError as CommanderError2,
@@ -78153,7 +78153,7 @@ function inferProgramName(argv) {
78153
78153
  if (typeof entrypoint !== "string" || entrypoint.length === 0) {
78154
78154
  return "toolcraft";
78155
78155
  }
78156
- const parsed = path121.parse(entrypoint);
78156
+ const parsed = path122.parse(entrypoint);
78157
78157
  return parsed.name.length > 0 ? parsed.name : "toolcraft";
78158
78158
  }
78159
78159
  function normalizeRoots2(roots, argv) {
@@ -78210,11 +78210,11 @@ function formatSegment2(segment, casing) {
78210
78210
  const separator = casing === "snake" ? "_" : "-";
78211
78211
  return splitWords4(segment).join(separator);
78212
78212
  }
78213
- function toOptionFlag(path154, casing) {
78214
- return `--${path154.map((segment) => formatSegment2(segment, casing)).join(".")}`;
78213
+ function toOptionFlag(path155, casing) {
78214
+ return `--${path155.map((segment) => formatSegment2(segment, casing)).join(".")}`;
78215
78215
  }
78216
- function toOptionAttribute(path154, casing) {
78217
- return path154.map((segment) => {
78216
+ function toOptionAttribute(path155, casing) {
78217
+ return path155.map((segment) => {
78218
78218
  const formatted = formatSegment2(segment, casing);
78219
78219
  if (casing === "snake") {
78220
78220
  return formatted;
@@ -78225,23 +78225,23 @@ function toOptionAttribute(path154, casing) {
78225
78225
  ).join("");
78226
78226
  }).join(".");
78227
78227
  }
78228
- function toDisplayPath(path154) {
78229
- return path154.join(".");
78228
+ function toDisplayPath(path155) {
78229
+ return path155.join(".");
78230
78230
  }
78231
- function toUnionKindControlPath(path154) {
78232
- if (path154.length === 0) {
78231
+ function toUnionKindControlPath(path155) {
78232
+ if (path155.length === 0) {
78233
78233
  return ["kind"];
78234
78234
  }
78235
- const head = path154.slice(0, -1);
78236
- const tail = path154[path154.length - 1] ?? "";
78235
+ const head = path155.slice(0, -1);
78236
+ const tail = path155[path155.length - 1] ?? "";
78237
78237
  return [...head, `${tail}Kind`];
78238
78238
  }
78239
- function toUnionKindDisplayPath(path154) {
78240
- if (path154.length === 0) {
78239
+ function toUnionKindDisplayPath(path155) {
78240
+ if (path155.length === 0) {
78241
78241
  return "kind";
78242
78242
  }
78243
- const head = path154.slice(0, -1);
78244
- const tail = path154[path154.length - 1] ?? "";
78243
+ const head = path155.slice(0, -1);
78244
+ const tail = path155[path155.length - 1] ?? "";
78245
78245
  return [...head, `${tail}-kind`].join(".");
78246
78246
  }
78247
78247
  function createSyntheticEnumSchema(values) {
@@ -78257,14 +78257,14 @@ function getRequiredBranchFingerprint(branch, casing) {
78257
78257
  const requiredKeys = Object.entries(branch.shape).filter(([, schema2]) => schema2.kind !== "optional").map(([key2]) => formatSegment2(key2, casing)).sort();
78258
78258
  return requiredKeys.join("+");
78259
78259
  }
78260
- function collectFields(schema2, casing, globalLongOptionFlags, path154 = [], inheritedOptional = false, variantContext) {
78260
+ function collectFields(schema2, casing, globalLongOptionFlags, path155 = [], inheritedOptional = false, variantContext) {
78261
78261
  const collected = {
78262
78262
  dynamicFields: [],
78263
78263
  fields: [],
78264
78264
  variants: []
78265
78265
  };
78266
78266
  for (const [key2, rawChildSchema] of Object.entries(schema2.shape)) {
78267
- const nextPath = [...path154, key2];
78267
+ const nextPath = [...path155, key2];
78268
78268
  const runtimeOptional = inheritedOptional || rawChildSchema.kind === "optional";
78269
78269
  const childSchema = unwrapOptional4(rawChildSchema);
78270
78270
  const requiredWhenActive = rawChildSchema.kind !== "optional" && childSchema.default === void 0;
@@ -78445,9 +78445,9 @@ function collectFields(schema2, casing, globalLongOptionFlags, path154 = [], inh
78445
78445
  }
78446
78446
  return collected;
78447
78447
  }
78448
- function toCommanderOptionAttribute(path154, casing, globalLongOptionFlags) {
78449
- const optionAttribute = toOptionAttribute(path154, casing);
78450
- const optionFlag = toOptionFlag(path154, casing);
78448
+ function toCommanderOptionAttribute(path155, casing, globalLongOptionFlags) {
78449
+ const optionAttribute = toOptionAttribute(path155, casing);
78450
+ const optionFlag = toOptionFlag(path155, casing);
78451
78451
  if (!globalLongOptionFlags.has(optionFlag)) {
78452
78452
  return optionAttribute;
78453
78453
  }
@@ -79415,10 +79415,10 @@ function parseDebugStackMode(value) {
79415
79415
  formatInvalidEnumMessage("--debug", String(value), ["raw"], { candidates: ["raw"] })
79416
79416
  );
79417
79417
  }
79418
- function setNestedValue(target, path154, value) {
79418
+ function setNestedValue(target, path155, value) {
79419
79419
  let cursor = target;
79420
- for (let index = 0; index < path154.length - 1; index += 1) {
79421
- const segment = path154[index] ?? "";
79420
+ for (let index = 0; index < path155.length - 1; index += 1) {
79421
+ const segment = path155[index] ?? "";
79422
79422
  const existing = Object.prototype.hasOwnProperty.call(cursor, segment) ? cursor[segment] : void 0;
79423
79423
  if (typeof existing === "object" && existing !== null) {
79424
79424
  cursor = existing;
@@ -79433,7 +79433,7 @@ function setNestedValue(target, path154, value) {
79433
79433
  });
79434
79434
  cursor = next;
79435
79435
  }
79436
- const leaf = path154[path154.length - 1];
79436
+ const leaf = path155[path155.length - 1];
79437
79437
  if (leaf !== void 0) {
79438
79438
  Object.defineProperty(cursor, leaf, {
79439
79439
  value,
@@ -79538,21 +79538,21 @@ async function withOutputFormat2(output, fn) {
79538
79538
  }
79539
79539
  function createFs3() {
79540
79540
  return {
79541
- readFile: async (path154, encoding = "utf8") => readFile35(path154, { encoding }),
79542
- writeFile: async (path154, contents) => {
79543
- await writeFile23(path154, contents);
79541
+ readFile: async (path155, encoding = "utf8") => readFile36(path155, { encoding }),
79542
+ writeFile: async (path155, contents) => {
79543
+ await writeFile23(path155, contents);
79544
79544
  },
79545
- exists: async (path154) => {
79545
+ exists: async (path155) => {
79546
79546
  try {
79547
- await access6(path154);
79547
+ await access6(path155);
79548
79548
  return true;
79549
79549
  } catch {
79550
79550
  return false;
79551
79551
  }
79552
79552
  },
79553
- lstat: async (path154) => lstat26(path154),
79553
+ lstat: async (path155) => lstat26(path155),
79554
79554
  rename: async (fromPath, toPath) => rename21(fromPath, toPath),
79555
- unlink: async (path154) => unlink17(path154)
79555
+ unlink: async (path155) => unlink17(path155)
79556
79556
  };
79557
79557
  }
79558
79558
  function createEnv3(values = process.env) {
@@ -79568,9 +79568,9 @@ function isPlainObject6(value) {
79568
79568
  function hasFieldValue(value) {
79569
79569
  return value !== void 0;
79570
79570
  }
79571
- function hasNestedField(fields, path154) {
79571
+ function hasNestedField(fields, path155) {
79572
79572
  return fields.some(
79573
- (field) => path154.length < field.path.length && path154.every((segment, index) => field.path[index] === segment)
79573
+ (field) => path155.length < field.path.length && path155.every((segment, index) => field.path[index] === segment)
79574
79574
  );
79575
79575
  }
79576
79576
  function describeExpectedPresetValue(schema2) {
@@ -79650,7 +79650,7 @@ function validatePresetFieldValue(value, field, presetPath) {
79650
79650
  async function loadPresetValues(fields, presetPath) {
79651
79651
  let rawPreset;
79652
79652
  try {
79653
- rawPreset = await readFile35(presetPath, {
79653
+ rawPreset = await readFile36(presetPath, {
79654
79654
  encoding: "utf8"
79655
79655
  });
79656
79656
  } catch (error3) {
@@ -79676,9 +79676,9 @@ async function loadPresetValues(fields, presetPath) {
79676
79676
  }
79677
79677
  const fieldByPath = new Map(fields.map((field) => [field.displayPath, field]));
79678
79678
  const presetValues = {};
79679
- function visitObject(current, path154) {
79679
+ function visitObject(current, path155) {
79680
79680
  for (const [key2, value] of Object.entries(current)) {
79681
- const nextPath = [...path154, key2];
79681
+ const nextPath = [...path155, key2];
79682
79682
  const displayPath = toDisplayPath(nextPath);
79683
79683
  const field = fieldByPath.get(displayPath);
79684
79684
  if (field !== void 0) {
@@ -79885,8 +79885,8 @@ function createFixtureService(definition) {
79885
79885
  );
79886
79886
  }
79887
79887
  function resolveFixturePath(commandPath) {
79888
- const parsed = path121.parse(commandPath);
79889
- return path121.join(parsed.dir, `${parsed.name}.fixture.json`);
79888
+ const parsed = path122.parse(commandPath);
79889
+ return path122.join(parsed.dir, `${parsed.name}.fixture.json`);
79890
79890
  }
79891
79891
  function selectFixtureScenario(scenarios, selector, fixturePath) {
79892
79892
  if (isNumericFixtureSelector(selector)) {
@@ -79917,7 +79917,7 @@ async function loadFixtureScenario(command, selector) {
79917
79917
  const fixturePath = resolveFixturePath(commandPath);
79918
79918
  let rawFixture;
79919
79919
  try {
79920
- rawFixture = await readFile35(fixturePath, {
79920
+ rawFixture = await readFile36(fixturePath, {
79921
79921
  encoding: "utf8"
79922
79922
  });
79923
79923
  } catch {
@@ -80020,8 +80020,8 @@ function validateServices2(services) {
80020
80020
  }
80021
80021
  }
80022
80022
  }
80023
- function getNestedValue(target, path154) {
80024
- return path154.reduce(
80023
+ function getNestedValue(target, path155) {
80024
+ return path155.reduce(
80025
80025
  (current, segment) => current !== null && typeof current === "object" ? current[segment] : void 0,
80026
80026
  target
80027
80027
  );
@@ -81551,7 +81551,7 @@ var init_explorer_config2 = __esm({
81551
81551
  });
81552
81552
 
81553
81553
  // packages/maestro-tui/src/run.ts
81554
- import path122 from "node:path";
81554
+ import path123 from "node:path";
81555
81555
  async function runMaestroTui(options = {}) {
81556
81556
  if (options.workflowPath !== void 0 && options.name !== void 0) {
81557
81557
  throw new Error("Cannot specify both workflowPath and name for Maestro.");
@@ -81570,7 +81570,7 @@ async function runMaestroTui(options = {}) {
81570
81570
  }
81571
81571
  async function openWorkflowTaskList(workflowPath) {
81572
81572
  const workflow = await loadWorkflow(workflowPath);
81573
- const cfg = resolveConfig2(workflow.config, path122.dirname(workflow.sourcePath));
81573
+ const cfg = resolveConfig2(workflow.config, path123.dirname(workflow.sourcePath));
81574
81574
  return openTaskList(resolveConfiguredTaskListOptions(cfg));
81575
81575
  }
81576
81576
  var init_run4 = __esm({
@@ -81841,7 +81841,7 @@ var init_container2 = __esm({
81841
81841
  });
81842
81842
 
81843
81843
  // src/cli/commands/configure.ts
81844
- import path123 from "node:path";
81844
+ import path124 from "node:path";
81845
81845
  function registerConfigureCommand(program, container) {
81846
81846
  const serviceNames = listServiceNames(container.registry.list());
81847
81847
  const serviceDescription = `Tool to configure${formatServiceList(serviceNames)}`;
@@ -82053,12 +82053,12 @@ function createOverlayFileSystem(base) {
82053
82053
  }
82054
82054
  return base.readFile(filePath, "utf8");
82055
82055
  };
82056
- async function readFile56(filePath, encoding) {
82056
+ async function readFile57(filePath, encoding) {
82057
82057
  const content = await readOverlayText(filePath);
82058
82058
  return encoding ? content : Buffer.from(content);
82059
82059
  }
82060
82060
  const fs27 = {
82061
- readFile: readFile56,
82061
+ readFile: readFile57,
82062
82062
  async writeFile(filePath, content, options) {
82063
82063
  await assertOverlayParentDirectory(filePath);
82064
82064
  if (options?.flag === "wx" && await overlayPathExists(filePath)) {
@@ -82080,7 +82080,7 @@ function createOverlayFileSystem(base) {
82080
82080
  let currentPath = directoryPath;
82081
82081
  while (!await overlayPathExists(currentPath)) {
82082
82082
  directories.add(currentPath);
82083
- const parentPath = path123.dirname(currentPath);
82083
+ const parentPath = path124.dirname(currentPath);
82084
82084
  if (parentPath === currentPath) {
82085
82085
  break;
82086
82086
  }
@@ -82142,18 +82142,18 @@ function createOverlayFileSystem(base) {
82142
82142
  throw error3;
82143
82143
  }));
82144
82144
  for (const directory of directories) {
82145
- if (path123.dirname(directory) === directoryPath) {
82146
- entries.add(path123.basename(directory));
82145
+ if (path124.dirname(directory) === directoryPath) {
82146
+ entries.add(path124.basename(directory));
82147
82147
  }
82148
82148
  }
82149
82149
  for (const [filePath, content] of writes) {
82150
- if (path123.dirname(filePath) !== directoryPath) {
82150
+ if (path124.dirname(filePath) !== directoryPath) {
82151
82151
  continue;
82152
82152
  }
82153
82153
  if (content === null) {
82154
- entries.delete(path123.basename(filePath));
82154
+ entries.delete(path124.basename(filePath));
82155
82155
  } else {
82156
- entries.add(path123.basename(filePath));
82156
+ entries.add(path124.basename(filePath));
82157
82157
  }
82158
82158
  }
82159
82159
  return [...entries];
@@ -82177,7 +82177,7 @@ function createOverlayFileSystem(base) {
82177
82177
  }
82178
82178
  };
82179
82179
  const assertOverlayParentDirectory = async (filePath) => {
82180
- const parentPath = path123.dirname(filePath);
82180
+ const parentPath = path124.dirname(filePath);
82181
82181
  try {
82182
82182
  const parent = await fs27.stat(parentPath);
82183
82183
  if (!parent.isDirectory()) {
@@ -82192,14 +82192,14 @@ function createOverlayFileSystem(base) {
82192
82192
  };
82193
82193
  const assertNoOverlayFileAncestor = async (directoryPath) => {
82194
82194
  let currentPath = directoryPath;
82195
- while (currentPath !== path123.dirname(currentPath)) {
82195
+ while (currentPath !== path124.dirname(currentPath)) {
82196
82196
  if (await overlayPathExists(currentPath)) {
82197
82197
  if (!(await fs27.stat(currentPath)).isDirectory()) {
82198
82198
  throw createFsError("ENOTDIR", currentPath);
82199
82199
  }
82200
82200
  return;
82201
82201
  }
82202
- currentPath = path123.dirname(currentPath);
82202
+ currentPath = path124.dirname(currentPath);
82203
82203
  }
82204
82204
  };
82205
82205
  return {
@@ -82229,7 +82229,7 @@ function createOverlayFileSystem(base) {
82229
82229
  },
82230
82230
  async commit() {
82231
82231
  const sortedDirectories = [...directories].sort(
82232
- (left, right) => left.split(path123.sep).length - right.split(path123.sep).length
82232
+ (left, right) => left.split(path124.sep).length - right.split(path124.sep).length
82233
82233
  );
82234
82234
  const createdDirectories = [];
82235
82235
  const originals = /* @__PURE__ */ new Map();
@@ -82633,7 +82633,7 @@ var init_runtime_options = __esm({
82633
82633
  });
82634
82634
 
82635
82635
  // src/cli/commands/spawn.ts
82636
- import path124 from "node:path";
82636
+ import path125 from "node:path";
82637
82637
  import { Option as Option3 } from "commander";
82638
82638
  function registerSpawnCommand(program, container, options = {}) {
82639
82639
  const spawnServices = container.registry.list().filter((service) => typeof service.spawn === "function" || getSpawnConfig(service.name));
@@ -82974,7 +82974,7 @@ async function resolvePromptInput(input, fs27, baseDir) {
82974
82974
  if (rawPath.length === 0) {
82975
82975
  throw new ValidationError("prompt @<path> requires a file path after '@'");
82976
82976
  }
82977
- const filePath = path124.isAbsolute(rawPath) ? rawPath : path124.join(baseDir, rawPath);
82977
+ const filePath = path125.isAbsolute(rawPath) ? rawPath : path125.join(baseDir, rawPath);
82978
82978
  try {
82979
82979
  const contents = await fs27.readFile(filePath, "utf8");
82980
82980
  return contents.trim();
@@ -82995,7 +82995,7 @@ async function resolveMcpSpawnInput(input, fs27, baseDir) {
82995
82995
  if (rawPath.length === 0) {
82996
82996
  throw new ValidationError("--mcp-servers @<path> requires a file path after '@'");
82997
82997
  }
82998
- const filePath = path124.isAbsolute(rawPath) ? rawPath : path124.join(baseDir, rawPath);
82998
+ const filePath = path125.isAbsolute(rawPath) ? rawPath : path125.join(baseDir, rawPath);
82999
82999
  try {
83000
83000
  return await fs27.readFile(filePath, "utf8");
83001
83001
  } catch (error3) {
@@ -84019,9 +84019,9 @@ var init_command_not_found = __esm({
84019
84019
 
84020
84020
  // src/cli/commands/utils-symlink-ops.ts
84021
84021
  import { dirname as dirname7 } from "node:path";
84022
- async function tryLstat(fs27, path154) {
84022
+ async function tryLstat(fs27, path155) {
84023
84023
  try {
84024
- return await fs27.lstat(path154);
84024
+ return await fs27.lstat(path155);
84025
84025
  } catch (error3) {
84026
84026
  if (isNotFound(error3)) {
84027
84027
  return null;
@@ -84089,13 +84089,13 @@ async function rollbackSymlinkOps(fs27, appliedOps) {
84089
84089
  await fs27.rename(op.to, op.from);
84090
84090
  }
84091
84091
  }
84092
- async function isSymlinkPointingTo(fs27, path154, expectedTarget) {
84092
+ async function isSymlinkPointingTo(fs27, path155, expectedTarget) {
84093
84093
  try {
84094
- const stats2 = await fs27.lstat(path154);
84094
+ const stats2 = await fs27.lstat(path155);
84095
84095
  if (!stats2.isSymbolicLink()) {
84096
84096
  return false;
84097
84097
  }
84098
- return await fs27.readlink(path154) === expectedTarget;
84098
+ return await fs27.readlink(path155) === expectedTarget;
84099
84099
  } catch (error3) {
84100
84100
  if (isNotFound(error3)) {
84101
84101
  return false;
@@ -84620,7 +84620,7 @@ var init_media_download = __esm({
84620
84620
  });
84621
84621
 
84622
84622
  // src/cli/commands/generate.ts
84623
- import path125 from "node:path";
84623
+ import path126 from "node:path";
84624
84624
  function registerGenerateCommand(program, container) {
84625
84625
  const generate2 = program.command("generate").alias("g").description("Generate content via Poe API.").option("--model <model>", `Model identifier (default: ${DEFAULT_TEXT_MODEL})`).option(
84626
84626
  "--param <key=value>",
@@ -84893,11 +84893,11 @@ function getDefaultMimeType(type2) {
84893
84893
  return defaults[type2];
84894
84894
  }
84895
84895
  function resolveOutputPath(filename, cwd) {
84896
- if (path125.isAbsolute(filename)) {
84896
+ if (path126.isAbsolute(filename)) {
84897
84897
  return { path: filename, label: filename };
84898
84898
  }
84899
84899
  return {
84900
- path: path125.join(cwd, filename),
84900
+ path: path126.join(cwd, filename),
84901
84901
  label: `./${filename}`
84902
84902
  };
84903
84903
  }
@@ -85504,10 +85504,10 @@ var init_shapes = __esm({
85504
85504
  });
85505
85505
 
85506
85506
  // packages/agent-mcp-config/src/apply.ts
85507
- import path126 from "node:path";
85507
+ import path127 from "node:path";
85508
85508
  import { isDeepStrictEqual } from "node:util";
85509
85509
  function getConfigDirectory(configPath) {
85510
- return path126.dirname(configPath);
85510
+ return path127.dirname(configPath);
85511
85511
  }
85512
85512
  function isConfigObject6(value) {
85513
85513
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -86820,8 +86820,8 @@ var init_dashboard_loop_shared = __esm({
86820
86820
  });
86821
86821
 
86822
86822
  // src/cli/commands/pipeline.ts
86823
- import path127 from "node:path";
86824
- import { readFile as readFile36, stat as stat24 } from "node:fs/promises";
86823
+ import path128 from "node:path";
86824
+ import { readFile as readFile37, stat as stat24 } from "node:fs/promises";
86825
86825
  import { fileURLToPath as fileURLToPath10 } from "node:url";
86826
86826
  async function resolvePipelineCommandConfig(container, options = {}) {
86827
86827
  const [configDoc, pipelineYamlConfig] = await Promise.all([
@@ -86880,11 +86880,11 @@ function resolveMaxRuns(value) {
86880
86880
  return parsed;
86881
86881
  }
86882
86882
  function resolvePipelineInitSourcePath(container, sourcePath) {
86883
- const absolutePath = sourcePath.startsWith("~/") ? path127.join(container.env.homeDir, sourcePath.slice(2)) : path127.isAbsolute(sourcePath) ? sourcePath : path127.resolve(container.env.cwd, sourcePath);
86883
+ const absolutePath = sourcePath.startsWith("~/") ? path128.join(container.env.homeDir, sourcePath.slice(2)) : path128.isAbsolute(sourcePath) ? sourcePath : path128.resolve(container.env.cwd, sourcePath);
86884
86884
  return {
86885
86885
  absolutePath,
86886
86886
  relativePath: sourcePath,
86887
- title: path127.basename(sourcePath, path127.extname(sourcePath))
86887
+ title: path128.basename(sourcePath, path128.extname(sourcePath))
86888
86888
  };
86889
86889
  }
86890
86890
  function isActivityTimeoutError4(error3) {
@@ -87277,12 +87277,12 @@ async function runPipelineWithIntegrations(integrations, name, options) {
87277
87277
  return integrations?.traceRun("pipeline", name, () => runPipeline2(options)) ?? runPipeline2(options);
87278
87278
  }
87279
87279
  function resolvePipelinePaths(scope, cwd, homeDir) {
87280
- const rootPath = scope === "global" ? path127.join(homeDir, ".poe-code", "pipeline") : path127.join(cwd, ".poe-code", "pipeline");
87280
+ const rootPath = scope === "global" ? path128.join(homeDir, ".poe-code", "pipeline") : path128.join(cwd, ".poe-code", "pipeline");
87281
87281
  const displayRoot = scope === "global" ? "~/.poe-code/pipeline" : ".poe-code/pipeline";
87282
87282
  return {
87283
- plansPath: path127.join(rootPath, "plans"),
87284
- stepsPath: path127.join(rootPath, "steps.yaml"),
87285
- legacyDefaultStepsPath: path127.join(rootPath, "steps", "default.yaml"),
87283
+ plansPath: path128.join(rootPath, "plans"),
87284
+ stepsPath: path128.join(rootPath, "steps.yaml"),
87285
+ legacyDefaultStepsPath: path128.join(rootPath, "steps", "default.yaml"),
87286
87286
  displayPlansPath: `${displayRoot}/plans`,
87287
87287
  displayStepsPath: `${displayRoot}/steps.yaml`
87288
87288
  };
@@ -87293,16 +87293,16 @@ async function loadPipelineTemplates() {
87293
87293
  }
87294
87294
  const packageRoot = await findPackageRoot3(fileURLToPath10(import.meta.url));
87295
87295
  const templateRoots = [
87296
- path127.join(packageRoot, "src", "templates", "pipeline"),
87297
- path127.join(packageRoot, "dist", "templates", "pipeline")
87296
+ path128.join(packageRoot, "src", "templates", "pipeline"),
87297
+ path128.join(packageRoot, "dist", "templates", "pipeline")
87298
87298
  ];
87299
87299
  for (const templateRoot of templateRoots) {
87300
87300
  if (!await pathExistsOnDisk(templateRoot)) {
87301
87301
  continue;
87302
87302
  }
87303
87303
  const [skillPlan, steps] = await Promise.all([
87304
- readFile36(path127.join(templateRoot, "SKILL_plan.md"), "utf8"),
87305
- readFile36(path127.join(templateRoot, "steps.yaml.mustache"), "utf8")
87304
+ readFile37(path128.join(templateRoot, "SKILL_plan.md"), "utf8"),
87305
+ readFile37(path128.join(templateRoot, "steps.yaml.mustache"), "utf8")
87306
87306
  ]);
87307
87307
  pipelineTemplatesCache = { skillPlan, steps };
87308
87308
  return pipelineTemplatesCache;
@@ -87321,12 +87321,12 @@ async function pathExistsOnDisk(targetPath) {
87321
87321
  }
87322
87322
  }
87323
87323
  async function findPackageRoot3(entryFilePath) {
87324
- let currentPath = path127.dirname(entryFilePath);
87324
+ let currentPath = path128.dirname(entryFilePath);
87325
87325
  while (true) {
87326
- if (await pathExistsOnDisk(path127.join(currentPath, "package.json"))) {
87326
+ if (await pathExistsOnDisk(path128.join(currentPath, "package.json"))) {
87327
87327
  return currentPath;
87328
87328
  }
87329
- const parentPath = path127.dirname(currentPath);
87329
+ const parentPath = path128.dirname(currentPath);
87330
87330
  if (parentPath === currentPath) {
87331
87331
  throw new Error("Unable to locate package root for Pipeline templates.");
87332
87332
  }
@@ -87664,11 +87664,11 @@ function registerPipelineCommand(program, container) {
87664
87664
  if (typeof t.status === "string") return t.status === "done";
87665
87665
  return Object.values(t.status).every((s) => s === "done");
87666
87666
  }).length;
87667
- const readFile56 = container.fs.readFile.bind(container.fs);
87667
+ const readFile57 = container.fs.readFile.bind(container.fs);
87668
87668
  const resolvedVars = await resolvePipelineVars(
87669
87669
  plan.vars ?? {},
87670
87670
  container.env.cwd,
87671
- readFile56
87671
+ readFile57
87672
87672
  );
87673
87673
  const resolvedSetup = plan.setup === null ? void 0 : plan.setup ?? steps.setup;
87674
87674
  const resolvedTeardown = plan.teardown === null ? void 0 : plan.teardown ?? steps.teardown;
@@ -87690,7 +87690,7 @@ function registerPipelineCommand(program, container) {
87690
87690
  if (opts.preview) {
87691
87691
  if (resolvedSetup) {
87692
87692
  const raw = interpolatePipelineVars(resolvedSetup.prompt, resolvedVars, "setup");
87693
- const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile56);
87693
+ const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile57);
87694
87694
  resources.logger.resolved("setup", expanded);
87695
87695
  }
87696
87696
  for (const task of plan.tasks) {
@@ -87703,7 +87703,7 @@ function registerPipelineCommand(program, container) {
87703
87703
  vars: resolvedVars
87704
87704
  }),
87705
87705
  container.env.cwd,
87706
- readFile56
87706
+ readFile57
87707
87707
  );
87708
87708
  resources.logger.resolved(`task: ${task.id} \u2014 ${task.title}`, expanded);
87709
87709
  } else {
@@ -87716,7 +87716,7 @@ function registerPipelineCommand(program, container) {
87716
87716
  vars: resolvedVars
87717
87717
  }),
87718
87718
  container.env.cwd,
87719
- readFile56
87719
+ readFile57
87720
87720
  );
87721
87721
  resources.logger.resolved(`task: ${task.id} / ${stepName}`, expanded);
87722
87722
  }
@@ -87724,7 +87724,7 @@ function registerPipelineCommand(program, container) {
87724
87724
  }
87725
87725
  if (resolvedTeardown) {
87726
87726
  const raw = interpolatePipelineVars(resolvedTeardown.prompt, resolvedVars, "teardown");
87727
- const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile56);
87727
+ const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile57);
87728
87728
  resources.logger.resolved("teardown", expanded);
87729
87729
  }
87730
87730
  }
@@ -87793,7 +87793,7 @@ function registerPipelineCommand(program, container) {
87793
87793
  const templates = await loadPipelineTemplates();
87794
87794
  const pipelinePaths = resolvePipelinePaths(scope, container.env.cwd, container.env.homeDir);
87795
87795
  const skillDisplayPath = `${scope === "global" ? support.config.globalSkillDir : support.config.localSkillDir}/poe-code-pipeline-plan/SKILL.md`;
87796
- const skillPath = path127.join(
87796
+ const skillPath = path128.join(
87797
87797
  resolveSkillDir(support.config, scope, container.env.cwd, container.env.homeDir),
87798
87798
  "poe-code-pipeline-plan",
87799
87799
  "SKILL.md"
@@ -87835,7 +87835,7 @@ function registerPipelineCommand(program, container) {
87835
87835
  `Would ${finalStepsExists ? "overwrite" : "create"}: ${pipelinePaths.displayStepsPath}`
87836
87836
  );
87837
87837
  } else {
87838
- await container.fs.mkdir(path127.dirname(pipelinePaths.stepsPath), {
87838
+ await container.fs.mkdir(path128.dirname(pipelinePaths.stepsPath), {
87839
87839
  recursive: true
87840
87840
  });
87841
87841
  await container.fs.writeFile(pipelinePaths.stepsPath, templates.steps, {
@@ -87935,7 +87935,7 @@ var init_pipeline5 = __esm({
87935
87935
  });
87936
87936
 
87937
87937
  // src/cli/commands/ralph.ts
87938
- import path128 from "node:path";
87938
+ import path129 from "node:path";
87939
87939
  function formatRalphAgentSummary(agent3) {
87940
87940
  return Array.isArray(agent3) ? agent3.join(", ") : agent3;
87941
87941
  }
@@ -88121,9 +88121,9 @@ function normalizeConfiguredIterations(value) {
88121
88121
  }
88122
88122
  function resolveAbsoluteDocPath(container, docPath) {
88123
88123
  if (docPath.startsWith("~/")) {
88124
- return path128.join(container.env.homeDir, docPath.slice(2));
88124
+ return path129.join(container.env.homeDir, docPath.slice(2));
88125
88125
  }
88126
- return path128.isAbsolute(docPath) ? docPath : path128.resolve(container.env.cwd, docPath);
88126
+ return path129.isAbsolute(docPath) ? docPath : path129.resolve(container.env.cwd, docPath);
88127
88127
  }
88128
88128
  async function resolveRalphCommandConfig(container) {
88129
88129
  const configDoc = await readMergedDocument(
@@ -88453,7 +88453,7 @@ function registerRalphCommand(program, container) {
88453
88453
  if (maxIterations2 == null) {
88454
88454
  return;
88455
88455
  }
88456
- const runCwd = options.cwd ? path128.resolve(container.env.cwd, options.cwd) : container.env.cwd;
88456
+ const runCwd = options.cwd ? path129.resolve(container.env.cwd, options.cwd) : container.env.cwd;
88457
88457
  const runOptions = {
88458
88458
  agent: agent3,
88459
88459
  cwd: runCwd,
@@ -88535,11 +88535,11 @@ var init_ralph4 = __esm({
88535
88535
  });
88536
88536
 
88537
88537
  // src/cli/commands/experiment.ts
88538
- import path129 from "node:path";
88539
- import { readFile as readFile37, stat as stat25 } from "node:fs/promises";
88538
+ import path130 from "node:path";
88539
+ import { readFile as readFile38, stat as stat25 } from "node:fs/promises";
88540
88540
  import { fileURLToPath as fileURLToPath11 } from "node:url";
88541
88541
  function resolveExperimentPaths(scope, cwd, homeDir) {
88542
- const rootPath = scope === "global" ? path129.join(homeDir, ".poe-code", "experiments") : path129.join(cwd, ".poe-code", "experiments");
88542
+ const rootPath = scope === "global" ? path130.join(homeDir, ".poe-code", "experiments") : path130.join(cwd, ".poe-code", "experiments");
88543
88543
  const displayRoot = scope === "global" ? "~/.poe-code/experiments" : ".poe-code/experiments";
88544
88544
  return {
88545
88545
  experimentsPath: rootPath,
@@ -88558,12 +88558,12 @@ async function pathExistsOnDisk2(targetPath) {
88558
88558
  }
88559
88559
  }
88560
88560
  async function findPackageRoot4(entryFilePath) {
88561
- let currentPath = path129.dirname(entryFilePath);
88561
+ let currentPath = path130.dirname(entryFilePath);
88562
88562
  while (true) {
88563
- if (await pathExistsOnDisk2(path129.join(currentPath, "package.json"))) {
88563
+ if (await pathExistsOnDisk2(path130.join(currentPath, "package.json"))) {
88564
88564
  return currentPath;
88565
88565
  }
88566
- const parentPath = path129.dirname(currentPath);
88566
+ const parentPath = path130.dirname(currentPath);
88567
88567
  if (parentPath === currentPath) {
88568
88568
  throw new Error("Unable to locate package root for Experiment templates.");
88569
88569
  }
@@ -88576,16 +88576,16 @@ async function loadExperimentTemplates() {
88576
88576
  }
88577
88577
  const packageRoot = await findPackageRoot4(fileURLToPath11(import.meta.url));
88578
88578
  const templateRoots = [
88579
- path129.join(packageRoot, "src", "templates", "experiment"),
88580
- path129.join(packageRoot, "dist", "templates", "experiment")
88579
+ path130.join(packageRoot, "src", "templates", "experiment"),
88580
+ path130.join(packageRoot, "dist", "templates", "experiment")
88581
88581
  ];
88582
88582
  for (const templateRoot of templateRoots) {
88583
88583
  if (!await pathExistsOnDisk2(templateRoot)) {
88584
88584
  continue;
88585
88585
  }
88586
88586
  const [skillPlan, runYaml] = await Promise.all([
88587
- readFile37(path129.join(templateRoot, "SKILL_experiment.md"), "utf8"),
88588
- readFile37(path129.join(templateRoot, "run.yaml.mustache"), "utf8")
88587
+ readFile38(path130.join(templateRoot, "SKILL_experiment.md"), "utf8"),
88588
+ readFile38(path130.join(templateRoot, "run.yaml.mustache"), "utf8")
88589
88589
  ]);
88590
88590
  experimentTemplatesCache = { skillPlan, runYaml };
88591
88591
  return experimentTemplatesCache;
@@ -89305,8 +89305,8 @@ function registerExperimentCommand(program, container) {
89305
89305
  container.env.cwd,
89306
89306
  container.env.homeDir
89307
89307
  );
89308
- const runYamlPath = path129.join(experimentPaths.experimentsPath, "run.yaml");
89309
- const runYamlDisplayPath = path129.join(experimentPaths.displayExperimentsPath, "run.yaml");
89308
+ const runYamlPath = path130.join(experimentPaths.experimentsPath, "run.yaml");
89309
+ const runYamlDisplayPath = path130.join(experimentPaths.displayExperimentsPath, "run.yaml");
89310
89310
  const experimentsPathExisted = await pathExists11(
89311
89311
  container.fs,
89312
89312
  experimentPaths.experimentsPath
@@ -89846,9 +89846,9 @@ var init_launch2 = __esm({
89846
89846
 
89847
89847
  // packages/memory/src/paths.ts
89848
89848
  import * as fs11 from "node:fs/promises";
89849
- import path130 from "node:path";
89849
+ import path131 from "node:path";
89850
89850
  function resolveMemoryRoot(cwd) {
89851
- return path130.resolve(cwd, ".poe-code", "memory");
89851
+ return path131.resolve(cwd, ".poe-code", "memory");
89852
89852
  }
89853
89853
  function assertSafeRelPath(input) {
89854
89854
  const trimmed = input.trim();
@@ -89856,10 +89856,10 @@ function assertSafeRelPath(input) {
89856
89856
  throw new MemoryPathError("Expected a non-empty relative path.");
89857
89857
  }
89858
89858
  const slashNormalized = trimmed.replaceAll("\\", "/");
89859
- if (path130.posix.isAbsolute(slashNormalized) || path130.win32.isAbsolute(slashNormalized)) {
89859
+ if (path131.posix.isAbsolute(slashNormalized) || path131.win32.isAbsolute(slashNormalized)) {
89860
89860
  throw new MemoryPathError(`Expected a relative path, received absolute path "${input}".`);
89861
89861
  }
89862
- const normalized = path130.posix.normalize(slashNormalized);
89862
+ const normalized = path131.posix.normalize(slashNormalized);
89863
89863
  if (normalized === "." || normalized.length === 0) {
89864
89864
  throw new MemoryPathError("Expected a relative path to a file or directory.");
89865
89865
  }
@@ -89872,7 +89872,7 @@ async function assertNoSymlinkSegments(root, relPath) {
89872
89872
  const normalizedRelPath = assertSafeRelPath(relPath);
89873
89873
  let currentPath = root;
89874
89874
  for (const segment of normalizedRelPath.split("/")) {
89875
- currentPath = path130.join(currentPath, segment);
89875
+ currentPath = path131.join(currentPath, segment);
89876
89876
  try {
89877
89877
  const stat33 = await fs11.lstat(currentPath);
89878
89878
  if (stat33.isSymbolicLink()) {
@@ -89921,7 +89921,7 @@ var init_paths2 = __esm({
89921
89921
  });
89922
89922
 
89923
89923
  // packages/memory/src/resolve-root.ts
89924
- import path131 from "node:path";
89924
+ import path132 from "node:path";
89925
89925
  async function resolveConfiguredMemoryRoot(options) {
89926
89926
  const envOverride = options.env[MEMORY_ROOT_ENV_VAR]?.trim();
89927
89927
  if (envOverride && envOverride.length > 0) {
@@ -89944,7 +89944,7 @@ function readMemoryRoot(document) {
89944
89944
  return typeof root === "string" ? root : void 0;
89945
89945
  }
89946
89946
  function resolveAgainstCwd(cwd, value) {
89947
- return path131.isAbsolute(value) ? value : path131.resolve(cwd, value);
89947
+ return path132.isAbsolute(value) ? value : path132.resolve(cwd, value);
89948
89948
  }
89949
89949
  var MEMORY_ROOT_ENV_VAR;
89950
89950
  var init_resolve_root = __esm({
@@ -89958,14 +89958,14 @@ var init_resolve_root = __esm({
89958
89958
 
89959
89959
  // packages/memory/src/init.ts
89960
89960
  import * as fs12 from "node:fs/promises";
89961
- import path132 from "node:path";
89961
+ import path133 from "node:path";
89962
89962
  async function initMemory(root) {
89963
89963
  await assertMemoryRootIsNotSymlink(root);
89964
89964
  const rootExisted = await pathExists12(root);
89965
- const pagesPath = path132.join(root, MEMORY_PAGES_DIR_RELPATH);
89965
+ const pagesPath = path133.join(root, MEMORY_PAGES_DIR_RELPATH);
89966
89966
  const pagesExisted = await pathExists12(pagesPath);
89967
- const indexPath = path132.join(root, MEMORY_INDEX_RELPATH);
89968
- const logPath = path132.join(root, MEMORY_LOG_RELPATH);
89967
+ const indexPath = path133.join(root, MEMORY_INDEX_RELPATH);
89968
+ const logPath = path133.join(root, MEMORY_LOG_RELPATH);
89969
89969
  let indexCreated = false;
89970
89970
  let logCreated = false;
89971
89971
  try {
@@ -90198,10 +90198,10 @@ function parseSources(value) {
90198
90198
  if (!isRecord38(item)) {
90199
90199
  throw new Error('Invalid "sources" frontmatter. Expected each source to be a string or object.');
90200
90200
  }
90201
- const path154 = readRequiredString(item.path, "sources[].path");
90201
+ const path155 = readRequiredString(item.path, "sources[].path");
90202
90202
  const startLine = readOptionalPositiveInteger(item.startLine, "sources[].startLine");
90203
90203
  const endLine = readOptionalPositiveInteger(item.endLine, "sources[].endLine");
90204
- return parseSourceRef(serializeSourceRef({ path: path154, ...startLine === void 0 ? {} : { startLine }, ...endLine === void 0 ? {} : { endLine } }));
90204
+ return parseSourceRef(serializeSourceRef({ path: path155, ...startLine === void 0 ? {} : { startLine }, ...endLine === void 0 ? {} : { endLine } }));
90205
90205
  });
90206
90206
  }
90207
90207
  function readOptionalString4(value, field) {
@@ -90245,7 +90245,7 @@ var init_frontmatter5 = __esm({
90245
90245
 
90246
90246
  // packages/memory/src/pages.ts
90247
90247
  import * as fs13 from "node:fs/promises";
90248
- import path133 from "node:path";
90248
+ import path134 from "node:path";
90249
90249
  async function listPages(root) {
90250
90250
  const relPaths = await collectMarkdownRelPaths(root, MEMORY_PAGES_DIR_RELPATH);
90251
90251
  const pages = await Promise.all(relPaths.map(async (relPath) => readPage(root, relPath)));
@@ -90254,7 +90254,7 @@ async function listPages(root) {
90254
90254
  async function readPage(root, relPath) {
90255
90255
  const normalizedRelPath = assertMarkdownRelPath(relPath);
90256
90256
  await assertNoSymlinkSegments(root, normalizedRelPath);
90257
- const absPath = path133.join(root, normalizedRelPath);
90257
+ const absPath = path134.join(root, normalizedRelPath);
90258
90258
  const [content, stat33] = await Promise.all([fs13.readFile(absPath, "utf8"), fs13.stat(absPath)]);
90259
90259
  try {
90260
90260
  const parsed = parseFrontmatter4(content);
@@ -90283,7 +90283,7 @@ async function collectMarkdownRelPaths(root, startRelPath = "") {
90283
90283
  return relPaths.sort((left, right) => left.localeCompare(right));
90284
90284
  }
90285
90285
  async function collectMarkdownRelPathsInto(root, currentRelPath, relPaths) {
90286
- const absPath = path133.join(root, currentRelPath);
90286
+ const absPath = path134.join(root, currentRelPath);
90287
90287
  let entryNames;
90288
90288
  try {
90289
90289
  entryNames = await fs13.readdir(absPath);
@@ -90294,8 +90294,8 @@ async function collectMarkdownRelPathsInto(root, currentRelPath, relPaths) {
90294
90294
  throw error3;
90295
90295
  }
90296
90296
  for (const entryName of entryNames.sort((left, right) => left.localeCompare(right))) {
90297
- const entryRelPath = currentRelPath.length === 0 ? entryName : path133.posix.join(currentRelPath, entryName);
90298
- const entryAbsPath = path133.join(root, entryRelPath);
90297
+ const entryRelPath = currentRelPath.length === 0 ? entryName : path134.posix.join(currentRelPath, entryName);
90298
+ const entryAbsPath = path134.join(root, entryRelPath);
90299
90299
  const entryStat = await fs13.lstat(entryAbsPath);
90300
90300
  if (entryStat.isSymbolicLink()) {
90301
90301
  continue;
@@ -90325,7 +90325,7 @@ function assertMarkdownRelPath(relPath) {
90325
90325
  return normalizedRelPath;
90326
90326
  }
90327
90327
  function isMarkdownPath(relPath) {
90328
- return path133.posix.extname(relPath).toLowerCase() === ".md";
90328
+ return path134.posix.extname(relPath).toLowerCase() === ".md";
90329
90329
  }
90330
90330
  function isMissing2(error3) {
90331
90331
  return typeof error3 === "object" && error3 !== null && "code" in error3 && error3.code === "ENOENT";
@@ -90340,7 +90340,7 @@ var init_pages = __esm({
90340
90340
 
90341
90341
  // packages/memory/src/search.ts
90342
90342
  import * as fs14 from "node:fs/promises";
90343
- import path134 from "node:path";
90343
+ import path135 from "node:path";
90344
90344
  async function searchMemory(root, query) {
90345
90345
  const normalizedQuery = query.trim();
90346
90346
  if (normalizedQuery.length === 0) {
@@ -90349,7 +90349,7 @@ async function searchMemory(root, query) {
90349
90349
  const relPaths = await collectMarkdownRelPaths(root);
90350
90350
  const hits = [];
90351
90351
  for (const relPath of relPaths) {
90352
- const content = await fs14.readFile(path134.join(root, relPath), "utf8");
90352
+ const content = await fs14.readFile(path135.join(root, relPath), "utf8");
90353
90353
  if (content.length === 0) {
90354
90354
  continue;
90355
90355
  }
@@ -90376,9 +90376,9 @@ var init_search = __esm({
90376
90376
 
90377
90377
  // packages/memory/src/status.ts
90378
90378
  import * as fs15 from "node:fs/promises";
90379
- import path135 from "node:path";
90379
+ import path136 from "node:path";
90380
90380
  async function statusOf(root) {
90381
- if (!await pathExists13(root) || !await pathExists13(path135.join(root, MEMORY_INDEX_RELPATH)) || !await pathExists13(path135.join(root, MEMORY_LOG_RELPATH)) || !await pathExists13(path135.join(root, MEMORY_PAGES_DIR_RELPATH))) {
90381
+ if (!await pathExists13(root) || !await pathExists13(path136.join(root, MEMORY_INDEX_RELPATH)) || !await pathExists13(path136.join(root, MEMORY_LOG_RELPATH)) || !await pathExists13(path136.join(root, MEMORY_PAGES_DIR_RELPATH))) {
90382
90382
  return {
90383
90383
  pageCount: 0,
90384
90384
  totalBytes: 0,
@@ -90393,7 +90393,7 @@ async function statusOf(root) {
90393
90393
  let totalBytes = 0;
90394
90394
  let lastWriteAtMs = Number.NEGATIVE_INFINITY;
90395
90395
  for (const relPath of markdownRelPaths) {
90396
- const stat33 = await fs15.stat(path135.join(root, relPath));
90396
+ const stat33 = await fs15.stat(path136.join(root, relPath));
90397
90397
  totalBytes += stat33.size;
90398
90398
  lastWriteAtMs = Math.max(lastWriteAtMs, stat33.mtimeMs);
90399
90399
  }
@@ -90647,13 +90647,13 @@ var init_confidence = __esm({
90647
90647
  // packages/memory/src/reconcile.ts
90648
90648
  import { createHash as createHash8 } from "node:crypto";
90649
90649
  import * as fs17 from "node:fs/promises";
90650
- import path136 from "node:path";
90650
+ import path137 from "node:path";
90651
90651
  async function snapshot(root) {
90652
90652
  const pages = Object.fromEntries(
90653
90653
  await Promise.all(
90654
90654
  (await collectMarkdownRelPaths(root, MEMORY_PAGES_DIR_RELPATH)).map(async (relPath) => [
90655
90655
  relPath,
90656
- hashContent(await fs17.readFile(path136.join(root, relPath), "utf8"))
90656
+ hashContent(await fs17.readFile(path137.join(root, relPath), "utf8"))
90657
90657
  ])
90658
90658
  )
90659
90659
  );
@@ -90662,13 +90662,13 @@ async function snapshot(root) {
90662
90662
  async function reconcile(root, before, _verb, detail) {
90663
90663
  await assertNoSymlinkSegments(root, MEMORY_INDEX_RELPATH);
90664
90664
  await assertNoSymlinkSegments(root, MEMORY_LOG_RELPATH);
90665
- const originalIndex = await readFileIfPresent(path136.join(root, MEMORY_INDEX_RELPATH));
90666
- const originalLog = await readFileIfPresent(path136.join(root, MEMORY_LOG_RELPATH));
90665
+ const originalIndex = await readFileIfPresent(path137.join(root, MEMORY_INDEX_RELPATH));
90666
+ const originalLog = await readFileIfPresent(path137.join(root, MEMORY_LOG_RELPATH));
90667
90667
  await initMemory(root);
90668
90668
  const timestamp2 = (/* @__PURE__ */ new Date()).toISOString();
90669
90669
  const currentPages = await Promise.all(
90670
90670
  (await collectMarkdownRelPaths(root, MEMORY_PAGES_DIR_RELPATH)).map(async (relPath) => {
90671
- const absPath = path136.join(root, relPath);
90671
+ const absPath = path137.join(root, relPath);
90672
90672
  const markdown = await fs17.readFile(absPath, "utf8");
90673
90673
  const parsed = parsePageMarkdown(relPath, markdown);
90674
90674
  const normalizedFrontmatter = withDenormalizedSources(parsed.frontmatter, parsed.body);
@@ -90691,7 +90691,7 @@ async function reconcile(root, before, _verb, detail) {
90691
90691
  );
90692
90692
  try {
90693
90693
  await Promise.all(
90694
- currentPages.filter((page) => page.currentMarkdown !== page.nextMarkdown).map((page) => writeFileAtomically3(path136.join(root, page.relPath), page.nextMarkdown))
90694
+ currentPages.filter((page) => page.currentMarkdown !== page.nextMarkdown).map((page) => writeFileAtomically3(path137.join(root, page.relPath), page.nextMarkdown))
90695
90695
  );
90696
90696
  const diff2 = diffSnapshots(before, await snapshot(root));
90697
90697
  await writeIndex(root);
@@ -90699,10 +90699,10 @@ async function reconcile(root, before, _verb, detail) {
90699
90699
  return diff2;
90700
90700
  } catch (error3) {
90701
90701
  await Promise.all(
90702
- currentPages.filter((page) => page.currentMarkdown !== page.nextMarkdown).map((page) => writeFileAtomically3(path136.join(root, page.relPath), page.currentMarkdown).catch(() => void 0))
90702
+ currentPages.filter((page) => page.currentMarkdown !== page.nextMarkdown).map((page) => writeFileAtomically3(path137.join(root, page.relPath), page.currentMarkdown).catch(() => void 0))
90703
90703
  );
90704
- await restoreGeneratedFile(path136.join(root, MEMORY_INDEX_RELPATH), originalIndex);
90705
- await restoreGeneratedFile(path136.join(root, MEMORY_LOG_RELPATH), originalLog);
90704
+ await restoreGeneratedFile(path137.join(root, MEMORY_INDEX_RELPATH), originalIndex);
90705
+ await restoreGeneratedFile(path137.join(root, MEMORY_LOG_RELPATH), originalLog);
90706
90706
  throw error3;
90707
90707
  }
90708
90708
  }
@@ -90730,7 +90730,7 @@ async function appendLogEntries(root, diff2, detail, timestamp2 = (/* @__PURE__
90730
90730
  return;
90731
90731
  }
90732
90732
  await assertNoSymlinkSegments(root, MEMORY_LOG_RELPATH);
90733
- const logPath = path136.join(root, MEMORY_LOG_RELPATH);
90733
+ const logPath = path137.join(root, MEMORY_LOG_RELPATH);
90734
90734
  const existing = await fs17.readFile(logPath, "utf8");
90735
90735
  const separator = existing.length === 0 || existing.endsWith("\n") ? "" : "\n";
90736
90736
  await writeFileAtomically3(logPath, `${existing}${separator}${entries.join("\n")}
@@ -90755,7 +90755,7 @@ async function writeIndex(root) {
90755
90755
  description: page.frontmatter.description ?? ""
90756
90756
  }))
90757
90757
  );
90758
- await writeFileAtomically3(path136.join(root, MEMORY_INDEX_RELPATH), index);
90758
+ await writeFileAtomically3(path137.join(root, MEMORY_INDEX_RELPATH), index);
90759
90759
  }
90760
90760
  async function readFileIfPresent(filePath) {
90761
90761
  try {
@@ -90829,14 +90829,14 @@ var init_reconcile2 = __esm({
90829
90829
  // packages/memory/src/write.ts
90830
90830
  import { randomUUID as randomUUID15 } from "node:crypto";
90831
90831
  import * as fs18 from "node:fs/promises";
90832
- import path137 from "node:path";
90832
+ import path138 from "node:path";
90833
90833
  async function writePage(root, relPath, body, opts) {
90834
90834
  const pageRelPath = assertPageRelPath(relPath);
90835
90835
  await assertNoSymlinkSegments(root, pageRelPath);
90836
- const pagePath = path137.join(root, pageRelPath);
90836
+ const pagePath = path138.join(root, pageRelPath);
90837
90837
  const originalPage = await readMarkdownIfPresent(pagePath);
90838
90838
  const before = await snapshot(root);
90839
- await fs18.mkdir(path137.dirname(pagePath), { recursive: true });
90839
+ await fs18.mkdir(path138.dirname(pagePath), { recursive: true });
90840
90840
  try {
90841
90841
  await writeFileAtomically3(pagePath, serializeFrontmatter(opts.frontmatter ?? {}, body));
90842
90842
  return await reconcile(root, before, "update", opts.reason);
@@ -90848,10 +90848,10 @@ async function writePage(root, relPath, body, opts) {
90848
90848
  async function appendToPage(root, relPath, content, opts) {
90849
90849
  const pageRelPath = assertPageRelPath(relPath);
90850
90850
  await assertNoSymlinkSegments(root, pageRelPath);
90851
- const pagePath = path137.join(root, pageRelPath);
90851
+ const pagePath = path138.join(root, pageRelPath);
90852
90852
  const originalPage = await readMarkdownIfPresent(pagePath);
90853
90853
  const before = await snapshot(root);
90854
- await fs18.mkdir(path137.dirname(pagePath), { recursive: true });
90854
+ await fs18.mkdir(path138.dirname(pagePath), { recursive: true });
90855
90855
  const parsed = originalPage === void 0 ? { frontmatter: {}, body: "" } : parseFrontmatter4(originalPage);
90856
90856
  try {
90857
90857
  await writeFileAtomically3(
@@ -90885,7 +90885,7 @@ async function clearMemory(root) {
90885
90885
  }
90886
90886
  function assertPageRelPath(relPath) {
90887
90887
  const normalizedRelPath = assertSafeRelPath(relPath);
90888
- if (!normalizedRelPath.startsWith(`${MEMORY_PAGES_DIR_RELPATH}/`) || path137.posix.extname(normalizedRelPath).toLowerCase() !== ".md") {
90888
+ if (!normalizedRelPath.startsWith(`${MEMORY_PAGES_DIR_RELPATH}/`) || path138.posix.extname(normalizedRelPath).toLowerCase() !== ".md") {
90889
90889
  throw new Error(`Expected a markdown page path under "${MEMORY_PAGES_DIR_RELPATH}/".`);
90890
90890
  }
90891
90891
  return normalizedRelPath;
@@ -90920,16 +90920,16 @@ var init_write2 = __esm({
90920
90920
 
90921
90921
  // packages/memory/src/edit.ts
90922
90922
  import * as fs19 from "node:fs/promises";
90923
- import path138 from "node:path";
90923
+ import path139 from "node:path";
90924
90924
  async function editPage(root, relPath, opts) {
90925
90925
  const normalizedRelPath = assertSafeRelPath(relPath);
90926
- const pagePath = path138.join(root, normalizedRelPath);
90926
+ const pagePath = path139.join(root, normalizedRelPath);
90927
90927
  const original = await readIfPresent(pagePath);
90928
- const tempRoot = path138.join(root, ".tmp");
90928
+ const tempRoot = path139.join(root, ".tmp");
90929
90929
  await assertNoSymlinkSegments(root, ".tmp");
90930
90930
  await fs19.mkdir(tempRoot, { recursive: true });
90931
- const tempDir = await fs19.mkdtemp(path138.join(tempRoot, "poe-code-memory-edit-"));
90932
- const tempPath = path138.join(tempDir, path138.basename(normalizedRelPath));
90931
+ const tempDir = await fs19.mkdtemp(path139.join(tempRoot, "poe-code-memory-edit-"));
90932
+ const tempPath = path139.join(tempDir, path139.basename(normalizedRelPath));
90933
90933
  try {
90934
90934
  await fs19.writeFile(tempPath, original ?? "", "utf8");
90935
90935
  await opts.launchEditor(tempPath);
@@ -90971,7 +90971,7 @@ var init_edit = __esm({
90971
90971
 
90972
90972
  // packages/memory/src/audit.ts
90973
90973
  import * as fs20 from "node:fs/promises";
90974
- import path139 from "node:path";
90974
+ import path140 from "node:path";
90975
90975
  async function auditClaims(root, repoRoot, options = {}) {
90976
90976
  const minInferredConfidence = options.minInferredConfidence ?? DEFAULT_MIN_INFERRED_CONFIDENCE;
90977
90977
  const rejectUntagged = options.rejectUntagged ?? DEFAULT_REJECT_UNTAGGED;
@@ -91023,10 +91023,10 @@ async function auditSourceRef(source, claimLineNumber, repoRoot, sourceCache) {
91023
91023
  if (isUrlLike(source.path)) {
91024
91024
  return void 0;
91025
91025
  }
91026
- if (path139.isAbsolute(source.path)) {
91026
+ if (path140.isAbsolute(source.path)) {
91027
91027
  return `Claim on line ${claimLineNumber} cites "${serializeSourceRef(source)}", but source paths must be repo-relative or URLs.`;
91028
91028
  }
91029
- const absPath = path139.resolve(repoRoot, source.path);
91029
+ const absPath = path140.resolve(repoRoot, source.path);
91030
91030
  if (!isWithinRoot(repoRoot, absPath)) {
91031
91031
  return `Claim on line ${claimLineNumber} cites "${serializeSourceRef(source)}", which resolves outside the repo root.`;
91032
91032
  }
@@ -91108,8 +91108,8 @@ function isUrlLike(value) {
91108
91108
  return /^[a-z][a-z\d+.-]*:\/\//i.test(value);
91109
91109
  }
91110
91110
  function isWithinRoot(root, absPath) {
91111
- const relative6 = path139.relative(root, absPath);
91112
- return relative6 === "" || !relative6.startsWith("..") && !path139.isAbsolute(relative6);
91111
+ const relative6 = path140.relative(root, absPath);
91112
+ return relative6 === "" || !relative6.startsWith("..") && !path140.isAbsolute(relative6);
91113
91113
  }
91114
91114
  var DEFAULT_MIN_INFERRED_CONFIDENCE, DEFAULT_REJECT_UNTAGGED, DEFAULT_UNTAGGED_BODY_THRESHOLD_CHARS;
91115
91115
  var init_audit = __esm({
@@ -91127,7 +91127,7 @@ var init_audit = __esm({
91127
91127
  // packages/memory/src/cache.ts
91128
91128
  import { createHash as createHash9 } from "node:crypto";
91129
91129
  import * as fs21 from "node:fs/promises";
91130
- import path140 from "node:path";
91130
+ import path141 from "node:path";
91131
91131
  function computeIngestKey(input) {
91132
91132
  const hash = createHash9("sha256");
91133
91133
  hash.update(input.sourceBytes);
@@ -91140,7 +91140,7 @@ function computeIngestKey(input) {
91140
91140
  return hash.digest("hex");
91141
91141
  }
91142
91142
  async function readCacheEntry(root, key2) {
91143
- const cachePath = path140.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH, `${assertSafeRelPath(key2)}.json`);
91143
+ const cachePath = path141.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH, `${assertSafeRelPath(key2)}.json`);
91144
91144
  let raw;
91145
91145
  try {
91146
91146
  raw = await fs21.readFile(cachePath, "utf8");
@@ -91160,18 +91160,18 @@ async function readCacheEntry(root, key2) {
91160
91160
  }
91161
91161
  async function writeCacheEntry(root, entry) {
91162
91162
  const key2 = assertSafeRelPath(entry.key);
91163
- await fs21.mkdir(path140.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH), { recursive: true });
91163
+ await fs21.mkdir(path141.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH), { recursive: true });
91164
91164
  await writeFileAtomically3(
91165
- path140.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH, `${key2}.json`),
91165
+ path141.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH, `${key2}.json`),
91166
91166
  `${JSON.stringify(entry)}
91167
91167
  `
91168
91168
  );
91169
91169
  }
91170
91170
  async function cacheStatus(root) {
91171
- const ingestDir = path140.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH);
91171
+ const ingestDir = path141.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH);
91172
91172
  const fileNames = await readCacheFileNames(ingestDir);
91173
91173
  const sizes = await Promise.all(
91174
- fileNames.map(async (fileName) => (await fs21.stat(path140.join(ingestDir, fileName))).size)
91174
+ fileNames.map(async (fileName) => (await fs21.stat(path141.join(ingestDir, fileName))).size)
91175
91175
  );
91176
91176
  return {
91177
91177
  entries: fileNames.length,
@@ -91179,8 +91179,8 @@ async function cacheStatus(root) {
91179
91179
  };
91180
91180
  }
91181
91181
  async function clearCache(root, opts = {}) {
91182
- const ingestDir = path140.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH);
91183
- const cacheDir = path140.join(root, MEMORY_CACHE_DIR_RELPATH);
91182
+ const ingestDir = path141.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH);
91183
+ const cacheDir = path141.join(root, MEMORY_CACHE_DIR_RELPATH);
91184
91184
  const fileNames = await readCacheFileNames(ingestDir);
91185
91185
  if (fileNames.length === 0) {
91186
91186
  if (opts.olderThanMs === void 0) {
@@ -91200,7 +91200,7 @@ async function clearCache(root, opts = {}) {
91200
91200
  if (entry === null || Date.parse(entry.ingestedAt) > cutoff) {
91201
91201
  continue;
91202
91202
  }
91203
- const filePath = path140.join(ingestDir, fileName);
91203
+ const filePath = path141.join(ingestDir, fileName);
91204
91204
  expiredEntries.push({ filePath, content: await fs21.readFile(filePath, "utf8") });
91205
91205
  }
91206
91206
  try {
@@ -91266,7 +91266,7 @@ function expectStringArray2(value, field) {
91266
91266
  }
91267
91267
  async function readCacheFileNames(ingestDir) {
91268
91268
  try {
91269
- return (await fs21.readdir(ingestDir)).filter((fileName) => path140.posix.extname(fileName).toLowerCase() === ".json").sort((left, right) => left.localeCompare(right));
91269
+ return (await fs21.readdir(ingestDir)).filter((fileName) => path141.posix.extname(fileName).toLowerCase() === ".json").sort((left, right) => left.localeCompare(right));
91270
91270
  } catch (error3) {
91271
91271
  if (isMissing5(error3)) {
91272
91272
  return [];
@@ -91437,7 +91437,7 @@ var init_src41 = __esm({
91437
91437
 
91438
91438
  // packages/memory/src/tokens.ts
91439
91439
  import * as fs22 from "node:fs/promises";
91440
- import path141 from "node:path";
91440
+ import path142 from "node:path";
91441
91441
  async function computeTokenStats(root) {
91442
91442
  if (!await pathExists14(root)) {
91443
91443
  return {
@@ -91459,18 +91459,18 @@ async function computeTokenStats(root) {
91459
91459
  }
91460
91460
  }
91461
91461
  }
91462
- const repoRoot = path141.resolve(root, "..", "..");
91462
+ const repoRoot = path142.resolve(root, "..", "..");
91463
91463
  let sourceTokens = 0;
91464
91464
  const missingSources = [];
91465
91465
  for (const sourcePath of sourcePaths) {
91466
91466
  if (isUrlLike2(sourcePath)) {
91467
91467
  continue;
91468
91468
  }
91469
- if (path141.isAbsolute(sourcePath)) {
91469
+ if (path142.isAbsolute(sourcePath)) {
91470
91470
  missingSources.push(sourcePath);
91471
91471
  continue;
91472
91472
  }
91473
- const absPath = path141.resolve(repoRoot, sourcePath);
91473
+ const absPath = path142.resolve(repoRoot, sourcePath);
91474
91474
  if (!isWithinRoot2(repoRoot, absPath)) {
91475
91475
  missingSources.push(sourcePath);
91476
91476
  continue;
@@ -91523,8 +91523,8 @@ function isUrlLike2(value) {
91523
91523
  }
91524
91524
  }
91525
91525
  function isWithinRoot2(root, absPath) {
91526
- const relative6 = path141.relative(root, absPath);
91527
- return relative6 === "" || !relative6.startsWith("..") && !path141.isAbsolute(relative6);
91526
+ const relative6 = path142.relative(root, absPath);
91527
+ return relative6 === "" || !relative6.startsWith("..") && !path142.isAbsolute(relative6);
91528
91528
  }
91529
91529
  var init_tokens2 = __esm({
91530
91530
  "packages/memory/src/tokens.ts"() {
@@ -91536,7 +91536,7 @@ var init_tokens2 = __esm({
91536
91536
 
91537
91537
  // packages/memory/src/ingest.ts
91538
91538
  import * as fs23 from "node:fs/promises";
91539
- import path142 from "node:path";
91539
+ import path143 from "node:path";
91540
91540
  function resolveRunners2(overrides) {
91541
91541
  return {
91542
91542
  computeIngestKey: overrides?.computeIngestKey ?? computeIngestKey,
@@ -91550,11 +91550,11 @@ function resolveRunners2(overrides) {
91550
91550
  async function ingest(root, opts, runners) {
91551
91551
  const resolved = resolveRunners2(runners);
91552
91552
  const source = await materializeSource(opts.source);
91553
- const indexMdBytes = await fs23.readFile(path142.join(root, MEMORY_INDEX_RELPATH));
91553
+ const indexMdBytes = await fs23.readFile(path143.join(root, MEMORY_INDEX_RELPATH));
91554
91554
  const configOptions = {
91555
91555
  fs: fs23,
91556
- filePath: path142.join(inferRepoRoot(root), "poe-code.json"),
91557
- projectFilePath: path142.join(inferRepoRoot(root), ".poe-code", "config.json")
91556
+ filePath: path143.join(inferRepoRoot(root), "poe-code.json"),
91557
+ projectFilePath: path143.join(inferRepoRoot(root), ".poe-code", "config.json")
91558
91558
  };
91559
91559
  const agentId = await resolveAgent(configOptions, opts.agent ?? null) ?? opts.agent ?? "claude-code";
91560
91560
  const key2 = resolved.computeIngestKey({
@@ -91655,7 +91655,7 @@ async function materializeSource(source) {
91655
91655
  };
91656
91656
  }
91657
91657
  function inferRepoRoot(root) {
91658
- return path142.resolve(root, "..", "..");
91658
+ return path143.resolve(root, "..", "..");
91659
91659
  }
91660
91660
  async function runWithTimeout(promise, timeoutMs, onTimeout) {
91661
91661
  return await new Promise((resolve10, reject) => {
@@ -91774,7 +91774,7 @@ var init_mcp5 = __esm({
91774
91774
  });
91775
91775
 
91776
91776
  // packages/memory/src/install.ts
91777
- import path143 from "node:path";
91777
+ import path144 from "node:path";
91778
91778
  async function installMemory(options) {
91779
91779
  if (options.skillOnly && options.mcpOnly) {
91780
91780
  throw new Error("--skill-only and --mcp-only cannot be combined.");
@@ -91838,12 +91838,12 @@ async function installMemory(options) {
91838
91838
  async function removeInstalledSkill(options, skillPath) {
91839
91839
  const baseDir = options.scope === "global" ? options.homeDir : options.cwd;
91840
91840
  const displayPath = skillPath.startsWith("~/") ? skillPath.slice(2) : skillPath;
91841
- const skillDirectory = path143.join(baseDir, path143.dirname(displayPath));
91841
+ const skillDirectory = path144.join(baseDir, path144.dirname(displayPath));
91842
91842
  if (options.fs.rm !== void 0) {
91843
91843
  await options.fs.rm(skillDirectory, { recursive: true, force: true });
91844
91844
  return;
91845
91845
  }
91846
- await options.fs.unlink(path143.join(skillDirectory, "SKILL.md"));
91846
+ await options.fs.unlink(path144.join(skillDirectory, "SKILL.md"));
91847
91847
  }
91848
91848
  var SKILL_NAME;
91849
91849
  var init_install3 = __esm({
@@ -91857,7 +91857,7 @@ var init_install3 = __esm({
91857
91857
 
91858
91858
  // packages/memory/src/query.ts
91859
91859
  import * as fs24 from "node:fs/promises";
91860
- import path144 from "node:path";
91860
+ import path145 from "node:path";
91861
91861
  async function queryMemory(root, options) {
91862
91862
  const pages = await listPages(root);
91863
91863
  if (pages.length === 0) {
@@ -91871,8 +91871,8 @@ async function queryMemory(root, options) {
91871
91871
  }
91872
91872
  const configOptions = {
91873
91873
  fs: fs24,
91874
- filePath: path144.join(inferRepoRoot2(root), "poe-code.json"),
91875
- projectFilePath: path144.join(inferRepoRoot2(root), ".poe-code", "config.json")
91874
+ filePath: path145.join(inferRepoRoot2(root), "poe-code.json"),
91875
+ projectFilePath: path145.join(inferRepoRoot2(root), ".poe-code", "config.json")
91876
91876
  };
91877
91877
  const agentId = await resolveAgent(configOptions, options.agent ?? null) ?? options.agent ?? "claude-code";
91878
91878
  const context = await selectQueryContext(root, options.question, options.budget);
@@ -91911,7 +91911,7 @@ async function selectQueryContext(root, question, budget) {
91911
91911
  throw new Error("budget must be a finite non-negative number");
91912
91912
  }
91913
91913
  const [indexText, pages] = await Promise.all([
91914
- fs24.readFile(path144.join(root, MEMORY_INDEX_RELPATH), "utf8"),
91914
+ fs24.readFile(path145.join(root, MEMORY_INDEX_RELPATH), "utf8"),
91915
91915
  listPages(root)
91916
91916
  ]);
91917
91917
  const indexTokens = countTokens(indexText);
@@ -91990,7 +91990,7 @@ function tokenize2(text6) {
91990
91990
  return text6.toLowerCase().split(/[^a-z0-9]+/).filter((token) => token.length > 0);
91991
91991
  }
91992
91992
  function inferRepoRoot2(root) {
91993
- return path144.resolve(root, "..", "..");
91993
+ return path145.resolve(root, "..", "..");
91994
91994
  }
91995
91995
  var init_query = __esm({
91996
91996
  "packages/memory/src/query.ts"() {
@@ -92005,7 +92005,7 @@ var init_query = __esm({
92005
92005
 
92006
92006
  // packages/memory/src/explain.ts
92007
92007
  import * as fs25 from "node:fs/promises";
92008
- import path145 from "node:path";
92008
+ import path146 from "node:path";
92009
92009
  async function explainPage(root, options) {
92010
92010
  const targetPage = await readPageIfPresent(root, options.relPath);
92011
92011
  if (targetPage === void 0) {
@@ -92028,8 +92028,8 @@ async function explainPage(root, options) {
92028
92028
  }
92029
92029
  const configOptions = {
92030
92030
  fs: fs25,
92031
- filePath: path145.join(inferRepoRoot3(root), "poe-code.json"),
92032
- projectFilePath: path145.join(inferRepoRoot3(root), ".poe-code", "config.json")
92031
+ filePath: path146.join(inferRepoRoot3(root), "poe-code.json"),
92032
+ projectFilePath: path146.join(inferRepoRoot3(root), ".poe-code", "config.json")
92033
92033
  };
92034
92034
  const agentId = await resolveAgent(configOptions, options.agent ?? null) ?? options.agent ?? "claude-code";
92035
92035
  const spawned = await spawn5(agentId, { prompt });
@@ -92099,7 +92099,7 @@ async function readPageIfPresent(root, relPath) {
92099
92099
  }
92100
92100
  }
92101
92101
  function inferRepoRoot3(root) {
92102
- return path145.resolve(root, "..", "..");
92102
+ return path146.resolve(root, "..", "..");
92103
92103
  }
92104
92104
  var init_explain = __esm({
92105
92105
  "packages/memory/src/explain.ts"() {
@@ -92121,9 +92121,9 @@ var init_explain_cli = __esm({
92121
92121
  });
92122
92122
 
92123
92123
  // packages/memory/src/handle.ts
92124
- import path146 from "node:path";
92124
+ import path147 from "node:path";
92125
92125
  function openMemory(opts) {
92126
- if (!path146.isAbsolute(opts.root)) {
92126
+ if (!path147.isAbsolute(opts.root)) {
92127
92127
  throw new Error(`openMemory: root must be absolute, got ${opts.root}`);
92128
92128
  }
92129
92129
  const root = opts.root;
@@ -92205,7 +92205,7 @@ var init_SKILL_memory = __esm({
92205
92205
  });
92206
92206
 
92207
92207
  // src/cli/commands/memory.ts
92208
- import path147 from "node:path";
92208
+ import path148 from "node:path";
92209
92209
  import * as fs26 from "node:fs/promises";
92210
92210
  import { execSync as execSync4 } from "node:child_process";
92211
92211
  async function resolveRoot(container) {
@@ -92223,8 +92223,8 @@ function resolvePageRelPath(input) {
92223
92223
  throw new ValidationError("Missing page path.");
92224
92224
  }
92225
92225
  const normalized = trimmed.replaceAll("\\", "/");
92226
- const withExt = path147.posix.extname(normalized).length === 0 ? `${normalized}.md` : normalized;
92227
- const relPath = path147.posix.normalize(withExt.startsWith("pages/") ? withExt : `pages/${withExt}`);
92226
+ const withExt = path148.posix.extname(normalized).length === 0 ? `${normalized}.md` : normalized;
92227
+ const relPath = path148.posix.normalize(withExt.startsWith("pages/") ? withExt : `pages/${withExt}`);
92228
92228
  if (!relPath.startsWith("pages/") || relPath === "pages/.." || relPath.includes("/../")) {
92229
92229
  throw new ValidationError("Page path must remain under memory pages/.");
92230
92230
  }
@@ -92283,7 +92283,7 @@ function resolveIngestSource(cwd, input) {
92283
92283
  throw error3;
92284
92284
  }
92285
92285
  }
92286
- return { kind: "file", absPath: path147.resolve(cwd, input) };
92286
+ return { kind: "file", absPath: path148.resolve(cwd, input) };
92287
92287
  }
92288
92288
  function registerMemoryCommand(program, container) {
92289
92289
  const memory = program.command("memory").description("Persistent memory directory commands.").allowExcessArguments().action(function() {
@@ -92309,8 +92309,8 @@ function registerMemoryCommand(program, container) {
92309
92309
  }
92310
92310
  await initMemory(root);
92311
92311
  resources.context.complete({
92312
- success: `Initialized memory at ${path147.relative(container.env.cwd, root)}`,
92313
- dry: `Would initialize memory at ${path147.relative(container.env.cwd, root)}`
92312
+ success: `Initialized memory at ${path148.relative(container.env.cwd, root)}`,
92313
+ dry: `Would initialize memory at ${path148.relative(container.env.cwd, root)}`
92314
92314
  });
92315
92315
  resources.context.finalize();
92316
92316
  });
@@ -92342,7 +92342,7 @@ function registerMemoryCommand(program, container) {
92342
92342
  resources.logger.intro("memory show");
92343
92343
  await assertInitialized(mem);
92344
92344
  const relPath = resolvePageRelPath(pagePath);
92345
- const absPath = path147.join(mem.root, relPath);
92345
+ const absPath = path148.join(mem.root, relPath);
92346
92346
  try {
92347
92347
  await mem.readPage(relPath);
92348
92348
  const content = await fs26.readFile(absPath, "utf8");
@@ -93036,7 +93036,7 @@ var init_provider = __esm({
93036
93036
  });
93037
93037
 
93038
93038
  // src/cli/commands/runtime/build.ts
93039
- import path148 from "node:path";
93039
+ import path149 from "node:path";
93040
93040
  function registerRuntimeBuildCommand(runtime, root, container) {
93041
93041
  const cmd = runtime.command("build").description("Build the configured runtime template.").option("--force", "Ignore the local template cache and rebuild.");
93042
93042
  addRuntimeOptions(cmd).action(async (options) => {
@@ -93125,16 +93125,16 @@ async function executeRuntimeBuild(program, container, options) {
93125
93125
  });
93126
93126
  }
93127
93127
  async function requireRuntimeBuildPaths(container, runtime, label) {
93128
- const dockerfilePath = path148.resolve(
93128
+ const dockerfilePath = path149.resolve(
93129
93129
  container.env.cwd,
93130
- runtime.dockerfile ?? path148.join(".poe-code", "Dockerfile")
93130
+ runtime.dockerfile ?? path149.join(".poe-code", "Dockerfile")
93131
93131
  );
93132
93132
  if (!await pathExists(container.fs, dockerfilePath)) {
93133
93133
  throw new Error(`${label} runtime requires a Dockerfile at ${dockerfilePath}.`);
93134
93134
  }
93135
93135
  return {
93136
93136
  dockerfilePath,
93137
- buildContext: path148.resolve(container.env.cwd, runtime.build_context ?? ".")
93137
+ buildContext: path149.resolve(container.env.cwd, runtime.build_context ?? ".")
93138
93138
  };
93139
93139
  }
93140
93140
  async function loadE2bRunnerModule() {
@@ -93175,9 +93175,9 @@ var init_build = __esm({
93175
93175
  });
93176
93176
 
93177
93177
  // src/cli/commands/runtime/shared.ts
93178
- import path149 from "node:path";
93178
+ import path150 from "node:path";
93179
93179
  function resolveDockerfilePath(container) {
93180
- return path149.join(container.env.cwd, ".poe-code", "Dockerfile");
93180
+ return path150.join(container.env.cwd, ".poe-code", "Dockerfile");
93181
93181
  }
93182
93182
  async function resolveRuntimeType(input) {
93183
93183
  if (input.value !== void 0) {
@@ -93219,7 +93219,7 @@ async function writeDefaultDockerfileIfNeeded(input) {
93219
93219
  if (await pathExists(input.container.fs, dockerfilePath)) {
93220
93220
  return false;
93221
93221
  }
93222
- await input.container.fs.mkdir(path149.dirname(dockerfilePath), { recursive: true });
93222
+ await input.container.fs.mkdir(path150.dirname(dockerfilePath), { recursive: true });
93223
93223
  await input.container.fs.writeFile(dockerfilePath, defaultDockerfile, { encoding: "utf8" });
93224
93224
  return true;
93225
93225
  }
@@ -106185,9 +106185,9 @@ function findPathToModule(currentModuleName, targetModuleName, dependencyGraph,
106185
106185
  }
106186
106186
  visited.add(currentModuleName);
106187
106187
  for (const dependencyModuleName of dependencyGraph.get(currentModuleName) ?? []) {
106188
- const path154 = findPathToModule(dependencyModuleName, targetModuleName, dependencyGraph, visited);
106189
- if (path154 !== void 0) {
106190
- return [currentModuleName, ...path154];
106188
+ const path155 = findPathToModule(dependencyModuleName, targetModuleName, dependencyGraph, visited);
106189
+ if (path155 !== void 0) {
106190
+ return [currentModuleName, ...path155];
106191
106191
  }
106192
106192
  }
106193
106193
  visited.delete(currentModuleName);
@@ -110883,7 +110883,7 @@ function createDumpFile(snapshot2) {
110883
110883
  }
110884
110884
  return dumped;
110885
110885
  }
110886
- function serializeDumpValue(value, path154, state) {
110886
+ function serializeDumpValue(value, path155, state) {
110887
110887
  if (value === null || typeof value === "string" || typeof value === "boolean") {
110888
110888
  return value;
110889
110889
  }
@@ -110900,22 +110900,22 @@ function serializeDumpValue(value, path154, state) {
110900
110900
  return SKIP_VALUE;
110901
110901
  }
110902
110902
  if (Array.isArray(value)) {
110903
- const reference2 = serializeHeapReference(value, path154, state);
110903
+ const reference2 = serializeHeapReference(value, path155, state);
110904
110904
  if (reference2 !== void 0) {
110905
110905
  return reference2;
110906
110906
  }
110907
- return serializeArrayItems(value, path154, state);
110907
+ return serializeArrayItems(value, path155, state);
110908
110908
  }
110909
110909
  if (!isPlainObject7(value)) {
110910
110910
  return SKIP_VALUE;
110911
110911
  }
110912
- const reference = serializeHeapReference(value, path154, state);
110912
+ const reference = serializeHeapReference(value, path155, state);
110913
110913
  if (reference !== void 0) {
110914
110914
  return reference;
110915
110915
  }
110916
- return serializeObjectEntries(value, path154, state);
110916
+ return serializeObjectEntries(value, path155, state);
110917
110917
  }
110918
- function serializeHeapReference(value, path154, state) {
110918
+ function serializeHeapReference(value, path155, state) {
110919
110919
  const id = state.heapIds.get(value);
110920
110920
  if (id === void 0) {
110921
110921
  return void 0;
@@ -110925,12 +110925,12 @@ function serializeHeapReference(value, path154, state) {
110925
110925
  if (Array.isArray(value)) {
110926
110926
  state.heap[String(id)] = {
110927
110927
  kind: "array",
110928
- items: serializeArrayItems(value, path154, state)
110928
+ items: serializeArrayItems(value, path155, state)
110929
110929
  };
110930
110930
  } else {
110931
110931
  state.heap[String(id)] = {
110932
110932
  kind: "object",
110933
- entries: serializeObjectEntries(value, path154, state)
110933
+ entries: serializeObjectEntries(value, path155, state)
110934
110934
  };
110935
110935
  }
110936
110936
  }
@@ -110939,10 +110939,10 @@ function serializeHeapReference(value, path154, state) {
110939
110939
  id
110940
110940
  };
110941
110941
  }
110942
- function serializeObjectEntries(value, path154, state) {
110942
+ function serializeObjectEntries(value, path155, state) {
110943
110943
  const serialized = {};
110944
110944
  for (const [key2, entry] of getEnumerableDataEntries(value)) {
110945
- const dumped = serializeDumpValue(entry, `${path154}.${key2}`, state);
110945
+ const dumped = serializeDumpValue(entry, `${path155}.${key2}`, state);
110946
110946
  if (dumped !== SKIP_VALUE) {
110947
110947
  serialized[key2] = dumped;
110948
110948
  }
@@ -111004,9 +111004,9 @@ function isPlainObject7(value) {
111004
111004
  const prototype = Object.getPrototypeOf(value);
111005
111005
  return prototype === Object.prototype || prototype === null;
111006
111006
  }
111007
- function serializeArrayItems(value, path154, state) {
111007
+ function serializeArrayItems(value, path155, state) {
111008
111008
  return getArrayDataItems(value).map((entry, index) => {
111009
- const serialized = serializeDumpValue(entry, `${path154}[${index}]`, state);
111009
+ const serialized = serializeDumpValue(entry, `${path155}[${index}]`, state);
111010
111010
  return serialized === SKIP_VALUE ? { kind: "undefined" } : serialized;
111011
111011
  });
111012
111012
  }
@@ -111405,7 +111405,7 @@ function deepCopyFromSandbox(value, options = {}) {
111405
111405
  options
111406
111406
  );
111407
111407
  }
111408
- function copyToSandbox(value, state, path154 = "<root>") {
111408
+ function copyToSandbox(value, state, path155 = "<root>") {
111409
111409
  if (isSandboxPrimitive(value)) {
111410
111410
  return value;
111411
111411
  }
@@ -111432,11 +111432,11 @@ function copyToSandbox(value, state, path154 = "<root>") {
111432
111432
  }
111433
111433
  const copy = new Array(value.length);
111434
111434
  state.seen.set(value, copy);
111435
- for (const entry of getEnumerableArrayEntries(value, path154)) {
111435
+ for (const entry of getEnumerableArrayEntries(value, path155)) {
111436
111436
  defineOwnDataProperty(
111437
111437
  copy,
111438
111438
  entry.key,
111439
- copyToSandbox(entry.value, state, joinArrayPath(path154, entry.key))
111439
+ copyToSandbox(entry.value, state, joinArrayPath(path155, entry.key))
111440
111440
  );
111441
111441
  }
111442
111442
  return copy;
@@ -111448,18 +111448,18 @@ function copyToSandbox(value, state, path154 = "<root>") {
111448
111448
  }
111449
111449
  const copy = createPlainObject(Object.getPrototypeOf(value) === null);
111450
111450
  state.seen.set(value, copy);
111451
- for (const entry of getEnumerableObjectEntries(value, path154)) {
111451
+ for (const entry of getEnumerableObjectEntries(value, path155)) {
111452
111452
  defineOwnDataProperty(
111453
111453
  copy,
111454
111454
  entry.key,
111455
- copyToSandbox(entry.value, state, joinPath(path154, entry.key))
111455
+ copyToSandbox(entry.value, state, joinPath(path155, entry.key))
111456
111456
  );
111457
111457
  }
111458
111458
  return copy;
111459
111459
  }
111460
- throw new TypeError(`Unsupported sandbox value at ${path154}: ${describeValue(value)}`);
111460
+ throw new TypeError(`Unsupported sandbox value at ${path155}: ${describeValue(value)}`);
111461
111461
  }
111462
- function copyFromSandbox(value, state, path154 = "<root>", options) {
111462
+ function copyFromSandbox(value, state, path155 = "<root>", options) {
111463
111463
  if (isSandboxPrimitive(value)) {
111464
111464
  return value;
111465
111465
  }
@@ -111490,11 +111490,11 @@ function copyFromSandbox(value, state, path154 = "<root>", options) {
111490
111490
  }
111491
111491
  const copy = new Array(value.length);
111492
111492
  state.seen.set(value, copy);
111493
- for (const entry of getEnumerableArrayEntries(value, path154)) {
111493
+ for (const entry of getEnumerableArrayEntries(value, path155)) {
111494
111494
  defineOwnDataProperty(
111495
111495
  copy,
111496
111496
  entry.key,
111497
- copyFromSandbox(entry.value, state, joinArrayPath(path154, entry.key), options)
111497
+ copyFromSandbox(entry.value, state, joinArrayPath(path155, entry.key), options)
111498
111498
  );
111499
111499
  }
111500
111500
  return copy;
@@ -111506,16 +111506,16 @@ function copyFromSandbox(value, state, path154 = "<root>", options) {
111506
111506
  }
111507
111507
  const copy = createPlainObject(Object.getPrototypeOf(value) === null);
111508
111508
  state.seen.set(value, copy);
111509
- for (const entry of getEnumerableObjectEntries(value, path154)) {
111509
+ for (const entry of getEnumerableObjectEntries(value, path155)) {
111510
111510
  defineOwnDataProperty(
111511
111511
  copy,
111512
111512
  entry.key,
111513
- copyFromSandbox(entry.value, state, joinPath(path154, entry.key), options)
111513
+ copyFromSandbox(entry.value, state, joinPath(path155, entry.key), options)
111514
111514
  );
111515
111515
  }
111516
111516
  return copy;
111517
111517
  }
111518
- throw new TypeError(`Unsupported sandbox value at ${path154}: ${describeValue(value)}`);
111518
+ throw new TypeError(`Unsupported sandbox value at ${path155}: ${describeValue(value)}`);
111519
111519
  }
111520
111520
  function isSandboxPrimitive(value) {
111521
111521
  return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
@@ -111544,7 +111544,7 @@ function defineOwnDataProperty(target, key2, value) {
111544
111544
  value
111545
111545
  });
111546
111546
  }
111547
- function getEnumerableObjectEntries(value, path154) {
111547
+ function getEnumerableObjectEntries(value, path155) {
111548
111548
  const descriptors = Object.getOwnPropertyDescriptors(value);
111549
111549
  const entries = [];
111550
111550
  for (const [key2, descriptor] of Object.entries(descriptors)) {
@@ -111552,7 +111552,7 @@ function getEnumerableObjectEntries(value, path154) {
111552
111552
  continue;
111553
111553
  }
111554
111554
  if ("get" in descriptor || "set" in descriptor) {
111555
- throw new TypeError(`Unsupported sandbox value at ${joinPath(path154, key2)}: accessor property`);
111555
+ throw new TypeError(`Unsupported sandbox value at ${joinPath(path155, key2)}: accessor property`);
111556
111556
  }
111557
111557
  entries.push({
111558
111558
  key: key2,
@@ -111561,7 +111561,7 @@ function getEnumerableObjectEntries(value, path154) {
111561
111561
  }
111562
111562
  return entries;
111563
111563
  }
111564
- function getEnumerableArrayEntries(value, path154) {
111564
+ function getEnumerableArrayEntries(value, path155) {
111565
111565
  const descriptors = Object.getOwnPropertyDescriptors(value);
111566
111566
  const entries = [];
111567
111567
  for (const [key2, descriptor] of Object.entries(descriptors)) {
@@ -111570,7 +111570,7 @@ function getEnumerableArrayEntries(value, path154) {
111570
111570
  }
111571
111571
  if ("get" in descriptor || "set" in descriptor) {
111572
111572
  throw new TypeError(
111573
- `Unsupported sandbox value at ${joinArrayPath(path154, key2)}: accessor property`
111573
+ `Unsupported sandbox value at ${joinArrayPath(path155, key2)}: accessor property`
111574
111574
  );
111575
111575
  }
111576
111576
  entries.push({
@@ -111599,11 +111599,11 @@ function describeValue(value) {
111599
111599
  }
111600
111600
  return typeof value;
111601
111601
  }
111602
- function joinPath(path154, key2) {
111603
- return path154 === "<root>" ? `<root>.${key2}` : `${path154}.${key2}`;
111602
+ function joinPath(path155, key2) {
111603
+ return path155 === "<root>" ? `<root>.${key2}` : `${path155}.${key2}`;
111604
111604
  }
111605
- function joinArrayPath(path154, key2) {
111606
- return isArrayIndexKey(key2) ? `${path154}[${key2}]` : joinPath(path154, key2);
111605
+ function joinArrayPath(path155, key2) {
111606
+ return isArrayIndexKey(key2) ? `${path155}[${key2}]` : joinPath(path155, key2);
111607
111607
  }
111608
111608
  var sandboxClosureBrand, sandboxPromiseBrand;
111609
111609
  var init_values = __esm({
@@ -113354,7 +113354,7 @@ function wrapHostPromiseWithSignal(promise, signal) {
113354
113354
  );
113355
113355
  });
113356
113356
  }
113357
- function copyHostValueToSandbox(value, stackFrames, options, state, path154) {
113357
+ function copyHostValueToSandbox(value, stackFrames, options, state, path155) {
113358
113358
  const { budget } = options;
113359
113359
  if (value === null || value === void 0 || typeof value === "number" || typeof value === "boolean") {
113360
113360
  return value;
@@ -113371,7 +113371,7 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path154) {
113371
113371
  if (existing !== void 0) {
113372
113372
  return existing;
113373
113373
  }
113374
- const properties = copyFunctionProperties(callable, stackFrames, options, state, path154);
113374
+ const properties = copyFunctionProperties(callable, stackFrames, options, state, path155);
113375
113375
  const wrapped = createSandboxClosure({
113376
113376
  ...isAsyncFunction(callable) ? { async: true } : {},
113377
113377
  call: (args, context) => {
@@ -113394,7 +113394,7 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path154) {
113394
113394
  throw createHostErrorValue(error3, context?.stack ?? [], budget, context?.span);
113395
113395
  }
113396
113396
  },
113397
- name: callable.name.length > 0 ? callable.name : readPathName(path154),
113397
+ name: callable.name.length > 0 ? callable.name : readPathName(path155),
113398
113398
  ...properties ? { properties } : {}
113399
113399
  });
113400
113400
  state.seen.set(value, wrapped);
@@ -113444,7 +113444,7 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path154) {
113444
113444
  state.seen.set(value, copy);
113445
113445
  budget.allocateArrayLength(value.length);
113446
113446
  value.forEach((entry, index) => {
113447
- copy[index] = copyHostValueToSandbox(entry, stackFrames, options, state, `${path154}[${index}]`);
113447
+ copy[index] = copyHostValueToSandbox(entry, stackFrames, options, state, `${path155}[${index}]`);
113448
113448
  });
113449
113449
  return copy;
113450
113450
  }
@@ -113461,7 +113461,7 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path154) {
113461
113461
  }
113462
113462
  if ("get" in descriptor || "set" in descriptor) {
113463
113463
  throw new TypeError(
113464
- `Unsupported sandbox value at ${joinPath2(path154, key2)}: accessor property`
113464
+ `Unsupported sandbox value at ${joinPath2(path155, key2)}: accessor property`
113465
113465
  );
113466
113466
  }
113467
113467
  Object.defineProperty(copy, key2, {
@@ -113473,13 +113473,13 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path154) {
113473
113473
  stackFrames,
113474
113474
  options,
113475
113475
  state,
113476
- joinPath2(path154, key2)
113476
+ joinPath2(path155, key2)
113477
113477
  )
113478
113478
  });
113479
113479
  }
113480
113480
  return copy;
113481
113481
  }
113482
- throw new TypeError(`Unsupported sandbox value at ${path154}: ${describeValue2(value)}`);
113482
+ throw new TypeError(`Unsupported sandbox value at ${path155}: ${describeValue2(value)}`);
113483
113483
  }
113484
113484
  function readAbortReason2(signal) {
113485
113485
  return signal.reason ?? createAbortError12();
@@ -113528,7 +113528,7 @@ function readStringProperty(value, key2) {
113528
113528
  const entry = value[key2];
113529
113529
  return typeof entry === "string" ? entry : void 0;
113530
113530
  }
113531
- function copyFunctionProperties(callable, stackFrames, options, state, path154) {
113531
+ function copyFunctionProperties(callable, stackFrames, options, state, path155) {
113532
113532
  const properties = {};
113533
113533
  for (const key2 of Object.keys(callable)) {
113534
113534
  const descriptor = Object.getOwnPropertyDescriptor(callable, key2);
@@ -113546,7 +113546,7 @@ function copyFunctionProperties(callable, stackFrames, options, state, path154)
113546
113546
  stackFrames,
113547
113547
  options,
113548
113548
  state,
113549
- joinPath2(path154, key2)
113549
+ joinPath2(path155, key2)
113550
113550
  );
113551
113551
  }
113552
113552
  return Object.keys(properties).length > 0 ? properties : void 0;
@@ -113558,11 +113558,11 @@ function isPlainObject10(value) {
113558
113558
  const prototype = Object.getPrototypeOf(value);
113559
113559
  return prototype === Object.prototype || prototype === null;
113560
113560
  }
113561
- function joinPath2(path154, key2) {
113562
- return /^[A-Za-z_$][A-Za-z0-9_$]*$/u.test(key2) ? `${path154}.${key2}` : `${path154}[${JSON.stringify(key2)}]`;
113561
+ function joinPath2(path155, key2) {
113562
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/u.test(key2) ? `${path155}.${key2}` : `${path155}[${JSON.stringify(key2)}]`;
113563
113563
  }
113564
- function readPathName(path154) {
113565
- const segment = path154.replace(/^.*\./u, "");
113564
+ function readPathName(path155) {
113565
+ const segment = path155.replace(/^.*\./u, "");
113566
113566
  return segment === "<root>" ? "host" : segment;
113567
113567
  }
113568
113568
  function describeValue2(value) {
@@ -116483,7 +116483,7 @@ var init_dump = __esm({
116483
116483
 
116484
116484
  // packages/agent-script/src/snapshot/backend.ts
116485
116485
  import { randomUUID as randomUUID16 } from "node:crypto";
116486
- import { readFile as readFile49, rename as rename24, stat as stat31, unlink as unlink22, writeFile as writeFile27 } from "node:fs/promises";
116486
+ import { readFile as readFile50, rename as rename24, stat as stat31, unlink as unlink22, writeFile as writeFile27 } from "node:fs/promises";
116487
116487
  import { dirname as dirname9 } from "node:path";
116488
116488
  async function writeSnapshotAtomically(snapshotPath, snapshot2, options) {
116489
116489
  const parentPath = dirname9(snapshotPath);
@@ -116542,16 +116542,16 @@ async function writeSnapshotOnce(temporaryPath, snapshotPath, contents) {
116542
116542
  }
116543
116543
  }
116544
116544
  }
116545
- async function enqueueOperation(path154, operation) {
116546
- const previous = pendingOperations.get(path154) ?? Promise.resolve();
116545
+ async function enqueueOperation(path155, operation) {
116546
+ const previous = pendingOperations.get(path155) ?? Promise.resolve();
116547
116547
  const pending = previous.catch(() => void 0).then(operation);
116548
116548
  const queued = pending.catch(() => void 0);
116549
- pendingOperations.set(path154, queued);
116549
+ pendingOperations.set(path155, queued);
116550
116550
  try {
116551
116551
  await pending;
116552
116552
  } finally {
116553
- if (pendingOperations.get(path154) === queued) {
116554
- pendingOperations.delete(path154);
116553
+ if (pendingOperations.get(path155) === queued) {
116554
+ pendingOperations.delete(path155);
116555
116555
  }
116556
116556
  }
116557
116557
  }
@@ -116590,8 +116590,8 @@ var init_backend = __esm({
116590
116590
  LOCKED_FILE_ERROR_CODES = /* @__PURE__ */ new Set(["EACCES", "EBUSY", "EPERM"]);
116591
116591
  pendingOperations = /* @__PURE__ */ new Map();
116592
116592
  FileSnapshotBackend = class {
116593
- constructor(path154, options = {}) {
116594
- this.path = path154;
116593
+ constructor(path155, options = {}) {
116594
+ this.path = path155;
116595
116595
  this.#writeMaxAttempts = options.writeMaxAttempts ?? DEFAULT_WRITE_MAX_ATTEMPTS;
116596
116596
  this.#writeRetryDelayMs = options.writeRetryDelayMs ?? DEFAULT_WRITE_RETRY_DELAY_MS;
116597
116597
  }
@@ -116600,7 +116600,7 @@ var init_backend = __esm({
116600
116600
  #writeRetryDelayMs;
116601
116601
  async read() {
116602
116602
  try {
116603
- return JSON.parse(await readFile49(this.path, "utf8"));
116603
+ return JSON.parse(await readFile50(this.path, "utf8"));
116604
116604
  } catch (error3) {
116605
116605
  if (hasErrorCode4(error3, "ENOENT")) {
116606
116606
  return void 0;
@@ -119786,7 +119786,7 @@ var init_runtime_modules = __esm({
119786
119786
  });
119787
119787
 
119788
119788
  // packages/agent-script/src/runner/run-harness.ts
119789
- import { readFile as readFile50, stat as stat32 } from "node:fs/promises";
119789
+ import { readFile as readFile51, stat as stat32 } from "node:fs/promises";
119790
119790
  import { extname as extname2 } from "node:path";
119791
119791
  var init_run_harness = __esm({
119792
119792
  "packages/agent-script/src/runner/run-harness.ts"() {
@@ -120274,7 +120274,7 @@ var init_fail = __esm({
120274
120274
 
120275
120275
  // packages/agent-script/src/modules/git.ts
120276
120276
  import { execFile as execFile3 } from "node:child_process";
120277
- import { mkdir as mkdir34, realpath as realpath9, rm as rm12 } from "node:fs/promises";
120277
+ import { mkdir as mkdir34, realpath as realpath10, rm as rm12 } from "node:fs/promises";
120278
120278
  import { basename as basename7, dirname as dirname10, isAbsolute as isAbsolute6, relative as relative5, resolve as resolve8, sep as sep6 } from "node:path";
120279
120279
  function makeGitModule(cwd) {
120280
120280
  const normalizedCwd = readNonEmptyString6(cwd, "Git module cwd");
@@ -120381,9 +120381,9 @@ function makeGitModule(cwd) {
120381
120381
  branch: normalizedBranch
120382
120382
  };
120383
120383
  },
120384
- async worktreeRemove(path154) {
120384
+ async worktreeRemove(path155) {
120385
120385
  const repoRoot = await getRepoRoot(normalizedCwd);
120386
- const worktreePath = await resolveWorktreePath(repoRoot, path154, "Git worktree path");
120386
+ const worktreePath = await resolveWorktreePath(repoRoot, path155, "Git worktree path");
120387
120387
  const worktrees = await listWorktrees(normalizedCwd);
120388
120388
  if (!worktrees.some((worktree) => resolve8(worktree.path) === worktreePath)) {
120389
120389
  return;
@@ -120489,10 +120489,10 @@ function parseBranchRef(ref) {
120489
120489
  const branchPrefix = "refs/heads/";
120490
120490
  return ref.startsWith(branchPrefix) ? ref.slice(branchPrefix.length) : ref;
120491
120491
  }
120492
- async function resolveWorktreePath(repoRoot, path154, label) {
120492
+ async function resolveWorktreePath(repoRoot, path155, label) {
120493
120493
  const resolvedRoot = resolve8(repoRoot);
120494
- const resolvedPath = isAbsolute6(path154) ? resolve8(path154) : resolve8(resolvedRoot, path154);
120495
- const canonicalRoot = await realpath9(resolvedRoot);
120494
+ const resolvedPath = isAbsolute6(path155) ? resolve8(path155) : resolve8(resolvedRoot, path155);
120495
+ const canonicalRoot = await realpath10(resolvedRoot);
120496
120496
  const canonicalPath = await resolveCanonicalPath(resolvedPath);
120497
120497
  const relativePath = relative5(canonicalRoot, canonicalPath);
120498
120498
  if (relativePath.length === 0 || relativePath === ".." || relativePath.startsWith(`..${sep6}`) || isAbsolute6(relativePath)) {
@@ -120500,12 +120500,12 @@ async function resolveWorktreePath(repoRoot, path154, label) {
120500
120500
  }
120501
120501
  return canonicalPath;
120502
120502
  }
120503
- async function resolveCanonicalPath(path154) {
120503
+ async function resolveCanonicalPath(path155) {
120504
120504
  const missingSegments = [];
120505
- let current = path154;
120505
+ let current = path155;
120506
120506
  while (true) {
120507
120507
  try {
120508
- const canonicalCurrent = await realpath9(current);
120508
+ const canonicalCurrent = await realpath10(current);
120509
120509
  return resolve8(canonicalCurrent, ...missingSegments.reverse());
120510
120510
  } catch (error3) {
120511
120511
  if (!isNotFoundError9(error3)) {
@@ -120513,7 +120513,7 @@ async function resolveCanonicalPath(path154) {
120513
120513
  }
120514
120514
  const parent = dirname10(current);
120515
120515
  if (parent === current) {
120516
- return resolve8(path154);
120516
+ return resolve8(path155);
120517
120517
  }
120518
120518
  missingSegments.push(basename7(current));
120519
120519
  current = parent;
@@ -121053,7 +121053,7 @@ var init_extract_schema = __esm({
121053
121053
 
121054
121054
  // packages/agent-harness/src/codegen/emit-schemas.ts
121055
121055
  import * as nodeFs16 from "node:fs/promises";
121056
- import path150 from "node:path";
121056
+ import path151 from "node:path";
121057
121057
  import { fileURLToPath as fileURLToPath13 } from "node:url";
121058
121058
  var init_emit_schemas = __esm({
121059
121059
  "packages/agent-harness/src/codegen/emit-schemas.ts"() {
@@ -121108,21 +121108,21 @@ var init_pair = __esm({
121108
121108
  MissingPairError = class extends Error {
121109
121109
  side;
121110
121110
  path;
121111
- constructor(side, path154) {
121112
- super(`Missing harness ${side} file: ${path154}`);
121111
+ constructor(side, path155) {
121112
+ super(`Missing harness ${side} file: ${path155}`);
121113
121113
  this.name = "MissingPairError";
121114
121114
  this.side = side;
121115
- this.path = path154;
121115
+ this.path = path155;
121116
121116
  }
121117
121117
  };
121118
121118
  InvalidPairExtensionError = class extends Error {
121119
121119
  extension;
121120
121120
  path;
121121
- constructor(path154, extension) {
121122
- super(`Harness pair input must be a .md or .ajs file: ${path154}`);
121121
+ constructor(path155, extension) {
121122
+ super(`Harness pair input must be a .md or .ajs file: ${path155}`);
121123
121123
  this.name = "InvalidPairExtensionError";
121124
121124
  this.extension = extension;
121125
- this.path = path154;
121125
+ this.path = path155;
121126
121126
  }
121127
121127
  };
121128
121128
  }
@@ -121188,8 +121188,8 @@ function validateFrontmatter(schema2, frontmatter, mdPath) {
121188
121188
  function formatIssues2(mdPath, issues) {
121189
121189
  return issues.map((issue) => `${mdPath} (${formatPath3(issue.path)}): ${issue.message}`).join("\n");
121190
121190
  }
121191
- function formatPath3(path154) {
121192
- return path154.join(".") || "frontmatter";
121191
+ function formatPath3(path155) {
121192
+ return path155.join(".") || "frontmatter";
121193
121193
  }
121194
121194
  var FrontmatterValidationError;
121195
121195
  var init_validate4 = __esm({
@@ -121209,7 +121209,7 @@ var init_validate4 = __esm({
121209
121209
 
121210
121210
  // packages/agent-harness/src/loader/run.ts
121211
121211
  import { createHash as createHash10 } from "node:crypto";
121212
- import { lstat as lstat29, mkdir as mkdir35, readFile as readFile52, rename as rename25, unlink as unlink23, writeFile as writeFile28 } from "node:fs/promises";
121212
+ import { lstat as lstat29, mkdir as mkdir35, readFile as readFile53, rename as rename25, unlink as unlink23, writeFile as writeFile28 } from "node:fs/promises";
121213
121213
  import os17 from "node:os";
121214
121214
  import { dirname as dirname12, join as join13, parse as parse15, resolve as resolve9, sep as sep7 } from "node:path";
121215
121215
  async function runHarnessPair2(mdPath, options) {
@@ -121554,7 +121554,7 @@ async function createHostCallReplay(snapshotPath, statefulBindings = {}) {
121554
121554
  }
121555
121555
  async function readHostCallRecords(storePath) {
121556
121556
  try {
121557
- const parsed = JSON.parse(await readFile52(storePath, "utf8"));
121557
+ const parsed = JSON.parse(await readFile53(storePath, "utf8"));
121558
121558
  return Array.isArray(parsed) ? parsed : [];
121559
121559
  } catch (error3) {
121560
121560
  if (hasErrorCode5(error3, "ENOENT")) {
@@ -121583,9 +121583,9 @@ async function writeHostCallRecords(storePath, records) {
121583
121583
  async function cleanupCompletedSnapshot(snapshotBackend, snapshotPath) {
121584
121584
  await Promise.all([snapshotBackend.remove(), unlinkIfExists(hostCallStorePath(snapshotPath))]);
121585
121585
  }
121586
- async function unlinkIfExists(path154) {
121586
+ async function unlinkIfExists(path155) {
121587
121587
  try {
121588
- await unlink23(path154);
121588
+ await unlink23(path155);
121589
121589
  } catch (error3) {
121590
121590
  if (!hasErrorCode5(error3, "ENOENT")) {
121591
121591
  throw error3;
@@ -121646,8 +121646,8 @@ async function assertDefaultSnapshotPathIsRegular(snapshotPath) {
121646
121646
  }
121647
121647
  }
121648
121648
  }
121649
- async function readTextFile(path154) {
121650
- const source = await readFile52(path154, "utf8");
121649
+ async function readTextFile(path155) {
121650
+ const source = await readFile53(path155, "utf8");
121651
121651
  return source.startsWith("\uFEFF") ? source.slice(1) : source;
121652
121652
  }
121653
121653
  function formatLintErrorMessage(diagnostics) {
@@ -121704,7 +121704,7 @@ var init_run6 = __esm({
121704
121704
  });
121705
121705
 
121706
121706
  // packages/agent-harness/src/testing/replay-equivalence.ts
121707
- import { mkdir as mkdir36, readFile as readFile53, rm as rm13, writeFile as writeFile29 } from "node:fs/promises";
121707
+ import { mkdir as mkdir36, readFile as readFile54, rm as rm13, writeFile as writeFile29 } from "node:fs/promises";
121708
121708
  import os18 from "node:os";
121709
121709
  import { join as join14 } from "node:path";
121710
121710
  import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
@@ -121756,8 +121756,8 @@ var init_src44 = __esm({
121756
121756
  });
121757
121757
 
121758
121758
  // src/cli/commands/harness.ts
121759
- import path151 from "node:path";
121760
- import { readFile as readFile54 } from "node:fs/promises";
121759
+ import path152 from "node:path";
121760
+ import { readFile as readFile55 } from "node:fs/promises";
121761
121761
  function registerHarnessCommand(program, container) {
121762
121762
  const harness = program.command("harness").description("Run and manage agent harness pairs.");
121763
121763
  harness.command("run").description("Run a harness pair.").argument("[md-path]", "Path to the harness .md file").option("--fix", "Apply supported lint fixes to the harness .ajs file before running.").option("--snapshot-path <path>", "File to write/read harness snapshots.").option("--resume", "Resume from the snapshot file when it exists.").option(
@@ -121782,7 +121782,7 @@ function registerHarnessCommand(program, container) {
121782
121782
  async function executeHarnessRun(program, container, mdPath, options) {
121783
121783
  const flags = resolveHarnessFlags(program, options.yes);
121784
121784
  const resources = createExecutionResources(container, flags, "harness:run");
121785
- const selectedPath = mdPath ? path151.resolve(container.env.cwd, mdPath) : (await resolveDiscoveredHarness(container, flags.assumeYes)).mdPath;
121785
+ const selectedPath = mdPath ? path152.resolve(container.env.cwd, mdPath) : (await resolveDiscoveredHarness(container, flags.assumeYes)).mdPath;
121786
121786
  if (flags.dryRun) {
121787
121787
  resources.logger.dryRun(
121788
121788
  `Dry run: would run ${formatDisplayPath2(container, selectedPath)} without executing its script or applying fixes.`
@@ -121848,10 +121848,10 @@ function buildAgentFrontmatterOverrides(options) {
121848
121848
  }
121849
121849
  function resolveRunSnapshotPath(container, mdPath, snapshotPath) {
121850
121850
  if (snapshotPath !== void 0) {
121851
- return path151.resolve(container.env.cwd, snapshotPath);
121851
+ return path152.resolve(container.env.cwd, snapshotPath);
121852
121852
  }
121853
- const basename9 = path151.basename(mdPath, path151.extname(mdPath));
121854
- return path151.join(container.env.cwd, ".poe-code", "harnesses", basename9, "snapshot.json");
121853
+ const basename9 = path152.basename(mdPath, path152.extname(mdPath));
121854
+ return path152.join(container.env.cwd, ".poe-code", "harnesses", basename9, "snapshot.json");
121855
121855
  }
121856
121856
  async function prepareHarnessSnapshot(container, mdPath, snapshotPath, resumeRequested) {
121857
121857
  const snapshotExists = await pathExists15(container, snapshotPath);
@@ -121920,8 +121920,8 @@ function formatRunMessage(baseMessage, progress) {
121920
121920
  return progress === void 0 ? baseMessage : `${baseMessage} (${progress})`;
121921
121921
  }
121922
121922
  function resolveAjsPath(mdPath) {
121923
- const parsed = path151.parse(mdPath);
121924
- return path151.join(parsed.dir, `${parsed.name}.ajs`);
121923
+ const parsed = path152.parse(mdPath);
121924
+ return path152.join(parsed.dir, `${parsed.name}.ajs`);
121925
121925
  }
121926
121926
  async function pathExists15(container, targetPath) {
121927
121927
  try {
@@ -121945,14 +121945,14 @@ async function executeHarnessNew(program, container, kind, basename9, options) {
121945
121945
  if (!template2) {
121946
121946
  throw new ValidationError(`Unknown harness template "${kind}".`);
121947
121947
  }
121948
- if (basename9.length === 0 || basename9 === "." || basename9 === ".." || path151.basename(basename9) !== basename9) {
121948
+ if (basename9.length === 0 || basename9 === "." || basename9 === ".." || path152.basename(basename9) !== basename9) {
121949
121949
  throw new ValidationError(`Invalid harness basename "${basename9}". Use a single directory name.`);
121950
121950
  }
121951
- const defaultDir = path151.join(".poe-code", "harnesses", basename9);
121951
+ const defaultDir = path152.join(".poe-code", "harnesses", basename9);
121952
121952
  const outputDir = options.dir ?? await resolveOutputDir(defaultDir, flags.assumeYes);
121953
- const resolvedDir = path151.resolve(container.env.cwd, outputDir);
121954
- const mdPath = path151.join(resolvedDir, `${basename9}.md`);
121955
- const ajsPath = path151.join(resolvedDir, `${basename9}.ajs`);
121953
+ const resolvedDir = path152.resolve(container.env.cwd, outputDir);
121954
+ const mdPath = path152.join(resolvedDir, `${basename9}.md`);
121955
+ const ajsPath = path152.join(resolvedDir, `${basename9}.ajs`);
121956
121956
  await assertFilesDoNotExist(container, [mdPath, ajsPath]);
121957
121957
  if (flags.dryRun) {
121958
121958
  resources.logger.dryRun(`Would create ${formatDisplayPath2(container, mdPath)}`);
@@ -121960,8 +121960,8 @@ async function executeHarnessNew(program, container, kind, basename9, options) {
121960
121960
  return;
121961
121961
  }
121962
121962
  const [mdSource, ajsSource] = await Promise.all([
121963
- readFile54(template2.mdPath, "utf8"),
121964
- readFile54(template2.ajsPath, "utf8")
121963
+ readFile55(template2.mdPath, "utf8"),
121964
+ readFile55(template2.ajsPath, "utf8")
121965
121965
  ]);
121966
121966
  await container.fs.mkdir(resolvedDir, { recursive: true });
121967
121967
  try {
@@ -122054,8 +122054,8 @@ async function resolveDiscoveredHarness(container, assumeYes) {
122054
122054
  }
122055
122055
  async function discoverProjectThenUserHarnesses(container) {
122056
122056
  const roots = [
122057
- path151.join(container.env.cwd, ".poe-code", "harnesses"),
122058
- path151.join(container.env.homeDir, ".poe-code", "harnesses")
122057
+ path152.join(container.env.cwd, ".poe-code", "harnesses"),
122058
+ path152.join(container.env.homeDir, ".poe-code", "harnesses")
122059
122059
  ];
122060
122060
  const discovered = [];
122061
122061
  for (const root of roots) {
@@ -122067,7 +122067,7 @@ async function discoverProjectThenUserHarnesses(container) {
122067
122067
  const stat33 = await container.fs.stat(pair.mdPath);
122068
122068
  discovered.push({
122069
122069
  ...pair,
122070
- dir: path151.dirname(pair.mdPath),
122070
+ dir: path152.dirname(pair.mdPath),
122071
122071
  mdMtimeMs: stat33.mtimeMs
122072
122072
  });
122073
122073
  }
@@ -122172,8 +122172,8 @@ function toModuleExports(moduleExports) {
122172
122172
  return new Map(Object.entries(moduleExports));
122173
122173
  }
122174
122174
  function formatDisplayPath2(container, filePath) {
122175
- const relative6 = path151.relative(container.env.cwd, filePath);
122176
- return relative6.length > 0 && !relative6.startsWith("..") && !path151.isAbsolute(relative6) ? relative6 : filePath.replace(container.env.homeDir, "~");
122175
+ const relative6 = path152.relative(container.env.cwd, filePath);
122176
+ return relative6.length > 0 && !relative6.startsWith("..") && !path152.isAbsolute(relative6) ? relative6 : filePath.replace(container.env.homeDir, "~");
122177
122177
  }
122178
122178
  var init_harness3 = __esm({
122179
122179
  async "src/cli/commands/harness.ts"() {
@@ -122252,7 +122252,7 @@ var init_braintrust = __esm({
122252
122252
 
122253
122253
  // src/cli/commands/tasks-options.ts
122254
122254
  import * as fsPromises23 from "node:fs/promises";
122255
- import path152 from "node:path";
122255
+ import path153 from "node:path";
122256
122256
  async function resolveWorkflowTaskListOptions(workflowPath) {
122257
122257
  const frontmatter = await readWorkflowFrontmatter(workflowPath);
122258
122258
  return readTaskListOptions(frontmatter, workflowPath);
@@ -122476,7 +122476,7 @@ function resolveStringValue2(value) {
122476
122476
  return process.env[value.slice(envPrefix.length)] ?? value;
122477
122477
  }
122478
122478
  function resolveWorkflowRelativePath(value, workflowPath) {
122479
- return path152.isAbsolute(value) ? value : path152.resolve(path152.dirname(workflowPath), value);
122479
+ return path153.isAbsolute(value) ? value : path153.resolve(path153.dirname(workflowPath), value);
122480
122480
  }
122481
122481
  function asRecord5(value) {
122482
122482
  return isPlainRecord3(value) ? value : void 0;
@@ -122513,7 +122513,7 @@ var init_tasks_options = __esm({
122513
122513
  });
122514
122514
 
122515
122515
  // src/cli/commands/tasks.ts
122516
- import path153 from "node:path";
122516
+ import path154 from "node:path";
122517
122517
  function registerTasksCommand(program, container) {
122518
122518
  const tasks = program.command("tasks").description("Read and mutate configured workflow tasks.");
122519
122519
  tasks.command("verify").description("Verify a task GitHub Project.").argument("<list>", "Project list in <owner>/<number> format.").option("--workflow <path>", "Workflow file path.", "./WORKFLOW.md").option("--repo <owner/name>", "GitHub repository owner/name.").option("--project <owner/number>", "GitHub project owner/number.").option("--states <csv>", "Required task state names.").option("--json", "Print the verification report as JSON.").action(async (list, options, command) => {
@@ -122643,7 +122643,7 @@ async function runImport(options, container) {
122643
122643
  const limit = options.limit === void 0 ? void 0 : parseNonNegativeInteger3(options.limit, "--limit");
122644
122644
  const source = {
122645
122645
  type: "markdown-dir",
122646
- path: path153.resolve(options.from),
122646
+ path: path154.resolve(options.from),
122647
122647
  singleList: "import",
122648
122648
  frontmatterMode: "passthrough"
122649
122649
  };
@@ -122997,7 +122997,7 @@ var init_package2 = __esm({
122997
122997
  "package.json"() {
122998
122998
  package_default2 = {
122999
122999
  name: "poe-code",
123000
- version: "3.0.237",
123000
+ version: "3.0.238",
123001
123001
  description: "CLI tool to configure Poe API for developer workflows.",
123002
123002
  type: "module",
123003
123003
  main: "./dist/index.js",
@@ -123243,22 +123243,22 @@ function formatCommandHeader(cmd) {
123243
123243
  }
123244
123244
  return `Poe - ${parts.reverse().join(" ")}`;
123245
123245
  }
123246
- function findCommandByPath(root, path154) {
123246
+ function findCommandByPath(root, path155) {
123247
123247
  let current = root;
123248
- for (const segment of path154) {
123248
+ for (const segment of path155) {
123249
123249
  const next = current.commands.find(
123250
123250
  (command) => Reflect.get(command, "_hidden") !== true && command.name() === segment
123251
123251
  );
123252
123252
  if (!next) {
123253
- throw new Error(`Root help command is missing: ${path154.join(" ")}`);
123253
+ throw new Error(`Root help command is missing: ${path155.join(" ")}`);
123254
123254
  }
123255
123255
  current = next;
123256
123256
  }
123257
123257
  return current;
123258
123258
  }
123259
- function formatRootHelpCommandName(path154, command) {
123259
+ function formatRootHelpCommandName(path155, command) {
123260
123260
  const leaf = [command.name(), ...command.aliases()].join(", ");
123261
- return path154.length > 1 ? [...path154.slice(0, -1), leaf].join(" ") : leaf;
123261
+ return path155.length > 1 ? [...path155.slice(0, -1), leaf].join(" ") : leaf;
123262
123262
  }
123263
123263
  function splitUsageParts(usage) {
123264
123264
  return usage.split(" ").map((part) => part.trim()).filter((part) => part.length > 0);
@@ -123524,8 +123524,8 @@ function registerMaestroCommand(program, container) {
123524
123524
  "--log-level <level>",
123525
123525
  maestroCommandSchema.shape.logLevel.description ?? "Log level"
123526
123526
  ).choices(maestroCommandSchema.shape.logLevel.values.map(String)).default(maestroCommandSchema.shape.logLevel.default)
123527
- ).action(async (path154, options, command) => {
123528
- if (path154 === "tui") {
123527
+ ).action(async (path155, options, command) => {
123528
+ if (path155 === "tui") {
123529
123529
  throw new ValidationError(
123530
123530
  "`poe-code maestro tui` only accepts --config, --workflow, or --name."
123531
123531
  );
@@ -123535,7 +123535,7 @@ function registerMaestroCommand(program, container) {
123535
123535
  ...command.optsWithGlobals()
123536
123536
  };
123537
123537
  await runMaestro({
123538
- workflowPath: path154,
123538
+ workflowPath: path155,
123539
123539
  maxConcurrent: mergedOptions.maxConcurrent,
123540
123540
  pollIntervalMs: mergedOptions.pollIntervalMs,
123541
123541
  list: mergedOptions.list,
@@ -124159,14 +124159,14 @@ function createCliMain(programFactory) {
124159
124159
  }
124160
124160
  };
124161
124161
  }
124162
- function isCliInvocation(argv, moduleUrl, realpath10 = realpathSync) {
124162
+ function isCliInvocation(argv, moduleUrl, realpath11 = realpathSync) {
124163
124163
  const entry = argv.at(1);
124164
124164
  if (typeof entry !== "string") {
124165
124165
  return false;
124166
124166
  }
124167
124167
  const candidates = [pathToFileURL2(entry).href];
124168
124168
  try {
124169
- candidates.push(pathToFileURL2(realpath10(entry)).href);
124169
+ candidates.push(pathToFileURL2(realpath11(entry)).href);
124170
124170
  } catch {
124171
124171
  }
124172
124172
  return candidates.includes(moduleUrl);
@@ -124322,6 +124322,91 @@ var planDocumentSchema = {
124322
124322
  additionalProperties: true
124323
124323
  };
124324
124324
 
124325
+ // src/sdk/prompt-document.ts
124326
+ init_src4();
124327
+ import { readFile as readFile26, realpath as realpath5 } from "node:fs/promises";
124328
+ import path97 from "node:path";
124329
+ var nativeFs = { readFile: readFile26, realpath: realpath5 };
124330
+ async function resolvePromptDocument(input) {
124331
+ const cwd = path97.resolve(input.cwd);
124332
+ const filePath = path97.resolve(cwd, input.filePath);
124333
+ assertInsideRoot(filePath, cwd, "Prompt document path must remain inside cwd");
124334
+ const basePaths = (input.basePaths ?? []).map((basePath) => {
124335
+ if (!path97.isAbsolute(basePath)) {
124336
+ throw new Error(`Prompt document base paths must be absolute: ${basePath}`);
124337
+ }
124338
+ return path97.resolve(basePath);
124339
+ });
124340
+ const fs27 = createRootedFileSystem(input.fs ?? nativeFs, [cwd, ...basePaths]);
124341
+ const content = input.content ?? await readDocumentContent2(fs27, filePath, input.optional);
124342
+ const chain = [
124343
+ { source: "document", filePath, content },
124344
+ ...basePaths.map((basePath, index) => ({ source: `base-${index + 1}`, path: basePath }))
124345
+ ];
124346
+ const composed = await resolve(chain, { fs: fs27 });
124347
+ const rendered = await resolve(chain, {
124348
+ fs: fs27,
124349
+ view: input.variables ?? {},
124350
+ validate: input.validate ?? true
124351
+ });
124352
+ const template2 = requirePrompt(composed.data.prompt, filePath);
124353
+ const prompt = requirePrompt(rendered.data.prompt, filePath);
124354
+ const { prompt: _ignored, ...metadata } = rendered.data;
124355
+ void _ignored;
124356
+ return {
124357
+ template: template2,
124358
+ prompt,
124359
+ metadata,
124360
+ sources: rendered.sources,
124361
+ source: filePath,
124362
+ chain: rendered.chain
124363
+ };
124364
+ }
124365
+ async function readDocumentContent2(fs27, filePath, optional) {
124366
+ try {
124367
+ return await fs27.readFile(filePath, "utf8");
124368
+ } catch (error3) {
124369
+ if (optional && hasCode7(error3, "ENOENT")) {
124370
+ return "---\nextends: true\n---\n";
124371
+ }
124372
+ throw error3;
124373
+ }
124374
+ }
124375
+ function createRootedFileSystem(fs27, roots) {
124376
+ return {
124377
+ async readFile(filePath, encoding) {
124378
+ await assertRealPathInsideOriginalRoot(fs27, filePath, roots);
124379
+ return fs27.readFile(filePath, encoding);
124380
+ },
124381
+ realpath: (filePath) => fs27.realpath(filePath)
124382
+ };
124383
+ }
124384
+ async function assertRealPathInsideOriginalRoot(fs27, filePath, roots) {
124385
+ const resolvedPath = path97.resolve(await fs27.realpath(filePath));
124386
+ const originalRoot = roots.find((root) => isInsideRoot(filePath, root));
124387
+ if (!originalRoot || !isInsideRoot(resolvedPath, originalRoot)) {
124388
+ throw new Error(`Prompt document path escapes configured root: ${filePath}`);
124389
+ }
124390
+ }
124391
+ function assertInsideRoot(filePath, root, message2) {
124392
+ if (!isInsideRoot(filePath, root)) {
124393
+ throw new Error(`${message2}: ${filePath}`);
124394
+ }
124395
+ }
124396
+ function isInsideRoot(filePath, root) {
124397
+ const relativePath = path97.relative(path97.resolve(root), path97.resolve(filePath));
124398
+ return relativePath === "" || relativePath !== ".." && !relativePath.startsWith(`..${path97.sep}`) && !path97.isAbsolute(relativePath);
124399
+ }
124400
+ function requirePrompt(value, filePath) {
124401
+ if (typeof value !== "string") {
124402
+ throw new Error(`Prompt document does not resolve to a Markdown prompt: ${filePath}`);
124403
+ }
124404
+ return value;
124405
+ }
124406
+ function hasCode7(error3, code) {
124407
+ return typeof error3 === "object" && error3 !== null && "code" in error3 && error3.code === code;
124408
+ }
124409
+
124325
124410
  // src/index.ts
124326
124411
  init_src37();
124327
124412
  init_src38();
@@ -124337,7 +124422,7 @@ init_config5();
124337
124422
  init_constants();
124338
124423
  init_errors2();
124339
124424
  import os16 from "node:os";
124340
- import path120 from "node:path";
124425
+ import path121 from "node:path";
124341
124426
  import fsPromises22 from "node:fs/promises";
124342
124427
  import { Command } from "commander";
124343
124428
  function parseMcpSpawnConfig(input) {
@@ -124409,10 +124494,10 @@ function resolveWorkingDirectory(baseDir, candidate) {
124409
124494
  if (!candidate || candidate.trim().length === 0) {
124410
124495
  return void 0;
124411
124496
  }
124412
- if (path120.isAbsolute(candidate)) {
124497
+ if (path121.isAbsolute(candidate)) {
124413
124498
  return candidate;
124414
124499
  }
124415
- return path120.resolve(baseDir, candidate);
124500
+ return path121.resolve(baseDir, candidate);
124416
124501
  }
124417
124502
  function configurePoeAgentRunOptions(command) {
124418
124503
  return command.option("-y, --yes", "Accept configured defaults without prompting").option("--model <model>", "Model identifier override").option("--prompt <text>", "Prompt text to send").option("-C, --cwd <path>", "Working directory for the agent").option("--stdin", "Read the prompt from stdin").option(
@@ -124533,14 +124618,14 @@ async function main() {
124533
124618
  const runCli = createCliMain2(createProgram2);
124534
124619
  await runCli();
124535
124620
  }
124536
- function isCliInvocation2(argv, moduleUrl, realpath10 = realpathSync2) {
124621
+ function isCliInvocation2(argv, moduleUrl, realpath11 = realpathSync2) {
124537
124622
  const entry = argv.at(1);
124538
124623
  if (typeof entry !== "string") {
124539
124624
  return false;
124540
124625
  }
124541
124626
  const candidates = [pathToFileURL3(entry).href];
124542
124627
  try {
124543
- candidates.push(pathToFileURL3(realpath10(entry)).href);
124628
+ candidates.push(pathToFileURL3(realpath11(entry)).href);
124544
124629
  } catch {
124545
124630
  }
124546
124631
  return candidates.includes(moduleUrl);
@@ -124589,6 +124674,7 @@ export {
124589
124674
  readExperimentJournal,
124590
124675
  readLaunchLogs,
124591
124676
  removeLaunch,
124677
+ resolvePromptDocument,
124592
124678
  restartLaunch,
124593
124679
  runCheckCli,
124594
124680
  runCodeReview,