poe-code 3.0.193 → 3.0.195

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
@@ -785,11 +785,11 @@ var init_parse = __esm({
785
785
  function mergeLayers(layers) {
786
786
  return mergeObjectLayers(layers, []);
787
787
  }
788
- function mergeObjectLayers(layers, path93) {
788
+ function mergeObjectLayers(layers, path94) {
789
789
  const data = {};
790
790
  const sources = {};
791
791
  for (const key2 of collectKeys(layers)) {
792
- const resolved = resolveKey(layers, key2, path93);
792
+ const resolved = resolveKey(layers, key2, path94);
793
793
  if (resolved === void 0) {
794
794
  continue;
795
795
  }
@@ -807,7 +807,7 @@ function collectKeys(layers) {
807
807
  }
808
808
  return [...keys];
809
809
  }
810
- function resolveKey(layers, key2, path93) {
810
+ function resolveKey(layers, key2, path94) {
811
811
  let winningSource;
812
812
  let winningValue;
813
813
  const objectLayers = [];
@@ -837,9 +837,9 @@ function resolveKey(layers, key2, path93) {
837
837
  if (winningSource === void 0) {
838
838
  return void 0;
839
839
  }
840
- const fullPath = buildPath(path93, key2);
840
+ const fullPath = buildPath(path94, key2);
841
841
  if (isPlainObject(winningValue)) {
842
- const merged = mergeObjectLayers(objectLayers, [...path93, key2]);
842
+ const merged = mergeObjectLayers(objectLayers, [...path94, key2]);
843
843
  return {
844
844
  value: merged.data,
845
845
  sources: {
@@ -864,8 +864,8 @@ function isWinningCandidate(key2, value) {
864
864
  }
865
865
  return true;
866
866
  }
867
- function buildPath(path93, key2) {
868
- return [...path93, key2].join(".");
867
+ function buildPath(path94, key2) {
868
+ return [...path94, key2].join(".");
869
869
  }
870
870
  function isPlainObject(value) {
871
871
  if (value === null || Array.isArray(value) || typeof value !== "object") {
@@ -1543,16 +1543,16 @@ function getConfigFormat(pathOrFormat) {
1543
1543
  }
1544
1544
  return formatRegistry[formatName];
1545
1545
  }
1546
- function detectFormat2(path93) {
1547
- const ext = getExtension(path93);
1546
+ function detectFormat2(path94) {
1547
+ const ext = getExtension(path94);
1548
1548
  return extensionMap[ext];
1549
1549
  }
1550
- function getExtension(path93) {
1551
- const lastDot = path93.lastIndexOf(".");
1550
+ function getExtension(path94) {
1551
+ const lastDot = path94.lastIndexOf(".");
1552
1552
  if (lastDot === -1) {
1553
1553
  return "";
1554
1554
  }
1555
- return path93.slice(lastDot).toLowerCase();
1555
+ return path94.slice(lastDot).toLowerCase();
1556
1556
  }
1557
1557
  var formatRegistry, extensionMap;
1558
1558
  var init_formats = __esm({
@@ -2764,50 +2764,50 @@ import { createTwoFilesPatch } from "diff";
2764
2764
  import chalk from "chalk";
2765
2765
  function createDryRunFileSystem(base, recorder) {
2766
2766
  const proxy = {
2767
- async readFile(path93, encoding) {
2767
+ async readFile(path94, encoding) {
2768
2768
  if (encoding) {
2769
- return base.readFile(path93, encoding);
2769
+ return base.readFile(path94, encoding);
2770
2770
  }
2771
- return base.readFile(path93);
2771
+ return base.readFile(path94);
2772
2772
  },
2773
- async writeFile(path93, data, options) {
2774
- const previousContent = await tryReadText(base, path93);
2773
+ async writeFile(path94, data, options) {
2774
+ const previousContent = await tryReadText(base, path94);
2775
2775
  const nextContent = formatData(data, options?.encoding);
2776
2776
  recorder.record({
2777
2777
  type: "writeFile",
2778
- path: path93,
2778
+ path: path94,
2779
2779
  nextContent,
2780
2780
  previousContent
2781
2781
  });
2782
2782
  },
2783
- async symlink(target, path93) {
2784
- recorder.record({ type: "symlink", target, path: path93 });
2783
+ async symlink(target, path94) {
2784
+ recorder.record({ type: "symlink", target, path: path94 });
2785
2785
  },
2786
- async readlink(path93) {
2787
- return base.readlink(path93);
2786
+ async readlink(path94) {
2787
+ return base.readlink(path94);
2788
2788
  },
2789
- async mkdir(path93, options) {
2790
- recorder.record({ type: "mkdir", path: path93, options });
2789
+ async mkdir(path94, options) {
2790
+ recorder.record({ type: "mkdir", path: path94, options });
2791
2791
  },
2792
- async stat(path93) {
2793
- return base.stat(path93);
2792
+ async stat(path94) {
2793
+ return base.stat(path94);
2794
2794
  },
2795
- async lstat(path93) {
2796
- return base.lstat(path93);
2795
+ async lstat(path94) {
2796
+ return base.lstat(path94);
2797
2797
  },
2798
2798
  async rename(from, to) {
2799
2799
  recorder.record({ type: "rename", from, to });
2800
2800
  },
2801
- async unlink(path93) {
2802
- recorder.record({ type: "unlink", path: path93 });
2801
+ async unlink(path94) {
2802
+ recorder.record({ type: "unlink", path: path94 });
2803
2803
  },
2804
- async readdir(path93) {
2805
- return base.readdir(path93);
2804
+ async readdir(path94) {
2805
+ return base.readdir(path94);
2806
2806
  }
2807
2807
  };
2808
2808
  if (typeof base.rm === "function") {
2809
- proxy.rm = async (path93, options) => {
2810
- recorder.record({ type: "rm", path: path93, options });
2809
+ proxy.rm = async (path94, options) => {
2810
+ recorder.record({ type: "rm", path: path94, options });
2811
2811
  };
2812
2812
  }
2813
2813
  if (typeof base.copyFile === "function") {
@@ -2909,8 +2909,8 @@ function describeWriteChange(previous, next) {
2909
2909
  }
2910
2910
  return "update";
2911
2911
  }
2912
- function renderWriteCommand(path93, change) {
2913
- const command = `cat > ${path93}`;
2912
+ function renderWriteCommand(path94, change) {
2913
+ const command = `cat > ${path94}`;
2914
2914
  if (change === "create") {
2915
2915
  return renderOperationCommand(command, chalk.green, "# create");
2916
2916
  }
@@ -3072,9 +3072,9 @@ function redactTomlLine(line) {
3072
3072
  }
3073
3073
  return line;
3074
3074
  }
3075
- async function tryReadText(base, path93) {
3075
+ async function tryReadText(base, path94) {
3076
3076
  try {
3077
- return await base.readFile(path93, "utf8");
3077
+ return await base.readFile(path94, "utf8");
3078
3078
  } catch (error2) {
3079
3079
  if (isNotFound(error2)) {
3080
3080
  return null;
@@ -11892,8 +11892,8 @@ function resourceNotFound(resource) {
11892
11892
  `Resource not found: ${resource}`
11893
11893
  );
11894
11894
  }
11895
- function assertAbsolutePath(path93) {
11896
- if (!isAbsolute(path93)) {
11895
+ function assertAbsolutePath(path94) {
11896
+ if (!isAbsolute(path94)) {
11897
11897
  throw invalidParams('"path" must be an absolute path');
11898
11898
  }
11899
11899
  }
@@ -12768,21 +12768,21 @@ async function* adaptClaude(lines) {
12768
12768
  if (blockType !== "tool_result") continue;
12769
12769
  const kind = toolKindsById.get(item.tool_use_id);
12770
12770
  toolKindsById.delete(item.tool_use_id);
12771
- let path93;
12771
+ let path94;
12772
12772
  if (typeof item.content === "string") {
12773
- path93 = item.content;
12773
+ path94 = item.content;
12774
12774
  } else {
12775
12775
  try {
12776
- path93 = JSON.stringify(item.content);
12776
+ path94 = JSON.stringify(item.content);
12777
12777
  } catch {
12778
- path93 = String(item.content);
12778
+ path94 = String(item.content);
12779
12779
  }
12780
12780
  }
12781
12781
  yield {
12782
12782
  event: "tool_complete",
12783
12783
  id: item.tool_use_id,
12784
12784
  kind,
12785
- path: path93
12785
+ path: path94
12786
12786
  };
12787
12787
  }
12788
12788
  }
@@ -12905,10 +12905,10 @@ async function* adaptCodex(lines) {
12905
12905
  const kindFromStart = toolKindById.get(item.id);
12906
12906
  const kind = kindFromStart ?? (itemType === "command_execution" ? "exec" : itemType === "file_edit" ? "edit" : "other");
12907
12907
  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;
12908
- const path93 = titleFromEvent ?? toolTitleById.get(item.id) ?? "";
12908
+ const path94 = titleFromEvent ?? toolTitleById.get(item.id) ?? "";
12909
12909
  toolTitleById.delete(item.id);
12910
12910
  toolKindById.delete(item.id);
12911
- yield { event: "tool_complete", id: item.id, kind, path: path93 };
12911
+ yield { event: "tool_complete", id: item.id, kind, path: path94 };
12912
12912
  }
12913
12913
  }
12914
12914
  }
@@ -13592,7 +13592,7 @@ function updateSessionFromEvent(ctx, event, toolCallsById) {
13592
13592
  }
13593
13593
  const id = readString2(event.id);
13594
13594
  const kind = readString2(event.kind);
13595
- const path93 = readString2(event.path);
13595
+ const path94 = readString2(event.path);
13596
13596
  let toolCall = id ? toolCallsById.get(id) : void 0;
13597
13597
  if (!toolCall) {
13598
13598
  toolCall = {};
@@ -13607,8 +13607,8 @@ function updateSessionFromEvent(ctx, event, toolCallsById) {
13607
13607
  if (kind) {
13608
13608
  toolCall.kind = kind;
13609
13609
  }
13610
- if (path93) {
13611
- toolCall.path = path93;
13610
+ if (path94) {
13611
+ toolCall.path = path94;
13612
13612
  }
13613
13613
  }
13614
13614
  var sessionCapture;
@@ -24144,22 +24144,83 @@ function backoff(attempt, minTimeout, maxTimeout) {
24144
24144
  function hasErrorCode(error2, code) {
24145
24145
  return !!error2 && typeof error2 === "object" && "code" in error2 && error2.code === code;
24146
24146
  }
24147
+ function hasAnyErrorCode(error2, codes) {
24148
+ return codes.some((code) => hasErrorCode(error2, code));
24149
+ }
24150
+ function isPidRunning(pid) {
24151
+ try {
24152
+ process.kill(pid, 0);
24153
+ return true;
24154
+ } catch (error2) {
24155
+ return !hasErrorCode(error2, "ESRCH");
24156
+ }
24157
+ }
24147
24158
  function createDefaultFs() {
24148
24159
  return {
24149
- open: (path93, flags) => fsPromises5.open(path93, flags),
24160
+ open: (path94, flags) => fsPromises5.open(path94, flags),
24161
+ readFile: (path94, encoding) => fsPromises5.readFile(path94, encoding),
24150
24162
  stat: fsPromises5.stat,
24151
24163
  unlink: fsPromises5.unlink
24152
24164
  };
24153
24165
  }
24154
- async function removeLockFile(fs19, lockPath) {
24166
+ async function removeLockFile(fs19, lockPath, signal) {
24167
+ for (let attempt = 0; attempt <= 4; attempt += 1) {
24168
+ throwIfAborted(signal);
24169
+ try {
24170
+ await fs19.unlink(lockPath);
24171
+ return;
24172
+ } catch (error2) {
24173
+ if (hasErrorCode(error2, "ENOENT")) {
24174
+ return;
24175
+ }
24176
+ if (!hasAnyErrorCode(error2, ["EPERM", "EBUSY"]) || attempt === 4) {
24177
+ throw error2;
24178
+ }
24179
+ }
24180
+ await sleep(25 * 2 ** attempt, signal);
24181
+ }
24182
+ }
24183
+ function parseLockMetadata(content) {
24155
24184
  try {
24156
- await fs19.unlink(lockPath);
24185
+ const parsed = JSON.parse(content);
24186
+ if (!parsed || typeof parsed !== "object" || !("host" in parsed) || !("pid" in parsed)) {
24187
+ return void 0;
24188
+ }
24189
+ const { host, pid } = parsed;
24190
+ if (typeof host === "string" && typeof pid === "number" && Number.isSafeInteger(pid) && pid > 0) {
24191
+ return {
24192
+ host,
24193
+ pid
24194
+ };
24195
+ }
24196
+ } catch (ignoredError) {
24197
+ void ignoredError;
24198
+ }
24199
+ return void 0;
24200
+ }
24201
+ async function readLockMetadata(fs19, lockPath) {
24202
+ if (!fs19.readFile) {
24203
+ return void 0;
24204
+ }
24205
+ try {
24206
+ return parseLockMetadata(await fs19.readFile(lockPath, "utf8"));
24157
24207
  } catch (error2) {
24158
- if (!hasErrorCode(error2, "ENOENT")) {
24159
- throw error2;
24208
+ if (hasErrorCode(error2, "ENOENT")) {
24209
+ return null;
24160
24210
  }
24211
+ return void 0;
24161
24212
  }
24162
24213
  }
24214
+ async function shouldReclaimLock(options) {
24215
+ const metadata = await readLockMetadata(options.fs, options.lockPath);
24216
+ if (metadata === null) {
24217
+ return "missing";
24218
+ }
24219
+ if (metadata?.host === os2.hostname()) {
24220
+ return !options.isPidRunning(metadata.pid);
24221
+ }
24222
+ return Date.now() - options.stat.mtimeMs > options.staleMs;
24223
+ }
24163
24224
  async function writeLockMetadata(handle) {
24164
24225
  try {
24165
24226
  await handle.writeFile(
@@ -24180,7 +24241,8 @@ async function acquireFileLock(filePath, options = {}) {
24180
24241
  const retries = options.retries ?? 20;
24181
24242
  const minTimeout = options.minTimeout ?? 25;
24182
24243
  const maxTimeout = options.maxTimeout ?? 250;
24183
- const staleMs = options.staleMs ?? 3e4;
24244
+ const staleMs = options.staleMs ?? 1e3;
24245
+ const pidIsRunning = options.isPidRunning ?? isPidRunning;
24184
24246
  const lockPath = `${filePath}.lock`;
24185
24247
  let attempt = 0;
24186
24248
  while (attempt <= retries) {
@@ -24194,7 +24256,7 @@ async function acquireFileLock(filePath, options = {}) {
24194
24256
  return;
24195
24257
  }
24196
24258
  released = true;
24197
- await removeLockFile(fs19, lockPath);
24259
+ await removeLockFile(fs19, lockPath, options.signal);
24198
24260
  };
24199
24261
  } catch (error2) {
24200
24262
  if (!hasErrorCode(error2, "EEXIST")) {
@@ -24210,8 +24272,18 @@ async function acquireFileLock(filePath, options = {}) {
24210
24272
  }
24211
24273
  throw statError;
24212
24274
  }
24213
- if (Date.now() - stat24.mtimeMs > staleMs) {
24214
- await removeLockFile(fs19, lockPath);
24275
+ const reclaimLock = await shouldReclaimLock({
24276
+ fs: fs19,
24277
+ isPidRunning: pidIsRunning,
24278
+ lockPath,
24279
+ staleMs,
24280
+ stat: stat24
24281
+ });
24282
+ if (reclaimLock === "missing") {
24283
+ continue;
24284
+ }
24285
+ if (reclaimLock) {
24286
+ await removeLockFile(fs19, lockPath, options.signal);
24215
24287
  continue;
24216
24288
  }
24217
24289
  if (attempt >= retries) {
@@ -26290,8 +26362,69 @@ var init_src14 = __esm({
26290
26362
  }
26291
26363
  });
26292
26364
 
26293
- // packages/toolcraft/src/index.ts
26365
+ // packages/toolcraft/src/package-metadata.ts
26366
+ import { existsSync, readFileSync as readFileSync2, statSync } from "node:fs";
26367
+ import path24 from "node:path";
26294
26368
  import { fileURLToPath as fileURLToPath2 } from "node:url";
26369
+ function pathFromInput(from) {
26370
+ if (from instanceof URL) {
26371
+ return fileURLToPath2(from);
26372
+ }
26373
+ if (from.startsWith("file:")) {
26374
+ return fileURLToPath2(from);
26375
+ }
26376
+ return path24.resolve(from);
26377
+ }
26378
+ function getSearchDirectory(from) {
26379
+ const resolved = pathFromInput(from);
26380
+ try {
26381
+ return statSync(resolved).isDirectory() ? resolved : path24.dirname(resolved);
26382
+ } catch {
26383
+ return path24.dirname(resolved);
26384
+ }
26385
+ }
26386
+ function readPackageMetadata(packageJsonPath) {
26387
+ const parsed = JSON.parse(readFileSync2(packageJsonPath, "utf8"));
26388
+ const metadata = { path: packageJsonPath };
26389
+ if (typeof parsed.name === "string") {
26390
+ metadata.name = parsed.name;
26391
+ }
26392
+ if (typeof parsed.version === "string") {
26393
+ metadata.version = parsed.version;
26394
+ }
26395
+ return metadata;
26396
+ }
26397
+ function findPackageMetadata(from) {
26398
+ let current = getSearchDirectory(from);
26399
+ while (true) {
26400
+ const packageJsonPath = path24.join(current, "package.json");
26401
+ if (existsSync(packageJsonPath)) {
26402
+ return readPackageMetadata(packageJsonPath);
26403
+ }
26404
+ const parent = path24.dirname(current);
26405
+ if (parent === current) {
26406
+ return void 0;
26407
+ }
26408
+ current = parent;
26409
+ }
26410
+ }
26411
+ function findEntrypointPackageMetadata(entrypoint) {
26412
+ if (entrypoint === void 0 || entrypoint.length === 0) {
26413
+ return void 0;
26414
+ }
26415
+ if (!path24.isAbsolute(entrypoint) && !entrypoint.startsWith("file:")) {
26416
+ return void 0;
26417
+ }
26418
+ return findPackageMetadata(entrypoint);
26419
+ }
26420
+ var init_package_metadata = __esm({
26421
+ "packages/toolcraft/src/package-metadata.ts"() {
26422
+ "use strict";
26423
+ }
26424
+ });
26425
+
26426
+ // packages/toolcraft/src/index.ts
26427
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
26295
26428
  function cloneScope(scope) {
26296
26429
  return scope === void 0 ? void 0 : [...scope];
26297
26430
  }
@@ -26373,7 +26506,7 @@ function validateRenameMap(rename8) {
26373
26506
  function parseStackPath(candidate) {
26374
26507
  if (candidate.startsWith("file://")) {
26375
26508
  try {
26376
- return fileURLToPath2(candidate);
26509
+ return fileURLToPath3(candidate);
26377
26510
  } catch {
26378
26511
  return void 0;
26379
26512
  }
@@ -26731,6 +26864,7 @@ var init_src15 = __esm({
26731
26864
  init_config3();
26732
26865
  init_user_error();
26733
26866
  init_src14();
26867
+ init_package_metadata();
26734
26868
  commandConfigSymbol = /* @__PURE__ */ Symbol("toolcraft.command.config");
26735
26869
  groupConfigSymbol = /* @__PURE__ */ Symbol("toolcraft.group.config");
26736
26870
  commandSourcePathSymbol = /* @__PURE__ */ Symbol("toolcraft.command.sourcePath");
@@ -26819,7 +26953,7 @@ var init_builder_group = __esm({
26819
26953
 
26820
26954
  // packages/agent-skill-config/src/configs.ts
26821
26955
  import os3 from "node:os";
26822
- import path24 from "node:path";
26956
+ import path25 from "node:path";
26823
26957
  function resolveAgentSupport(input, registry = agentSkillConfigs) {
26824
26958
  const resolvedId = resolveAgentId(input);
26825
26959
  if (!resolvedId) {
@@ -26859,9 +26993,9 @@ var init_configs2 = __esm({
26859
26993
  });
26860
26994
 
26861
26995
  // packages/agent-skill-config/src/templates.ts
26862
- import { readFile as readFile3, stat as stat3 } from "node:fs/promises";
26863
- import path25 from "node:path";
26864
- import { fileURLToPath as fileURLToPath3 } from "node:url";
26996
+ import { readFile as readFile4, stat as stat3 } from "node:fs/promises";
26997
+ import path26 from "node:path";
26998
+ import { fileURLToPath as fileURLToPath4 } from "node:url";
26865
26999
  async function pathExists2(target) {
26866
27000
  try {
26867
27001
  await stat3(target);
@@ -26874,12 +27008,12 @@ async function pathExists2(target) {
26874
27008
  }
26875
27009
  }
26876
27010
  async function findPackageRoot(entryFilePath) {
26877
- let current = path25.dirname(entryFilePath);
27011
+ let current = path26.dirname(entryFilePath);
26878
27012
  while (true) {
26879
- if (await pathExists2(path25.join(current, "package.json"))) {
27013
+ if (await pathExists2(path26.join(current, "package.json"))) {
26880
27014
  return current;
26881
27015
  }
26882
- const parent = path25.dirname(current);
27016
+ const parent = path26.dirname(current);
26883
27017
  if (parent === current) {
26884
27018
  throw new Error("Unable to locate package root for agent-skill-config templates.");
26885
27019
  }
@@ -26887,11 +27021,11 @@ async function findPackageRoot(entryFilePath) {
26887
27021
  }
26888
27022
  }
26889
27023
  async function resolveTemplatePath(templateId) {
26890
- const packageRoot = await findPackageRoot(fileURLToPath3(import.meta.url));
27024
+ const packageRoot = await findPackageRoot(fileURLToPath4(import.meta.url));
26891
27025
  const candidates = [
26892
- path25.join(packageRoot, "src", "templates", templateId),
26893
- path25.join(packageRoot, "dist", "templates", templateId),
26894
- path25.join(packageRoot, "dist", "templates", "skill", templateId)
27026
+ path26.join(packageRoot, "src", "templates", templateId),
27027
+ path26.join(packageRoot, "dist", "templates", templateId),
27028
+ path26.join(packageRoot, "dist", "templates", "skill", templateId)
26895
27029
  ];
26896
27030
  for (const candidate of candidates) {
26897
27031
  if (await pathExists2(candidate)) {
@@ -26912,7 +27046,7 @@ async function loadTemplate(templateId) {
26912
27046
  return cached2;
26913
27047
  }
26914
27048
  const resolved = await resolveTemplatePath(templateId);
26915
- const content = await readFile3(resolved, "utf8");
27049
+ const content = await readFile4(resolved, "utf8");
26916
27050
  cache.set(templateId, content);
26917
27051
  return content;
26918
27052
  }
@@ -27059,9 +27193,9 @@ var init_src16 = __esm({
27059
27193
  });
27060
27194
 
27061
27195
  // packages/superintendent/src/commands/install.ts
27062
- import path26 from "node:path";
27063
- import { readFile as readFile4, stat as stat4, mkdir as mkdir4, writeFile as writeFile2, unlink as unlink3, readdir as readdir3, chmod as chmod2 } from "node:fs/promises";
27064
- import { fileURLToPath as fileURLToPath4 } from "node:url";
27196
+ import path27 from "node:path";
27197
+ import { readFile as readFile5, stat as stat4, mkdir as mkdir4, writeFile as writeFile2, unlink as unlink3, readdir as readdir3, chmod as chmod2 } from "node:fs/promises";
27198
+ import { fileURLToPath as fileURLToPath5 } from "node:url";
27065
27199
  async function resolvePlanDirectory(cwd, homeDir, env) {
27066
27200
  const configPath = resolveConfigPath(homeDir);
27067
27201
  const projectConfigPath = resolveProjectConfigPath(cwd);
@@ -27070,9 +27204,9 @@ async function resolvePlanDirectory(cwd, homeDir, env) {
27070
27204
  }
27071
27205
  function resolveAbsoluteDirectory(dir, cwd, homeDir) {
27072
27206
  if (dir.startsWith("~/")) {
27073
- return path26.join(homeDir, dir.slice(2));
27207
+ return path27.join(homeDir, dir.slice(2));
27074
27208
  }
27075
- return path26.isAbsolute(dir) ? dir : path26.resolve(cwd, dir);
27209
+ return path27.isAbsolute(dir) ? dir : path27.resolve(cwd, dir);
27076
27210
  }
27077
27211
  async function pathExists3(targetPath) {
27078
27212
  try {
@@ -27089,17 +27223,17 @@ async function loadSkillTemplate() {
27089
27223
  if (skillTemplateCache) {
27090
27224
  return skillTemplateCache;
27091
27225
  }
27092
- const packageRoot = await findPackageRoot2(fileURLToPath4(import.meta.url));
27226
+ const packageRoot = await findPackageRoot2(fileURLToPath5(import.meta.url));
27093
27227
  const templateRoots = [
27094
- path26.join(packageRoot, "src", "templates"),
27095
- path26.join(packageRoot, "dist", "templates")
27228
+ path27.join(packageRoot, "src", "templates"),
27229
+ path27.join(packageRoot, "dist", "templates")
27096
27230
  ];
27097
27231
  for (const templateRoot of templateRoots) {
27098
27232
  if (!await pathExists3(templateRoot)) {
27099
27233
  continue;
27100
27234
  }
27101
- skillTemplateCache = await readFile4(
27102
- path26.join(templateRoot, "SKILL_superintendent.md"),
27235
+ skillTemplateCache = await readFile5(
27236
+ path27.join(templateRoot, "SKILL_superintendent.md"),
27103
27237
  "utf8"
27104
27238
  );
27105
27239
  return skillTemplateCache;
@@ -27107,12 +27241,12 @@ async function loadSkillTemplate() {
27107
27241
  throw new Error("Unable to locate Superintendent skill template.");
27108
27242
  }
27109
27243
  async function findPackageRoot2(entryFilePath) {
27110
- let currentPath = path26.dirname(entryFilePath);
27244
+ let currentPath = path27.dirname(entryFilePath);
27111
27245
  while (true) {
27112
- if (await pathExists3(path26.join(currentPath, "package.json"))) {
27246
+ if (await pathExists3(path27.join(currentPath, "package.json"))) {
27113
27247
  return currentPath;
27114
27248
  }
27115
- const parentPath = path26.dirname(currentPath);
27249
+ const parentPath = path27.dirname(currentPath);
27116
27250
  if (parentPath === currentPath) {
27117
27251
  throw new Error("Unable to locate package root for Superintendent templates.");
27118
27252
  }
@@ -27128,7 +27262,7 @@ var init_install = __esm({
27128
27262
  init_src16();
27129
27263
  init_src13();
27130
27264
  fs2 = {
27131
- readFile: (p, encoding) => readFile4(p, encoding),
27265
+ readFile: (p, encoding) => readFile5(p, encoding),
27132
27266
  writeFile: (p, content) => writeFile2(p, content),
27133
27267
  mkdir: (p, options) => mkdir4(p, options).then(() => void 0),
27134
27268
  unlink: (p) => unlink3(p),
@@ -27423,13 +27557,13 @@ var init_complete = __esm({
27423
27557
  });
27424
27558
 
27425
27559
  // packages/superintendent/src/commands/plan-path.ts
27426
- import path27 from "node:path";
27427
- import { readFile as readFile5, writeFile as writeFile3, mkdir as mkdir5, unlink as unlink4, stat as stat5, readdir as readdir4 } from "node:fs/promises";
27560
+ import path28 from "node:path";
27561
+ import { readFile as readFile6, writeFile as writeFile3, mkdir as mkdir5, unlink as unlink4, stat as stat5, readdir as readdir4 } from "node:fs/promises";
27428
27562
  function resolveAbsoluteDirectory2(dir, cwd, homeDir) {
27429
27563
  if (dir.startsWith("~/")) {
27430
- return path27.join(homeDir, dir.slice(2));
27564
+ return path28.join(homeDir, dir.slice(2));
27431
27565
  }
27432
- return path27.isAbsolute(dir) ? dir : path27.resolve(cwd, dir);
27566
+ return path28.isAbsolute(dir) ? dir : path28.resolve(cwd, dir);
27433
27567
  }
27434
27568
  var fs3, planPathCommand;
27435
27569
  var init_plan_path = __esm({
@@ -27438,7 +27572,7 @@ var init_plan_path = __esm({
27438
27572
  init_src15();
27439
27573
  init_src5();
27440
27574
  fs3 = {
27441
- readFile: (p, encoding) => readFile5(p, encoding),
27575
+ readFile: (p, encoding) => readFile6(p, encoding),
27442
27576
  writeFile: (p, content) => writeFile3(p, content),
27443
27577
  mkdir: (p, options) => mkdir5(p, options).then(() => void 0),
27444
27578
  unlink: (p) => unlink4(p),
@@ -27512,7 +27646,7 @@ var init_config_scope = __esm({
27512
27646
  });
27513
27647
 
27514
27648
  // packages/superintendent/src/commands/run.ts
27515
- import path28 from "node:path";
27649
+ import path29 from "node:path";
27516
27650
  import * as fsPromises7 from "node:fs/promises";
27517
27651
  import { spawn as nodeSpawn, spawnSync as nodeSpawnSync } from "node:child_process";
27518
27652
  function createRunMcpCommand(runners) {
@@ -27905,7 +28039,7 @@ async function runSuperintendentCommand(options) {
27905
28039
  session.pauseRequested = true;
27906
28040
  }
27907
28041
  editPlan(session.dashboard, session.latestLogFile, env, options.openInEditor);
27908
- appendEvent("info", `Log opened: ${path28.basename(session.latestLogFile)}`);
28042
+ appendEvent("info", `Log opened: ${path29.basename(session.latestLogFile)}`);
27909
28043
  syncStats();
27910
28044
  }
27911
28045
  };
@@ -28054,13 +28188,13 @@ async function listPlanDirectoryDocs(fs19, planDirectory, cwd, homeDir) {
28054
28188
  }
28055
28189
  throw error2;
28056
28190
  }
28057
- return entries.filter((entry) => entry.toLowerCase().endsWith(".md")).map((entry) => path28.join(absoluteDir, entry)).sort((left, right) => left.localeCompare(right));
28191
+ return entries.filter((entry) => entry.toLowerCase().endsWith(".md")).map((entry) => path29.join(absoluteDir, entry)).sort((left, right) => left.localeCompare(right));
28058
28192
  }
28059
28193
  function resolveAbsolutePlanDirectory(dir, cwd, homeDir) {
28060
28194
  if (dir.startsWith("~/")) {
28061
- return path28.join(homeDir, dir.slice(2));
28195
+ return path29.join(homeDir, dir.slice(2));
28062
28196
  }
28063
- return path28.isAbsolute(dir) ? dir : path28.resolve(cwd, dir);
28197
+ return path29.isAbsolute(dir) ? dir : path29.resolve(cwd, dir);
28064
28198
  }
28065
28199
  function normalizeAgentSelection(value) {
28066
28200
  if (typeof value !== "string") {
@@ -28296,7 +28430,7 @@ function resolveEditor(env) {
28296
28430
  const parts = raw.split(/\s+/);
28297
28431
  const command = parts[0] ?? "vi";
28298
28432
  const args = parts.slice(1);
28299
- const binary = path28.basename(command);
28433
+ const binary = path29.basename(command);
28300
28434
  const mode = GUI_EDITOR_BINARIES.has(binary) ? "gui" : "tty";
28301
28435
  return { command, args, mode };
28302
28436
  }
@@ -28323,11 +28457,11 @@ function stripStopReason(result) {
28323
28457
  };
28324
28458
  }
28325
28459
  function displayPath(filePath, cwd, homeDir) {
28326
- if (filePath.startsWith(`${cwd}${path28.sep}`)) {
28327
- return path28.relative(cwd, filePath);
28460
+ if (filePath.startsWith(`${cwd}${path29.sep}`)) {
28461
+ return path29.relative(cwd, filePath);
28328
28462
  }
28329
- if (filePath.startsWith(`${homeDir}${path28.sep}`)) {
28330
- return `~/${path28.relative(homeDir, filePath)}`;
28463
+ if (filePath.startsWith(`${homeDir}${path29.sep}`)) {
28464
+ return `~/${path29.relative(homeDir, filePath)}`;
28331
28465
  }
28332
28466
  return filePath;
28333
28467
  }
@@ -28731,7 +28865,7 @@ var init_src17 = __esm({
28731
28865
  });
28732
28866
 
28733
28867
  // src/services/config.ts
28734
- import path29 from "node:path";
28868
+ import path30 from "node:path";
28735
28869
  async function deleteConfig(options) {
28736
28870
  const { fs: fs19, filePath } = options;
28737
28871
  try {
@@ -28834,7 +28968,7 @@ async function migrateLegacyCredentialsIfNeeded(fs19, filePath) {
28834
28968
  await migrateLegacyCredentialsFile(fs19, filePath);
28835
28969
  }
28836
28970
  async function migrateLegacyCredentialsFile(fs19, configPath) {
28837
- const legacyPath = path29.join(path29.dirname(configPath), "credentials.json");
28971
+ const legacyPath = path30.join(path30.dirname(configPath), "credentials.json");
28838
28972
  const raw = await readFileIfExists(fs19, legacyPath);
28839
28973
  if (raw === null) {
28840
28974
  return;
@@ -28903,9 +29037,9 @@ async function recoverInvalidConfig(fs19, filePath, content) {
28903
29037
  await fs19.writeFile(filePath, EMPTY_DOCUMENT3, { encoding: "utf8" });
28904
29038
  }
28905
29039
  function createInvalidBackupPath2(filePath) {
28906
- const directory = path29.dirname(filePath);
28907
- const baseName = path29.basename(filePath);
28908
- return path29.join(directory, `${baseName}.invalid-${createTimestamp()}.json`);
29040
+ const directory = path30.dirname(filePath);
29041
+ const baseName = path30.basename(filePath);
29042
+ return path30.join(directory, `${baseName}.invalid-${createTimestamp()}.json`);
28909
29043
  }
28910
29044
  function isRecord10(value) {
28911
29045
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
@@ -29062,7 +29196,7 @@ var init_errors2 = __esm({
29062
29196
  });
29063
29197
 
29064
29198
  // src/cli/commands/shared.ts
29065
- import path30 from "node:path";
29199
+ import path31 from "node:path";
29066
29200
  function buildActiveProvider(id, baseUrl, credential) {
29067
29201
  return { id, baseUrl, credential, extraEnv: {} };
29068
29202
  }
@@ -29197,7 +29331,7 @@ function buildResumeCommand(canonicalService, threadId, cwd) {
29197
29331
  if (!binaryName) {
29198
29332
  return void 0;
29199
29333
  }
29200
- const resumeCwd = path30.resolve(cwd);
29334
+ const resumeCwd = path31.resolve(cwd);
29201
29335
  const args = spawnConfig.resumeCommand(threadId, resumeCwd);
29202
29336
  const agentCommand = [binaryName, ...args.map(shlexQuote)].join(" ");
29203
29337
  const needsCdPrefix = !args.includes(resumeCwd);
@@ -29397,14 +29531,14 @@ function parseDockerLocator(input) {
29397
29531
  throw new Error(`Invalid docker workspace locator "${input}".`);
29398
29532
  }
29399
29533
  const container = input.slice(0, slashIndex);
29400
- const path93 = input.slice(slashIndex);
29401
- if (container.length === 0 || path93.length === 0) {
29534
+ const path94 = input.slice(slashIndex);
29535
+ if (container.length === 0 || path94.length === 0) {
29402
29536
  throw new Error(`Invalid docker workspace locator "${input}".`);
29403
29537
  }
29404
29538
  return {
29405
29539
  scheme: "docker",
29406
29540
  container,
29407
- path: path93
29541
+ path: path94
29408
29542
  };
29409
29543
  }
29410
29544
  function splitOnce(input, separator) {
@@ -29465,9 +29599,9 @@ var init_parse3 = __esm({
29465
29599
  });
29466
29600
 
29467
29601
  // packages/workspace-resolver/src/github/clone.ts
29468
- import path31 from "node:path";
29602
+ import path32 from "node:path";
29469
29603
  function buildCachePath(homeDir, locator) {
29470
- return path31.join(
29604
+ return path32.join(
29471
29605
  homeDir,
29472
29606
  ".poe-code",
29473
29607
  "workspaces",
@@ -29482,7 +29616,7 @@ async function cloneOrUpdate(locator, options) {
29482
29616
  const cacheDir = buildCachePath(options.homeDir, locator);
29483
29617
  const exists = await pathExists4(options.fs, cacheDir);
29484
29618
  if (!exists) {
29485
- await options.fs.mkdir(path31.dirname(cacheDir), { recursive: true });
29619
+ await options.fs.mkdir(path32.dirname(cacheDir), { recursive: true });
29486
29620
  await assertExecSuccess(
29487
29621
  await options.exec("git", ["clone", "--depth", "1", buildCloneUrl(locator), cacheDir]),
29488
29622
  "git clone failed"
@@ -29528,9 +29662,9 @@ var init_clone = __esm({
29528
29662
  });
29529
29663
 
29530
29664
  // packages/workspace-resolver/src/github/isolation.ts
29531
- import path32 from "node:path";
29665
+ import path33 from "node:path";
29532
29666
  async function createWritableCheckout(locator, sourceCwd, options) {
29533
- const cwd = path32.join(
29667
+ const cwd = path33.join(
29534
29668
  options.homeDir,
29535
29669
  ".poe-code",
29536
29670
  "workspaces",
@@ -29539,7 +29673,7 @@ async function createWritableCheckout(locator, sourceCwd, options) {
29539
29673
  createCheckoutId()
29540
29674
  );
29541
29675
  const revision = locator.ref ?? "HEAD";
29542
- await options.fs.mkdir(path32.dirname(cwd), { recursive: true });
29676
+ await options.fs.mkdir(path33.dirname(cwd), { recursive: true });
29543
29677
  await assertExecSuccess2(
29544
29678
  await options.exec("git", ["worktree", "add", "--detach", cwd, revision], {
29545
29679
  cwd: sourceCwd
@@ -29579,12 +29713,12 @@ var init_isolation = __esm({
29579
29713
  });
29580
29714
 
29581
29715
  // packages/workspace-resolver/src/resolve.ts
29582
- import path33 from "node:path";
29716
+ import path34 from "node:path";
29583
29717
  async function resolveWorkspace(input, options) {
29584
29718
  const locator = parseLocator(input);
29585
29719
  if (locator.scheme === "local") {
29586
29720
  return {
29587
- cwd: path33.isAbsolute(locator.path) ? locator.path : path33.resolve(options.baseDir, locator.path),
29721
+ cwd: path34.isAbsolute(locator.path) ? locator.path : path34.resolve(options.baseDir, locator.path),
29588
29722
  locator
29589
29723
  };
29590
29724
  }
@@ -29597,7 +29731,7 @@ async function resolveWorkspace(input, options) {
29597
29731
  try {
29598
29732
  writable = mode === "read" ? void 0 : await createWritableCheckout(locator, cacheDir, options);
29599
29733
  const workspaceRoot = writable?.cwd ?? cacheDir;
29600
- const cwd = locator.subdir ? path33.join(workspaceRoot, locator.subdir) : workspaceRoot;
29734
+ const cwd = locator.subdir ? path34.join(workspaceRoot, locator.subdir) : workspaceRoot;
29601
29735
  await assertPathExists(options.fs, cwd, locator);
29602
29736
  return {
29603
29737
  cwd,
@@ -29810,7 +29944,7 @@ var init_spawn_core = __esm({
29810
29944
  });
29811
29945
 
29812
29946
  // src/cli/environment.ts
29813
- import path34 from "node:path";
29947
+ import path35 from "node:path";
29814
29948
  function createCliEnvironment(init) {
29815
29949
  const platform = init.platform ?? process.platform;
29816
29950
  const variables = init.variables ?? process.env;
@@ -29818,7 +29952,7 @@ function createCliEnvironment(init) {
29818
29952
  const projectConfigPath = resolveProjectConfigPath(init.cwd);
29819
29953
  const logDir = resolveLogDir(init.homeDir);
29820
29954
  const { poeApiBaseUrl, poeBaseUrl } = resolvePoeBaseUrls(variables);
29821
- const resolveHomePath = (...segments) => path34.join(init.homeDir, ...segments);
29955
+ const resolveHomePath = (...segments) => path35.join(init.homeDir, ...segments);
29822
29956
  const getVariable = (name) => variables[name];
29823
29957
  return {
29824
29958
  cwd: init.cwd,
@@ -29835,7 +29969,7 @@ function createCliEnvironment(init) {
29835
29969
  };
29836
29970
  }
29837
29971
  function resolveLogDir(homeDir) {
29838
- return path34.join(homeDir, ".poe-code", "logs");
29972
+ return path35.join(homeDir, ".poe-code", "logs");
29839
29973
  }
29840
29974
  function resolvePoeBaseUrls(variables) {
29841
29975
  const raw = variables.POE_BASE_URL;
@@ -30583,7 +30717,7 @@ var init_logger2 = __esm({
30583
30717
  });
30584
30718
 
30585
30719
  // src/cli/error-logger.ts
30586
- import path35 from "node:path";
30720
+ import path36 from "node:path";
30587
30721
  var DEFAULT_MAX_SIZE, DEFAULT_MAX_BACKUPS, ErrorLogger;
30588
30722
  var init_error_logger = __esm({
30589
30723
  "src/cli/error-logger.ts"() {
@@ -30600,7 +30734,7 @@ var init_error_logger = __esm({
30600
30734
  fileLoggingAvailable;
30601
30735
  constructor(options) {
30602
30736
  this.fs = options.fs;
30603
- this.logFilePath = path35.join(options.logDir, "errors.log");
30737
+ this.logFilePath = path36.join(options.logDir, "errors.log");
30604
30738
  this.logToStderr = options.logToStderr ?? true;
30605
30739
  this.maxSize = options.maxSize ?? DEFAULT_MAX_SIZE;
30606
30740
  this.maxBackups = options.maxBackups ?? DEFAULT_MAX_BACKUPS;
@@ -30721,7 +30855,7 @@ ${entry.stack}`);
30721
30855
  return `${this.logFilePath}.${index}`;
30722
30856
  }
30723
30857
  ensureLogDirectory() {
30724
- const directory = path35.dirname(this.logFilePath);
30858
+ const directory = path36.dirname(this.logFilePath);
30725
30859
  try {
30726
30860
  if (!this.fs.existsSync(directory)) {
30727
30861
  this.fs.mkdirSync(directory, { recursive: true });
@@ -30739,9 +30873,9 @@ ${entry.stack}`);
30739
30873
  });
30740
30874
 
30741
30875
  // src/providers/index.ts
30742
- import path36 from "node:path";
30876
+ import path37 from "node:path";
30743
30877
  import { readdir as readdir6 } from "node:fs/promises";
30744
- import { fileURLToPath as fileURLToPath5, pathToFileURL } from "node:url";
30878
+ import { fileURLToPath as fileURLToPath6, pathToFileURL } from "node:url";
30745
30879
  function isProviderModule(filename) {
30746
30880
  if (filename.endsWith(".d.ts") || filename.endsWith(".d.ts.map")) {
30747
30881
  return false;
@@ -30766,7 +30900,7 @@ async function loadProviders() {
30766
30900
  for (const entry of entries) {
30767
30901
  if (!entry.isFile()) continue;
30768
30902
  if (!isProviderModule(entry.name)) continue;
30769
- const moduleUrl = pathToFileURL(path36.join(currentDir, entry.name)).href;
30903
+ const moduleUrl = pathToFileURL(path37.join(currentDir, entry.name)).href;
30770
30904
  const moduleExports = await import(moduleUrl);
30771
30905
  if (!moduleExports.provider) {
30772
30906
  throw new Error(`Provider module "${entry.name}" must export "provider".`);
@@ -30782,8 +30916,8 @@ var moduleDir, currentDir, defaultProviders;
30782
30916
  var init_providers = __esm({
30783
30917
  async "src/providers/index.ts"() {
30784
30918
  "use strict";
30785
- moduleDir = path36.dirname(fileURLToPath5(import.meta.url));
30786
- currentDir = path36.basename(moduleDir) === "providers" ? moduleDir : path36.join(moduleDir, "providers");
30919
+ moduleDir = path37.dirname(fileURLToPath6(import.meta.url));
30920
+ currentDir = path37.basename(moduleDir) === "providers" ? moduleDir : path37.join(moduleDir, "providers");
30787
30921
  defaultProviders = await loadProviders();
30788
30922
  }
30789
30923
  });
@@ -31360,25 +31494,25 @@ function createSdkContainer(options) {
31360
31494
  });
31361
31495
  loggerFactory.setErrorLogger(errorLogger);
31362
31496
  const asyncFs = {
31363
- readFile: ((path93, encoding) => {
31497
+ readFile: ((path94, encoding) => {
31364
31498
  if (encoding) {
31365
- return fs4.readFile(path93, encoding);
31499
+ return fs4.readFile(path94, encoding);
31366
31500
  }
31367
- return fs4.readFile(path93);
31501
+ return fs4.readFile(path94);
31368
31502
  }),
31369
- symlink: (target, path93) => fs4.symlink(target, path93),
31370
- readlink: (path93) => fs4.readlink(path93, { encoding: "utf8" }),
31371
- writeFile: (path93, data, opts) => fs4.writeFile(path93, data, opts),
31372
- mkdir: (path93, opts) => fs4.mkdir(path93, opts).then(() => {
31503
+ symlink: (target, path94) => fs4.symlink(target, path94),
31504
+ readlink: (path94) => fs4.readlink(path94, { encoding: "utf8" }),
31505
+ writeFile: (path94, data, opts) => fs4.writeFile(path94, data, opts),
31506
+ mkdir: (path94, opts) => fs4.mkdir(path94, opts).then(() => {
31373
31507
  }),
31374
- stat: (path93) => fs4.stat(path93),
31375
- lstat: (path93) => fs4.lstat(path93),
31508
+ stat: (path94) => fs4.stat(path94),
31509
+ lstat: (path94) => fs4.lstat(path94),
31376
31510
  rename: (oldPath, newPath) => fs4.rename(oldPath, newPath),
31377
- rm: (path93, opts) => fs4.rm(path93, opts),
31378
- unlink: (path93) => fs4.unlink(path93),
31379
- readdir: (path93) => fs4.readdir(path93),
31511
+ rm: (path94, opts) => fs4.rm(path94, opts),
31512
+ unlink: (path94) => fs4.unlink(path94),
31513
+ readdir: (path94) => fs4.readdir(path94),
31380
31514
  copyFile: (src, dest) => fs4.copyFile(src, dest),
31381
- chmod: (path93, mode) => fs4.chmod(path93, mode)
31515
+ chmod: (path94, mode) => fs4.chmod(path94, mode)
31382
31516
  };
31383
31517
  const contextFactory = createCommandContextFactory({ fs: asyncFs });
31384
31518
  const authFs = {
@@ -31764,7 +31898,7 @@ var init_utils2 = __esm({
31764
31898
  });
31765
31899
 
31766
31900
  // packages/pipeline/src/config/loader.ts
31767
- import path37 from "node:path";
31901
+ import path38 from "node:path";
31768
31902
  import { parse as parse6 } from "yaml";
31769
31903
  function asStepMode(value) {
31770
31904
  if (value === void 0 || value === null) {
@@ -31872,22 +32006,22 @@ async function directoryExists(fs19, targetPath) {
31872
32006
  }
31873
32007
  }
31874
32008
  async function resolveStepsFile(options) {
31875
- const projectFile = path37.join(options.cwd, ".poe-code", "pipeline", "steps.yaml");
32009
+ const projectFile = path38.join(options.cwd, ".poe-code", "pipeline", "steps.yaml");
31876
32010
  if (await fileExists2(options.fs, projectFile)) {
31877
32011
  return projectFile;
31878
32012
  }
31879
- const globalFile = path37.join(options.homeDir, ".poe-code", "pipeline", "steps.yaml");
32013
+ const globalFile = path38.join(options.homeDir, ".poe-code", "pipeline", "steps.yaml");
31880
32014
  if (await fileExists2(options.fs, globalFile)) {
31881
32015
  return globalFile;
31882
32016
  }
31883
32017
  return null;
31884
32018
  }
31885
32019
  async function resolveStepsDirectory(options) {
31886
- const projectDir = path37.join(options.cwd, ".poe-code", "pipeline", "steps");
32020
+ const projectDir = path38.join(options.cwd, ".poe-code", "pipeline", "steps");
31887
32021
  if (await directoryExists(options.fs, projectDir)) {
31888
32022
  return projectDir;
31889
32023
  }
31890
- const globalDir = path37.join(options.homeDir, ".poe-code", "pipeline", "steps");
32024
+ const globalDir = path38.join(options.homeDir, ".poe-code", "pipeline", "steps");
31891
32025
  if (await directoryExists(options.fs, globalDir)) {
31892
32026
  return globalDir;
31893
32027
  }
@@ -31911,9 +32045,9 @@ function parseConfigData(filePath, document) {
31911
32045
  return config;
31912
32046
  }
31913
32047
  async function loadPipelineConfig(options) {
31914
- const globalDir = path37.join(options.homeDir, ".poe-code", "pipeline");
31915
- const globalPath = path37.join(globalDir, "config.yaml");
31916
- const projectPath = path37.join(options.cwd, ".poe-code", "pipeline", "config.yaml");
32048
+ const globalDir = path38.join(options.homeDir, ".poe-code", "pipeline");
32049
+ const globalPath = path38.join(globalDir, "config.yaml");
32050
+ const projectPath = path38.join(options.cwd, ".poe-code", "pipeline", "config.yaml");
31917
32051
  const [globalContent, projectContent] = await Promise.all([
31918
32052
  readOptionalFile2(options.fs, globalPath),
31919
32053
  readOptionalFile2(options.fs, projectPath)
@@ -31950,7 +32084,7 @@ async function loadResolvedSteps(options) {
31950
32084
  }
31951
32085
  return applyStepOverrides({ steps: {} }, options.stepOverrides);
31952
32086
  }
31953
- const filePath = path37.join(stepsDir, `${name}.yaml`);
32087
+ const filePath = path38.join(stepsDir, `${name}.yaml`);
31954
32088
  const content = await readOptionalFile2(options.fs, filePath);
31955
32089
  if (content == null) {
31956
32090
  throw new Error(`Unknown pipeline step config "${name}" in "${stepsDir}".`);
@@ -32194,7 +32328,7 @@ var init_parser2 = __esm({
32194
32328
  });
32195
32329
 
32196
32330
  // packages/pipeline/src/plan/discovery.ts
32197
- import path38 from "node:path";
32331
+ import path39 from "node:path";
32198
32332
  import * as fsPromises8 from "node:fs/promises";
32199
32333
  import { parse as parseYaml3 } from "yaml";
32200
32334
  function createDefaultFs4() {
@@ -32239,7 +32373,7 @@ function countCompletedTasks(planPath, content) {
32239
32373
  };
32240
32374
  }
32241
32375
  async function ensurePlanExists(fs19, cwd, planPath) {
32242
- const absolutePath = path38.isAbsolute(planPath) ? planPath : path38.resolve(cwd, planPath);
32376
+ const absolutePath = path39.isAbsolute(planPath) ? planPath : path39.resolve(cwd, planPath);
32243
32377
  try {
32244
32378
  const stat24 = await fs19.stat(absolutePath);
32245
32379
  if (!stat24.isFile()) {
@@ -32267,12 +32401,12 @@ async function scanPlansDir(fs19, plansDir, displayPrefix) {
32267
32401
  if (!isMarkdownFile(entry)) {
32268
32402
  continue;
32269
32403
  }
32270
- const absolutePath = path38.join(plansDir, entry);
32404
+ const absolutePath = path39.join(plansDir, entry);
32271
32405
  const stat24 = await fs19.stat(absolutePath);
32272
32406
  if (!stat24.isFile()) {
32273
32407
  continue;
32274
32408
  }
32275
- const displayPath2 = path38.join(displayPrefix, entry);
32409
+ const displayPath2 = path39.join(displayPrefix, entry);
32276
32410
  const content = await fs19.readFile(absolutePath, "utf8");
32277
32411
  if (!isPipelinePlan(content)) {
32278
32412
  continue;
@@ -32293,9 +32427,9 @@ async function scanCustomPlanDir(fs19, planDirectory, cwd, homeDir) {
32293
32427
  }
32294
32428
  function resolveAbsoluteDirectory3(dir, cwd, homeDir) {
32295
32429
  if (dir.startsWith("~/")) {
32296
- return path38.join(homeDir, dir.slice(2));
32430
+ return path39.join(homeDir, dir.slice(2));
32297
32431
  }
32298
- return path38.isAbsolute(dir) ? dir : path38.resolve(cwd, dir);
32432
+ return path39.isAbsolute(dir) ? dir : path39.resolve(cwd, dir);
32299
32433
  }
32300
32434
  function describeDiscoveryDirectory(planDirectory) {
32301
32435
  const configured = planDirectory?.trim();
@@ -32307,9 +32441,9 @@ function resolvePlanDirectory2(options) {
32307
32441
  }
32308
32442
  function resolveAbsolutePlanPath(planPath, cwd, homeDir) {
32309
32443
  if (planPath.startsWith("~/")) {
32310
- return path38.join(homeDir, planPath.slice(2));
32444
+ return path39.join(homeDir, planPath.slice(2));
32311
32445
  }
32312
- return path38.isAbsolute(planPath) ? planPath : path38.resolve(cwd, planPath);
32446
+ return path39.isAbsolute(planPath) ? planPath : path39.resolve(cwd, planPath);
32313
32447
  }
32314
32448
  async function resolvePlanPath(options) {
32315
32449
  const fs19 = options.fs ?? createDefaultFs4();
@@ -32371,7 +32505,7 @@ async function resolvePlanPaths(options) {
32371
32505
  }
32372
32506
  const selectedPath = await options.promptForPath({
32373
32507
  message: "Enter the pipeline plan path",
32374
- placeholder: path38.join(describeDiscoveryDirectory(options.planDirectory), "plan.md")
32508
+ placeholder: path39.join(describeDiscoveryDirectory(options.planDirectory), "plan.md")
32375
32509
  });
32376
32510
  return selectedPath ? [selectedPath] : null;
32377
32511
  }
@@ -32563,7 +32697,7 @@ var init_interpolate = __esm({
32563
32697
  });
32564
32698
 
32565
32699
  // packages/pipeline/src/run/runner.ts
32566
- import path39 from "node:path";
32700
+ import path40 from "node:path";
32567
32701
  function selectFromTask(task) {
32568
32702
  if (typeof task.status === "string") {
32569
32703
  return task.status === "done" ? { kind: "completed" } : { kind: "run", task };
@@ -32587,15 +32721,15 @@ function selectNextExecution(plan, taskId) {
32587
32721
  function describeExecutionContext(selection) {
32588
32722
  return selection.stepName ? `task "${selection.task.id}" step "${selection.stepName}"` : `task "${selection.task.id}"`;
32589
32723
  }
32590
- async function resolveFileIncludes(template, cwd, readFile37) {
32724
+ async function resolveFileIncludes(template, cwd, readFile38) {
32591
32725
  const matches2 = [...template.matchAll(FILE_INCLUDE_PATTERN)];
32592
32726
  if (matches2.length === 0) {
32593
32727
  return template;
32594
32728
  }
32595
32729
  let result = template;
32596
32730
  for (const match of matches2) {
32597
- const absolutePath = path39.resolve(cwd, match[1]);
32598
- const content = await readFile37(absolutePath, "utf8");
32731
+ const absolutePath = path40.resolve(cwd, match[1]);
32732
+ const content = await readFile38(absolutePath, "utf8");
32599
32733
  result = result.replace(match[0], content);
32600
32734
  }
32601
32735
  return result;
@@ -32636,7 +32770,7 @@ var init_runner2 = __esm({
32636
32770
  });
32637
32771
 
32638
32772
  // packages/pipeline/src/vars/resolve.ts
32639
- import path40 from "node:path";
32773
+ import path41 from "node:path";
32640
32774
  function looksLikeDocPath(value) {
32641
32775
  const trimmed = value.trim();
32642
32776
  if (trimmed.length === 0) return false;
@@ -32653,7 +32787,7 @@ function looksLikeDocPath(value) {
32653
32787
  }
32654
32788
  async function resolveDocVarFromPath(options) {
32655
32789
  const trimmed = options.value.trim();
32656
- const absolutePath = path40.isAbsolute(trimmed) ? trimmed : path40.join(options.cwd, trimmed);
32790
+ const absolutePath = path41.isAbsolute(trimmed) ? trimmed : path41.join(options.cwd, trimmed);
32657
32791
  try {
32658
32792
  return await options.readFile(absolutePath, "utf8");
32659
32793
  } catch (error2) {
@@ -32663,15 +32797,15 @@ async function resolveDocVarFromPath(options) {
32663
32797
  );
32664
32798
  }
32665
32799
  }
32666
- async function resolvePipelineVars(vars, cwd, readFile37) {
32800
+ async function resolvePipelineVars(vars, cwd, readFile38) {
32667
32801
  const resolved = {};
32668
32802
  for (const [key2, value] of Object.entries(vars)) {
32669
32803
  if (key2.endsWith("_doc") && looksLikeDocPath(value)) {
32670
- const docContent = await resolveDocVarFromPath({ key: key2, value, cwd, readFile: readFile37 });
32671
- resolved[key2] = await resolveFileIncludes(docContent, cwd, readFile37);
32804
+ const docContent = await resolveDocVarFromPath({ key: key2, value, cwd, readFile: readFile38 });
32805
+ resolved[key2] = await resolveFileIncludes(docContent, cwd, readFile38);
32672
32806
  continue;
32673
32807
  }
32674
- resolved[key2] = await resolveFileIncludes(value, cwd, readFile37);
32808
+ resolved[key2] = await resolveFileIncludes(value, cwd, readFile38);
32675
32809
  }
32676
32810
  return resolved;
32677
32811
  }
@@ -32722,7 +32856,7 @@ var init_validate = __esm({
32722
32856
  });
32723
32857
 
32724
32858
  // packages/pipeline/src/run/pipeline.ts
32725
- import path41 from "node:path";
32859
+ import path42 from "node:path";
32726
32860
  import * as fsPromises9 from "node:fs/promises";
32727
32861
  function createDefaultFs5() {
32728
32862
  const fs19 = {
@@ -32807,9 +32941,9 @@ function resolveMode2(stepName, steps) {
32807
32941
  return step.mode;
32808
32942
  }
32809
32943
  async function archivePlan(fs19, absolutePlanPath) {
32810
- const dir = path41.dirname(absolutePlanPath);
32811
- const archiveDir = path41.join(dir, "archive");
32812
- const archivePath = path41.join(archiveDir, path41.basename(absolutePlanPath));
32944
+ const dir = path42.dirname(absolutePlanPath);
32945
+ const archiveDir = path42.join(dir, "archive");
32946
+ const archivePath = path42.join(archiveDir, path42.basename(absolutePlanPath));
32813
32947
  await fs19.mkdir(archiveDir, { recursive: true });
32814
32948
  await fs19.rename(absolutePlanPath, archivePath);
32815
32949
  }
@@ -33512,9 +33646,9 @@ var init_git = __esm({
33512
33646
  });
33513
33647
 
33514
33648
  // packages/experiment-loop/src/config/loader.ts
33515
- import path42 from "node:path";
33516
- import { readFile as readFile10 } from "node:fs/promises";
33517
- import { fileURLToPath as fileURLToPath6 } from "node:url";
33649
+ import path43 from "node:path";
33650
+ import { readFile as readFile11 } from "node:fs/promises";
33651
+ import { fileURLToPath as fileURLToPath7 } from "node:url";
33518
33652
  import { parse as parse8 } from "yaml";
33519
33653
  function isRecord13(value) {
33520
33654
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -33557,8 +33691,8 @@ function parseRunConfigDocument(filePath, content) {
33557
33691
  return parseRunConfigData(filePath, parseRunConfigYaml(filePath, content));
33558
33692
  }
33559
33693
  async function readBundledFile(name) {
33560
- const filePath = fileURLToPath6(new URL(`./${name}`, import.meta.url));
33561
- return readFile10(filePath, "utf8");
33694
+ const filePath = fileURLToPath7(new URL(`./${name}`, import.meta.url));
33695
+ return readFile11(filePath, "utf8");
33562
33696
  }
33563
33697
  async function readDefaultRunConfig() {
33564
33698
  const content = await readBundledFile("default-run.yaml");
@@ -33569,7 +33703,7 @@ async function readDefaultRunConfig() {
33569
33703
  return config;
33570
33704
  }
33571
33705
  function createRunConfigResolveFs(fs19) {
33572
- const bundledRunPath = fileURLToPath6(new URL("./run.yaml", import.meta.url));
33706
+ const bundledRunPath = fileURLToPath7(new URL("./run.yaml", import.meta.url));
33573
33707
  return {
33574
33708
  async readFile(filePath, encoding) {
33575
33709
  if (filePath === bundledRunPath) {
@@ -33583,7 +33717,7 @@ async function loadInstructions() {
33583
33717
  return readBundledFile("default-instructions.md");
33584
33718
  }
33585
33719
  async function loadRunConfig(options) {
33586
- const projectPath = path42.join(options.cwd, ".poe-code", "experiments", "run.yaml");
33720
+ const projectPath = path43.join(options.cwd, ".poe-code", "experiments", "run.yaml");
33587
33721
  const projectContent = await readOptionalFile3(options.fs, projectPath);
33588
33722
  if (projectContent == null) {
33589
33723
  return readDefaultRunConfig();
@@ -33592,8 +33726,8 @@ async function loadRunConfig(options) {
33592
33726
  if (projectDocument === null || projectDocument === void 0) {
33593
33727
  return readDefaultRunConfig();
33594
33728
  }
33595
- const bundledConfigDir = path42.resolve(fileURLToPath6(new URL(".", import.meta.url)));
33596
- const globalConfigDir = path42.resolve(path42.join(options.homeDir, ".poe-code", "experiments"));
33729
+ const bundledConfigDir = path43.resolve(fileURLToPath7(new URL(".", import.meta.url)));
33730
+ const globalConfigDir = path43.resolve(path43.join(options.homeDir, ".poe-code", "experiments"));
33597
33731
  const resolved = await resolve(
33598
33732
  [
33599
33733
  { source: "document", filePath: projectPath, content: projectContent },
@@ -33616,7 +33750,7 @@ var init_loader2 = __esm({
33616
33750
  });
33617
33751
 
33618
33752
  // packages/experiment-loop/src/discovery/discovery.ts
33619
- import path43 from "node:path";
33753
+ import path44 from "node:path";
33620
33754
  import * as fsPromises10 from "node:fs/promises";
33621
33755
  function createDefaultFs6() {
33622
33756
  return {
@@ -33650,12 +33784,12 @@ async function scanDir(fs19, absoluteDir, displayDir) {
33650
33784
  if (!isMarkdownFile2(entry)) {
33651
33785
  continue;
33652
33786
  }
33653
- const absolutePath = path43.join(absoluteDir, entry);
33787
+ const absolutePath = path44.join(absoluteDir, entry);
33654
33788
  const stat24 = await fs19.stat(absolutePath);
33655
33789
  if (!stat24.isFile()) {
33656
33790
  continue;
33657
33791
  }
33658
- const displayPath2 = path43.join(displayDir, entry);
33792
+ const displayPath2 = path44.join(displayDir, entry);
33659
33793
  docs.push({
33660
33794
  path: displayPath2,
33661
33795
  displayPath: displayPath2
@@ -33664,18 +33798,18 @@ async function scanDir(fs19, absoluteDir, displayDir) {
33664
33798
  return docs;
33665
33799
  }
33666
33800
  function toDisplayPath(options) {
33667
- const localDir = path43.join(options.cwd, ".poe-code", "experiments");
33668
- const globalDir = path43.join(options.homeDir, ".poe-code", "experiments");
33669
- if (options.absolutePath.startsWith(`${localDir}${path43.sep}`)) {
33670
- return path43.join(
33801
+ const localDir = path44.join(options.cwd, ".poe-code", "experiments");
33802
+ const globalDir = path44.join(options.homeDir, ".poe-code", "experiments");
33803
+ if (options.absolutePath.startsWith(`${localDir}${path44.sep}`)) {
33804
+ return path44.join(
33671
33805
  ".poe-code/experiments",
33672
- path43.relative(localDir, options.absolutePath)
33806
+ path44.relative(localDir, options.absolutePath)
33673
33807
  );
33674
33808
  }
33675
- if (options.absolutePath.startsWith(`${globalDir}${path43.sep}`)) {
33676
- return path43.join(
33809
+ if (options.absolutePath.startsWith(`${globalDir}${path44.sep}`)) {
33810
+ return path44.join(
33677
33811
  "~/.poe-code/experiments",
33678
- path43.relative(globalDir, options.absolutePath)
33812
+ path44.relative(globalDir, options.absolutePath)
33679
33813
  );
33680
33814
  }
33681
33815
  return options.absolutePath;
@@ -33708,8 +33842,8 @@ async function discoverExperimentDocs(options) {
33708
33842
  const customDir = options.planDirectory?.trim();
33709
33843
  const docs = customDir ? await scanCustomDir(fs19, customDir, options.cwd, options.homeDir) : await scanDefaultDirs(fs19, options.cwd, options.homeDir);
33710
33844
  return docs.sort((left, right) => {
33711
- const leftName = path43.basename(left.displayPath).toLowerCase();
33712
- const rightName = path43.basename(right.displayPath).toLowerCase();
33845
+ const leftName = path44.basename(left.displayPath).toLowerCase();
33846
+ const rightName = path44.basename(right.displayPath).toLowerCase();
33713
33847
  return leftName === rightName ? left.displayPath.localeCompare(right.displayPath) : leftName.localeCompare(rightName);
33714
33848
  });
33715
33849
  }
@@ -33723,7 +33857,7 @@ var init_discovery2 = __esm({
33723
33857
  // packages/experiment-loop/src/run/loop.ts
33724
33858
  import { exec as execCallback } from "node:child_process";
33725
33859
  import * as fsPromises11 from "node:fs/promises";
33726
- import path44 from "node:path";
33860
+ import path45 from "node:path";
33727
33861
  function createDefaultFs7() {
33728
33862
  const fs19 = {
33729
33863
  readFile: fsPromises11.readFile,
@@ -33775,9 +33909,9 @@ function createDefaultExec() {
33775
33909
  });
33776
33910
  }
33777
33911
  function resolveJournalPath(docPath) {
33778
- return path44.join(
33779
- path44.dirname(docPath),
33780
- `${path44.basename(docPath, path44.extname(docPath))}.journal.jsonl`
33912
+ return path45.join(
33913
+ path45.dirname(docPath),
33914
+ `${path45.basename(docPath, path45.extname(docPath))}.journal.jsonl`
33781
33915
  );
33782
33916
  }
33783
33917
  function normalizeMetrics(metric) {
@@ -33911,8 +34045,8 @@ async function runExperimentLoop(options) {
33911
34045
  [
33912
34046
  { source: "cli", data: { agent: options.agent } },
33913
34047
  { source: "document", filePath: absoluteDocPath, content: rawContent },
33914
- { source: "base", path: path44.join(options.cwd, ".poe-code/experiments/bases") },
33915
- { source: "base", path: path44.join(options.homeDir, ".poe-code/experiments/bases") },
34048
+ { source: "base", path: path45.join(options.cwd, ".poe-code/experiments/bases") },
34049
+ { source: "base", path: path45.join(options.homeDir, ".poe-code/experiments/bases") },
33916
34050
  { source: "defaults", data: { agent: "claude-code" } }
33917
34051
  ],
33918
34052
  { fs: fs19 }
@@ -33994,7 +34128,7 @@ async function runExperimentLoop(options) {
33994
34128
  experimentIndex,
33995
34129
  baseline,
33996
34130
  docPath: options.docPath,
33997
- docName: path44.basename(absoluteDocPath, path44.extname(absoluteDocPath))
34131
+ docName: path45.basename(absoluteDocPath, path45.extname(absoluteDocPath))
33998
34132
  });
33999
34133
  const currentSpecifier = agents[(experimentIndex - 1) % agents.length];
34000
34134
  const model = currentSpecifier.model;
@@ -34227,7 +34361,7 @@ var init_frontmatter3 = __esm({
34227
34361
  });
34228
34362
 
34229
34363
  // packages/ralph/src/discovery/discovery.ts
34230
- import path45 from "node:path";
34364
+ import path46 from "node:path";
34231
34365
  import * as fsPromises12 from "node:fs/promises";
34232
34366
  function createDefaultFs8() {
34233
34367
  return {
@@ -34263,12 +34397,12 @@ async function scanDir2(fs19, absoluteDir, displayDir) {
34263
34397
  if (!isMarkdownFile3(entry)) {
34264
34398
  continue;
34265
34399
  }
34266
- const absolutePath = path45.join(absoluteDir, entry);
34400
+ const absolutePath = path46.join(absoluteDir, entry);
34267
34401
  const stat24 = await fs19.stat(absolutePath);
34268
34402
  if (!stat24.isFile()) {
34269
34403
  continue;
34270
34404
  }
34271
- const displayPath2 = path45.join(displayDir, entry);
34405
+ const displayPath2 = path46.join(displayDir, entry);
34272
34406
  docs.push({
34273
34407
  path: displayPath2,
34274
34408
  displayPath: displayPath2
@@ -34277,18 +34411,18 @@ async function scanDir2(fs19, absoluteDir, displayDir) {
34277
34411
  return docs;
34278
34412
  }
34279
34413
  function toDisplayPath2(options) {
34280
- const localDir = path45.join(options.cwd, ".poe-code", "ralph", "plans");
34281
- const globalDir = path45.join(options.homeDir, ".poe-code", "ralph", "plans");
34282
- if (options.absolutePath.startsWith(`${localDir}${path45.sep}`)) {
34283
- return path45.join(
34414
+ const localDir = path46.join(options.cwd, ".poe-code", "ralph", "plans");
34415
+ const globalDir = path46.join(options.homeDir, ".poe-code", "ralph", "plans");
34416
+ if (options.absolutePath.startsWith(`${localDir}${path46.sep}`)) {
34417
+ return path46.join(
34284
34418
  ".poe-code/ralph/plans",
34285
- path45.relative(localDir, options.absolutePath)
34419
+ path46.relative(localDir, options.absolutePath)
34286
34420
  );
34287
34421
  }
34288
- if (options.absolutePath.startsWith(`${globalDir}${path45.sep}`)) {
34289
- return path45.join(
34422
+ if (options.absolutePath.startsWith(`${globalDir}${path46.sep}`)) {
34423
+ return path46.join(
34290
34424
  "~/.poe-code/ralph/plans",
34291
- path45.relative(globalDir, options.absolutePath)
34425
+ path46.relative(globalDir, options.absolutePath)
34292
34426
  );
34293
34427
  }
34294
34428
  return options.absolutePath;
@@ -34321,8 +34455,8 @@ async function discoverDocs(options) {
34321
34455
  const customDir = options.planDirectory?.trim();
34322
34456
  const docs = customDir ? await scanCustomDir2(fs19, customDir, options.cwd, options.homeDir) : await scanDefaultDirs2(fs19, options.cwd, options.homeDir);
34323
34457
  return docs.sort((left, right) => {
34324
- const leftName = path45.basename(left.displayPath).toLowerCase();
34325
- const rightName = path45.basename(right.displayPath).toLowerCase();
34458
+ const leftName = path46.basename(left.displayPath).toLowerCase();
34459
+ const rightName = path46.basename(right.displayPath).toLowerCase();
34326
34460
  return leftName === rightName ? left.displayPath.localeCompare(right.displayPath) : leftName.localeCompare(rightName);
34327
34461
  });
34328
34462
  }
@@ -34346,7 +34480,7 @@ var init_variables = __esm({
34346
34480
  });
34347
34481
 
34348
34482
  // packages/ralph/src/run/ralph.ts
34349
- import path46 from "node:path";
34483
+ import path47 from "node:path";
34350
34484
  import * as fsPromises13 from "node:fs/promises";
34351
34485
  async function runRalph(options) {
34352
34486
  const fs19 = options.fs ?? createDefaultFs9();
@@ -34550,11 +34684,11 @@ async function resolveDocumentConfigFromContent(options, fs19, absoluteDocPath,
34550
34684
  },
34551
34685
  {
34552
34686
  source: "base",
34553
- path: path46.join(options.cwd, ".poe-code/ralph/bases")
34687
+ path: path47.join(options.cwd, ".poe-code/ralph/bases")
34554
34688
  },
34555
34689
  {
34556
34690
  source: "base",
34557
- path: path46.join(options.homeDir, ".poe-code/ralph/bases")
34691
+ path: path47.join(options.homeDir, ".poe-code/ralph/bases")
34558
34692
  },
34559
34693
  {
34560
34694
  source: "defaults",
@@ -34694,9 +34828,9 @@ async function updateFrontmatter2(fs19, absoluteDocPath, state, iteration) {
34694
34828
  await fs19.writeFile(absoluteDocPath, content);
34695
34829
  }
34696
34830
  async function archivePlan2(fs19, absoluteDocPath) {
34697
- const dir = path46.dirname(absoluteDocPath);
34698
- const archiveDir = path46.join(dir, "archive");
34699
- const archivePath = path46.join(archiveDir, path46.basename(absoluteDocPath));
34831
+ const dir = path47.dirname(absoluteDocPath);
34832
+ const archiveDir = path47.join(dir, "archive");
34833
+ const archivePath = path47.join(archiveDir, path47.basename(absoluteDocPath));
34700
34834
  await fs19.mkdir(archiveDir, { recursive: true });
34701
34835
  await fs19.rename(absoluteDocPath, archivePath);
34702
34836
  }
@@ -34731,7 +34865,7 @@ var init_src23 = __esm({
34731
34865
  });
34732
34866
 
34733
34867
  // packages/plan-browser/src/format.ts
34734
- import path47 from "node:path";
34868
+ import path48 from "node:path";
34735
34869
  import { parseDocument as parseDocument5 } from "yaml";
34736
34870
  function isPipelineTaskDone(task) {
34737
34871
  if (typeof task.status === "string") {
@@ -34902,9 +35036,9 @@ function formatPipelinePlanMarkdown(options) {
34902
35036
  return lines.join("\n").trimEnd();
34903
35037
  }
34904
35038
  function resolveExperimentJournalPath(absolutePath) {
34905
- return path47.join(
34906
- path47.dirname(absolutePath),
34907
- `${path47.basename(absolutePath, path47.extname(absolutePath))}.journal.jsonl`
35039
+ return path48.join(
35040
+ path48.dirname(absolutePath),
35041
+ `${path48.basename(absolutePath, path48.extname(absolutePath))}.journal.jsonl`
34908
35042
  );
34909
35043
  }
34910
35044
  async function readExperimentState(fs19, absolutePath) {
@@ -34934,7 +35068,7 @@ function resolveFormatFromPath(filePath) {
34934
35068
  }
34935
35069
  async function readPlanMetadata(options) {
34936
35070
  const content = await options.fs.readFile(options.absolutePath, "utf8");
34937
- const fallbackName = path47.basename(options.path);
35071
+ const fallbackName = path48.basename(options.path);
34938
35072
  if (options.kind === "pipeline") {
34939
35073
  return {
34940
35074
  title: fallbackName,
@@ -34995,7 +35129,7 @@ var init_format = __esm({
34995
35129
  });
34996
35130
 
34997
35131
  // packages/plan-browser/src/discovery.ts
34998
- import path48 from "node:path";
35132
+ import path49 from "node:path";
34999
35133
  import * as fsPromises14 from "node:fs/promises";
35000
35134
  function createDefaultFs10() {
35001
35135
  return {
@@ -35022,9 +35156,9 @@ function isNotFound5(error2) {
35022
35156
  }
35023
35157
  function resolveAbsoluteDirectory4(dir, cwd, homeDir) {
35024
35158
  if (dir.startsWith("~/")) {
35025
- return path48.join(homeDir, dir.slice(2));
35159
+ return path49.join(homeDir, dir.slice(2));
35026
35160
  }
35027
- return path48.isAbsolute(dir) ? dir : path48.resolve(cwd, dir);
35161
+ return path49.isAbsolute(dir) ? dir : path49.resolve(cwd, dir);
35028
35162
  }
35029
35163
  function isMarkdownFile4(name) {
35030
35164
  return name.toLowerCase().endsWith(".md");
@@ -35101,12 +35235,12 @@ async function discoverSharedPlans(options) {
35101
35235
  if (!isMarkdownFile4(name)) {
35102
35236
  continue;
35103
35237
  }
35104
- const absolutePath = path48.join(absoluteDir, name);
35238
+ const absolutePath = path49.join(absoluteDir, name);
35105
35239
  const stat24 = await options.fs.stat(absolutePath);
35106
35240
  if (!stat24.isFile()) {
35107
35241
  continue;
35108
35242
  }
35109
- const displayPath2 = path48.join(displayDir, name);
35243
+ const displayPath2 = path49.join(displayDir, name);
35110
35244
  const content = await options.fs.readFile(absolutePath, "utf8");
35111
35245
  const kind = classifyPlanKind(content, displayPath2);
35112
35246
  if (options.kind && kind !== options.kind) {
@@ -35151,7 +35285,7 @@ var init_discovery4 = __esm({
35151
35285
  });
35152
35286
 
35153
35287
  // packages/plan-browser/src/actions.ts
35154
- import path49 from "node:path";
35288
+ import path50 from "node:path";
35155
35289
  import { spawnSync as nodeSpawnSync2 } from "node:child_process";
35156
35290
  function resolveEditor2(env = process.env) {
35157
35291
  const editor = env.EDITOR?.trim() || env.VISUAL?.trim() || "vi";
@@ -35163,8 +35297,8 @@ function editPlan2(absolutePath, options = {}) {
35163
35297
  spawnSync3(editor, [absolutePath], { stdio: "inherit" });
35164
35298
  }
35165
35299
  async function archivePlan3(entry, fs19) {
35166
- const archiveDir = path49.join(path49.dirname(entry.absolutePath), "archive");
35167
- const archivedPath = path49.join(archiveDir, path49.basename(entry.absolutePath));
35300
+ const archiveDir = path50.join(path50.dirname(entry.absolutePath), "archive");
35301
+ const archivedPath = path50.join(archiveDir, path50.basename(entry.absolutePath));
35168
35302
  await fs19.mkdir(archiveDir, { recursive: true });
35169
35303
  await fs19.rename(entry.absolutePath, archivedPath);
35170
35304
  return archivedPath;
@@ -35179,7 +35313,7 @@ var init_actions = __esm({
35179
35313
  });
35180
35314
 
35181
35315
  // packages/plan-browser/src/browser.ts
35182
- import path50 from "node:path";
35316
+ import path51 from "node:path";
35183
35317
  async function runPlanBrowser(options) {
35184
35318
  const renderPlanPreview = async (entry) => {
35185
35319
  const markdown = await loadPlanPreviewMarkdown(entry, options.fs);
@@ -35208,7 +35342,7 @@ async function runPlanBrowser(options) {
35208
35342
  const selectedPath = await select2({
35209
35343
  message: "Select a plan",
35210
35344
  options: plans.map((plan) => ({
35211
- label: text.selectLabel(path50.basename(plan.path), plan.detail),
35345
+ label: text.selectLabel(path51.basename(plan.path), plan.detail),
35212
35346
  hint: plan.typeLabel,
35213
35347
  value: plan.absolutePath
35214
35348
  }))
@@ -35244,7 +35378,7 @@ async function runPlanBrowser(options) {
35244
35378
  if (action === "archive") {
35245
35379
  try {
35246
35380
  const confirmed = options.assumeYes || await confirmOrCancel({
35247
- message: `Archive ${path50.basename(selectedPlan.path)}?`,
35381
+ message: `Archive ${path51.basename(selectedPlan.path)}?`,
35248
35382
  initialValue: true
35249
35383
  });
35250
35384
  if (confirmed) {
@@ -35259,7 +35393,7 @@ async function runPlanBrowser(options) {
35259
35393
  }
35260
35394
  try {
35261
35395
  const confirmed = options.assumeYes || await confirmOrCancel({
35262
- message: `Permanently delete ${path50.basename(selectedPlan.path)}?`,
35396
+ message: `Permanently delete ${path51.basename(selectedPlan.path)}?`,
35263
35397
  initialValue: true
35264
35398
  });
35265
35399
  if (confirmed) {
@@ -35404,7 +35538,7 @@ var init_scan = __esm({
35404
35538
 
35405
35539
  // packages/markdown-reader/src/core/document.ts
35406
35540
  import nodeFs2 from "node:fs/promises";
35407
- import path51 from "node:path";
35541
+ import path52 from "node:path";
35408
35542
  import { parseDocument as parseDocument6 } from "yaml";
35409
35543
  async function loadMarkdownDocument(file, dependencies = {}) {
35410
35544
  const resolvedFile = resolveMarkdownPath(file, dependencies.cwd);
@@ -35419,7 +35553,7 @@ async function loadMarkdownDocument(file, dependencies = {}) {
35419
35553
  };
35420
35554
  }
35421
35555
  function resolveMarkdownPath(file, cwd = process.cwd()) {
35422
- return path51.isAbsolute(file) ? file : path51.resolve(cwd, file);
35556
+ return path52.isAbsolute(file) ? file : path52.resolve(cwd, file);
35423
35557
  }
35424
35558
  function sliceMarkdownBytes(source, start, end) {
35425
35559
  return Buffer.from(source, "utf8").subarray(start, end).toString("utf8");
@@ -36594,7 +36728,7 @@ var init_state = __esm({
36594
36728
  });
36595
36729
 
36596
36730
  // packages/task-list/src/backends/utils.ts
36597
- import path52 from "node:path";
36731
+ import path53 from "node:path";
36598
36732
  function hasErrorCode2(error2, code) {
36599
36733
  return !!error2 && typeof error2 === "object" && "code" in error2 && error2.code === code;
36600
36734
  }
@@ -36626,7 +36760,7 @@ async function statIfExists(fs19, filePath) {
36626
36760
  async function writeAtomically(fs19, filePath, content) {
36627
36761
  const tempPath = `${filePath}.tmp-${process.pid}-${tmpFileCounter}`;
36628
36762
  tmpFileCounter += 1;
36629
- await fs19.mkdir(path52.dirname(filePath), { recursive: true });
36763
+ await fs19.mkdir(path53.dirname(filePath), { recursive: true });
36630
36764
  try {
36631
36765
  await fs19.writeFile(tempPath, content, { encoding: "utf8", flag: "wx" });
36632
36766
  await fs19.rename(tempPath, filePath);
@@ -36650,7 +36784,7 @@ var init_utils3 = __esm({
36650
36784
  });
36651
36785
 
36652
36786
  // packages/task-list/src/backends/markdown-dir.ts
36653
- import path53 from "node:path";
36787
+ import path54 from "node:path";
36654
36788
  import { parseDocument as parseDocument7, stringify as stringify3 } from "yaml";
36655
36789
  function validateListName(name) {
36656
36790
  if (name.length === 0 || name === ARCHIVE_DIRECTORY_NAME || name.startsWith(".") || name.includes("/") || name.includes("\\") || name.includes("..")) {
@@ -36669,16 +36803,16 @@ function parseQualifiedId(qualifiedId) {
36669
36803
  };
36670
36804
  }
36671
36805
  function listPath(rootPath, list) {
36672
- return path53.join(rootPath, list);
36806
+ return path54.join(rootPath, list);
36673
36807
  }
36674
36808
  function archiveDirectoryPath(rootPath, list) {
36675
- return path53.join(listPath(rootPath, list), ARCHIVE_DIRECTORY_NAME);
36809
+ return path54.join(listPath(rootPath, list), ARCHIVE_DIRECTORY_NAME);
36676
36810
  }
36677
36811
  function activeTaskPath(rootPath, list, id) {
36678
- return path53.join(listPath(rootPath, list), `${id}${MARKDOWN_EXTENSION}`);
36812
+ return path54.join(listPath(rootPath, list), `${id}${MARKDOWN_EXTENSION}`);
36679
36813
  }
36680
36814
  function archivedTaskPath(rootPath, list, id) {
36681
- return path53.join(archiveDirectoryPath(rootPath, list), `${id}${MARKDOWN_EXTENSION}`);
36815
+ return path54.join(archiveDirectoryPath(rootPath, list), `${id}${MARKDOWN_EXTENSION}`);
36682
36816
  }
36683
36817
  function isMarkdownFile5(entryName) {
36684
36818
  return entryName.endsWith(MARKDOWN_EXTENSION);
@@ -36910,7 +37044,7 @@ function createTasksView(deps, list) {
36910
37044
  if (isHiddenEntry(entryName) || isLockFile(entryName) || !isMarkdownFile5(entryName)) {
36911
37045
  continue;
36912
37046
  }
36913
- const entryPath = path53.join(directoryPath, entryName);
37047
+ const entryPath = path54.join(directoryPath, entryName);
36914
37048
  const entryStat = await statIfExists(deps.fs, entryPath);
36915
37049
  if (!entryStat?.isFile()) {
36916
37050
  continue;
@@ -37065,7 +37199,7 @@ async function markdownDirBackend(deps) {
37065
37199
  if (entryName === ARCHIVE_DIRECTORY_NAME || isHiddenEntry(entryName) || isLockFile(entryName)) {
37066
37200
  continue;
37067
37201
  }
37068
- const entryPath = path53.join(deps.path, entryName);
37202
+ const entryPath = path54.join(deps.path, entryName);
37069
37203
  const entryStat = await statIfExists(deps.fs, entryPath);
37070
37204
  if (entryStat?.isDirectory()) {
37071
37205
  result.push(entryName);
@@ -38072,7 +38206,7 @@ var init_gate = __esm({
38072
38206
  });
38073
38207
 
38074
38208
  // packages/toolcraft/src/human-in-loop/runner.ts
38075
- import { access, readFile as readFile14, writeFile as writeFile10 } from "node:fs/promises";
38209
+ import { access, readFile as readFile15, writeFile as writeFile10 } from "node:fs/promises";
38076
38210
  async function runApproval(approvalId, runtimeOptions, root) {
38077
38211
  const { tasks } = await ensureApprovalList(runtimeOptions);
38078
38212
  const task = await tasks.get(approvalId);
@@ -38192,13 +38326,13 @@ function createHandlerContext(command, params) {
38192
38326
  }
38193
38327
  function createFs() {
38194
38328
  return {
38195
- readFile: async (path93, encoding = "utf8") => readFile14(path93, { encoding }),
38196
- writeFile: async (path93, contents) => {
38197
- await writeFile10(path93, contents);
38329
+ readFile: async (path94, encoding = "utf8") => readFile15(path94, { encoding }),
38330
+ writeFile: async (path94, contents) => {
38331
+ await writeFile10(path94, contents);
38198
38332
  },
38199
- exists: async (path93) => {
38333
+ exists: async (path94) => {
38200
38334
  try {
38201
- await access(path93);
38335
+ await access(path94);
38202
38336
  return true;
38203
38337
  } catch {
38204
38338
  return false;
@@ -38804,9 +38938,9 @@ function mergeJsonSchemas(base, overlay) {
38804
38938
  ...mergedRequired === void 0 ? {} : { required: mergedRequired }
38805
38939
  };
38806
38940
  }
38807
- function hasSelfReferencingRef(schema, root, path93 = "#", activePaths = /* @__PURE__ */ new Set()) {
38941
+ function hasSelfReferencingRef(schema, root, path94 = "#", activePaths = /* @__PURE__ */ new Set()) {
38808
38942
  const nextActivePaths = new Set(activePaths);
38809
- nextActivePaths.add(path93);
38943
+ nextActivePaths.add(path94);
38810
38944
  const localRefPath = getLocalRefPath(schema.$ref);
38811
38945
  if (localRefPath !== void 0) {
38812
38946
  if (nextActivePaths.has(localRefPath)) {
@@ -38817,13 +38951,13 @@ function hasSelfReferencingRef(schema, root, path93 = "#", activePaths = /* @__P
38817
38951
  return true;
38818
38952
  }
38819
38953
  }
38820
- if (schema.items !== void 0 && hasSelfReferencingRef(schema.items, root, `${path93}/items`, nextActivePaths)) {
38954
+ if (schema.items !== void 0 && hasSelfReferencingRef(schema.items, root, `${path94}/items`, nextActivePaths)) {
38821
38955
  return true;
38822
38956
  }
38823
38957
  if (typeof schema.additionalProperties === "object" && schema.additionalProperties !== null && hasSelfReferencingRef(
38824
38958
  schema.additionalProperties,
38825
38959
  root,
38826
- `${path93}/additionalProperties`,
38960
+ `${path94}/additionalProperties`,
38827
38961
  nextActivePaths
38828
38962
  )) {
38829
38963
  return true;
@@ -38832,7 +38966,7 @@ function hasSelfReferencingRef(schema, root, path93 = "#", activePaths = /* @__P
38832
38966
  if (hasSelfReferencingRef(
38833
38967
  childSchema,
38834
38968
  root,
38835
- `${path93}/properties/${escapeJsonPointerSegment(key2)}`,
38969
+ `${path94}/properties/${escapeJsonPointerSegment(key2)}`,
38836
38970
  nextActivePaths
38837
38971
  )) {
38838
38972
  return true;
@@ -38842,19 +38976,19 @@ function hasSelfReferencingRef(schema, root, path93 = "#", activePaths = /* @__P
38842
38976
  if (hasSelfReferencingRef(
38843
38977
  childSchema,
38844
38978
  root,
38845
- `${path93}/$defs/${escapeJsonPointerSegment(key2)}`,
38979
+ `${path94}/$defs/${escapeJsonPointerSegment(key2)}`,
38846
38980
  nextActivePaths
38847
38981
  )) {
38848
38982
  return true;
38849
38983
  }
38850
38984
  }
38851
38985
  for (const [index, childSchema] of (schema.oneOf ?? []).entries()) {
38852
- if (hasSelfReferencingRef(childSchema, root, `${path93}/oneOf/${index}`, nextActivePaths)) {
38986
+ if (hasSelfReferencingRef(childSchema, root, `${path94}/oneOf/${index}`, nextActivePaths)) {
38853
38987
  return true;
38854
38988
  }
38855
38989
  }
38856
38990
  for (const [index, childSchema] of (schema.anyOf ?? []).entries()) {
38857
- if (hasSelfReferencingRef(childSchema, root, `${path93}/anyOf/${index}`, nextActivePaths)) {
38991
+ if (hasSelfReferencingRef(childSchema, root, `${path94}/anyOf/${index}`, nextActivePaths)) {
38858
38992
  return true;
38859
38993
  }
38860
38994
  }
@@ -38870,14 +39004,14 @@ function getLocalRefPath(ref) {
38870
39004
  return ref.startsWith("#/") ? ref : void 0;
38871
39005
  }
38872
39006
  function resolveLocalRef(root, ref) {
38873
- const path93 = getLocalRefPath(ref);
38874
- if (path93 === void 0) {
39007
+ const path94 = getLocalRefPath(ref);
39008
+ if (path94 === void 0) {
38875
39009
  return void 0;
38876
39010
  }
38877
- if (path93 === "#") {
39011
+ if (path94 === "#") {
38878
39012
  return root;
38879
39013
  }
38880
- const segments = path93.slice(2).split("/").map(unescapeJsonPointerSegment);
39014
+ const segments = path94.slice(2).split("/").map(unescapeJsonPointerSegment);
38881
39015
  let current = root;
38882
39016
  for (const segment of segments) {
38883
39017
  if (Array.isArray(current)) {
@@ -38971,9 +39105,9 @@ var init_json_schema_converter = __esm({
38971
39105
  });
38972
39106
 
38973
39107
  // packages/toolcraft/src/mcp-proxy.ts
38974
- import { existsSync } from "node:fs";
38975
- import { mkdir as mkdir13, readFile as readFile15, rename as rename7, unlink as unlink11, writeFile as writeFile11 } from "node:fs/promises";
38976
- import path54 from "node:path";
39108
+ import { existsSync as existsSync2 } from "node:fs";
39109
+ import { mkdir as mkdir13, readFile as readFile16, rename as rename7, unlink as unlink11, writeFile as writeFile11 } from "node:fs/promises";
39110
+ import path55 from "node:path";
38977
39111
  function getInternalGroupConfig2(group) {
38978
39112
  const symbol = Object.getOwnPropertySymbols(group).find(
38979
39113
  (candidate) => candidate.description === GROUP_CONFIG_SYMBOL_DESCRIPTION
@@ -39115,7 +39249,7 @@ async function ensureConnected(connection) {
39115
39249
  }
39116
39250
  async function readCache(cachePath) {
39117
39251
  try {
39118
- const raw = await readFile15(cachePath, "utf8");
39252
+ const raw = await readFile16(cachePath, "utf8");
39119
39253
  const parsed = JSON.parse(raw);
39120
39254
  if (parsed === null || typeof parsed !== "object" || !Array.isArray(parsed.tools) || parsed.upstream === void 0 || typeof parsed.upstream.name !== "string" || typeof parsed.upstream.version !== "string") {
39121
39255
  return void 0;
@@ -39136,7 +39270,7 @@ async function readCache(cachePath) {
39136
39270
  }
39137
39271
  }
39138
39272
  async function writeCache(cachePath, cache2) {
39139
- const directory = path54.dirname(cachePath);
39273
+ const directory = path55.dirname(cachePath);
39140
39274
  const tempPath = `${cachePath}.tmp`;
39141
39275
  await mkdir13(directory, { recursive: true });
39142
39276
  await writeFile11(tempPath, `${JSON.stringify(cache2, null, 2)}
@@ -39279,14 +39413,14 @@ function collectProxyGroups(root) {
39279
39413
  }
39280
39414
  function resolveCachePath(name, projectRoot) {
39281
39415
  if (projectRoot !== void 0) {
39282
- return path54.join(projectRoot, ".toolcraft", "mcp", `${name}.json`);
39416
+ return path55.join(projectRoot, ".toolcraft", "mcp", `${name}.json`);
39283
39417
  }
39284
39418
  let current = process.cwd();
39285
39419
  while (true) {
39286
- if (existsSync(path54.join(current, "package.json"))) {
39287
- return path54.join(current, ".toolcraft", "mcp", `${name}.json`);
39420
+ if (existsSync2(path55.join(current, "package.json"))) {
39421
+ return path55.join(current, ".toolcraft", "mcp", `${name}.json`);
39288
39422
  }
39289
- const parent = path54.dirname(current);
39423
+ const parent = path55.dirname(current);
39290
39424
  if (parent === current) {
39291
39425
  throw new Error(
39292
39426
  `Could not find package.json above "${process.cwd()}" while resolving MCP cache path.`
@@ -39404,7 +39538,7 @@ var init_schema_scope = __esm({
39404
39538
  });
39405
39539
 
39406
39540
  // packages/toolcraft/src/mcp.ts
39407
- import { access as access2, readFile as readFile16, writeFile as writeFile12 } from "node:fs/promises";
39541
+ import { access as access2, readFile as readFile17, writeFile as writeFile12 } from "node:fs/promises";
39408
39542
  function normalizeRoots(roots) {
39409
39543
  if (!Array.isArray(roots)) {
39410
39544
  return roots;
@@ -39472,13 +39606,13 @@ function isPlainObject4(value) {
39472
39606
  }
39473
39607
  function createFs2() {
39474
39608
  return {
39475
- readFile: async (path93, encoding = "utf8") => readFile16(path93, { encoding }),
39476
- writeFile: async (path93, contents) => {
39477
- await writeFile12(path93, contents);
39609
+ readFile: async (path94, encoding = "utf8") => readFile17(path94, { encoding }),
39610
+ writeFile: async (path94, contents) => {
39611
+ await writeFile12(path94, contents);
39478
39612
  },
39479
- exists: async (path93) => {
39613
+ exists: async (path94) => {
39480
39614
  try {
39481
- await access2(path93);
39615
+ await access2(path94);
39482
39616
  return true;
39483
39617
  } catch {
39484
39618
  return false;
@@ -39523,11 +39657,11 @@ function applySchemaCasing(schema, casing) {
39523
39657
  ...required === void 0 ? {} : { required }
39524
39658
  };
39525
39659
  }
39526
- function collectParamSummaries(schema, casing, path93 = [], inheritedOptional = false) {
39660
+ function collectParamSummaries(schema, casing, path94 = [], inheritedOptional = false) {
39527
39661
  const summaries = [];
39528
39662
  for (const [key2, rawChildSchema] of Object.entries(schema.shape)) {
39529
39663
  const childSchema = unwrapOptional2(rawChildSchema);
39530
- const nextPath = [...path93, formatSegment(key2, casing)];
39664
+ const nextPath = [...path94, formatSegment(key2, casing)];
39531
39665
  const optional = inheritedOptional || isOptional(rawChildSchema);
39532
39666
  if (childSchema.kind === "object") {
39533
39667
  summaries.push(...collectParamSummaries(childSchema, casing, nextPath, optional));
@@ -39556,8 +39690,8 @@ function matchesAllowlist(toolName, allowlist) {
39556
39690
  const candidates = segments.map((_segment, index) => segments.slice(0, index + 1).join("__"));
39557
39691
  return candidates.some((candidate) => allowlist.includes(candidate));
39558
39692
  }
39559
- function formatToolName(path93) {
39560
- return path93.map((segment) => formatSegment(segment, "snake")).join("__");
39693
+ function formatToolName(path94) {
39694
+ return path94.map((segment) => formatSegment(segment, "snake")).join("__");
39561
39695
  }
39562
39696
  function enumerateTools(root, casing, allowlist) {
39563
39697
  const tools = [];
@@ -39759,7 +39893,8 @@ function createResolvedMCPServer(root, options) {
39759
39893
  };
39760
39894
  validateServices(services);
39761
39895
  const tools = enumerateTools(root, casing, options.tools);
39762
- const server = createServer({ name: options.name, version: options.version });
39896
+ const version = resolveMCPVersion(options.version);
39897
+ const server = createServer({ name: options.name, version });
39763
39898
  for (const tool of tools) {
39764
39899
  server.tool(
39765
39900
  tool.name,
@@ -39809,6 +39944,13 @@ function createResolvedMCPServer(root, options) {
39809
39944
  }
39810
39945
  };
39811
39946
  }
39947
+ function resolveMCPVersion(version) {
39948
+ const resolvedVersion = version ?? findEntrypointPackageMetadata(process.argv[1])?.version;
39949
+ if (resolvedVersion === void 0) {
39950
+ throw new Error("MCP version is required when no package.json version can be inferred from the entrypoint.");
39951
+ }
39952
+ return resolvedVersion;
39953
+ }
39812
39954
  async function runMCP(roots, options) {
39813
39955
  const root = mergeApprovalsGroup(normalizeRoots(roots));
39814
39956
  await resolveMcpProxies(root);
@@ -39826,6 +39968,7 @@ var init_mcp2 = __esm({
39826
39968
  init_human_in_loop();
39827
39969
  init_mcp_proxy();
39828
39970
  init_number_schema();
39971
+ init_package_metadata();
39829
39972
  init_schema_scope();
39830
39973
  RESERVED_SERVICE_NAMES = /* @__PURE__ */ new Set(["params", "secrets", "fetch", "fs", "env", "progress"]);
39831
39974
  }
@@ -39901,7 +40044,7 @@ var init_SKILL_plan = __esm({
39901
40044
  });
39902
40045
 
39903
40046
  // src/cli/commands/plan.ts
39904
- import path55 from "node:path";
40047
+ import path56 from "node:path";
39905
40048
  import { stringify as stringifyYaml2 } from "yaml";
39906
40049
  function buildPlanPrompt(options) {
39907
40050
  const trimmedQuestion = options.question.trim();
@@ -40053,7 +40196,7 @@ async function discoverPlans(container, kind) {
40053
40196
  async function resolveSelectedPlan(options) {
40054
40197
  const providedPath = options.providedPath?.trim();
40055
40198
  if (providedPath) {
40056
- const resolvedAbsolute = providedPath.startsWith("~/") ? path55.join(options.container.env.homeDir, providedPath.slice(2)) : path55.isAbsolute(providedPath) ? providedPath : path55.resolve(options.container.env.cwd, providedPath);
40199
+ const resolvedAbsolute = providedPath.startsWith("~/") ? path56.join(options.container.env.homeDir, providedPath.slice(2)) : path56.isAbsolute(providedPath) ? providedPath : path56.resolve(options.container.env.cwd, providedPath);
40057
40200
  const matched2 = options.plans.find(
40058
40201
  (plan) => plan.path === providedPath || plan.absolutePath === providedPath || plan.absolutePath === resolvedAbsolute
40059
40202
  );
@@ -40071,7 +40214,7 @@ async function resolveSelectedPlan(options) {
40071
40214
  const selected = await select2({
40072
40215
  message: options.promptMessage,
40073
40216
  options: options.plans.map((plan) => ({
40074
- label: text.selectLabel(path55.basename(plan.path), plan.detail),
40217
+ label: text.selectLabel(path56.basename(plan.path), plan.detail),
40075
40218
  hint: plan.typeLabel,
40076
40219
  value: plan.absolutePath
40077
40220
  }))
@@ -40109,7 +40252,7 @@ async function renderPlanList(container, options) {
40109
40252
  kind: plan.kind,
40110
40253
  type: plan.typeLabel,
40111
40254
  runner: plan.runner,
40112
- name: path55.basename(plan.path),
40255
+ name: path56.basename(plan.path),
40113
40256
  path: plan.path,
40114
40257
  detail: plan.detail,
40115
40258
  updated: formatDate(plan.updatedAt)
@@ -40134,7 +40277,7 @@ async function renderPlanList(container, options) {
40134
40277
  rows: plans.map((plan) => ({
40135
40278
  kind: plan.kind,
40136
40279
  type: plan.typeLabel,
40137
- name: path55.basename(plan.path),
40280
+ name: path56.basename(plan.path),
40138
40281
  detail: plan.detail,
40139
40282
  updated: formatDate(plan.updatedAt)
40140
40283
  }))
@@ -40168,7 +40311,7 @@ async function executePlanAction(options) {
40168
40311
  }
40169
40312
  if (!flags.assumeYes) {
40170
40313
  const confirmed = await confirmOrCancel({
40171
- message: options.action === "archive" ? `Archive ${path55.basename(plan.path)}?` : `Permanently delete ${path55.basename(plan.path)}?`,
40314
+ message: options.action === "archive" ? `Archive ${path56.basename(plan.path)}?` : `Permanently delete ${path56.basename(plan.path)}?`,
40172
40315
  initialValue: true
40173
40316
  });
40174
40317
  if (!confirmed) {
@@ -40518,7 +40661,7 @@ var init_plan = __esm({
40518
40661
  });
40519
40662
 
40520
40663
  // src/cli/commands/pipeline-init.ts
40521
- import path56 from "node:path";
40664
+ import path57 from "node:path";
40522
40665
  import { parse as parseYaml4 } from "yaml";
40523
40666
  function buildPipelineInitPrompt(options) {
40524
40667
  const trimmedQuestion = options.question?.trim() ?? "";
@@ -40605,8 +40748,8 @@ async function discoverMarkdownFiles(fs19, absoluteDirectory, parentRelativePath
40605
40748
  }
40606
40749
  const markdownFiles = [];
40607
40750
  for (const entry of [...entries].sort((left, right) => left.localeCompare(right))) {
40608
- const absolutePath = path56.join(absoluteDirectory, entry);
40609
- const relativePath = parentRelativePath.length > 0 ? path56.join(parentRelativePath, entry) : entry;
40751
+ const absolutePath = path57.join(absoluteDirectory, entry);
40752
+ const relativePath = parentRelativePath.length > 0 ? path57.join(parentRelativePath, entry) : entry;
40610
40753
  const stat24 = await fs19.stat(absolutePath);
40611
40754
  if (stat24.isDirectory()) {
40612
40755
  if (entry === "archive") {
@@ -40636,7 +40779,7 @@ function extractTitle2(filePath, content) {
40636
40779
  return title;
40637
40780
  }
40638
40781
  }
40639
- return path56.basename(filePath, path56.extname(filePath));
40782
+ return path57.basename(filePath, path57.extname(filePath));
40640
40783
  }
40641
40784
  function createMarkdownFence(content) {
40642
40785
  return "`".repeat(Math.max(3, longestBacktickRun(content) + 1));
@@ -40681,7 +40824,7 @@ var init_SKILL_plan2 = __esm({
40681
40824
 
40682
40825
  // src/sdk/pipeline.ts
40683
40826
  import * as fsPromises16 from "node:fs/promises";
40684
- import path57 from "node:path";
40827
+ import path58 from "node:path";
40685
40828
  import { parse as parseYaml5 } from "yaml";
40686
40829
  function isActivityTimeoutError2(error2) {
40687
40830
  return error2 instanceof Error && error2.name === "ActivityTimeoutError";
@@ -40727,7 +40870,7 @@ async function runPipeline2(options) {
40727
40870
  });
40728
40871
  });
40729
40872
  if (options.plan) {
40730
- const planAbsolutePath = path57.resolve(options.cwd, options.plan);
40873
+ const planAbsolutePath = path58.resolve(options.cwd, options.plan);
40731
40874
  if (await planNeedsInit(planAbsolutePath)) {
40732
40875
  const sourceDocContent = await fsPromises16.readFile(planAbsolutePath, "utf8");
40733
40876
  const prompt = buildPipelineInitPrompt({
@@ -40845,7 +40988,7 @@ var init_pipeline2 = __esm({
40845
40988
  });
40846
40989
 
40847
40990
  // packages/process-launcher/src/state/state-store.ts
40848
- import path58 from "node:path";
40991
+ import path59 from "node:path";
40849
40992
  import * as nodeFs3 from "node:fs/promises";
40850
40993
  function isNotFoundError2(error2) {
40851
40994
  return error2 instanceof Error && "code" in error2 && error2.code === "ENOENT";
@@ -40861,7 +41004,7 @@ async function removeDirectory2(fs19, directoryPath) {
40861
41004
  throw error2;
40862
41005
  }
40863
41006
  for (const entry of entries) {
40864
- const entryPath = path58.join(directoryPath, entry);
41007
+ const entryPath = path59.join(directoryPath, entry);
40865
41008
  const stat24 = await fs19.stat(entryPath);
40866
41009
  if (stat24.isFile()) {
40867
41010
  await fs19.rm(entryPath, { force: true });
@@ -40878,7 +41021,7 @@ async function removeDirectory2(fs19, directoryPath) {
40878
41021
  }
40879
41022
  function createStateStore(stateDir, fs19 = nodeFs3) {
40880
41023
  async function read(id) {
40881
- const statePath = path58.join(stateDir, id, "state.json");
41024
+ const statePath = path59.join(stateDir, id, "state.json");
40882
41025
  try {
40883
41026
  const content = await fs19.readFile(statePath, "utf8");
40884
41027
  return JSON.parse(content);
@@ -40890,9 +41033,9 @@ function createStateStore(stateDir, fs19 = nodeFs3) {
40890
41033
  }
40891
41034
  }
40892
41035
  async function write2(id, state) {
40893
- const processDir = path58.join(stateDir, id);
41036
+ const processDir = path59.join(stateDir, id);
40894
41037
  await fs19.mkdir(processDir, { recursive: true });
40895
- await fs19.writeFile(path58.join(processDir, "state.json"), `${JSON.stringify(state, null, 2)}
41038
+ await fs19.writeFile(path59.join(processDir, "state.json"), `${JSON.stringify(state, null, 2)}
40896
41039
  `);
40897
41040
  }
40898
41041
  async function list() {
@@ -40907,7 +41050,7 @@ function createStateStore(stateDir, fs19 = nodeFs3) {
40907
41050
  }
40908
41051
  const states = [];
40909
41052
  for (const entry of [...entries].sort()) {
40910
- const entryPath = path58.join(stateDir, entry);
41053
+ const entryPath = path59.join(stateDir, entry);
40911
41054
  try {
40912
41055
  const stat24 = await fs19.stat(entryPath);
40913
41056
  if (stat24.isFile()) {
@@ -40927,7 +41070,7 @@ function createStateStore(stateDir, fs19 = nodeFs3) {
40927
41070
  return states;
40928
41071
  }
40929
41072
  async function remove2(id) {
40930
- await removeDirectory2(fs19, path58.join(stateDir, id));
41073
+ await removeDirectory2(fs19, path59.join(stateDir, id));
40931
41074
  }
40932
41075
  return { read, write: write2, list, remove: remove2 };
40933
41076
  }
@@ -40938,16 +41081,16 @@ var init_state_store = __esm({
40938
41081
  });
40939
41082
 
40940
41083
  // packages/process-launcher/src/logs/log-writer.ts
40941
- import path59 from "node:path";
41084
+ import path60 from "node:path";
40942
41085
  import * as nodeFs4 from "node:fs/promises";
40943
41086
  function isNotFoundError3(error2) {
40944
41087
  return error2 instanceof Error && "code" in error2 && error2.code === "ENOENT";
40945
41088
  }
40946
41089
  function getCurrentLogPath(logDir, stream) {
40947
- return path59.join(logDir, `${stream}.log`);
41090
+ return path60.join(logDir, `${stream}.log`);
40948
41091
  }
40949
41092
  function getRotatedLogPath(logDir, stream, index) {
40950
- return path59.join(logDir, `${stream}.${index}.log`);
41093
+ return path60.join(logDir, `${stream}.${index}.log`);
40951
41094
  }
40952
41095
  async function isFile(fs19, filePath) {
40953
41096
  try {
@@ -40994,7 +41137,7 @@ async function removeAllStreamLogs(fs19, logDir, stream) {
40994
41137
  if (getRotatedLogIndex(fileName, stream) === null) {
40995
41138
  continue;
40996
41139
  }
40997
- await fs19.rm(path59.join(logDir, fileName), { force: true });
41140
+ await fs19.rm(path60.join(logDir, fileName), { force: true });
40998
41141
  }
40999
41142
  } catch (error2) {
41000
41143
  if (isNotFoundError3(error2)) {
@@ -41254,7 +41397,7 @@ var init_engine = __esm({
41254
41397
  });
41255
41398
 
41256
41399
  // packages/process-runner/src/docker/args.ts
41257
- import path60 from "node:path";
41400
+ import path61 from "node:path";
41258
41401
  function buildDockerRunArgs(input) {
41259
41402
  const args = [input.engine];
41260
41403
  if (input.engine === "docker" && input.context) {
@@ -41281,7 +41424,7 @@ function buildDockerRunArgs(input) {
41281
41424
  args.push("-e", `${key2}=${value}`);
41282
41425
  }
41283
41426
  for (const mount of input.mounts) {
41284
- const volume = `${path60.resolve(mount.source)}:${mount.target}${mount.readonly ? ":ro" : ""}`;
41427
+ const volume = `${path61.resolve(mount.source)}:${mount.target}${mount.readonly ? ":ro" : ""}`;
41285
41428
  args.push("-v", volume);
41286
41429
  }
41287
41430
  for (const port of input.ports) {
@@ -41538,13 +41681,13 @@ var init_src29 = __esm({
41538
41681
  import { spawnSync } from "node:child_process";
41539
41682
  import * as nodeFs5 from "node:fs/promises";
41540
41683
  import os6 from "node:os";
41541
- import path61 from "node:path";
41684
+ import path62 from "node:path";
41542
41685
  function createSupervisor(options) {
41543
41686
  const { spec: spec10 } = options;
41544
41687
  const runner = resolveRunner(options);
41545
41688
  const stateStore = createStateStore(options.stateDir, options.fs);
41546
41689
  const logWriter = createLogWriter(
41547
- path61.join(options.stateDir, spec10.id, "logs"),
41690
+ path62.join(options.stateDir, spec10.id, "logs"),
41548
41691
  spec10.logRetainCount ?? 5,
41549
41692
  options.fs
41550
41693
  );
@@ -41912,8 +42055,8 @@ async function resolveProcessWorkspace(cwd, stateDir) {
41912
42055
  };
41913
42056
  }
41914
42057
  function resolveWorkspaceHomeDir(stateDir) {
41915
- if (path61.basename(stateDir) === "launch" && path61.basename(path61.dirname(stateDir)) === ".poe-code") {
41916
- return path61.dirname(path61.dirname(stateDir));
42058
+ if (path62.basename(stateDir) === "launch" && path62.basename(path62.dirname(stateDir)) === ".poe-code") {
42059
+ return path62.dirname(path62.dirname(stateDir));
41917
42060
  }
41918
42061
  return os6.homedir();
41919
42062
  }
@@ -41965,7 +42108,7 @@ var init_supervisor = __esm({
41965
42108
  });
41966
42109
 
41967
42110
  // packages/process-launcher/src/launcher.ts
41968
- import path62 from "node:path";
42111
+ import path63 from "node:path";
41969
42112
  import * as nodeFs6 from "node:fs/promises";
41970
42113
  async function startManagedProcess(options) {
41971
42114
  const fs19 = options.fs ?? defaultFs2();
@@ -42314,7 +42457,7 @@ async function listIds(fs19, baseDir) {
42314
42457
  const entries = await fs19.readdir(baseDir);
42315
42458
  const ids = [];
42316
42459
  for (const entry of entries) {
42317
- const entryPath = path62.join(baseDir, entry);
42460
+ const entryPath = path63.join(baseDir, entry);
42318
42461
  try {
42319
42462
  const stat24 = await fs19.stat(entryPath);
42320
42463
  if (!stat24.isFile()) {
@@ -42364,24 +42507,24 @@ async function readJsonFile(fs19, filePath) {
42364
42507
  }
42365
42508
  }
42366
42509
  async function writeJsonFile(fs19, filePath, value) {
42367
- await fs19.mkdir(path62.dirname(filePath), { recursive: true });
42510
+ await fs19.mkdir(path63.dirname(filePath), { recursive: true });
42368
42511
  await fs19.writeFile(filePath, `${JSON.stringify(value, null, 2)}
42369
42512
  `);
42370
42513
  }
42371
42514
  function resolveProcessDir(baseDir, id) {
42372
- return path62.join(baseDir, id);
42515
+ return path63.join(baseDir, id);
42373
42516
  }
42374
42517
  function resolveSpecPath(baseDir, id) {
42375
- return path62.join(resolveProcessDir(baseDir, id), "spec.json");
42518
+ return path63.join(resolveProcessDir(baseDir, id), "spec.json");
42376
42519
  }
42377
42520
  function resolveStatePath(baseDir, id) {
42378
- return path62.join(resolveProcessDir(baseDir, id), "state.json");
42521
+ return path63.join(resolveProcessDir(baseDir, id), "state.json");
42379
42522
  }
42380
42523
  function resolveMetaPath(baseDir, id) {
42381
- return path62.join(resolveProcessDir(baseDir, id), "meta.json");
42524
+ return path63.join(resolveProcessDir(baseDir, id), "meta.json");
42382
42525
  }
42383
42526
  function resolveLogDir2(baseDir, id) {
42384
- return path62.join(resolveProcessDir(baseDir, id), "logs");
42527
+ return path63.join(resolveProcessDir(baseDir, id), "logs");
42385
42528
  }
42386
42529
  function isNotFoundError4(error2) {
42387
42530
  return error2 instanceof Error && "code" in error2 && error2.code === "ENOENT";
@@ -42462,7 +42605,7 @@ var init_ralph2 = __esm({
42462
42605
 
42463
42606
  // src/sdk/experiment.ts
42464
42607
  import * as fsPromises17 from "node:fs/promises";
42465
- import path63 from "node:path";
42608
+ import path64 from "node:path";
42466
42609
  function createDefaultFs12() {
42467
42610
  return {
42468
42611
  readFile: fsPromises17.readFile,
@@ -42490,9 +42633,9 @@ function createDefaultFs12() {
42490
42633
  };
42491
42634
  }
42492
42635
  function resolveJournalPath2(docPath) {
42493
- return path63.join(
42494
- path63.dirname(docPath),
42495
- `${path63.basename(docPath, path63.extname(docPath))}.journal.jsonl`
42636
+ return path64.join(
42637
+ path64.dirname(docPath),
42638
+ `${path64.basename(docPath, path64.extname(docPath))}.journal.jsonl`
42496
42639
  );
42497
42640
  }
42498
42641
  async function runExperiment(options) {
@@ -42699,7 +42842,7 @@ var init_frontmatter4 = __esm({
42699
42842
  });
42700
42843
 
42701
42844
  // packages/github-workflows/src/discover.ts
42702
- import { readdir as readdir16, readFile as readFile19 } from "node:fs/promises";
42845
+ import { readdir as readdir16, readFile as readFile20 } from "node:fs/promises";
42703
42846
  import { join as join2 } from "node:path";
42704
42847
  async function discoverAutomations(builtInDir, ...projectDirs) {
42705
42848
  const directories = [builtInDir, ...projectDirs];
@@ -42743,7 +42886,7 @@ async function listMarkdownFiles(dir) {
42743
42886
  }
42744
42887
  async function readAutomation(dir, fileName, baseName, baseDirs) {
42745
42888
  const filePath = join2(dir, fileName);
42746
- const content = await readFile19(filePath, "utf8");
42889
+ const content = await readFile20(filePath, "utf8");
42747
42890
  const resolved = await resolve(
42748
42891
  [
42749
42892
  {
@@ -42764,7 +42907,7 @@ async function readAutomation(dir, fileName, baseName, baseDirs) {
42764
42907
  }
42765
42908
  ],
42766
42909
  {
42767
- fs: { readFile: readFile19 }
42910
+ fs: { readFile: readFile20 }
42768
42911
  }
42769
42912
  );
42770
42913
  const name = stripPrefix(fileName.slice(0, -3));
@@ -43052,8 +43195,8 @@ var init_setup_agent = __esm({
43052
43195
  });
43053
43196
 
43054
43197
  // packages/github-workflows/src/variables.ts
43055
- import path64 from "node:path";
43056
- import { readFile as readFile20 } from "node:fs/promises";
43198
+ import path65 from "node:path";
43199
+ import { readFile as readFile21 } from "node:fs/promises";
43057
43200
  import { isMap as isMap3, parseDocument as parseDocument9, stringify as stringify4 } from "yaml";
43058
43201
  function isRecord20(value) {
43059
43202
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -43144,7 +43287,7 @@ function extractUserOverrideBlocks(filePath, content) {
43144
43287
  }
43145
43288
  async function readOptionalVariablesContent(filePath) {
43146
43289
  try {
43147
- return await readFile20(filePath, "utf8");
43290
+ return await readFile21(filePath, "utf8");
43148
43291
  } catch (error2) {
43149
43292
  if (error2 instanceof Error && error2.code === "ENOENT") {
43150
43293
  return void 0;
@@ -43172,9 +43315,9 @@ function formatCommentedBlock(name, value) {
43172
43315
  return formatVariableBlock(name, value).split("\n").map((line) => `# ${line}`).join("\n");
43173
43316
  }
43174
43317
  async function loadVariableSources(builtInDir, projectDir) {
43175
- const builtInPath = path64.join(builtInDir, VARIABLES_FILE_NAME);
43176
- const builtInVariables = parseVariables(builtInPath, await readFile20(builtInPath, "utf8"));
43177
- const projectVariablesPath = projectDir === void 0 ? void 0 : path64.join(projectDir, VARIABLES_FILE_NAME);
43318
+ const builtInPath = path65.join(builtInDir, VARIABLES_FILE_NAME);
43319
+ const builtInVariables = parseVariables(builtInPath, await readFile21(builtInPath, "utf8"));
43320
+ const projectVariablesPath = projectDir === void 0 ? void 0 : path65.join(projectDir, VARIABLES_FILE_NAME);
43178
43321
  const projectVariablesContent = projectVariablesPath === void 0 ? void 0 : await readOptionalVariablesContent(projectVariablesPath);
43179
43322
  if (projectVariablesPath === void 0 || projectVariablesContent === void 0) {
43180
43323
  return { builtInVariables, extendsBuiltIns: true, projectVariables: {} };
@@ -43186,13 +43329,13 @@ async function loadVariableSources(builtInDir, projectDir) {
43186
43329
  return { builtInVariables, extendsBuiltIns, projectVariables };
43187
43330
  }
43188
43331
  async function loadVariables(builtInDir, projectDir) {
43189
- const builtInPath = path64.join(builtInDir, VARIABLES_FILE_NAME);
43190
- const builtInContent = await readFile20(builtInPath, "utf8");
43332
+ const builtInPath = path65.join(builtInDir, VARIABLES_FILE_NAME);
43333
+ const builtInContent = await readFile21(builtInPath, "utf8");
43191
43334
  const builtInVariables = parseVariables(builtInPath, builtInContent);
43192
43335
  if (projectDir === void 0) {
43193
43336
  return filterDisabledVariables(builtInVariables);
43194
43337
  }
43195
- const projectVariablesPath = path64.join(projectDir, VARIABLES_FILE_NAME);
43338
+ const projectVariablesPath = path65.join(projectDir, VARIABLES_FILE_NAME);
43196
43339
  const projectVariablesContent = await readOptionalVariablesContent(projectVariablesPath);
43197
43340
  if (projectVariablesContent === void 0) {
43198
43341
  return filterDisabledVariables(builtInVariables);
@@ -43211,7 +43354,7 @@ async function loadVariables(builtInDir, projectDir) {
43211
43354
  }
43212
43355
  ],
43213
43356
  {
43214
- fs: { readFile: readFile20 },
43357
+ fs: { readFile: readFile21 },
43215
43358
  autoExtend: true
43216
43359
  }
43217
43360
  );
@@ -43225,7 +43368,7 @@ async function loadVariableStatuses(builtInDir, projectDir) {
43225
43368
  (key2) => !extendsBuiltIns || !Object.prototype.hasOwnProperty.call(builtInVariables, key2)
43226
43369
  )
43227
43370
  ];
43228
- const projectVariablesPath = projectDir === void 0 ? void 0 : path64.join(projectDir, VARIABLES_FILE_NAME);
43371
+ const projectVariablesPath = projectDir === void 0 ? void 0 : path65.join(projectDir, VARIABLES_FILE_NAME);
43229
43372
  return orderedNames.map((name) => {
43230
43373
  if (!Object.prototype.hasOwnProperty.call(projectVariables, name)) {
43231
43374
  return {
@@ -43286,9 +43429,9 @@ var init_variables2 = __esm({
43286
43429
  });
43287
43430
 
43288
43431
  // packages/github-workflows/src/commands.ts
43289
- import { access as access3, mkdir as mkdir16, readFile as readFile21, unlink as unlink12, writeFile as writeFile14 } from "node:fs/promises";
43290
- import path65 from "node:path";
43291
- import { fileURLToPath as fileURLToPath7 } from "node:url";
43432
+ import { access as access3, mkdir as mkdir16, readFile as readFile22, unlink as unlink12, writeFile as writeFile14 } from "node:fs/promises";
43433
+ import path66 from "node:path";
43434
+ import { fileURLToPath as fileURLToPath8 } from "node:url";
43292
43435
  import Mustache3 from "mustache";
43293
43436
  function formatLabel(name) {
43294
43437
  const capitalize2 = (s) => s.charAt(0).toUpperCase() + s.slice(1);
@@ -43310,7 +43453,7 @@ async function loadNamedAutomation(name, cwd) {
43310
43453
  }
43311
43454
  async function readBuiltInPromptFile(name) {
43312
43455
  try {
43313
- return await readFile21(path65.join(await resolveBuiltInPromptsDir(), `${name}.md`), "utf8");
43456
+ return await readFile22(path66.join(await resolveBuiltInPromptsDir(), `${name}.md`), "utf8");
43314
43457
  } catch (error2) {
43315
43458
  if (isMissingPathError2(error2)) {
43316
43459
  throw new UserError(`Automation "${name}" was not found.`);
@@ -43319,11 +43462,11 @@ async function readBuiltInPromptFile(name) {
43319
43462
  }
43320
43463
  }
43321
43464
  async function readBuiltInWorkflowTemplate(name, variant, automationName = name, promptPath) {
43322
- const templatePath = path65.join(await resolveBuiltInWorkflowTemplatesDir(), `${name}.${variant}.yml`);
43465
+ const templatePath = path66.join(await resolveBuiltInWorkflowTemplatesDir(), `${name}.${variant}.yml`);
43323
43466
  try {
43324
- const content = await readFile21(templatePath, "utf8");
43467
+ const content = await readFile22(templatePath, "utf8");
43325
43468
  const header = promptPath !== void 0 ? `# Auto-generated by: poe-code github-workflows install ${name}
43326
- # Edit ${path65.relative(process.cwd(), promptPath)} to customize the prompt.
43469
+ # Edit ${path66.relative(process.cwd(), promptPath)} to customize the prompt.
43327
43470
  ` : `# Auto-generated by: poe-code github-workflows install ${name}
43328
43471
  `;
43329
43472
  const processedContent = content.replaceAll(` ${name}`, ` ${automationName}`).replaceAll("__UPSTREAM_REPO__", UPSTREAM_REPO);
@@ -43352,7 +43495,7 @@ function projectPromptDirs(cwd) {
43352
43495
  return [projectWorkflowDir(cwd)];
43353
43496
  }
43354
43497
  function projectWorkflowDir(cwd) {
43355
- return path65.join(cwd, ".github", "workflows");
43498
+ return path66.join(cwd, ".github", "workflows");
43356
43499
  }
43357
43500
  function projectGitHubWorkflowsDir(cwd) {
43358
43501
  return projectWorkflowDir(cwd);
@@ -43371,7 +43514,7 @@ async function resolveBuiltInPromptsDir() {
43371
43514
  return builtInPromptsDirCandidates[0];
43372
43515
  }
43373
43516
  async function resolveBuiltInAssetsDir() {
43374
- return path65.dirname(await resolveBuiltInPromptsDir());
43517
+ return path66.dirname(await resolveBuiltInPromptsDir());
43375
43518
  }
43376
43519
  function resolveCwd(cwd) {
43377
43520
  return cwd ?? process.cwd();
@@ -43525,16 +43668,16 @@ function addPromptHeader(content, name) {
43525
43668
  async function installAutomation(name, cwd, isEject) {
43526
43669
  const variant = isEject ? "ejected" : "caller";
43527
43670
  const localAutomationName = isEject ? `poe-code-${name}` : name;
43528
- const promptPath = isEject ? path65.join(projectWorkflowDir(cwd), `${localAutomationName}.md`) : void 0;
43671
+ const promptPath = isEject ? path66.join(projectWorkflowDir(cwd), `${localAutomationName}.md`) : void 0;
43529
43672
  const [workflowTemplate, rawPrompt] = await Promise.all([
43530
43673
  readBuiltInWorkflowTemplate(name, variant, localAutomationName, promptPath),
43531
43674
  readBuiltInPromptFile(name)
43532
43675
  ]);
43533
- const workflowPath = path65.join(cwd, ".github", "workflows", `poe-code-${name}.yml`);
43534
- await mkdir16(path65.dirname(workflowPath), { recursive: true });
43676
+ const workflowPath = path66.join(cwd, ".github", "workflows", `poe-code-${name}.yml`);
43677
+ await mkdir16(path66.dirname(workflowPath), { recursive: true });
43535
43678
  await writeFile14(workflowPath, workflowTemplate, "utf8");
43536
43679
  if (promptPath !== void 0) {
43537
- await mkdir16(path65.dirname(promptPath), { recursive: true });
43680
+ await mkdir16(path66.dirname(promptPath), { recursive: true });
43538
43681
  await writeFile14(promptPath, addPromptHeader(rawPrompt, name), "utf8");
43539
43682
  }
43540
43683
  return {
@@ -43547,8 +43690,8 @@ async function installAutomation(name, cwd, isEject) {
43547
43690
  }
43548
43691
  async function ensureProjectSupportFiles(cwd, builtInVariables) {
43549
43692
  const projectDir = projectGitHubWorkflowsDir(cwd);
43550
- const variablesPath = path65.join(projectDir, "variables.yaml");
43551
- const readmePath = path65.join(projectDir, "README.md");
43693
+ const variablesPath = path66.join(projectDir, "variables.yaml");
43694
+ const readmePath = path66.join(projectDir, "README.md");
43552
43695
  await mkdir16(projectDir, { recursive: true });
43553
43696
  await writeFile14(
43554
43697
  variablesPath,
@@ -43560,7 +43703,7 @@ async function ensureProjectSupportFiles(cwd, builtInVariables) {
43560
43703
  }
43561
43704
  async function readOptionalFile4(filePath) {
43562
43705
  try {
43563
- return await readFile21(filePath, "utf8");
43706
+ return await readFile22(filePath, "utf8");
43564
43707
  } catch (error2) {
43565
43708
  if (isMissingPathError2(error2)) {
43566
43709
  return void 0;
@@ -43623,12 +43766,12 @@ var init_commands2 = __esm({
43623
43766
  init_variables2();
43624
43767
  UPSTREAM_REPO = "poe-platform/poe-code";
43625
43768
  builtInPromptsDirCandidates = [
43626
- fileURLToPath7(new URL("./prompts", import.meta.url)),
43627
- fileURLToPath7(new URL("../src/prompts", import.meta.url))
43769
+ fileURLToPath8(new URL("./prompts", import.meta.url)),
43770
+ fileURLToPath8(new URL("../src/prompts", import.meta.url))
43628
43771
  ];
43629
43772
  builtInWorkflowTemplatesDirCandidates = [
43630
- fileURLToPath7(new URL("./workflow-templates", import.meta.url)),
43631
- fileURLToPath7(new URL("../src/workflow-templates", import.meta.url))
43773
+ fileURLToPath8(new URL("./workflow-templates", import.meta.url)),
43774
+ fileURLToPath8(new URL("../src/workflow-templates", import.meta.url))
43632
43775
  ];
43633
43776
  Mustache3.escape = (value) => value;
43634
43777
  installableAutomations = [
@@ -43830,7 +43973,7 @@ var init_commands2 = __esm({
43830
43973
  scope: ["cli"],
43831
43974
  handler: async ({ params }) => {
43832
43975
  const name = params.name;
43833
- const workflowPath = path65.join(resolveCwd(), ".github", "workflows", `poe-code-${name}.yml`);
43976
+ const workflowPath = path66.join(resolveCwd(), ".github", "workflows", `poe-code-${name}.yml`);
43834
43977
  try {
43835
43978
  await unlink12(workflowPath);
43836
43979
  } catch (error2) {
@@ -43933,7 +44076,7 @@ var init_commands2 = __esm({
43933
44076
  return (await loadVariableStatuses(await resolveBuiltInAssetsDir(), projectGitHubWorkflowsDir(cwd))).map(
43934
44077
  (status) => ({
43935
44078
  ...status,
43936
- source: status.source === "built-in" ? status.source : path65.relative(cwd, status.source)
44079
+ source: status.source === "built-in" ? status.source : path66.relative(cwd, status.source)
43937
44080
  })
43938
44081
  );
43939
44082
  },
@@ -43988,7 +44131,7 @@ var init_src31 = __esm({
43988
44131
 
43989
44132
  // src/utils/execution-context.ts
43990
44133
  import { basename as basename2, dirname as dirname3 } from "node:path";
43991
- import { fileURLToPath as fileURLToPath8 } from "node:url";
44134
+ import { fileURLToPath as fileURLToPath9 } from "node:url";
43992
44135
  function detectExecutionContext(input) {
43993
44136
  const { argv, env, moduleUrl } = input;
43994
44137
  if (isDevelopmentMode(argv, env)) {
@@ -44047,7 +44190,7 @@ function detectNpxVersion(env) {
44047
44190
  return "default";
44048
44191
  }
44049
44192
  function createDevelopmentContext(moduleUrl) {
44050
- const modulePath = fileURLToPath8(moduleUrl);
44193
+ const modulePath = fileURLToPath9(moduleUrl);
44051
44194
  const srcIndex = modulePath.lastIndexOf("/src/");
44052
44195
  const projectRoot = srcIndex !== -1 ? modulePath.substring(0, srcIndex) : dirname3(dirname3(modulePath));
44053
44196
  return {
@@ -44111,7 +44254,7 @@ var init_execution_context = __esm({
44111
44254
  });
44112
44255
 
44113
44256
  // src/sdk/launch.ts
44114
- import path66 from "node:path";
44257
+ import path67 from "node:path";
44115
44258
  import { spawnSync as spawnSync2 } from "node:child_process";
44116
44259
  async function startLaunch(options) {
44117
44260
  const homeDir = resolveHomeDir(options.homeDir);
@@ -44217,7 +44360,7 @@ async function runLaunchDaemon(options) {
44217
44360
  });
44218
44361
  }
44219
44362
  function resolveLaunchBaseDir(homeDir) {
44220
- return path66.join(homeDir, ".poe-code", "launch");
44363
+ return path67.join(homeDir, ".poe-code", "launch");
44221
44364
  }
44222
44365
  function resolveHomeDir(homeDir) {
44223
44366
  if (homeDir) {
@@ -44233,7 +44376,7 @@ function normalizeLaunchSpec(spec10, baseDir) {
44233
44376
  if (locator.scheme !== "local") {
44234
44377
  return spec10;
44235
44378
  }
44236
- const cwd = path66.isAbsolute(locator.path) ? locator.path : path66.resolve(baseDir, locator.path);
44379
+ const cwd = path67.isAbsolute(locator.path) ? locator.path : path67.resolve(baseDir, locator.path);
44237
44380
  return {
44238
44381
  ...spec10,
44239
44382
  cwd
@@ -45227,15 +45370,15 @@ var init_renderer3 = __esm({
45227
45370
  });
45228
45371
 
45229
45372
  // packages/toolcraft/src/cli.ts
45230
- import { access as access4, readFile as readFile22, writeFile as writeFile15 } from "node:fs/promises";
45231
- import path68 from "node:path";
45373
+ import { access as access4, readFile as readFile23, writeFile as writeFile15 } from "node:fs/promises";
45374
+ import path69 from "node:path";
45232
45375
  import { Command as CommanderCommand, CommanderError, InvalidArgumentError, Option } from "commander";
45233
45376
  function inferProgramName(argv) {
45234
45377
  const entrypoint = argv[1];
45235
45378
  if (typeof entrypoint !== "string" || entrypoint.length === 0) {
45236
45379
  return "toolcraft";
45237
45380
  }
45238
- const parsed = path68.parse(entrypoint);
45381
+ const parsed = path69.parse(entrypoint);
45239
45382
  return parsed.name.length > 0 ? parsed.name : "toolcraft";
45240
45383
  }
45241
45384
  function normalizeRoots2(roots, argv) {
@@ -45292,11 +45435,11 @@ function formatSegment2(segment, casing) {
45292
45435
  const separator = casing === "snake" ? "_" : "-";
45293
45436
  return splitWords2(segment).join(separator);
45294
45437
  }
45295
- function toOptionFlag(path93, casing) {
45296
- return `--${path93.map((segment) => formatSegment2(segment, casing)).join(".")}`;
45438
+ function toOptionFlag(path94, casing) {
45439
+ return `--${path94.map((segment) => formatSegment2(segment, casing)).join(".")}`;
45297
45440
  }
45298
- function toOptionAttribute(path93, casing) {
45299
- return path93.map((segment) => {
45441
+ function toOptionAttribute(path94, casing) {
45442
+ return path94.map((segment) => {
45300
45443
  const formatted = formatSegment2(segment, casing);
45301
45444
  if (casing === "snake") {
45302
45445
  return formatted;
@@ -45307,23 +45450,23 @@ function toOptionAttribute(path93, casing) {
45307
45450
  ).join("");
45308
45451
  }).join(".");
45309
45452
  }
45310
- function toDisplayPath3(path93) {
45311
- return path93.join(".");
45453
+ function toDisplayPath3(path94) {
45454
+ return path94.join(".");
45312
45455
  }
45313
- function toUnionKindControlPath(path93) {
45314
- if (path93.length === 0) {
45456
+ function toUnionKindControlPath(path94) {
45457
+ if (path94.length === 0) {
45315
45458
  return ["kind"];
45316
45459
  }
45317
- const head = path93.slice(0, -1);
45318
- const tail = path93[path93.length - 1] ?? "";
45460
+ const head = path94.slice(0, -1);
45461
+ const tail = path94[path94.length - 1] ?? "";
45319
45462
  return [...head, `${tail}Kind`];
45320
45463
  }
45321
- function toUnionKindDisplayPath(path93) {
45322
- if (path93.length === 0) {
45464
+ function toUnionKindDisplayPath(path94) {
45465
+ if (path94.length === 0) {
45323
45466
  return "kind";
45324
45467
  }
45325
- const head = path93.slice(0, -1);
45326
- const tail = path93[path93.length - 1] ?? "";
45468
+ const head = path94.slice(0, -1);
45469
+ const tail = path94[path94.length - 1] ?? "";
45327
45470
  return [...head, `${tail}-kind`].join(".");
45328
45471
  }
45329
45472
  function createSyntheticEnumSchema(values) {
@@ -45339,19 +45482,19 @@ function getRequiredBranchFingerprint(branch, casing) {
45339
45482
  const requiredKeys = Object.entries(branch.shape).filter(([, schema]) => schema.kind !== "optional").map(([key2]) => formatSegment2(key2, casing)).sort();
45340
45483
  return requiredKeys.join("+");
45341
45484
  }
45342
- function collectFields(schema, casing, path93 = [], inheritedOptional = false, variantContext) {
45485
+ function collectFields(schema, casing, globalLongOptionFlags, path94 = [], inheritedOptional = false, variantContext) {
45343
45486
  const collected = {
45344
45487
  dynamicFields: [],
45345
45488
  fields: [],
45346
45489
  variants: []
45347
45490
  };
45348
45491
  for (const [key2, rawChildSchema] of Object.entries(schema.shape)) {
45349
- const nextPath = [...path93, key2];
45492
+ const nextPath = [...path94, key2];
45350
45493
  const runtimeOptional = inheritedOptional || rawChildSchema.kind === "optional";
45351
45494
  const childSchema = unwrapOptional3(rawChildSchema);
45352
45495
  const requiredWhenActive = rawChildSchema.kind !== "optional" && childSchema.default === void 0;
45353
45496
  if (childSchema.kind === "object") {
45354
- const nested = collectFields(childSchema, casing, nextPath, runtimeOptional, variantContext);
45497
+ const nested = collectFields(childSchema, casing, globalLongOptionFlags, nextPath, runtimeOptional, variantContext);
45355
45498
  collected.dynamicFields.push(...nested.dynamicFields);
45356
45499
  collected.fields.push(...nested.fields);
45357
45500
  collected.variants.push(...nested.variants);
@@ -45365,7 +45508,7 @@ function collectFields(schema, casing, path93 = [], inheritedOptional = false, v
45365
45508
  path: [...nextPath, childSchema.discriminator],
45366
45509
  displayPath: toDisplayPath3([...nextPath, childSchema.discriminator]),
45367
45510
  optionAttribute: toOptionAttribute([...nextPath, childSchema.discriminator], casing),
45368
- commanderOptionAttribute: toCommanderOptionAttribute([...nextPath, childSchema.discriminator], casing),
45511
+ commanderOptionAttribute: toCommanderOptionAttribute([...nextPath, childSchema.discriminator], casing, globalLongOptionFlags),
45369
45512
  optionFlag: toOptionFlag([...nextPath, childSchema.discriminator], casing),
45370
45513
  shortFlag: void 0,
45371
45514
  schema: createSyntheticEnumSchema(branchIds),
@@ -45378,7 +45521,7 @@ function collectFields(schema, casing, path93 = [], inheritedOptional = false, v
45378
45521
  collected.fields.push(controlField);
45379
45522
  const branches = [];
45380
45523
  for (const [branchId, branchSchema] of Object.entries(childSchema.branches)) {
45381
- const branch = collectFields(branchSchema, casing, nextPath, true, {
45524
+ const branch = collectFields(branchSchema, casing, globalLongOptionFlags, nextPath, true, {
45382
45525
  id: variantId,
45383
45526
  branchId
45384
45527
  });
@@ -45412,7 +45555,7 @@ function collectFields(schema, casing, path93 = [], inheritedOptional = false, v
45412
45555
  path: controlPath,
45413
45556
  displayPath: controlDisplayPath,
45414
45557
  optionAttribute: toOptionAttribute(controlPath, casing),
45415
- commanderOptionAttribute: toCommanderOptionAttribute(controlPath, casing),
45558
+ commanderOptionAttribute: toCommanderOptionAttribute(controlPath, casing, globalLongOptionFlags),
45416
45559
  optionFlag: toOptionFlag(controlPath, casing),
45417
45560
  shortFlag: void 0,
45418
45561
  schema: createSyntheticEnumSchema(branchIds),
@@ -45427,7 +45570,7 @@ function collectFields(schema, casing, path93 = [], inheritedOptional = false, v
45427
45570
  const branches = [];
45428
45571
  childSchema.branches.forEach((branchSchema, index) => {
45429
45572
  const branchId = branchIds[index] ?? "";
45430
- const branch = collectFields(branchSchema, casing, nextPath, true, {
45573
+ const branch = collectFields(branchSchema, casing, globalLongOptionFlags, nextPath, true, {
45431
45574
  id: variantId,
45432
45575
  branchId
45433
45576
  });
@@ -45494,7 +45637,7 @@ function collectFields(schema, casing, path93 = [], inheritedOptional = false, v
45494
45637
  path: nextPath,
45495
45638
  displayPath: toDisplayPath3(nextPath),
45496
45639
  optionAttribute: toOptionAttribute(nextPath, casing),
45497
- commanderOptionAttribute: toCommanderOptionAttribute(nextPath, casing),
45640
+ commanderOptionAttribute: toCommanderOptionAttribute(nextPath, casing, globalLongOptionFlags),
45498
45641
  optionFlag: toOptionFlag(nextPath, casing),
45499
45642
  shortFlag: childSchema.short,
45500
45643
  schema: childSchema,
@@ -45509,10 +45652,10 @@ function collectFields(schema, casing, path93 = [], inheritedOptional = false, v
45509
45652
  }
45510
45653
  return collected;
45511
45654
  }
45512
- function toCommanderOptionAttribute(path93, casing) {
45513
- const optionAttribute = toOptionAttribute(path93, casing);
45514
- const optionFlag = toOptionFlag(path93, casing);
45515
- if (!GLOBAL_LONG_OPTION_FLAGS.has(optionFlag)) {
45655
+ function toCommanderOptionAttribute(path94, casing, globalLongOptionFlags) {
45656
+ const optionAttribute = toOptionAttribute(path94, casing);
45657
+ const optionFlag = toOptionFlag(path94, casing);
45658
+ if (!globalLongOptionFlags.has(optionFlag)) {
45516
45659
  return optionAttribute;
45517
45660
  }
45518
45661
  return `param_${optionAttribute}`;
@@ -45542,8 +45685,8 @@ function assignPositionals(fields, positional) {
45542
45685
  });
45543
45686
  return fields;
45544
45687
  }
45545
- function formatOptionFlags(field) {
45546
- const collidesWithGlobalFlag = GLOBAL_LONG_OPTION_FLAGS.has(field.optionFlag);
45688
+ function formatOptionFlags(field, globalLongOptionFlags) {
45689
+ const collidesWithGlobalFlag = globalLongOptionFlags.has(field.optionFlag);
45547
45690
  if (collidesWithGlobalFlag) {
45548
45691
  if (field.shortFlag === void 0) {
45549
45692
  throw new UserError(
@@ -45661,9 +45804,9 @@ function parseArrayValue(value, schema, label) {
45661
45804
  }
45662
45805
  return splitArrayInput(value).map((item) => parseScalarValue(item, itemSchema, label));
45663
45806
  }
45664
- function createOption(field) {
45665
- const flags = formatOptionFlags(field);
45666
- const collidesWithGlobalFlag = GLOBAL_LONG_OPTION_FLAGS.has(field.optionFlag);
45807
+ function createOption(field, globalLongOptionFlags) {
45808
+ const flags = formatOptionFlags(field, globalLongOptionFlags);
45809
+ const collidesWithGlobalFlag = globalLongOptionFlags.has(field.optionFlag);
45667
45810
  const commanderValue = (value) => value === null ? NULL_OPTION_VALUE : value;
45668
45811
  if (field.schema.kind === "boolean") {
45669
45812
  if (collidesWithGlobalFlag) {
@@ -45708,6 +45851,9 @@ function createOption(field) {
45708
45851
  );
45709
45852
  return [option];
45710
45853
  }
45854
+ function getGlobalLongOptionFlags(presetsEnabled) {
45855
+ return new Set(presetsEnabled ? ["--preset", ...ALWAYS_GLOBAL_LONG_OPTION_FLAGS] : ALWAYS_GLOBAL_LONG_OPTION_FLAGS);
45856
+ }
45711
45857
  function createCommanderOption(flags, description, field) {
45712
45858
  const option = new Option(flags, description);
45713
45859
  if (field.commanderOptionAttribute !== field.optionAttribute) {
@@ -45801,14 +45947,14 @@ function describeSchemaType(schema) {
45801
45947
  throw new UserError("Unsupported CLI schema kind.");
45802
45948
  }
45803
45949
  }
45804
- function formatHelpFieldFlags(field) {
45950
+ function formatHelpFieldFlags(field, globalLongOptionFlags) {
45805
45951
  if (field.positionalIndex !== void 0) {
45806
45952
  return formatPositionalToken(field);
45807
45953
  }
45808
45954
  if (field.schema.kind === "boolean") {
45809
- return `${formatOptionFlags(field)} [value]`;
45955
+ return `${formatOptionFlags(field, globalLongOptionFlags)} [value]`;
45810
45956
  }
45811
- return `${formatOptionFlags(field)} <${describeSchemaType(field.schema)}>`;
45957
+ return `${formatOptionFlags(field, globalLongOptionFlags)} <${describeSchemaType(field.schema)}>`;
45812
45958
  }
45813
45959
  function appendHelpMetadata(description, metadata) {
45814
45960
  if (metadata.length === 0) {
@@ -45950,18 +46096,31 @@ function formatSecretDescription(secret) {
45950
46096
  }
45951
46097
  return secret.optional === true ? "Optional secret" : "Required secret";
45952
46098
  }
45953
- function formatCommandRows(group, scope) {
45954
- return getVisibleChildren(group, scope).map((child) => ({
45955
- name: child.aliases.length === 0 ? child.name : `${child.name} (${child.aliases.join(", ")})`,
45956
- description: child.description ?? ""
45957
- }));
46099
+ function formatCommandRowName(node, depth) {
46100
+ const name = node.aliases.length === 0 ? node.name : `${node.name} (${node.aliases.join(", ")})`;
46101
+ return `${" ".repeat(depth)}${name}`;
45958
46102
  }
45959
- function formatGlobalOptionRows(showVersion) {
45960
- const rows = [
45961
- {
46103
+ function formatCommandRows(group, scope, depth = 0) {
46104
+ return getVisibleChildren(group, scope).flatMap((child) => {
46105
+ const row = {
46106
+ name: formatCommandRowName(child, depth),
46107
+ description: child.description ?? ""
46108
+ };
46109
+ if (child.kind === "command") {
46110
+ return [row];
46111
+ }
46112
+ return [row, ...formatCommandRows(child, scope, depth + 1)];
46113
+ });
46114
+ }
46115
+ function formatGlobalOptionRows(showVersion, presetsEnabled) {
46116
+ const rows = [];
46117
+ if (presetsEnabled) {
46118
+ rows.push({
45962
46119
  flags: "--preset <path>",
45963
46120
  description: "Load parameter defaults from a JSON file"
45964
- },
46121
+ });
46122
+ }
46123
+ rows.push(
45965
46124
  {
45966
46125
  flags: "--yes",
45967
46126
  description: "Accept defaults, skip prompts"
@@ -45974,7 +46133,7 @@ function formatGlobalOptionRows(showVersion) {
45974
46133
  flags: "-h, --help",
45975
46134
  description: "Show help"
45976
46135
  }
45977
- ];
46136
+ );
45978
46137
  if (showVersion) {
45979
46138
  rows.push({
45980
46139
  flags: "--version",
@@ -45993,7 +46152,7 @@ function buildUsageLine(breadcrumb, rootUsageName, suffix) {
45993
46152
  const subPath = breadcrumb.slice(1).join(" ");
45994
46153
  return subPath ? `${rootUsageName} ${subPath} ${suffix}` : `${rootUsageName} ${suffix}`;
45995
46154
  }
45996
- function renderGroupHelp(group, breadcrumb, scope, showVersion, rootUsageName) {
46155
+ function renderGroupHelp(group, breadcrumb, scope, showVersion, presetsEnabled, rootUsageName) {
45997
46156
  const sections = [];
45998
46157
  const commandRows = formatCommandRows(group, scope);
45999
46158
  if (commandRows.length > 0) {
@@ -46001,7 +46160,7 @@ function renderGroupHelp(group, breadcrumb, scope, showVersion, rootUsageName) {
46001
46160
  ${formatCommandList(commandRows)}`);
46002
46161
  }
46003
46162
  sections.push(`${text.section("Global options:")}
46004
- ${formatOptionList(formatGlobalOptionRows(showVersion))}`);
46163
+ ${formatOptionList(formatGlobalOptionRows(showVersion, presetsEnabled))}`);
46005
46164
  return renderHelpDocument({
46006
46165
  breadcrumb,
46007
46166
  usageLine: buildUsageLine(breadcrumb, rootUsageName, "[options] [command]"),
@@ -46010,12 +46169,13 @@ ${formatOptionList(formatGlobalOptionRows(showVersion))}`);
46010
46169
  sections
46011
46170
  });
46012
46171
  }
46013
- function renderLeafHelp(command, breadcrumb, casing, rootUsageName) {
46172
+ function renderLeafHelp(command, breadcrumb, casing, presetsEnabled, rootUsageName) {
46014
46173
  const sections = [];
46015
- const collected = collectFields(command.params, casing);
46174
+ const globalLongOptionFlags = getGlobalLongOptionFlags(presetsEnabled);
46175
+ const collected = collectFields(command.params, casing, globalLongOptionFlags);
46016
46176
  const fields = assignPositionals(collected.fields, command.positional);
46017
46177
  const optionRows = fields.map((field) => ({
46018
- flags: formatHelpFieldFlags(field),
46178
+ flags: formatHelpFieldFlags(field, globalLongOptionFlags),
46019
46179
  description: formatHelpFieldDescription(field)
46020
46180
  })).concat(collected.dynamicFields.flatMap((field) => formatDynamicHelpFields(field, casing)));
46021
46181
  if (optionRows.length > 0) {
@@ -46023,7 +46183,7 @@ function renderLeafHelp(command, breadcrumb, casing, rootUsageName) {
46023
46183
  ${formatOptionList(optionRows)}`);
46024
46184
  }
46025
46185
  sections.push(`${text.section("Global options:")}
46026
- ${formatOptionList(formatGlobalOptionRows(false))}`);
46186
+ ${formatOptionList(formatGlobalOptionRows(false, presetsEnabled))}`);
46027
46187
  const secretRows = formatSecretRows(command.secrets);
46028
46188
  if (secretRows.length > 0) {
46029
46189
  sections.push(`${text.section("Secrets (via environment):")}
@@ -46062,25 +46222,32 @@ async function renderGeneratedHelp(root, argv, options) {
46062
46222
  const output = resolveHelpOutput(argv);
46063
46223
  const casing = options.casing ?? "kebab";
46064
46224
  await withOutputFormat2(output, async () => {
46065
- const rendered = target.node.kind === "group" ? renderGroupHelp(target.node, target.breadcrumb, "cli", options.version !== void 0, options.rootUsageName) : renderLeafHelp(target.node, target.breadcrumb, casing, options.rootUsageName);
46225
+ const rendered = target.node.kind === "group" ? renderGroupHelp(
46226
+ target.node,
46227
+ target.breadcrumb,
46228
+ "cli",
46229
+ options.version !== void 0,
46230
+ options.presets === true,
46231
+ options.rootUsageName
46232
+ ) : renderLeafHelp(target.node, target.breadcrumb, casing, options.presets === true, options.rootUsageName);
46066
46233
  process.stdout.write(rendered);
46067
46234
  });
46068
46235
  }
46069
- function createNodeCommand(node, casing, execute2, pathSegments = []) {
46236
+ function createNodeCommand(node, casing, globalLongOptionFlags, execute2, presetsEnabled, pathSegments = []) {
46070
46237
  const nextPathSegments = [...pathSegments, node.name];
46071
46238
  if (node.kind === "command") {
46072
46239
  if (!node.scope.includes("cli")) {
46073
46240
  return null;
46074
46241
  }
46075
46242
  const command = new CommanderCommand(node.name);
46076
- const collected = collectFields(node.params, casing);
46243
+ const collected = collectFields(node.params, casing, globalLongOptionFlags);
46077
46244
  const fields = assignPositionals(collected.fields, node.positional);
46078
46245
  if (node.description !== void 0) {
46079
46246
  command.description(node.description);
46080
46247
  }
46081
46248
  node.aliases.forEach((alias) => command.alias(alias));
46082
46249
  command.addHelpCommand(false);
46083
- addGlobalOptions(command);
46250
+ addGlobalOptions(command, presetsEnabled);
46084
46251
  command.allowExcessArguments(true);
46085
46252
  if (collected.dynamicFields.length > 0) {
46086
46253
  command.allowUnknownOption(true);
@@ -46090,7 +46257,7 @@ function createNodeCommand(node, casing, execute2, pathSegments = []) {
46090
46257
  command.argument(formatPositionalToken(field));
46091
46258
  continue;
46092
46259
  }
46093
- for (const option of createOption(field)) {
46260
+ for (const option of createOption(field, globalLongOptionFlags)) {
46094
46261
  command.addOption(option);
46095
46262
  }
46096
46263
  }
@@ -46104,6 +46271,7 @@ function createNodeCommand(node, casing, execute2, pathSegments = []) {
46104
46271
  dynamicFields: collected.dynamicFields,
46105
46272
  fields,
46106
46273
  positionalValues,
46274
+ presetsEnabled,
46107
46275
  rawArgv: actionCommand.args,
46108
46276
  actionCommand,
46109
46277
  variants: collected.variants
@@ -46114,22 +46282,25 @@ function createNodeCommand(node, casing, execute2, pathSegments = []) {
46114
46282
  if (!isNodeVisibleInScope(node, "cli")) {
46115
46283
  return null;
46116
46284
  }
46117
- const visibleChildren = node.children.map((child) => createNodeCommand(child, casing, execute2, nextPathSegments)).filter((child) => child !== null);
46285
+ const visibleChildren = node.children.map((child) => createNodeCommand(child, casing, globalLongOptionFlags, execute2, presetsEnabled, nextPathSegments)).filter((child) => child !== null);
46118
46286
  const group = new CommanderCommand(node.name);
46119
46287
  if (node.description !== void 0) {
46120
46288
  group.description(node.description);
46121
46289
  }
46122
46290
  node.aliases.forEach((alias) => group.alias(alias));
46123
46291
  group.addHelpCommand(false);
46124
- addGlobalOptions(group);
46292
+ addGlobalOptions(group, presetsEnabled);
46125
46293
  for (const child of visibleChildren) {
46126
46294
  const isDefaultChild = node.default !== void 0 && node.default.scope.includes("cli") && (child.name() === node.default.name || child.aliases().includes(node.default.name));
46127
46295
  group.addCommand(child, isDefaultChild ? { isDefault: true } : void 0);
46128
46296
  }
46129
46297
  return group;
46130
46298
  }
46131
- function addGlobalOptions(command) {
46132
- command.option("--preset <path>", "Load parameter defaults from a JSON file.").option("--yes", "Accept defaults and skip prompts.").option("--output <format>", "Output format.", (value) => {
46299
+ function addGlobalOptions(command, presetsEnabled) {
46300
+ if (presetsEnabled) {
46301
+ command.option("--preset <path>", "Load parameter defaults from a JSON file.");
46302
+ }
46303
+ command.option("--yes", "Accept defaults and skip prompts.").option("--output <format>", "Output format.", (value) => {
46133
46304
  if (value === "rich" || value === "md" || value === "json") {
46134
46305
  return value;
46135
46306
  }
@@ -46139,10 +46310,10 @@ function addGlobalOptions(command) {
46139
46310
  throw new InvalidArgumentError('Invalid value for "--output". Expected one of: rich, md, markdown, json.');
46140
46311
  }).option("--verbose", "Print stack traces for unexpected errors.");
46141
46312
  }
46142
- function setNestedValue(target, path93, value) {
46313
+ function setNestedValue(target, path94, value) {
46143
46314
  let cursor = target;
46144
- for (let index = 0; index < path93.length - 1; index += 1) {
46145
- const segment = path93[index] ?? "";
46315
+ for (let index = 0; index < path94.length - 1; index += 1) {
46316
+ const segment = path94[index] ?? "";
46146
46317
  const existing = cursor[segment];
46147
46318
  if (typeof existing === "object" && existing !== null) {
46148
46319
  cursor = existing;
@@ -46152,7 +46323,7 @@ function setNestedValue(target, path93, value) {
46152
46323
  cursor[segment] = next;
46153
46324
  cursor = next;
46154
46325
  }
46155
- const leaf = path93[path93.length - 1];
46326
+ const leaf = path94[path94.length - 1];
46156
46327
  if (leaf !== void 0) {
46157
46328
  cursor[leaf] = value;
46158
46329
  }
@@ -46249,13 +46420,13 @@ async function withOutputFormat2(output, fn) {
46249
46420
  }
46250
46421
  function createFs3() {
46251
46422
  return {
46252
- readFile: async (path93, encoding = "utf8") => readFile22(path93, { encoding }),
46253
- writeFile: async (path93, contents) => {
46254
- await writeFile15(path93, contents);
46423
+ readFile: async (path94, encoding = "utf8") => readFile23(path94, { encoding }),
46424
+ writeFile: async (path94, contents) => {
46425
+ await writeFile15(path94, contents);
46255
46426
  },
46256
- exists: async (path93) => {
46427
+ exists: async (path94) => {
46257
46428
  try {
46258
- await access4(path93);
46429
+ await access4(path94);
46259
46430
  return true;
46260
46431
  } catch {
46261
46432
  return false;
@@ -46276,9 +46447,9 @@ function isPlainObject5(value) {
46276
46447
  function hasFieldValue(value) {
46277
46448
  return value !== void 0;
46278
46449
  }
46279
- function hasNestedField(fields, path93) {
46450
+ function hasNestedField(fields, path94) {
46280
46451
  return fields.some(
46281
- (field) => path93.length < field.path.length && path93.every((segment, index) => field.path[index] === segment)
46452
+ (field) => path94.length < field.path.length && path94.every((segment, index) => field.path[index] === segment)
46282
46453
  );
46283
46454
  }
46284
46455
  function describeExpectedPresetValue(schema) {
@@ -46353,7 +46524,7 @@ function validatePresetFieldValue(value, field, presetPath) {
46353
46524
  async function loadPresetValues(fields, presetPath) {
46354
46525
  let rawPreset;
46355
46526
  try {
46356
- rawPreset = await readFile22(presetPath, {
46527
+ rawPreset = await readFile23(presetPath, {
46357
46528
  encoding: "utf8"
46358
46529
  });
46359
46530
  } catch (error2) {
@@ -46374,9 +46545,9 @@ async function loadPresetValues(fields, presetPath) {
46374
46545
  }
46375
46546
  const fieldByPath = new Map(fields.map((field) => [field.displayPath, field]));
46376
46547
  const presetValues = {};
46377
- function visitObject(current, path93) {
46548
+ function visitObject(current, path94) {
46378
46549
  for (const [key2, value] of Object.entries(current)) {
46379
- const nextPath = [...path93, key2];
46550
+ const nextPath = [...path94, key2];
46380
46551
  const displayPath2 = toDisplayPath3(nextPath);
46381
46552
  const field = fieldByPath.get(displayPath2);
46382
46553
  if (field !== void 0) {
@@ -46574,8 +46745,8 @@ function createFixtureService(definition) {
46574
46745
  );
46575
46746
  }
46576
46747
  function resolveFixturePath(commandPath) {
46577
- const parsed = path68.parse(commandPath);
46578
- return path68.join(parsed.dir, `${parsed.name}.fixture.json`);
46748
+ const parsed = path69.parse(commandPath);
46749
+ return path69.join(parsed.dir, `${parsed.name}.fixture.json`);
46579
46750
  }
46580
46751
  function selectFixtureScenario(scenarios, selector) {
46581
46752
  if (isNumericFixtureSelector(selector)) {
@@ -46602,7 +46773,7 @@ async function loadFixtureScenario(command, selector) {
46602
46773
  const fixturePath = resolveFixturePath(commandPath);
46603
46774
  let rawFixture;
46604
46775
  try {
46605
- rawFixture = await readFile22(fixturePath, {
46776
+ rawFixture = await readFile23(fixturePath, {
46606
46777
  encoding: "utf8"
46607
46778
  });
46608
46779
  } catch {
@@ -46698,8 +46869,8 @@ function validateServices2(services) {
46698
46869
  }
46699
46870
  }
46700
46871
  }
46701
- function getNestedValue(target, path93) {
46702
- return path93.reduce(
46872
+ function getNestedValue(target, path94) {
46873
+ return path94.reduce(
46703
46874
  (current, segment) => current !== null && typeof current === "object" ? current[segment] : void 0,
46704
46875
  target
46705
46876
  );
@@ -47165,7 +47336,7 @@ async function executeCommand(state, services, requirementOptions, runtimeOption
47165
47336
  optionValues,
47166
47337
  state.rawArgv,
47167
47338
  state.casing,
47168
- resolvedFlags.preset,
47339
+ state.presetsEnabled ? resolvedFlags.preset : void 0,
47169
47340
  shouldPrompt
47170
47341
  );
47171
47342
  const context = {
@@ -47233,6 +47404,7 @@ async function runCLI(roots, options = {}) {
47233
47404
  const casing = options.casing ?? "kebab";
47234
47405
  const services = options.services ?? {};
47235
47406
  const runtimeOptions = options.humanInLoop ?? {};
47407
+ const version = options.version ?? findEntrypointPackageMetadata(process.argv[1])?.version;
47236
47408
  const servicesWithBuiltIns = {
47237
47409
  ...services,
47238
47410
  runtimeOptions,
@@ -47243,7 +47415,7 @@ async function runCLI(roots, options = {}) {
47243
47415
  };
47244
47416
  validateServices2(services);
47245
47417
  if (hasHelpFlag(process.argv)) {
47246
- await renderGeneratedHelp(root, process.argv, options);
47418
+ await renderGeneratedHelp(root, process.argv, { ...options, version });
47247
47419
  return;
47248
47420
  }
47249
47421
  const program = new CommanderCommand();
@@ -47251,9 +47423,11 @@ async function runCLI(roots, options = {}) {
47251
47423
  program.exitOverride();
47252
47424
  program.showHelpAfterError();
47253
47425
  program.addHelpCommand(false);
47254
- addGlobalOptions(program);
47255
- if (options.version !== void 0) {
47256
- program.version(options.version, "--version");
47426
+ const presetsEnabled = options.presets === true;
47427
+ const globalLongOptionFlags = getGlobalLongOptionFlags(presetsEnabled);
47428
+ addGlobalOptions(program, presetsEnabled);
47429
+ if (version !== void 0) {
47430
+ program.version(version, "--version");
47257
47431
  }
47258
47432
  let lastActionCommand;
47259
47433
  const execute2 = async (state) => {
@@ -47261,7 +47435,7 @@ async function runCLI(roots, options = {}) {
47261
47435
  await executeCommand(state, servicesWithBuiltIns, requirementOptions, runtimeOptions);
47262
47436
  };
47263
47437
  for (const child of root.children) {
47264
- const command = createNodeCommand(child, casing, execute2);
47438
+ const command = createNodeCommand(child, casing, globalLongOptionFlags, execute2, presetsEnabled);
47265
47439
  if (command === null) {
47266
47440
  continue;
47267
47441
  }
@@ -47281,7 +47455,7 @@ async function runCLI(roots, options = {}) {
47281
47455
  );
47282
47456
  }
47283
47457
  }
47284
- var RESERVED_SERVICE_NAMES2, NULL_OPTION_VALUE, HELP_FLAGS, GLOBAL_LONG_OPTION_FLAGS, DESIGN_SYSTEM_OUTPUT_BY_MODE;
47458
+ var RESERVED_SERVICE_NAMES2, NULL_OPTION_VALUE, HELP_FLAGS, ALWAYS_GLOBAL_LONG_OPTION_FLAGS, DESIGN_SYSTEM_OUTPUT_BY_MODE;
47285
47459
  var init_cli = __esm({
47286
47460
  "packages/toolcraft/src/cli.ts"() {
47287
47461
  "use strict";
@@ -47291,11 +47465,12 @@ var init_cli = __esm({
47291
47465
  init_human_in_loop();
47292
47466
  init_mcp_proxy();
47293
47467
  init_number_schema();
47468
+ init_package_metadata();
47294
47469
  init_renderer3();
47295
47470
  RESERVED_SERVICE_NAMES2 = /* @__PURE__ */ new Set(["params", "secrets", "fetch", "fs", "env", "progress"]);
47296
47471
  NULL_OPTION_VALUE = /* @__PURE__ */ Symbol("toolcraft.cli.null");
47297
47472
  HELP_FLAGS = /* @__PURE__ */ new Set(["--help", "-h"]);
47298
- GLOBAL_LONG_OPTION_FLAGS = /* @__PURE__ */ new Set(["--preset", "--yes", "--output", "--verbose"]);
47473
+ ALWAYS_GLOBAL_LONG_OPTION_FLAGS = ["--yes", "--output", "--verbose"];
47299
47474
  DESIGN_SYSTEM_OUTPUT_BY_MODE = {
47300
47475
  rich: "terminal",
47301
47476
  md: "markdown",
@@ -47815,7 +47990,7 @@ var init_agent2 = __esm({
47815
47990
  });
47816
47991
 
47817
47992
  // src/cli/commands/spawn.ts
47818
- import path69 from "node:path";
47993
+ import path70 from "node:path";
47819
47994
  import { Option as Option2 } from "commander";
47820
47995
  function registerSpawnCommand(program, container, options = {}) {
47821
47996
  const spawnServices = container.registry.list().filter((service) => typeof service.spawn === "function" || getSpawnConfig(service.name));
@@ -48096,7 +48271,7 @@ async function resolvePromptInput(input, fs19, baseDir) {
48096
48271
  if (rawPath.length === 0) {
48097
48272
  throw new ValidationError("prompt @<path> requires a file path after '@'");
48098
48273
  }
48099
- const filePath = path69.isAbsolute(rawPath) ? rawPath : path69.join(baseDir, rawPath);
48274
+ const filePath = path70.isAbsolute(rawPath) ? rawPath : path70.join(baseDir, rawPath);
48100
48275
  try {
48101
48276
  const contents = await fs19.readFile(filePath, "utf8");
48102
48277
  return contents.trim();
@@ -48117,7 +48292,7 @@ async function resolveMcpSpawnInput(input, fs19, baseDir) {
48117
48292
  if (rawPath.length === 0) {
48118
48293
  throw new ValidationError("--mcp-servers @<path> requires a file path after '@'");
48119
48294
  }
48120
- const filePath = path69.isAbsolute(rawPath) ? rawPath : path69.join(baseDir, rawPath);
48295
+ const filePath = path70.isAbsolute(rawPath) ? rawPath : path70.join(baseDir, rawPath);
48121
48296
  try {
48122
48297
  return await fs19.readFile(filePath, "utf8");
48123
48298
  } catch (error2) {
@@ -49005,9 +49180,9 @@ var init_command_not_found = __esm({
49005
49180
 
49006
49181
  // src/cli/commands/utils-symlink-ops.ts
49007
49182
  import { dirname as dirname4 } from "node:path";
49008
- async function tryLstat(fs19, path93) {
49183
+ async function tryLstat(fs19, path94) {
49009
49184
  try {
49010
- return await fs19.lstat(path93);
49185
+ return await fs19.lstat(path94);
49011
49186
  } catch (error2) {
49012
49187
  if (isNotFound(error2)) {
49013
49188
  return null;
@@ -49058,13 +49233,13 @@ async function applySymlinkOps(fs19, ops, opts) {
49058
49233
  }
49059
49234
  return { conflicts };
49060
49235
  }
49061
- async function isSymlinkPointingTo(fs19, path93, expectedTarget) {
49236
+ async function isSymlinkPointingTo(fs19, path94, expectedTarget) {
49062
49237
  try {
49063
- const stats = await fs19.lstat(path93);
49238
+ const stats = await fs19.lstat(path94);
49064
49239
  if (!stats.isSymbolicLink()) {
49065
49240
  return false;
49066
49241
  }
49067
- return await fs19.readlink(path93) === expectedTarget;
49242
+ return await fs19.readlink(path94) === expectedTarget;
49068
49243
  } catch (error2) {
49069
49244
  if (isNotFound(error2)) {
49070
49245
  return false;
@@ -49542,7 +49717,7 @@ var init_media_download = __esm({
49542
49717
  });
49543
49718
 
49544
49719
  // src/cli/commands/generate.ts
49545
- import path70 from "node:path";
49720
+ import path71 from "node:path";
49546
49721
  function registerGenerateCommand(program, container) {
49547
49722
  const generate2 = program.command("generate").alias("g").description("Generate content via Poe API.").option("--model <model>", `Model identifier (default: ${DEFAULT_TEXT_MODEL})`).option(
49548
49723
  "--param <key=value>",
@@ -49815,11 +49990,11 @@ function getDefaultMimeType(type) {
49815
49990
  return defaults[type];
49816
49991
  }
49817
49992
  function resolveOutputPath(filename, cwd) {
49818
- if (path70.isAbsolute(filename)) {
49993
+ if (path71.isAbsolute(filename)) {
49819
49994
  return { path: filename, label: filename };
49820
49995
  }
49821
49996
  return {
49822
- path: path70.join(cwd, filename),
49997
+ path: path71.join(cwd, filename),
49823
49998
  label: `./${filename}`
49824
49999
  };
49825
50000
  }
@@ -50420,10 +50595,10 @@ var init_shapes = __esm({
50420
50595
  });
50421
50596
 
50422
50597
  // packages/agent-mcp-config/src/apply.ts
50423
- import path71 from "node:path";
50598
+ import path72 from "node:path";
50424
50599
  import { parse as parseYaml6, stringify as stringifyYaml3 } from "yaml";
50425
50600
  function getConfigDirectory(configPath) {
50426
- return path71.dirname(configPath);
50601
+ return path72.dirname(configPath);
50427
50602
  }
50428
50603
  function isConfigObject6(value) {
50429
50604
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -50443,9 +50618,9 @@ function expandHomePath(configPath, homeDir) {
50443
50618
  return homeDir;
50444
50619
  }
50445
50620
  if (configPath.startsWith("~/")) {
50446
- return path71.join(homeDir, configPath.slice(2));
50621
+ return path72.join(homeDir, configPath.slice(2));
50447
50622
  }
50448
- return path71.join(homeDir, configPath.slice(1));
50623
+ return path72.join(homeDir, configPath.slice(1));
50449
50624
  }
50450
50625
  function parseYamlDocument2(content) {
50451
50626
  if (content.trim() === "") {
@@ -50478,7 +50653,7 @@ async function writeYamlConfig(configPath, document, options) {
50478
50653
  return;
50479
50654
  }
50480
50655
  const absolutePath = expandHomePath(configPath, options.homeDir);
50481
- const configDir = path71.dirname(absolutePath);
50656
+ const configDir = path72.dirname(absolutePath);
50482
50657
  await options.fs.mkdir(configDir, { recursive: true });
50483
50658
  await options.fs.writeFile(absolutePath, serializeYamlDocument(document), {
50484
50659
  encoding: "utf8"
@@ -51757,9 +51932,9 @@ var init_dashboard_loop_shared = __esm({
51757
51932
  });
51758
51933
 
51759
51934
  // src/cli/commands/pipeline.ts
51760
- import path72 from "node:path";
51761
- import { readFile as readFile23, stat as stat18 } from "node:fs/promises";
51762
- import { fileURLToPath as fileURLToPath9 } from "node:url";
51935
+ import path73 from "node:path";
51936
+ import { readFile as readFile24, stat as stat18 } from "node:fs/promises";
51937
+ import { fileURLToPath as fileURLToPath10 } from "node:url";
51763
51938
  async function resolvePipelineCommandConfig(container) {
51764
51939
  const [configDoc, pipelineYamlConfig] = await Promise.all([
51765
51940
  readMergedDocument(
@@ -51816,11 +51991,11 @@ function resolveMaxRuns(value) {
51816
51991
  return parsed;
51817
51992
  }
51818
51993
  function resolvePipelineInitSourcePath(container, sourcePath) {
51819
- const absolutePath = sourcePath.startsWith("~/") ? path72.join(container.env.homeDir, sourcePath.slice(2)) : path72.isAbsolute(sourcePath) ? sourcePath : path72.resolve(container.env.cwd, sourcePath);
51994
+ const absolutePath = sourcePath.startsWith("~/") ? path73.join(container.env.homeDir, sourcePath.slice(2)) : path73.isAbsolute(sourcePath) ? sourcePath : path73.resolve(container.env.cwd, sourcePath);
51820
51995
  return {
51821
51996
  absolutePath,
51822
51997
  relativePath: sourcePath,
51823
- title: path72.basename(sourcePath, path72.extname(sourcePath))
51998
+ title: path73.basename(sourcePath, path73.extname(sourcePath))
51824
51999
  };
51825
52000
  }
51826
52001
  function isActivityTimeoutError3(error2) {
@@ -52162,12 +52337,12 @@ async function runPipelineWithDashboard(options) {
52162
52337
  }
52163
52338
  }
52164
52339
  function resolvePipelinePaths(scope, cwd, homeDir) {
52165
- const rootPath = scope === "global" ? path72.join(homeDir, ".poe-code", "pipeline") : path72.join(cwd, ".poe-code", "pipeline");
52340
+ const rootPath = scope === "global" ? path73.join(homeDir, ".poe-code", "pipeline") : path73.join(cwd, ".poe-code", "pipeline");
52166
52341
  const displayRoot = scope === "global" ? "~/.poe-code/pipeline" : ".poe-code/pipeline";
52167
52342
  return {
52168
- plansPath: path72.join(rootPath, "plans"),
52169
- stepsPath: path72.join(rootPath, "steps.yaml"),
52170
- legacyDefaultStepsPath: path72.join(rootPath, "steps", "default.yaml"),
52343
+ plansPath: path73.join(rootPath, "plans"),
52344
+ stepsPath: path73.join(rootPath, "steps.yaml"),
52345
+ legacyDefaultStepsPath: path73.join(rootPath, "steps", "default.yaml"),
52171
52346
  displayPlansPath: `${displayRoot}/plans`,
52172
52347
  displayStepsPath: `${displayRoot}/steps.yaml`
52173
52348
  };
@@ -52176,18 +52351,18 @@ async function loadPipelineTemplates() {
52176
52351
  if (pipelineTemplatesCache) {
52177
52352
  return pipelineTemplatesCache;
52178
52353
  }
52179
- const packageRoot = await findPackageRoot3(fileURLToPath9(import.meta.url));
52354
+ const packageRoot = await findPackageRoot3(fileURLToPath10(import.meta.url));
52180
52355
  const templateRoots = [
52181
- path72.join(packageRoot, "src", "templates", "pipeline"),
52182
- path72.join(packageRoot, "dist", "templates", "pipeline")
52356
+ path73.join(packageRoot, "src", "templates", "pipeline"),
52357
+ path73.join(packageRoot, "dist", "templates", "pipeline")
52183
52358
  ];
52184
52359
  for (const templateRoot of templateRoots) {
52185
52360
  if (!await pathExistsOnDisk(templateRoot)) {
52186
52361
  continue;
52187
52362
  }
52188
52363
  const [skillPlan, steps] = await Promise.all([
52189
- readFile23(path72.join(templateRoot, "SKILL_plan.md"), "utf8"),
52190
- readFile23(path72.join(templateRoot, "steps.yaml.mustache"), "utf8")
52364
+ readFile24(path73.join(templateRoot, "SKILL_plan.md"), "utf8"),
52365
+ readFile24(path73.join(templateRoot, "steps.yaml.mustache"), "utf8")
52191
52366
  ]);
52192
52367
  pipelineTemplatesCache = { skillPlan, steps };
52193
52368
  return pipelineTemplatesCache;
@@ -52206,12 +52381,12 @@ async function pathExistsOnDisk(targetPath) {
52206
52381
  }
52207
52382
  }
52208
52383
  async function findPackageRoot3(entryFilePath) {
52209
- let currentPath = path72.dirname(entryFilePath);
52384
+ let currentPath = path73.dirname(entryFilePath);
52210
52385
  while (true) {
52211
- if (await pathExistsOnDisk(path72.join(currentPath, "package.json"))) {
52386
+ if (await pathExistsOnDisk(path73.join(currentPath, "package.json"))) {
52212
52387
  return currentPath;
52213
52388
  }
52214
- const parentPath = path72.dirname(currentPath);
52389
+ const parentPath = path73.dirname(currentPath);
52215
52390
  if (parentPath === currentPath) {
52216
52391
  throw new Error("Unable to locate package root for Pipeline templates.");
52217
52392
  }
@@ -52499,11 +52674,11 @@ function registerPipelineCommand(program, container) {
52499
52674
  if (typeof t.status === "string") return t.status === "done";
52500
52675
  return Object.values(t.status).every((s) => s === "done");
52501
52676
  }).length;
52502
- const readFile37 = container.fs.readFile.bind(container.fs);
52677
+ const readFile38 = container.fs.readFile.bind(container.fs);
52503
52678
  const resolvedVars = await resolvePipelineVars(
52504
52679
  plan.vars ?? {},
52505
52680
  container.env.cwd,
52506
- readFile37
52681
+ readFile38
52507
52682
  );
52508
52683
  const resolvedSetup = plan.setup === null ? void 0 : plan.setup ?? steps.setup;
52509
52684
  const resolvedTeardown = plan.teardown === null ? void 0 : plan.teardown ?? steps.teardown;
@@ -52525,7 +52700,7 @@ function registerPipelineCommand(program, container) {
52525
52700
  if (opts.preview) {
52526
52701
  if (resolvedSetup) {
52527
52702
  const raw = interpolatePipelineVars(resolvedSetup.prompt, resolvedVars, "setup");
52528
- const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile37);
52703
+ const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile38);
52529
52704
  resources.logger.resolved("setup", expanded);
52530
52705
  }
52531
52706
  for (const task of plan.tasks) {
@@ -52538,7 +52713,7 @@ function registerPipelineCommand(program, container) {
52538
52713
  vars: resolvedVars
52539
52714
  }),
52540
52715
  container.env.cwd,
52541
- readFile37
52716
+ readFile38
52542
52717
  );
52543
52718
  resources.logger.resolved(`task: ${task.id} \u2014 ${task.title}`, expanded);
52544
52719
  } else {
@@ -52551,7 +52726,7 @@ function registerPipelineCommand(program, container) {
52551
52726
  vars: resolvedVars
52552
52727
  }),
52553
52728
  container.env.cwd,
52554
- readFile37
52729
+ readFile38
52555
52730
  );
52556
52731
  resources.logger.resolved(`task: ${task.id} / ${stepName}`, expanded);
52557
52732
  }
@@ -52559,7 +52734,7 @@ function registerPipelineCommand(program, container) {
52559
52734
  }
52560
52735
  if (resolvedTeardown) {
52561
52736
  const raw = interpolatePipelineVars(resolvedTeardown.prompt, resolvedVars, "teardown");
52562
- const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile37);
52737
+ const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile38);
52563
52738
  resources.logger.resolved("teardown", expanded);
52564
52739
  }
52565
52740
  }
@@ -52676,7 +52851,7 @@ function registerPipelineCommand(program, container) {
52676
52851
  `Would ${stepsExists ? "overwrite" : "create"}: ${pipelinePaths.displayStepsPath}`
52677
52852
  );
52678
52853
  } else {
52679
- await container.fs.mkdir(path72.dirname(pipelinePaths.stepsPath), {
52854
+ await container.fs.mkdir(path73.dirname(pipelinePaths.stepsPath), {
52680
52855
  recursive: true
52681
52856
  });
52682
52857
  await container.fs.writeFile(pipelinePaths.stepsPath, templates.steps, {
@@ -52722,7 +52897,7 @@ var init_pipeline3 = __esm({
52722
52897
  });
52723
52898
 
52724
52899
  // src/cli/commands/ralph.ts
52725
- import path73 from "node:path";
52900
+ import path74 from "node:path";
52726
52901
  function formatRalphAgentSummary(agent2) {
52727
52902
  return Array.isArray(agent2) ? agent2.join(", ") : agent2;
52728
52903
  }
@@ -52903,9 +53078,9 @@ function normalizeConfiguredIterations(value) {
52903
53078
  }
52904
53079
  function resolveAbsoluteDocPath(container, docPath) {
52905
53080
  if (docPath.startsWith("~/")) {
52906
- return path73.join(container.env.homeDir, docPath.slice(2));
53081
+ return path74.join(container.env.homeDir, docPath.slice(2));
52907
53082
  }
52908
- return path73.isAbsolute(docPath) ? docPath : path73.resolve(container.env.cwd, docPath);
53083
+ return path74.isAbsolute(docPath) ? docPath : path74.resolve(container.env.cwd, docPath);
52909
53084
  }
52910
53085
  async function resolveRalphCommandConfig(container) {
52911
53086
  const configDoc = await readMergedDocument(
@@ -53300,11 +53475,11 @@ var init_ralph3 = __esm({
53300
53475
  });
53301
53476
 
53302
53477
  // src/cli/commands/experiment.ts
53303
- import path74 from "node:path";
53304
- import { readFile as readFile24, stat as stat19 } from "node:fs/promises";
53305
- import { fileURLToPath as fileURLToPath10 } from "node:url";
53478
+ import path75 from "node:path";
53479
+ import { readFile as readFile25, stat as stat19 } from "node:fs/promises";
53480
+ import { fileURLToPath as fileURLToPath11 } from "node:url";
53306
53481
  function resolveExperimentPaths(scope, cwd, homeDir) {
53307
- const rootPath = scope === "global" ? path74.join(homeDir, ".poe-code", "experiments") : path74.join(cwd, ".poe-code", "experiments");
53482
+ const rootPath = scope === "global" ? path75.join(homeDir, ".poe-code", "experiments") : path75.join(cwd, ".poe-code", "experiments");
53308
53483
  const displayRoot = scope === "global" ? "~/.poe-code/experiments" : ".poe-code/experiments";
53309
53484
  return {
53310
53485
  experimentsPath: rootPath,
@@ -53323,12 +53498,12 @@ async function pathExistsOnDisk2(targetPath) {
53323
53498
  }
53324
53499
  }
53325
53500
  async function findPackageRoot4(entryFilePath) {
53326
- let currentPath = path74.dirname(entryFilePath);
53501
+ let currentPath = path75.dirname(entryFilePath);
53327
53502
  while (true) {
53328
- if (await pathExistsOnDisk2(path74.join(currentPath, "package.json"))) {
53503
+ if (await pathExistsOnDisk2(path75.join(currentPath, "package.json"))) {
53329
53504
  return currentPath;
53330
53505
  }
53331
- const parentPath = path74.dirname(currentPath);
53506
+ const parentPath = path75.dirname(currentPath);
53332
53507
  if (parentPath === currentPath) {
53333
53508
  throw new Error("Unable to locate package root for Experiment templates.");
53334
53509
  }
@@ -53339,18 +53514,18 @@ async function loadExperimentTemplates() {
53339
53514
  if (experimentTemplatesCache) {
53340
53515
  return experimentTemplatesCache;
53341
53516
  }
53342
- const packageRoot = await findPackageRoot4(fileURLToPath10(import.meta.url));
53517
+ const packageRoot = await findPackageRoot4(fileURLToPath11(import.meta.url));
53343
53518
  const templateRoots = [
53344
- path74.join(packageRoot, "src", "templates", "experiment"),
53345
- path74.join(packageRoot, "dist", "templates", "experiment")
53519
+ path75.join(packageRoot, "src", "templates", "experiment"),
53520
+ path75.join(packageRoot, "dist", "templates", "experiment")
53346
53521
  ];
53347
53522
  for (const templateRoot of templateRoots) {
53348
53523
  if (!await pathExistsOnDisk2(templateRoot)) {
53349
53524
  continue;
53350
53525
  }
53351
53526
  const [skillPlan, runYaml] = await Promise.all([
53352
- readFile24(path74.join(templateRoot, "SKILL_experiment.md"), "utf8"),
53353
- readFile24(path74.join(templateRoot, "run.yaml.mustache"), "utf8")
53527
+ readFile25(path75.join(templateRoot, "SKILL_experiment.md"), "utf8"),
53528
+ readFile25(path75.join(templateRoot, "run.yaml.mustache"), "utf8")
53354
53529
  ]);
53355
53530
  experimentTemplatesCache = { skillPlan, runYaml };
53356
53531
  return experimentTemplatesCache;
@@ -54044,8 +54219,8 @@ function registerExperimentCommand(program, container) {
54044
54219
  resources.logger.info(`Create: ${experimentPaths.displayExperimentsPath}`);
54045
54220
  }
54046
54221
  }
54047
- const runYamlPath = path74.join(experimentPaths.experimentsPath, "run.yaml");
54048
- const runYamlDisplayPath = path74.join(experimentPaths.displayExperimentsPath, "run.yaml");
54222
+ const runYamlPath = path75.join(experimentPaths.experimentsPath, "run.yaml");
54223
+ const runYamlDisplayPath = path75.join(experimentPaths.displayExperimentsPath, "run.yaml");
54049
54224
  if (!await pathExists6(container.fs, runYamlPath)) {
54050
54225
  if (flags.dryRun) {
54051
54226
  resources.logger.dryRun(`Would create: ${runYamlDisplayPath}`);
@@ -54508,9 +54683,9 @@ var init_launch2 = __esm({
54508
54683
  });
54509
54684
 
54510
54685
  // packages/memory/src/paths.ts
54511
- import path75 from "node:path";
54686
+ import path76 from "node:path";
54512
54687
  function resolveMemoryRoot(cwd) {
54513
- return path75.resolve(cwd, ".poe-code", "memory");
54688
+ return path76.resolve(cwd, ".poe-code", "memory");
54514
54689
  }
54515
54690
  function assertSafeRelPath(input) {
54516
54691
  const trimmed = input.trim();
@@ -54518,10 +54693,10 @@ function assertSafeRelPath(input) {
54518
54693
  throw new MemoryPathError("Expected a non-empty relative path.");
54519
54694
  }
54520
54695
  const slashNormalized = trimmed.replaceAll("\\", "/");
54521
- if (path75.posix.isAbsolute(slashNormalized) || path75.win32.isAbsolute(slashNormalized)) {
54696
+ if (path76.posix.isAbsolute(slashNormalized) || path76.win32.isAbsolute(slashNormalized)) {
54522
54697
  throw new MemoryPathError(`Expected a relative path, received absolute path "${input}".`);
54523
54698
  }
54524
- const normalized = path75.posix.normalize(slashNormalized);
54699
+ const normalized = path76.posix.normalize(slashNormalized);
54525
54700
  if (normalized === "." || normalized.length === 0) {
54526
54701
  throw new MemoryPathError("Expected a relative path to a file or directory.");
54527
54702
  }
@@ -54550,7 +54725,7 @@ var init_paths2 = __esm({
54550
54725
  });
54551
54726
 
54552
54727
  // packages/memory/src/resolve-root.ts
54553
- import path76 from "node:path";
54728
+ import path77 from "node:path";
54554
54729
  async function resolveConfiguredMemoryRoot(options) {
54555
54730
  const envOverride = options.env[MEMORY_ROOT_ENV_VAR]?.trim();
54556
54731
  if (envOverride && envOverride.length > 0) {
@@ -54567,7 +54742,7 @@ async function resolveConfiguredMemoryRoot(options) {
54567
54742
  return resolveMemoryRoot(options.cwd);
54568
54743
  }
54569
54744
  function resolveAgainstCwd(cwd, value) {
54570
- return path76.isAbsolute(value) ? value : path76.resolve(cwd, value);
54745
+ return path77.isAbsolute(value) ? value : path77.resolve(cwd, value);
54571
54746
  }
54572
54747
  var MEMORY_ROOT_ENV_VAR;
54573
54748
  var init_resolve_root = __esm({
@@ -54581,11 +54756,11 @@ var init_resolve_root = __esm({
54581
54756
 
54582
54757
  // packages/memory/src/init.ts
54583
54758
  import * as fs5 from "node:fs/promises";
54584
- import path77 from "node:path";
54759
+ import path78 from "node:path";
54585
54760
  async function initMemory(root) {
54586
- await fs5.mkdir(path77.join(root, MEMORY_PAGES_DIR_RELPATH), { recursive: true });
54587
- await writeFileIfMissing(path77.join(root, MEMORY_INDEX_RELPATH), "# Memory index\n");
54588
- await writeFileIfMissing(path77.join(root, MEMORY_LOG_RELPATH), "");
54761
+ await fs5.mkdir(path78.join(root, MEMORY_PAGES_DIR_RELPATH), { recursive: true });
54762
+ await writeFileIfMissing(path78.join(root, MEMORY_INDEX_RELPATH), "# Memory index\n");
54763
+ await writeFileIfMissing(path78.join(root, MEMORY_LOG_RELPATH), "");
54589
54764
  }
54590
54765
  async function writeFileIfMissing(filePath, content) {
54591
54766
  try {
@@ -54784,10 +54959,10 @@ function parseSources(value) {
54784
54959
  if (!isRecord22(item)) {
54785
54960
  throw new Error('Invalid "sources" frontmatter. Expected each source to be a string or object.');
54786
54961
  }
54787
- const path93 = readRequiredString(item.path, "sources[].path");
54962
+ const path94 = readRequiredString(item.path, "sources[].path");
54788
54963
  const startLine = readOptionalPositiveInteger(item.startLine, "sources[].startLine");
54789
54964
  const endLine = readOptionalPositiveInteger(item.endLine, "sources[].endLine");
54790
- return parseSourceRef(serializeSourceRef({ path: path93, ...startLine === void 0 ? {} : { startLine }, ...endLine === void 0 ? {} : { endLine } }));
54965
+ return parseSourceRef(serializeSourceRef({ path: path94, ...startLine === void 0 ? {} : { startLine }, ...endLine === void 0 ? {} : { endLine } }));
54791
54966
  });
54792
54967
  }
54793
54968
  function readOptionalString3(value, field) {
@@ -54831,7 +55006,7 @@ var init_frontmatter5 = __esm({
54831
55006
 
54832
55007
  // packages/memory/src/pages.ts
54833
55008
  import * as fs6 from "node:fs/promises";
54834
- import path78 from "node:path";
55009
+ import path79 from "node:path";
54835
55010
  async function listPages(root) {
54836
55011
  const relPaths = await collectMarkdownRelPaths(root, MEMORY_PAGES_DIR_RELPATH);
54837
55012
  const pages = await Promise.all(relPaths.map(async (relPath) => readPage(root, relPath)));
@@ -54839,7 +55014,7 @@ async function listPages(root) {
54839
55014
  }
54840
55015
  async function readPage(root, relPath) {
54841
55016
  const normalizedRelPath = assertMarkdownRelPath(relPath);
54842
- const absPath = path78.join(root, normalizedRelPath);
55017
+ const absPath = path79.join(root, normalizedRelPath);
54843
55018
  const [content, stat24] = await Promise.all([fs6.readFile(absPath, "utf8"), fs6.stat(absPath)]);
54844
55019
  try {
54845
55020
  const parsed = parseFrontmatter4(content);
@@ -54868,7 +55043,7 @@ async function collectMarkdownRelPaths(root, startRelPath = "") {
54868
55043
  return relPaths.sort((left, right) => left.localeCompare(right));
54869
55044
  }
54870
55045
  async function collectMarkdownRelPathsInto(root, currentRelPath, relPaths) {
54871
- const absPath = path78.join(root, currentRelPath);
55046
+ const absPath = path79.join(root, currentRelPath);
54872
55047
  let entryNames;
54873
55048
  try {
54874
55049
  entryNames = await fs6.readdir(absPath);
@@ -54879,8 +55054,8 @@ async function collectMarkdownRelPathsInto(root, currentRelPath, relPaths) {
54879
55054
  throw error2;
54880
55055
  }
54881
55056
  for (const entryName of entryNames.sort((left, right) => left.localeCompare(right))) {
54882
- const entryRelPath = currentRelPath.length === 0 ? entryName : path78.posix.join(currentRelPath, entryName);
54883
- const entryAbsPath = path78.join(root, entryRelPath);
55057
+ const entryRelPath = currentRelPath.length === 0 ? entryName : path79.posix.join(currentRelPath, entryName);
55058
+ const entryAbsPath = path79.join(root, entryRelPath);
54884
55059
  const entryStat = await fs6.stat(entryAbsPath);
54885
55060
  if (entryStat.isDirectory()) {
54886
55061
  if (entryName === MEMORY_CACHE_DIR_RELPATH) {
@@ -54910,7 +55085,7 @@ function assertMarkdownRelPath(relPath) {
54910
55085
  return normalizedRelPath;
54911
55086
  }
54912
55087
  function isMarkdownPath(relPath) {
54913
- return path78.posix.extname(relPath).toLowerCase() === ".md";
55088
+ return path79.posix.extname(relPath).toLowerCase() === ".md";
54914
55089
  }
54915
55090
  function isMissing(error2) {
54916
55091
  return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "ENOENT";
@@ -54925,7 +55100,7 @@ var init_pages = __esm({
54925
55100
 
54926
55101
  // packages/memory/src/search.ts
54927
55102
  import * as fs7 from "node:fs/promises";
54928
- import path79 from "node:path";
55103
+ import path80 from "node:path";
54929
55104
  async function searchMemory(root, query) {
54930
55105
  const normalizedQuery = query.trim();
54931
55106
  if (normalizedQuery.length === 0) {
@@ -54934,7 +55109,7 @@ async function searchMemory(root, query) {
54934
55109
  const relPaths = await collectMarkdownRelPaths(root);
54935
55110
  const hits = [];
54936
55111
  for (const relPath of relPaths) {
54937
- const content = await fs7.readFile(path79.join(root, relPath), "utf8");
55112
+ const content = await fs7.readFile(path80.join(root, relPath), "utf8");
54938
55113
  if (content.length === 0) {
54939
55114
  continue;
54940
55115
  }
@@ -54961,7 +55136,7 @@ var init_search = __esm({
54961
55136
 
54962
55137
  // packages/memory/src/status.ts
54963
55138
  import * as fs8 from "node:fs/promises";
54964
- import path80 from "node:path";
55139
+ import path81 from "node:path";
54965
55140
  async function statusOf(root) {
54966
55141
  if (!await pathExists7(root)) {
54967
55142
  return {
@@ -54978,7 +55153,7 @@ async function statusOf(root) {
54978
55153
  let totalBytes = 0;
54979
55154
  let lastWriteAtMs = Number.NEGATIVE_INFINITY;
54980
55155
  for (const relPath of markdownRelPaths) {
54981
- const stat24 = await fs8.stat(path80.join(root, relPath));
55156
+ const stat24 = await fs8.stat(path81.join(root, relPath));
54982
55157
  totalBytes += stat24.size;
54983
55158
  lastWriteAtMs = Math.max(lastWriteAtMs, stat24.mtimeMs);
54984
55159
  }
@@ -55010,7 +55185,7 @@ var init_status = __esm({
55010
55185
 
55011
55186
  // packages/memory/src/lock.ts
55012
55187
  import * as fsPromises20 from "node:fs/promises";
55013
- import path81 from "node:path";
55188
+ import path82 from "node:path";
55014
55189
  function createDefaultFs13() {
55015
55190
  return {
55016
55191
  readFile: (filePath, encoding) => fsPromises20.readFile(filePath, encoding),
@@ -55040,7 +55215,7 @@ function parsePid(input) {
55040
55215
  const pid = Number.parseInt(value, 10);
55041
55216
  return Number.isSafeInteger(pid) && pid > 0 ? pid : void 0;
55042
55217
  }
55043
- function isPidRunning(pid) {
55218
+ function isPidRunning2(pid) {
55044
55219
  try {
55045
55220
  process.kill(pid, 0);
55046
55221
  return true;
@@ -55069,12 +55244,12 @@ async function readLockPid(fs19, lockPath) {
55069
55244
  }
55070
55245
  async function withLock(root, run, options = {}) {
55071
55246
  const fs19 = options.fs ?? createDefaultFs13();
55072
- const lockPath = path81.join(root, MEMORY_LOCK_RELPATH);
55247
+ const lockPath = path82.join(root, MEMORY_LOCK_RELPATH);
55073
55248
  const pid = options.pid ?? process.pid;
55074
55249
  const retries = options.retries ?? 20;
55075
55250
  const minTimeoutMs = options.minTimeoutMs ?? 25;
55076
55251
  const maxTimeoutMs = options.maxTimeoutMs ?? 250;
55077
- const pidIsRunning = options.isPidRunning ?? isPidRunning;
55252
+ const pidIsRunning = options.isPidRunning ?? isPidRunning2;
55078
55253
  for (let attempt = 0; attempt <= retries; attempt += 1) {
55079
55254
  try {
55080
55255
  await fs19.writeFile(lockPath, `${pid}
@@ -55292,13 +55467,13 @@ var init_confidence = __esm({
55292
55467
  // packages/memory/src/reconcile.ts
55293
55468
  import { createHash } from "node:crypto";
55294
55469
  import * as fs9 from "node:fs/promises";
55295
- import path82 from "node:path";
55470
+ import path83 from "node:path";
55296
55471
  async function snapshot(root) {
55297
55472
  const pages = Object.fromEntries(
55298
55473
  await Promise.all(
55299
55474
  (await collectMarkdownRelPaths(root, MEMORY_PAGES_DIR_RELPATH)).map(async (relPath) => [
55300
55475
  relPath,
55301
- hashContent(await fs9.readFile(path82.join(root, relPath), "utf8"))
55476
+ hashContent(await fs9.readFile(path83.join(root, relPath), "utf8"))
55302
55477
  ])
55303
55478
  )
55304
55479
  );
@@ -55309,7 +55484,7 @@ async function reconcile(root, before, _verb, detail) {
55309
55484
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
55310
55485
  const currentPages = await Promise.all(
55311
55486
  (await collectMarkdownRelPaths(root, MEMORY_PAGES_DIR_RELPATH)).map(async (relPath) => {
55312
- const absPath = path82.join(root, relPath);
55487
+ const absPath = path83.join(root, relPath);
55313
55488
  const markdown = await fs9.readFile(absPath, "utf8");
55314
55489
  const parsed = parsePageMarkdown(relPath, markdown);
55315
55490
  const normalizedFrontmatter = withDenormalizedSources(parsed.frontmatter, parsed.body);
@@ -55331,7 +55506,7 @@ async function reconcile(root, before, _verb, detail) {
55331
55506
  })
55332
55507
  );
55333
55508
  await Promise.all(
55334
- currentPages.filter((page) => page.currentMarkdown !== page.nextMarkdown).map((page) => fs9.writeFile(path82.join(root, page.relPath), page.nextMarkdown, "utf8"))
55509
+ currentPages.filter((page) => page.currentMarkdown !== page.nextMarkdown).map((page) => fs9.writeFile(path83.join(root, page.relPath), page.nextMarkdown, "utf8"))
55335
55510
  );
55336
55511
  const diff2 = diffSnapshots(before, await snapshot(root));
55337
55512
  await writeIndex(root);
@@ -55361,7 +55536,7 @@ async function appendLogEntries(root, diff2, detail, timestamp = (/* @__PURE__ *
55361
55536
  if (entries.length === 0) {
55362
55537
  return;
55363
55538
  }
55364
- const logPath = path82.join(root, MEMORY_LOG_RELPATH);
55539
+ const logPath = path83.join(root, MEMORY_LOG_RELPATH);
55365
55540
  const existing = await fs9.readFile(logPath, "utf8");
55366
55541
  const separator = existing.length === 0 || existing.endsWith("\n") ? "" : "\n";
55367
55542
  await fs9.writeFile(logPath, `${existing}${separator}${entries.join("\n")}
@@ -55385,7 +55560,7 @@ async function writeIndex(root) {
55385
55560
  description: page.frontmatter.description ?? ""
55386
55561
  }))
55387
55562
  );
55388
- await fs9.writeFile(path82.join(root, MEMORY_INDEX_RELPATH), index, "utf8");
55563
+ await fs9.writeFile(path83.join(root, MEMORY_INDEX_RELPATH), index, "utf8");
55389
55564
  }
55390
55565
  function parsePageMarkdown(relPath, markdown) {
55391
55566
  try {
@@ -55437,14 +55612,14 @@ var init_reconcile = __esm({
55437
55612
 
55438
55613
  // packages/memory/src/write.ts
55439
55614
  import * as fs10 from "node:fs/promises";
55440
- import path83 from "node:path";
55615
+ import path84 from "node:path";
55441
55616
  async function writePage(root, relPath, body, opts) {
55442
55617
  const pageRelPath = assertPageRelPath(relPath);
55443
55618
  return withLock(root, async () => {
55444
55619
  const before = await snapshot(root);
55445
- await fs10.mkdir(path83.dirname(path83.join(root, pageRelPath)), { recursive: true });
55620
+ await fs10.mkdir(path84.dirname(path84.join(root, pageRelPath)), { recursive: true });
55446
55621
  await fs10.writeFile(
55447
- path83.join(root, pageRelPath),
55622
+ path84.join(root, pageRelPath),
55448
55623
  serializeFrontmatter(opts.frontmatter ?? {}, body),
55449
55624
  "utf8"
55450
55625
  );
@@ -55455,8 +55630,8 @@ async function appendToPage(root, relPath, content, opts) {
55455
55630
  const pageRelPath = assertPageRelPath(relPath);
55456
55631
  return withLock(root, async () => {
55457
55632
  const before = await snapshot(root);
55458
- const pagePath = path83.join(root, pageRelPath);
55459
- await fs10.mkdir(path83.dirname(pagePath), { recursive: true });
55633
+ const pagePath = path84.join(root, pageRelPath);
55634
+ await fs10.mkdir(path84.dirname(pagePath), { recursive: true });
55460
55635
  const existing = await readMarkdownIfPresent(pagePath);
55461
55636
  const parsed = existing === void 0 ? { frontmatter: {}, body: "" } : parseFrontmatter4(existing);
55462
55637
  await fs10.writeFile(
@@ -55478,7 +55653,7 @@ async function removeChildren(directoryPath) {
55478
55653
  if (entryName === MEMORY_LOCK_RELPATH) {
55479
55654
  continue;
55480
55655
  }
55481
- const entryPath = path83.join(directoryPath, entryName);
55656
+ const entryPath = path84.join(directoryPath, entryName);
55482
55657
  const stat24 = await fs10.stat(entryPath);
55483
55658
  if (stat24.isDirectory()) {
55484
55659
  await removeDirectory3(entryPath);
@@ -55495,7 +55670,7 @@ async function removeDirectory3(directoryPath) {
55495
55670
  }
55496
55671
  function assertPageRelPath(relPath) {
55497
55672
  const normalizedRelPath = assertSafeRelPath(relPath);
55498
- if (!normalizedRelPath.startsWith(`${MEMORY_PAGES_DIR_RELPATH}/`) || path83.posix.extname(normalizedRelPath).toLowerCase() !== ".md") {
55673
+ if (!normalizedRelPath.startsWith(`${MEMORY_PAGES_DIR_RELPATH}/`) || path84.posix.extname(normalizedRelPath).toLowerCase() !== ".md") {
55499
55674
  throw new Error(`Expected a markdown page path under "${MEMORY_PAGES_DIR_RELPATH}/".`);
55500
55675
  }
55501
55676
  return normalizedRelPath;
@@ -55523,7 +55698,7 @@ var init_write2 = __esm({
55523
55698
 
55524
55699
  // packages/memory/src/edit.ts
55525
55700
  import * as fs11 from "node:fs/promises";
55526
- import path84 from "node:path";
55701
+ import path85 from "node:path";
55527
55702
  var init_edit = __esm({
55528
55703
  "packages/memory/src/edit.ts"() {
55529
55704
  "use strict";
@@ -55534,7 +55709,7 @@ var init_edit = __esm({
55534
55709
 
55535
55710
  // packages/memory/src/audit.ts
55536
55711
  import * as fs12 from "node:fs/promises";
55537
- import path85 from "node:path";
55712
+ import path86 from "node:path";
55538
55713
  async function auditClaims(root, repoRoot, options = {}) {
55539
55714
  const minInferredConfidence = options.minInferredConfidence ?? DEFAULT_MIN_INFERRED_CONFIDENCE;
55540
55715
  const rejectUntagged = options.rejectUntagged ?? DEFAULT_REJECT_UNTAGGED;
@@ -55586,10 +55761,10 @@ async function auditSourceRef(source, claimLineNumber, repoRoot, sourceCache) {
55586
55761
  if (isUrlLike(source.path)) {
55587
55762
  return void 0;
55588
55763
  }
55589
- if (path85.isAbsolute(source.path)) {
55764
+ if (path86.isAbsolute(source.path)) {
55590
55765
  return `Claim on line ${claimLineNumber} cites "${serializeSourceRef(source)}", but source paths must be repo-relative or URLs.`;
55591
55766
  }
55592
- const absPath = path85.resolve(repoRoot, source.path);
55767
+ const absPath = path86.resolve(repoRoot, source.path);
55593
55768
  if (!isWithinRoot(repoRoot, absPath)) {
55594
55769
  return `Claim on line ${claimLineNumber} cites "${serializeSourceRef(source)}", which resolves outside the repo root.`;
55595
55770
  }
@@ -55655,8 +55830,8 @@ function isUrlLike(value) {
55655
55830
  return /^[a-z][a-z\d+.-]*:\/\//i.test(value);
55656
55831
  }
55657
55832
  function isWithinRoot(root, absPath) {
55658
- const relative = path85.relative(root, absPath);
55659
- return relative === "" || !relative.startsWith("..") && !path85.isAbsolute(relative);
55833
+ const relative = path86.relative(root, absPath);
55834
+ return relative === "" || !relative.startsWith("..") && !path86.isAbsolute(relative);
55660
55835
  }
55661
55836
  var DEFAULT_MIN_INFERRED_CONFIDENCE, DEFAULT_REJECT_UNTAGGED, DEFAULT_UNTAGGED_BODY_THRESHOLD_CHARS;
55662
55837
  var init_audit = __esm({
@@ -55674,7 +55849,7 @@ var init_audit = __esm({
55674
55849
  // packages/memory/src/cache.ts
55675
55850
  import { createHash as createHash2 } from "node:crypto";
55676
55851
  import * as fs13 from "node:fs/promises";
55677
- import path86 from "node:path";
55852
+ import path87 from "node:path";
55678
55853
  function computeIngestKey(input) {
55679
55854
  const hash = createHash2("sha256");
55680
55855
  hash.update(input.sourceBytes);
@@ -55687,7 +55862,7 @@ function computeIngestKey(input) {
55687
55862
  return hash.digest("hex");
55688
55863
  }
55689
55864
  async function readCacheEntry(root, key2) {
55690
- const cachePath = path86.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH, `${key2}.json`);
55865
+ const cachePath = path87.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH, `${key2}.json`);
55691
55866
  let raw;
55692
55867
  try {
55693
55868
  raw = await fs13.readFile(cachePath, "utf8");
@@ -55706,9 +55881,9 @@ async function readCacheEntry(root, key2) {
55706
55881
  }
55707
55882
  }
55708
55883
  async function writeCacheEntry(root, entry) {
55709
- await fs13.mkdir(path86.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH), { recursive: true });
55884
+ await fs13.mkdir(path87.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH), { recursive: true });
55710
55885
  await fs13.writeFile(
55711
- path86.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH, `${entry.key}.json`),
55886
+ path87.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH, `${entry.key}.json`),
55712
55887
  `${JSON.stringify(entry)}
55713
55888
  `,
55714
55889
  "utf8"
@@ -55824,9 +55999,9 @@ var init_tokenizer = __esm({
55824
55999
  });
55825
56000
 
55826
56001
  // packages/tokenfill/src/corpus.ts
55827
- import { readdirSync, readFileSync as readFileSync2 } from "node:fs";
56002
+ import { readdirSync, readFileSync as readFileSync3 } from "node:fs";
55828
56003
  import { dirname as dirname5, join as join5 } from "node:path";
55829
- import { fileURLToPath as fileURLToPath11 } from "node:url";
56004
+ import { fileURLToPath as fileURLToPath12 } from "node:url";
55830
56005
  function getCorpusFileNames() {
55831
56006
  return readdirSync(corpusDirectoryPath, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".md")).map((entry) => entry.name).sort((left, right) => left.localeCompare(right));
55832
56007
  }
@@ -55835,14 +56010,14 @@ function loadBuiltInCorpusArticles() {
55835
56010
  if (corpusFileNames.length === 0) {
55836
56011
  throw new Error(`No built-in corpus markdown files found in ${corpusDirectoryPath}`);
55837
56012
  }
55838
- return corpusFileNames.map((fileName) => readFileSync2(join5(corpusDirectoryPath, fileName), "utf8").trim());
56013
+ return corpusFileNames.map((fileName) => readFileSync3(join5(corpusDirectoryPath, fileName), "utf8").trim());
55839
56014
  }
55840
56015
  var CORPUS_ARTICLE_SEPARATOR, corpusDirectoryPath, BUILT_IN_CORPUS_ARTICLES;
55841
56016
  var init_corpus = __esm({
55842
56017
  "packages/tokenfill/src/corpus.ts"() {
55843
56018
  "use strict";
55844
56019
  CORPUS_ARTICLE_SEPARATOR = "\n\n";
55845
- corpusDirectoryPath = join5(dirname5(fileURLToPath11(import.meta.url)), "corpus");
56020
+ corpusDirectoryPath = join5(dirname5(fileURLToPath12(import.meta.url)), "corpus");
55846
56021
  BUILT_IN_CORPUS_ARTICLES = loadBuiltInCorpusArticles();
55847
56022
  }
55848
56023
  });
@@ -55870,7 +56045,7 @@ var init_src33 = __esm({
55870
56045
 
55871
56046
  // packages/memory/src/tokens.ts
55872
56047
  import * as fs14 from "node:fs/promises";
55873
- import path87 from "node:path";
56048
+ import path88 from "node:path";
55874
56049
  async function computeTokenStats(root) {
55875
56050
  if (!await pathExists8(root)) {
55876
56051
  return {
@@ -55892,11 +56067,11 @@ async function computeTokenStats(root) {
55892
56067
  }
55893
56068
  }
55894
56069
  }
55895
- const repoRoot = path87.resolve(root, "..", "..");
56070
+ const repoRoot = path88.resolve(root, "..", "..");
55896
56071
  let sourceTokens = 0;
55897
56072
  const missingSources = [];
55898
56073
  for (const sourcePath of sourcePaths) {
55899
- const absPath = path87.isAbsolute(sourcePath) ? sourcePath : path87.resolve(repoRoot, sourcePath);
56074
+ const absPath = path88.isAbsolute(sourcePath) ? sourcePath : path88.resolve(repoRoot, sourcePath);
55900
56075
  try {
55901
56076
  const content = await fs14.readFile(absPath, "utf8");
55902
56077
  sourceTokens += countTokens(content);
@@ -55941,7 +56116,7 @@ var init_tokens2 = __esm({
55941
56116
 
55942
56117
  // packages/memory/src/ingest.ts
55943
56118
  import * as fs15 from "node:fs/promises";
55944
- import path88 from "node:path";
56119
+ import path89 from "node:path";
55945
56120
  function resolveRunners2(overrides) {
55946
56121
  return {
55947
56122
  computeIngestKey: overrides?.computeIngestKey ?? computeIngestKey,
@@ -55955,10 +56130,10 @@ function resolveRunners2(overrides) {
55955
56130
  async function ingest(root, opts, runners) {
55956
56131
  const resolved = resolveRunners2(runners);
55957
56132
  const source = await materializeSource(opts.source);
55958
- const indexMdBytes = await fs15.readFile(path88.join(root, MEMORY_INDEX_RELPATH));
56133
+ const indexMdBytes = await fs15.readFile(path89.join(root, MEMORY_INDEX_RELPATH));
55959
56134
  const configOptions = {
55960
56135
  fs: fs15,
55961
- filePath: path88.join(inferRepoRoot(root), "poe-code.json")
56136
+ filePath: path89.join(inferRepoRoot(root), "poe-code.json")
55962
56137
  };
55963
56138
  const agentId = await resolveAgent(configOptions, opts.agent ?? null) ?? opts.agent ?? "claude-code";
55964
56139
  const key2 = resolved.computeIngestKey({
@@ -56048,7 +56223,7 @@ async function materializeSource(source) {
56048
56223
  throw new Error("URL ingest not implemented yet.");
56049
56224
  }
56050
56225
  function inferRepoRoot(root) {
56051
- return path88.resolve(root, "..", "..");
56226
+ return path89.resolve(root, "..", "..");
56052
56227
  }
56053
56228
  async function runWithTimeout(promise, timeoutMs) {
56054
56229
  return await new Promise((resolve2, reject) => {
@@ -56100,7 +56275,7 @@ var init_install3 = __esm({
56100
56275
 
56101
56276
  // packages/memory/src/query.ts
56102
56277
  import * as fs16 from "node:fs/promises";
56103
- import path89 from "node:path";
56278
+ import path90 from "node:path";
56104
56279
  async function queryMemory(root, options) {
56105
56280
  const pages = await listPages(root);
56106
56281
  if (pages.length === 0) {
@@ -56114,7 +56289,7 @@ async function queryMemory(root, options) {
56114
56289
  }
56115
56290
  const configOptions = {
56116
56291
  fs: fs16,
56117
- filePath: path89.join(inferRepoRoot2(root), "poe-code.json")
56292
+ filePath: path90.join(inferRepoRoot2(root), "poe-code.json")
56118
56293
  };
56119
56294
  const agentId = await resolveAgent(configOptions, options.agent ?? null) ?? options.agent ?? "claude-code";
56120
56295
  const context = await selectQueryContext(root, options.question, options.budget);
@@ -56129,7 +56304,7 @@ async function queryMemory(root, options) {
56129
56304
  }
56130
56305
  async function selectQueryContext(root, question, budget) {
56131
56306
  const [indexText, pages] = await Promise.all([
56132
- fs16.readFile(path89.join(root, MEMORY_INDEX_RELPATH), "utf8"),
56307
+ fs16.readFile(path90.join(root, MEMORY_INDEX_RELPATH), "utf8"),
56133
56308
  listPages(root)
56134
56309
  ]);
56135
56310
  const indexTokens = countTokens(indexText);
@@ -56208,7 +56383,7 @@ function tokenize2(text4) {
56208
56383
  return text4.toLowerCase().split(/[^a-z0-9]+/).filter((token) => token.length > 0);
56209
56384
  }
56210
56385
  function inferRepoRoot2(root) {
56211
- return path89.resolve(root, "..", "..");
56386
+ return path90.resolve(root, "..", "..");
56212
56387
  }
56213
56388
  var init_query = __esm({
56214
56389
  "packages/memory/src/query.ts"() {
@@ -56223,7 +56398,7 @@ var init_query = __esm({
56223
56398
 
56224
56399
  // packages/memory/src/explain.ts
56225
56400
  import * as fs17 from "node:fs/promises";
56226
- import path90 from "node:path";
56401
+ import path91 from "node:path";
56227
56402
  async function explainPage(root, options) {
56228
56403
  const targetPage = await readPageIfPresent(root, options.relPath);
56229
56404
  if (targetPage === void 0) {
@@ -56246,7 +56421,7 @@ async function explainPage(root, options) {
56246
56421
  }
56247
56422
  const configOptions = {
56248
56423
  fs: fs17,
56249
- filePath: path90.join(inferRepoRoot3(root), "poe-code.json")
56424
+ filePath: path91.join(inferRepoRoot3(root), "poe-code.json")
56250
56425
  };
56251
56426
  const agentId = await resolveAgent(configOptions, options.agent ?? null) ?? options.agent ?? "claude-code";
56252
56427
  const response = await spawn3(agentId, { prompt });
@@ -56295,7 +56470,7 @@ async function readPageIfPresent(root, relPath) {
56295
56470
  }
56296
56471
  }
56297
56472
  function inferRepoRoot3(root) {
56298
- return path90.resolve(root, "..", "..");
56473
+ return path91.resolve(root, "..", "..");
56299
56474
  }
56300
56475
  var init_explain = __esm({
56301
56476
  "packages/memory/src/explain.ts"() {
@@ -56317,9 +56492,9 @@ var init_explain_cli = __esm({
56317
56492
  });
56318
56493
 
56319
56494
  // packages/memory/src/handle.ts
56320
- import path91 from "node:path";
56495
+ import path92 from "node:path";
56321
56496
  function openMemory(opts) {
56322
- if (!path91.isAbsolute(opts.root)) {
56497
+ if (!path92.isAbsolute(opts.root)) {
56323
56498
  throw new Error(`openMemory: root must be absolute, got ${opts.root}`);
56324
56499
  }
56325
56500
  const root = opts.root;
@@ -56393,7 +56568,7 @@ var init_src34 = __esm({
56393
56568
  });
56394
56569
 
56395
56570
  // src/cli/commands/memory.ts
56396
- import path92 from "node:path";
56571
+ import path93 from "node:path";
56397
56572
  import * as fs18 from "node:fs/promises";
56398
56573
  async function resolveRoot(container) {
56399
56574
  return resolveConfiguredMemoryRoot({
@@ -56410,7 +56585,7 @@ function resolvePageRelPath(input) {
56410
56585
  throw new ValidationError("Missing page path.");
56411
56586
  }
56412
56587
  const normalized = trimmed.replaceAll("\\", "/");
56413
- const withExt = path92.posix.extname(normalized).length === 0 ? `${normalized}.md` : normalized;
56588
+ const withExt = path93.posix.extname(normalized).length === 0 ? `${normalized}.md` : normalized;
56414
56589
  return withExt.startsWith("pages/") ? withExt : `pages/${withExt}`;
56415
56590
  }
56416
56591
  function displayPageRelPath(relPath) {
@@ -56448,8 +56623,8 @@ function registerMemoryCommand(program, container) {
56448
56623
  }
56449
56624
  await initMemory(root);
56450
56625
  resources.context.complete({
56451
- success: `Initialized memory at ${path92.relative(container.env.cwd, root)}`,
56452
- dry: `Would initialize memory at ${path92.relative(container.env.cwd, root)}`
56626
+ success: `Initialized memory at ${path93.relative(container.env.cwd, root)}`,
56627
+ dry: `Would initialize memory at ${path93.relative(container.env.cwd, root)}`
56453
56628
  });
56454
56629
  resources.context.finalize();
56455
56630
  });
@@ -56481,7 +56656,7 @@ function registerMemoryCommand(program, container) {
56481
56656
  resources.logger.intro("memory show");
56482
56657
  await assertInitialized(mem);
56483
56658
  const relPath = resolvePageRelPath(pagePath);
56484
- const absPath = path92.join(mem.root, relPath);
56659
+ const absPath = path93.join(mem.root, relPath);
56485
56660
  try {
56486
56661
  const content = await fs18.readFile(absPath, "utf8");
56487
56662
  process.stdout.write(content.endsWith("\n") ? content : `${content}
@@ -56663,7 +56838,7 @@ var init_package2 = __esm({
56663
56838
  "package.json"() {
56664
56839
  package_default2 = {
56665
56840
  name: "poe-code",
56666
- version: "3.0.193",
56841
+ version: "3.0.195",
56667
56842
  description: "CLI tool to configure Poe API for developer workflows.",
56668
56843
  type: "module",
56669
56844
  main: "./dist/index.js",
@@ -56880,22 +57055,22 @@ function formatCommandHeader(cmd) {
56880
57055
  }
56881
57056
  return `Poe - ${parts.reverse().join(" ")}`;
56882
57057
  }
56883
- function findCommandByPath(root, path93) {
57058
+ function findCommandByPath(root, path94) {
56884
57059
  let current = root;
56885
- for (const segment of path93) {
57060
+ for (const segment of path94) {
56886
57061
  const next = current.commands.find(
56887
57062
  (command) => Reflect.get(command, "_hidden") !== true && command.name() === segment
56888
57063
  );
56889
57064
  if (!next) {
56890
- throw new Error(`Root help command is missing: ${path93.join(" ")}`);
57065
+ throw new Error(`Root help command is missing: ${path94.join(" ")}`);
56891
57066
  }
56892
57067
  current = next;
56893
57068
  }
56894
57069
  return current;
56895
57070
  }
56896
- function formatRootHelpCommandName(path93, command) {
57071
+ function formatRootHelpCommandName(path94, command) {
56897
57072
  const leaf = [command.name(), ...command.aliases()].join(", ");
56898
- return path93.length > 1 ? [...path93.slice(0, -1), leaf].join(" ") : leaf;
57073
+ return path94.length > 1 ? [...path94.slice(0, -1), leaf].join(" ") : leaf;
56899
57074
  }
56900
57075
  function splitUsageParts(usage) {
56901
57076
  return usage.split(" ").map((part) => part.trim()).filter((part) => part.length > 0);
@@ -57606,7 +57781,7 @@ init_config4();
57606
57781
  init_constants();
57607
57782
  init_errors2();
57608
57783
  import os8 from "node:os";
57609
- import path67 from "node:path";
57784
+ import path68 from "node:path";
57610
57785
  import fsPromises19 from "node:fs/promises";
57611
57786
  import { Command } from "commander";
57612
57787
  function parseMcpSpawnConfig(input) {
@@ -57678,10 +57853,10 @@ function resolveWorkingDirectory(baseDir, candidate) {
57678
57853
  if (!candidate || candidate.trim().length === 0) {
57679
57854
  return void 0;
57680
57855
  }
57681
- if (path67.isAbsolute(candidate)) {
57856
+ if (path68.isAbsolute(candidate)) {
57682
57857
  return candidate;
57683
57858
  }
57684
- return path67.resolve(baseDir, candidate);
57859
+ return path68.resolve(baseDir, candidate);
57685
57860
  }
57686
57861
  function configurePoeAgentRunOptions(command) {
57687
57862
  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(