poe-code 3.0.193 → 3.0.194

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,21 +24144,82 @@ 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;
24212
+ }
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);
24161
24221
  }
24222
+ return Date.now() - options.stat.mtimeMs > options.staleMs;
24162
24223
  }
24163
24224
  async function writeLockMetadata(handle) {
24164
24225
  try {
@@ -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,14 +45482,14 @@ 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, 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;
@@ -45509,9 +45652,9 @@ 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);
45655
+ function toCommanderOptionAttribute(path94, casing) {
45656
+ const optionAttribute = toOptionAttribute(path94, casing);
45657
+ const optionFlag = toOptionFlag(path94, casing);
45515
45658
  if (!GLOBAL_LONG_OPTION_FLAGS.has(optionFlag)) {
45516
45659
  return optionAttribute;
45517
45660
  }
@@ -46139,10 +46282,10 @@ function addGlobalOptions(command) {
46139
46282
  throw new InvalidArgumentError('Invalid value for "--output". Expected one of: rich, md, markdown, json.');
46140
46283
  }).option("--verbose", "Print stack traces for unexpected errors.");
46141
46284
  }
46142
- function setNestedValue(target, path93, value) {
46285
+ function setNestedValue(target, path94, value) {
46143
46286
  let cursor = target;
46144
- for (let index = 0; index < path93.length - 1; index += 1) {
46145
- const segment = path93[index] ?? "";
46287
+ for (let index = 0; index < path94.length - 1; index += 1) {
46288
+ const segment = path94[index] ?? "";
46146
46289
  const existing = cursor[segment];
46147
46290
  if (typeof existing === "object" && existing !== null) {
46148
46291
  cursor = existing;
@@ -46152,7 +46295,7 @@ function setNestedValue(target, path93, value) {
46152
46295
  cursor[segment] = next;
46153
46296
  cursor = next;
46154
46297
  }
46155
- const leaf = path93[path93.length - 1];
46298
+ const leaf = path94[path94.length - 1];
46156
46299
  if (leaf !== void 0) {
46157
46300
  cursor[leaf] = value;
46158
46301
  }
@@ -46249,13 +46392,13 @@ async function withOutputFormat2(output, fn) {
46249
46392
  }
46250
46393
  function createFs3() {
46251
46394
  return {
46252
- readFile: async (path93, encoding = "utf8") => readFile22(path93, { encoding }),
46253
- writeFile: async (path93, contents) => {
46254
- await writeFile15(path93, contents);
46395
+ readFile: async (path94, encoding = "utf8") => readFile23(path94, { encoding }),
46396
+ writeFile: async (path94, contents) => {
46397
+ await writeFile15(path94, contents);
46255
46398
  },
46256
- exists: async (path93) => {
46399
+ exists: async (path94) => {
46257
46400
  try {
46258
- await access4(path93);
46401
+ await access4(path94);
46259
46402
  return true;
46260
46403
  } catch {
46261
46404
  return false;
@@ -46276,9 +46419,9 @@ function isPlainObject5(value) {
46276
46419
  function hasFieldValue(value) {
46277
46420
  return value !== void 0;
46278
46421
  }
46279
- function hasNestedField(fields, path93) {
46422
+ function hasNestedField(fields, path94) {
46280
46423
  return fields.some(
46281
- (field) => path93.length < field.path.length && path93.every((segment, index) => field.path[index] === segment)
46424
+ (field) => path94.length < field.path.length && path94.every((segment, index) => field.path[index] === segment)
46282
46425
  );
46283
46426
  }
46284
46427
  function describeExpectedPresetValue(schema) {
@@ -46353,7 +46496,7 @@ function validatePresetFieldValue(value, field, presetPath) {
46353
46496
  async function loadPresetValues(fields, presetPath) {
46354
46497
  let rawPreset;
46355
46498
  try {
46356
- rawPreset = await readFile22(presetPath, {
46499
+ rawPreset = await readFile23(presetPath, {
46357
46500
  encoding: "utf8"
46358
46501
  });
46359
46502
  } catch (error2) {
@@ -46374,9 +46517,9 @@ async function loadPresetValues(fields, presetPath) {
46374
46517
  }
46375
46518
  const fieldByPath = new Map(fields.map((field) => [field.displayPath, field]));
46376
46519
  const presetValues = {};
46377
- function visitObject(current, path93) {
46520
+ function visitObject(current, path94) {
46378
46521
  for (const [key2, value] of Object.entries(current)) {
46379
- const nextPath = [...path93, key2];
46522
+ const nextPath = [...path94, key2];
46380
46523
  const displayPath2 = toDisplayPath3(nextPath);
46381
46524
  const field = fieldByPath.get(displayPath2);
46382
46525
  if (field !== void 0) {
@@ -46574,8 +46717,8 @@ function createFixtureService(definition) {
46574
46717
  );
46575
46718
  }
46576
46719
  function resolveFixturePath(commandPath) {
46577
- const parsed = path68.parse(commandPath);
46578
- return path68.join(parsed.dir, `${parsed.name}.fixture.json`);
46720
+ const parsed = path69.parse(commandPath);
46721
+ return path69.join(parsed.dir, `${parsed.name}.fixture.json`);
46579
46722
  }
46580
46723
  function selectFixtureScenario(scenarios, selector) {
46581
46724
  if (isNumericFixtureSelector(selector)) {
@@ -46602,7 +46745,7 @@ async function loadFixtureScenario(command, selector) {
46602
46745
  const fixturePath = resolveFixturePath(commandPath);
46603
46746
  let rawFixture;
46604
46747
  try {
46605
- rawFixture = await readFile22(fixturePath, {
46748
+ rawFixture = await readFile23(fixturePath, {
46606
46749
  encoding: "utf8"
46607
46750
  });
46608
46751
  } catch {
@@ -46698,8 +46841,8 @@ function validateServices2(services) {
46698
46841
  }
46699
46842
  }
46700
46843
  }
46701
- function getNestedValue(target, path93) {
46702
- return path93.reduce(
46844
+ function getNestedValue(target, path94) {
46845
+ return path94.reduce(
46703
46846
  (current, segment) => current !== null && typeof current === "object" ? current[segment] : void 0,
46704
46847
  target
46705
46848
  );
@@ -47233,6 +47376,7 @@ async function runCLI(roots, options = {}) {
47233
47376
  const casing = options.casing ?? "kebab";
47234
47377
  const services = options.services ?? {};
47235
47378
  const runtimeOptions = options.humanInLoop ?? {};
47379
+ const version = options.version ?? findEntrypointPackageMetadata(process.argv[1])?.version;
47236
47380
  const servicesWithBuiltIns = {
47237
47381
  ...services,
47238
47382
  runtimeOptions,
@@ -47243,7 +47387,7 @@ async function runCLI(roots, options = {}) {
47243
47387
  };
47244
47388
  validateServices2(services);
47245
47389
  if (hasHelpFlag(process.argv)) {
47246
- await renderGeneratedHelp(root, process.argv, options);
47390
+ await renderGeneratedHelp(root, process.argv, { ...options, version });
47247
47391
  return;
47248
47392
  }
47249
47393
  const program = new CommanderCommand();
@@ -47252,8 +47396,8 @@ async function runCLI(roots, options = {}) {
47252
47396
  program.showHelpAfterError();
47253
47397
  program.addHelpCommand(false);
47254
47398
  addGlobalOptions(program);
47255
- if (options.version !== void 0) {
47256
- program.version(options.version, "--version");
47399
+ if (version !== void 0) {
47400
+ program.version(version, "--version");
47257
47401
  }
47258
47402
  let lastActionCommand;
47259
47403
  const execute2 = async (state) => {
@@ -47291,6 +47435,7 @@ var init_cli = __esm({
47291
47435
  init_human_in_loop();
47292
47436
  init_mcp_proxy();
47293
47437
  init_number_schema();
47438
+ init_package_metadata();
47294
47439
  init_renderer3();
47295
47440
  RESERVED_SERVICE_NAMES2 = /* @__PURE__ */ new Set(["params", "secrets", "fetch", "fs", "env", "progress"]);
47296
47441
  NULL_OPTION_VALUE = /* @__PURE__ */ Symbol("toolcraft.cli.null");
@@ -47815,7 +47960,7 @@ var init_agent2 = __esm({
47815
47960
  });
47816
47961
 
47817
47962
  // src/cli/commands/spawn.ts
47818
- import path69 from "node:path";
47963
+ import path70 from "node:path";
47819
47964
  import { Option as Option2 } from "commander";
47820
47965
  function registerSpawnCommand(program, container, options = {}) {
47821
47966
  const spawnServices = container.registry.list().filter((service) => typeof service.spawn === "function" || getSpawnConfig(service.name));
@@ -48096,7 +48241,7 @@ async function resolvePromptInput(input, fs19, baseDir) {
48096
48241
  if (rawPath.length === 0) {
48097
48242
  throw new ValidationError("prompt @<path> requires a file path after '@'");
48098
48243
  }
48099
- const filePath = path69.isAbsolute(rawPath) ? rawPath : path69.join(baseDir, rawPath);
48244
+ const filePath = path70.isAbsolute(rawPath) ? rawPath : path70.join(baseDir, rawPath);
48100
48245
  try {
48101
48246
  const contents = await fs19.readFile(filePath, "utf8");
48102
48247
  return contents.trim();
@@ -48117,7 +48262,7 @@ async function resolveMcpSpawnInput(input, fs19, baseDir) {
48117
48262
  if (rawPath.length === 0) {
48118
48263
  throw new ValidationError("--mcp-servers @<path> requires a file path after '@'");
48119
48264
  }
48120
- const filePath = path69.isAbsolute(rawPath) ? rawPath : path69.join(baseDir, rawPath);
48265
+ const filePath = path70.isAbsolute(rawPath) ? rawPath : path70.join(baseDir, rawPath);
48121
48266
  try {
48122
48267
  return await fs19.readFile(filePath, "utf8");
48123
48268
  } catch (error2) {
@@ -49005,9 +49150,9 @@ var init_command_not_found = __esm({
49005
49150
 
49006
49151
  // src/cli/commands/utils-symlink-ops.ts
49007
49152
  import { dirname as dirname4 } from "node:path";
49008
- async function tryLstat(fs19, path93) {
49153
+ async function tryLstat(fs19, path94) {
49009
49154
  try {
49010
- return await fs19.lstat(path93);
49155
+ return await fs19.lstat(path94);
49011
49156
  } catch (error2) {
49012
49157
  if (isNotFound(error2)) {
49013
49158
  return null;
@@ -49058,13 +49203,13 @@ async function applySymlinkOps(fs19, ops, opts) {
49058
49203
  }
49059
49204
  return { conflicts };
49060
49205
  }
49061
- async function isSymlinkPointingTo(fs19, path93, expectedTarget) {
49206
+ async function isSymlinkPointingTo(fs19, path94, expectedTarget) {
49062
49207
  try {
49063
- const stats = await fs19.lstat(path93);
49208
+ const stats = await fs19.lstat(path94);
49064
49209
  if (!stats.isSymbolicLink()) {
49065
49210
  return false;
49066
49211
  }
49067
- return await fs19.readlink(path93) === expectedTarget;
49212
+ return await fs19.readlink(path94) === expectedTarget;
49068
49213
  } catch (error2) {
49069
49214
  if (isNotFound(error2)) {
49070
49215
  return false;
@@ -49542,7 +49687,7 @@ var init_media_download = __esm({
49542
49687
  });
49543
49688
 
49544
49689
  // src/cli/commands/generate.ts
49545
- import path70 from "node:path";
49690
+ import path71 from "node:path";
49546
49691
  function registerGenerateCommand(program, container) {
49547
49692
  const generate2 = program.command("generate").alias("g").description("Generate content via Poe API.").option("--model <model>", `Model identifier (default: ${DEFAULT_TEXT_MODEL})`).option(
49548
49693
  "--param <key=value>",
@@ -49815,11 +49960,11 @@ function getDefaultMimeType(type) {
49815
49960
  return defaults[type];
49816
49961
  }
49817
49962
  function resolveOutputPath(filename, cwd) {
49818
- if (path70.isAbsolute(filename)) {
49963
+ if (path71.isAbsolute(filename)) {
49819
49964
  return { path: filename, label: filename };
49820
49965
  }
49821
49966
  return {
49822
- path: path70.join(cwd, filename),
49967
+ path: path71.join(cwd, filename),
49823
49968
  label: `./${filename}`
49824
49969
  };
49825
49970
  }
@@ -50420,10 +50565,10 @@ var init_shapes = __esm({
50420
50565
  });
50421
50566
 
50422
50567
  // packages/agent-mcp-config/src/apply.ts
50423
- import path71 from "node:path";
50568
+ import path72 from "node:path";
50424
50569
  import { parse as parseYaml6, stringify as stringifyYaml3 } from "yaml";
50425
50570
  function getConfigDirectory(configPath) {
50426
- return path71.dirname(configPath);
50571
+ return path72.dirname(configPath);
50427
50572
  }
50428
50573
  function isConfigObject6(value) {
50429
50574
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -50443,9 +50588,9 @@ function expandHomePath(configPath, homeDir) {
50443
50588
  return homeDir;
50444
50589
  }
50445
50590
  if (configPath.startsWith("~/")) {
50446
- return path71.join(homeDir, configPath.slice(2));
50591
+ return path72.join(homeDir, configPath.slice(2));
50447
50592
  }
50448
- return path71.join(homeDir, configPath.slice(1));
50593
+ return path72.join(homeDir, configPath.slice(1));
50449
50594
  }
50450
50595
  function parseYamlDocument2(content) {
50451
50596
  if (content.trim() === "") {
@@ -50478,7 +50623,7 @@ async function writeYamlConfig(configPath, document, options) {
50478
50623
  return;
50479
50624
  }
50480
50625
  const absolutePath = expandHomePath(configPath, options.homeDir);
50481
- const configDir = path71.dirname(absolutePath);
50626
+ const configDir = path72.dirname(absolutePath);
50482
50627
  await options.fs.mkdir(configDir, { recursive: true });
50483
50628
  await options.fs.writeFile(absolutePath, serializeYamlDocument(document), {
50484
50629
  encoding: "utf8"
@@ -51757,9 +51902,9 @@ var init_dashboard_loop_shared = __esm({
51757
51902
  });
51758
51903
 
51759
51904
  // 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";
51905
+ import path73 from "node:path";
51906
+ import { readFile as readFile24, stat as stat18 } from "node:fs/promises";
51907
+ import { fileURLToPath as fileURLToPath10 } from "node:url";
51763
51908
  async function resolvePipelineCommandConfig(container) {
51764
51909
  const [configDoc, pipelineYamlConfig] = await Promise.all([
51765
51910
  readMergedDocument(
@@ -51816,11 +51961,11 @@ function resolveMaxRuns(value) {
51816
51961
  return parsed;
51817
51962
  }
51818
51963
  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);
51964
+ const absolutePath = sourcePath.startsWith("~/") ? path73.join(container.env.homeDir, sourcePath.slice(2)) : path73.isAbsolute(sourcePath) ? sourcePath : path73.resolve(container.env.cwd, sourcePath);
51820
51965
  return {
51821
51966
  absolutePath,
51822
51967
  relativePath: sourcePath,
51823
- title: path72.basename(sourcePath, path72.extname(sourcePath))
51968
+ title: path73.basename(sourcePath, path73.extname(sourcePath))
51824
51969
  };
51825
51970
  }
51826
51971
  function isActivityTimeoutError3(error2) {
@@ -52162,12 +52307,12 @@ async function runPipelineWithDashboard(options) {
52162
52307
  }
52163
52308
  }
52164
52309
  function resolvePipelinePaths(scope, cwd, homeDir) {
52165
- const rootPath = scope === "global" ? path72.join(homeDir, ".poe-code", "pipeline") : path72.join(cwd, ".poe-code", "pipeline");
52310
+ const rootPath = scope === "global" ? path73.join(homeDir, ".poe-code", "pipeline") : path73.join(cwd, ".poe-code", "pipeline");
52166
52311
  const displayRoot = scope === "global" ? "~/.poe-code/pipeline" : ".poe-code/pipeline";
52167
52312
  return {
52168
- plansPath: path72.join(rootPath, "plans"),
52169
- stepsPath: path72.join(rootPath, "steps.yaml"),
52170
- legacyDefaultStepsPath: path72.join(rootPath, "steps", "default.yaml"),
52313
+ plansPath: path73.join(rootPath, "plans"),
52314
+ stepsPath: path73.join(rootPath, "steps.yaml"),
52315
+ legacyDefaultStepsPath: path73.join(rootPath, "steps", "default.yaml"),
52171
52316
  displayPlansPath: `${displayRoot}/plans`,
52172
52317
  displayStepsPath: `${displayRoot}/steps.yaml`
52173
52318
  };
@@ -52176,18 +52321,18 @@ async function loadPipelineTemplates() {
52176
52321
  if (pipelineTemplatesCache) {
52177
52322
  return pipelineTemplatesCache;
52178
52323
  }
52179
- const packageRoot = await findPackageRoot3(fileURLToPath9(import.meta.url));
52324
+ const packageRoot = await findPackageRoot3(fileURLToPath10(import.meta.url));
52180
52325
  const templateRoots = [
52181
- path72.join(packageRoot, "src", "templates", "pipeline"),
52182
- path72.join(packageRoot, "dist", "templates", "pipeline")
52326
+ path73.join(packageRoot, "src", "templates", "pipeline"),
52327
+ path73.join(packageRoot, "dist", "templates", "pipeline")
52183
52328
  ];
52184
52329
  for (const templateRoot of templateRoots) {
52185
52330
  if (!await pathExistsOnDisk(templateRoot)) {
52186
52331
  continue;
52187
52332
  }
52188
52333
  const [skillPlan, steps] = await Promise.all([
52189
- readFile23(path72.join(templateRoot, "SKILL_plan.md"), "utf8"),
52190
- readFile23(path72.join(templateRoot, "steps.yaml.mustache"), "utf8")
52334
+ readFile24(path73.join(templateRoot, "SKILL_plan.md"), "utf8"),
52335
+ readFile24(path73.join(templateRoot, "steps.yaml.mustache"), "utf8")
52191
52336
  ]);
52192
52337
  pipelineTemplatesCache = { skillPlan, steps };
52193
52338
  return pipelineTemplatesCache;
@@ -52206,12 +52351,12 @@ async function pathExistsOnDisk(targetPath) {
52206
52351
  }
52207
52352
  }
52208
52353
  async function findPackageRoot3(entryFilePath) {
52209
- let currentPath = path72.dirname(entryFilePath);
52354
+ let currentPath = path73.dirname(entryFilePath);
52210
52355
  while (true) {
52211
- if (await pathExistsOnDisk(path72.join(currentPath, "package.json"))) {
52356
+ if (await pathExistsOnDisk(path73.join(currentPath, "package.json"))) {
52212
52357
  return currentPath;
52213
52358
  }
52214
- const parentPath = path72.dirname(currentPath);
52359
+ const parentPath = path73.dirname(currentPath);
52215
52360
  if (parentPath === currentPath) {
52216
52361
  throw new Error("Unable to locate package root for Pipeline templates.");
52217
52362
  }
@@ -52499,11 +52644,11 @@ function registerPipelineCommand(program, container) {
52499
52644
  if (typeof t.status === "string") return t.status === "done";
52500
52645
  return Object.values(t.status).every((s) => s === "done");
52501
52646
  }).length;
52502
- const readFile37 = container.fs.readFile.bind(container.fs);
52647
+ const readFile38 = container.fs.readFile.bind(container.fs);
52503
52648
  const resolvedVars = await resolvePipelineVars(
52504
52649
  plan.vars ?? {},
52505
52650
  container.env.cwd,
52506
- readFile37
52651
+ readFile38
52507
52652
  );
52508
52653
  const resolvedSetup = plan.setup === null ? void 0 : plan.setup ?? steps.setup;
52509
52654
  const resolvedTeardown = plan.teardown === null ? void 0 : plan.teardown ?? steps.teardown;
@@ -52525,7 +52670,7 @@ function registerPipelineCommand(program, container) {
52525
52670
  if (opts.preview) {
52526
52671
  if (resolvedSetup) {
52527
52672
  const raw = interpolatePipelineVars(resolvedSetup.prompt, resolvedVars, "setup");
52528
- const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile37);
52673
+ const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile38);
52529
52674
  resources.logger.resolved("setup", expanded);
52530
52675
  }
52531
52676
  for (const task of plan.tasks) {
@@ -52538,7 +52683,7 @@ function registerPipelineCommand(program, container) {
52538
52683
  vars: resolvedVars
52539
52684
  }),
52540
52685
  container.env.cwd,
52541
- readFile37
52686
+ readFile38
52542
52687
  );
52543
52688
  resources.logger.resolved(`task: ${task.id} \u2014 ${task.title}`, expanded);
52544
52689
  } else {
@@ -52551,7 +52696,7 @@ function registerPipelineCommand(program, container) {
52551
52696
  vars: resolvedVars
52552
52697
  }),
52553
52698
  container.env.cwd,
52554
- readFile37
52699
+ readFile38
52555
52700
  );
52556
52701
  resources.logger.resolved(`task: ${task.id} / ${stepName}`, expanded);
52557
52702
  }
@@ -52559,7 +52704,7 @@ function registerPipelineCommand(program, container) {
52559
52704
  }
52560
52705
  if (resolvedTeardown) {
52561
52706
  const raw = interpolatePipelineVars(resolvedTeardown.prompt, resolvedVars, "teardown");
52562
- const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile37);
52707
+ const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile38);
52563
52708
  resources.logger.resolved("teardown", expanded);
52564
52709
  }
52565
52710
  }
@@ -52676,7 +52821,7 @@ function registerPipelineCommand(program, container) {
52676
52821
  `Would ${stepsExists ? "overwrite" : "create"}: ${pipelinePaths.displayStepsPath}`
52677
52822
  );
52678
52823
  } else {
52679
- await container.fs.mkdir(path72.dirname(pipelinePaths.stepsPath), {
52824
+ await container.fs.mkdir(path73.dirname(pipelinePaths.stepsPath), {
52680
52825
  recursive: true
52681
52826
  });
52682
52827
  await container.fs.writeFile(pipelinePaths.stepsPath, templates.steps, {
@@ -52722,7 +52867,7 @@ var init_pipeline3 = __esm({
52722
52867
  });
52723
52868
 
52724
52869
  // src/cli/commands/ralph.ts
52725
- import path73 from "node:path";
52870
+ import path74 from "node:path";
52726
52871
  function formatRalphAgentSummary(agent2) {
52727
52872
  return Array.isArray(agent2) ? agent2.join(", ") : agent2;
52728
52873
  }
@@ -52903,9 +53048,9 @@ function normalizeConfiguredIterations(value) {
52903
53048
  }
52904
53049
  function resolveAbsoluteDocPath(container, docPath) {
52905
53050
  if (docPath.startsWith("~/")) {
52906
- return path73.join(container.env.homeDir, docPath.slice(2));
53051
+ return path74.join(container.env.homeDir, docPath.slice(2));
52907
53052
  }
52908
- return path73.isAbsolute(docPath) ? docPath : path73.resolve(container.env.cwd, docPath);
53053
+ return path74.isAbsolute(docPath) ? docPath : path74.resolve(container.env.cwd, docPath);
52909
53054
  }
52910
53055
  async function resolveRalphCommandConfig(container) {
52911
53056
  const configDoc = await readMergedDocument(
@@ -53300,11 +53445,11 @@ var init_ralph3 = __esm({
53300
53445
  });
53301
53446
 
53302
53447
  // 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";
53448
+ import path75 from "node:path";
53449
+ import { readFile as readFile25, stat as stat19 } from "node:fs/promises";
53450
+ import { fileURLToPath as fileURLToPath11 } from "node:url";
53306
53451
  function resolveExperimentPaths(scope, cwd, homeDir) {
53307
- const rootPath = scope === "global" ? path74.join(homeDir, ".poe-code", "experiments") : path74.join(cwd, ".poe-code", "experiments");
53452
+ const rootPath = scope === "global" ? path75.join(homeDir, ".poe-code", "experiments") : path75.join(cwd, ".poe-code", "experiments");
53308
53453
  const displayRoot = scope === "global" ? "~/.poe-code/experiments" : ".poe-code/experiments";
53309
53454
  return {
53310
53455
  experimentsPath: rootPath,
@@ -53323,12 +53468,12 @@ async function pathExistsOnDisk2(targetPath) {
53323
53468
  }
53324
53469
  }
53325
53470
  async function findPackageRoot4(entryFilePath) {
53326
- let currentPath = path74.dirname(entryFilePath);
53471
+ let currentPath = path75.dirname(entryFilePath);
53327
53472
  while (true) {
53328
- if (await pathExistsOnDisk2(path74.join(currentPath, "package.json"))) {
53473
+ if (await pathExistsOnDisk2(path75.join(currentPath, "package.json"))) {
53329
53474
  return currentPath;
53330
53475
  }
53331
- const parentPath = path74.dirname(currentPath);
53476
+ const parentPath = path75.dirname(currentPath);
53332
53477
  if (parentPath === currentPath) {
53333
53478
  throw new Error("Unable to locate package root for Experiment templates.");
53334
53479
  }
@@ -53339,18 +53484,18 @@ async function loadExperimentTemplates() {
53339
53484
  if (experimentTemplatesCache) {
53340
53485
  return experimentTemplatesCache;
53341
53486
  }
53342
- const packageRoot = await findPackageRoot4(fileURLToPath10(import.meta.url));
53487
+ const packageRoot = await findPackageRoot4(fileURLToPath11(import.meta.url));
53343
53488
  const templateRoots = [
53344
- path74.join(packageRoot, "src", "templates", "experiment"),
53345
- path74.join(packageRoot, "dist", "templates", "experiment")
53489
+ path75.join(packageRoot, "src", "templates", "experiment"),
53490
+ path75.join(packageRoot, "dist", "templates", "experiment")
53346
53491
  ];
53347
53492
  for (const templateRoot of templateRoots) {
53348
53493
  if (!await pathExistsOnDisk2(templateRoot)) {
53349
53494
  continue;
53350
53495
  }
53351
53496
  const [skillPlan, runYaml] = await Promise.all([
53352
- readFile24(path74.join(templateRoot, "SKILL_experiment.md"), "utf8"),
53353
- readFile24(path74.join(templateRoot, "run.yaml.mustache"), "utf8")
53497
+ readFile25(path75.join(templateRoot, "SKILL_experiment.md"), "utf8"),
53498
+ readFile25(path75.join(templateRoot, "run.yaml.mustache"), "utf8")
53354
53499
  ]);
53355
53500
  experimentTemplatesCache = { skillPlan, runYaml };
53356
53501
  return experimentTemplatesCache;
@@ -54044,8 +54189,8 @@ function registerExperimentCommand(program, container) {
54044
54189
  resources.logger.info(`Create: ${experimentPaths.displayExperimentsPath}`);
54045
54190
  }
54046
54191
  }
54047
- const runYamlPath = path74.join(experimentPaths.experimentsPath, "run.yaml");
54048
- const runYamlDisplayPath = path74.join(experimentPaths.displayExperimentsPath, "run.yaml");
54192
+ const runYamlPath = path75.join(experimentPaths.experimentsPath, "run.yaml");
54193
+ const runYamlDisplayPath = path75.join(experimentPaths.displayExperimentsPath, "run.yaml");
54049
54194
  if (!await pathExists6(container.fs, runYamlPath)) {
54050
54195
  if (flags.dryRun) {
54051
54196
  resources.logger.dryRun(`Would create: ${runYamlDisplayPath}`);
@@ -54508,9 +54653,9 @@ var init_launch2 = __esm({
54508
54653
  });
54509
54654
 
54510
54655
  // packages/memory/src/paths.ts
54511
- import path75 from "node:path";
54656
+ import path76 from "node:path";
54512
54657
  function resolveMemoryRoot(cwd) {
54513
- return path75.resolve(cwd, ".poe-code", "memory");
54658
+ return path76.resolve(cwd, ".poe-code", "memory");
54514
54659
  }
54515
54660
  function assertSafeRelPath(input) {
54516
54661
  const trimmed = input.trim();
@@ -54518,10 +54663,10 @@ function assertSafeRelPath(input) {
54518
54663
  throw new MemoryPathError("Expected a non-empty relative path.");
54519
54664
  }
54520
54665
  const slashNormalized = trimmed.replaceAll("\\", "/");
54521
- if (path75.posix.isAbsolute(slashNormalized) || path75.win32.isAbsolute(slashNormalized)) {
54666
+ if (path76.posix.isAbsolute(slashNormalized) || path76.win32.isAbsolute(slashNormalized)) {
54522
54667
  throw new MemoryPathError(`Expected a relative path, received absolute path "${input}".`);
54523
54668
  }
54524
- const normalized = path75.posix.normalize(slashNormalized);
54669
+ const normalized = path76.posix.normalize(slashNormalized);
54525
54670
  if (normalized === "." || normalized.length === 0) {
54526
54671
  throw new MemoryPathError("Expected a relative path to a file or directory.");
54527
54672
  }
@@ -54550,7 +54695,7 @@ var init_paths2 = __esm({
54550
54695
  });
54551
54696
 
54552
54697
  // packages/memory/src/resolve-root.ts
54553
- import path76 from "node:path";
54698
+ import path77 from "node:path";
54554
54699
  async function resolveConfiguredMemoryRoot(options) {
54555
54700
  const envOverride = options.env[MEMORY_ROOT_ENV_VAR]?.trim();
54556
54701
  if (envOverride && envOverride.length > 0) {
@@ -54567,7 +54712,7 @@ async function resolveConfiguredMemoryRoot(options) {
54567
54712
  return resolveMemoryRoot(options.cwd);
54568
54713
  }
54569
54714
  function resolveAgainstCwd(cwd, value) {
54570
- return path76.isAbsolute(value) ? value : path76.resolve(cwd, value);
54715
+ return path77.isAbsolute(value) ? value : path77.resolve(cwd, value);
54571
54716
  }
54572
54717
  var MEMORY_ROOT_ENV_VAR;
54573
54718
  var init_resolve_root = __esm({
@@ -54581,11 +54726,11 @@ var init_resolve_root = __esm({
54581
54726
 
54582
54727
  // packages/memory/src/init.ts
54583
54728
  import * as fs5 from "node:fs/promises";
54584
- import path77 from "node:path";
54729
+ import path78 from "node:path";
54585
54730
  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), "");
54731
+ await fs5.mkdir(path78.join(root, MEMORY_PAGES_DIR_RELPATH), { recursive: true });
54732
+ await writeFileIfMissing(path78.join(root, MEMORY_INDEX_RELPATH), "# Memory index\n");
54733
+ await writeFileIfMissing(path78.join(root, MEMORY_LOG_RELPATH), "");
54589
54734
  }
54590
54735
  async function writeFileIfMissing(filePath, content) {
54591
54736
  try {
@@ -54784,10 +54929,10 @@ function parseSources(value) {
54784
54929
  if (!isRecord22(item)) {
54785
54930
  throw new Error('Invalid "sources" frontmatter. Expected each source to be a string or object.');
54786
54931
  }
54787
- const path93 = readRequiredString(item.path, "sources[].path");
54932
+ const path94 = readRequiredString(item.path, "sources[].path");
54788
54933
  const startLine = readOptionalPositiveInteger(item.startLine, "sources[].startLine");
54789
54934
  const endLine = readOptionalPositiveInteger(item.endLine, "sources[].endLine");
54790
- return parseSourceRef(serializeSourceRef({ path: path93, ...startLine === void 0 ? {} : { startLine }, ...endLine === void 0 ? {} : { endLine } }));
54935
+ return parseSourceRef(serializeSourceRef({ path: path94, ...startLine === void 0 ? {} : { startLine }, ...endLine === void 0 ? {} : { endLine } }));
54791
54936
  });
54792
54937
  }
54793
54938
  function readOptionalString3(value, field) {
@@ -54831,7 +54976,7 @@ var init_frontmatter5 = __esm({
54831
54976
 
54832
54977
  // packages/memory/src/pages.ts
54833
54978
  import * as fs6 from "node:fs/promises";
54834
- import path78 from "node:path";
54979
+ import path79 from "node:path";
54835
54980
  async function listPages(root) {
54836
54981
  const relPaths = await collectMarkdownRelPaths(root, MEMORY_PAGES_DIR_RELPATH);
54837
54982
  const pages = await Promise.all(relPaths.map(async (relPath) => readPage(root, relPath)));
@@ -54839,7 +54984,7 @@ async function listPages(root) {
54839
54984
  }
54840
54985
  async function readPage(root, relPath) {
54841
54986
  const normalizedRelPath = assertMarkdownRelPath(relPath);
54842
- const absPath = path78.join(root, normalizedRelPath);
54987
+ const absPath = path79.join(root, normalizedRelPath);
54843
54988
  const [content, stat24] = await Promise.all([fs6.readFile(absPath, "utf8"), fs6.stat(absPath)]);
54844
54989
  try {
54845
54990
  const parsed = parseFrontmatter4(content);
@@ -54868,7 +55013,7 @@ async function collectMarkdownRelPaths(root, startRelPath = "") {
54868
55013
  return relPaths.sort((left, right) => left.localeCompare(right));
54869
55014
  }
54870
55015
  async function collectMarkdownRelPathsInto(root, currentRelPath, relPaths) {
54871
- const absPath = path78.join(root, currentRelPath);
55016
+ const absPath = path79.join(root, currentRelPath);
54872
55017
  let entryNames;
54873
55018
  try {
54874
55019
  entryNames = await fs6.readdir(absPath);
@@ -54879,8 +55024,8 @@ async function collectMarkdownRelPathsInto(root, currentRelPath, relPaths) {
54879
55024
  throw error2;
54880
55025
  }
54881
55026
  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);
55027
+ const entryRelPath = currentRelPath.length === 0 ? entryName : path79.posix.join(currentRelPath, entryName);
55028
+ const entryAbsPath = path79.join(root, entryRelPath);
54884
55029
  const entryStat = await fs6.stat(entryAbsPath);
54885
55030
  if (entryStat.isDirectory()) {
54886
55031
  if (entryName === MEMORY_CACHE_DIR_RELPATH) {
@@ -54910,7 +55055,7 @@ function assertMarkdownRelPath(relPath) {
54910
55055
  return normalizedRelPath;
54911
55056
  }
54912
55057
  function isMarkdownPath(relPath) {
54913
- return path78.posix.extname(relPath).toLowerCase() === ".md";
55058
+ return path79.posix.extname(relPath).toLowerCase() === ".md";
54914
55059
  }
54915
55060
  function isMissing(error2) {
54916
55061
  return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "ENOENT";
@@ -54925,7 +55070,7 @@ var init_pages = __esm({
54925
55070
 
54926
55071
  // packages/memory/src/search.ts
54927
55072
  import * as fs7 from "node:fs/promises";
54928
- import path79 from "node:path";
55073
+ import path80 from "node:path";
54929
55074
  async function searchMemory(root, query) {
54930
55075
  const normalizedQuery = query.trim();
54931
55076
  if (normalizedQuery.length === 0) {
@@ -54934,7 +55079,7 @@ async function searchMemory(root, query) {
54934
55079
  const relPaths = await collectMarkdownRelPaths(root);
54935
55080
  const hits = [];
54936
55081
  for (const relPath of relPaths) {
54937
- const content = await fs7.readFile(path79.join(root, relPath), "utf8");
55082
+ const content = await fs7.readFile(path80.join(root, relPath), "utf8");
54938
55083
  if (content.length === 0) {
54939
55084
  continue;
54940
55085
  }
@@ -54961,7 +55106,7 @@ var init_search = __esm({
54961
55106
 
54962
55107
  // packages/memory/src/status.ts
54963
55108
  import * as fs8 from "node:fs/promises";
54964
- import path80 from "node:path";
55109
+ import path81 from "node:path";
54965
55110
  async function statusOf(root) {
54966
55111
  if (!await pathExists7(root)) {
54967
55112
  return {
@@ -54978,7 +55123,7 @@ async function statusOf(root) {
54978
55123
  let totalBytes = 0;
54979
55124
  let lastWriteAtMs = Number.NEGATIVE_INFINITY;
54980
55125
  for (const relPath of markdownRelPaths) {
54981
- const stat24 = await fs8.stat(path80.join(root, relPath));
55126
+ const stat24 = await fs8.stat(path81.join(root, relPath));
54982
55127
  totalBytes += stat24.size;
54983
55128
  lastWriteAtMs = Math.max(lastWriteAtMs, stat24.mtimeMs);
54984
55129
  }
@@ -55010,7 +55155,7 @@ var init_status = __esm({
55010
55155
 
55011
55156
  // packages/memory/src/lock.ts
55012
55157
  import * as fsPromises20 from "node:fs/promises";
55013
- import path81 from "node:path";
55158
+ import path82 from "node:path";
55014
55159
  function createDefaultFs13() {
55015
55160
  return {
55016
55161
  readFile: (filePath, encoding) => fsPromises20.readFile(filePath, encoding),
@@ -55040,7 +55185,7 @@ function parsePid(input) {
55040
55185
  const pid = Number.parseInt(value, 10);
55041
55186
  return Number.isSafeInteger(pid) && pid > 0 ? pid : void 0;
55042
55187
  }
55043
- function isPidRunning(pid) {
55188
+ function isPidRunning2(pid) {
55044
55189
  try {
55045
55190
  process.kill(pid, 0);
55046
55191
  return true;
@@ -55069,12 +55214,12 @@ async function readLockPid(fs19, lockPath) {
55069
55214
  }
55070
55215
  async function withLock(root, run, options = {}) {
55071
55216
  const fs19 = options.fs ?? createDefaultFs13();
55072
- const lockPath = path81.join(root, MEMORY_LOCK_RELPATH);
55217
+ const lockPath = path82.join(root, MEMORY_LOCK_RELPATH);
55073
55218
  const pid = options.pid ?? process.pid;
55074
55219
  const retries = options.retries ?? 20;
55075
55220
  const minTimeoutMs = options.minTimeoutMs ?? 25;
55076
55221
  const maxTimeoutMs = options.maxTimeoutMs ?? 250;
55077
- const pidIsRunning = options.isPidRunning ?? isPidRunning;
55222
+ const pidIsRunning = options.isPidRunning ?? isPidRunning2;
55078
55223
  for (let attempt = 0; attempt <= retries; attempt += 1) {
55079
55224
  try {
55080
55225
  await fs19.writeFile(lockPath, `${pid}
@@ -55292,13 +55437,13 @@ var init_confidence = __esm({
55292
55437
  // packages/memory/src/reconcile.ts
55293
55438
  import { createHash } from "node:crypto";
55294
55439
  import * as fs9 from "node:fs/promises";
55295
- import path82 from "node:path";
55440
+ import path83 from "node:path";
55296
55441
  async function snapshot(root) {
55297
55442
  const pages = Object.fromEntries(
55298
55443
  await Promise.all(
55299
55444
  (await collectMarkdownRelPaths(root, MEMORY_PAGES_DIR_RELPATH)).map(async (relPath) => [
55300
55445
  relPath,
55301
- hashContent(await fs9.readFile(path82.join(root, relPath), "utf8"))
55446
+ hashContent(await fs9.readFile(path83.join(root, relPath), "utf8"))
55302
55447
  ])
55303
55448
  )
55304
55449
  );
@@ -55309,7 +55454,7 @@ async function reconcile(root, before, _verb, detail) {
55309
55454
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
55310
55455
  const currentPages = await Promise.all(
55311
55456
  (await collectMarkdownRelPaths(root, MEMORY_PAGES_DIR_RELPATH)).map(async (relPath) => {
55312
- const absPath = path82.join(root, relPath);
55457
+ const absPath = path83.join(root, relPath);
55313
55458
  const markdown = await fs9.readFile(absPath, "utf8");
55314
55459
  const parsed = parsePageMarkdown(relPath, markdown);
55315
55460
  const normalizedFrontmatter = withDenormalizedSources(parsed.frontmatter, parsed.body);
@@ -55331,7 +55476,7 @@ async function reconcile(root, before, _verb, detail) {
55331
55476
  })
55332
55477
  );
55333
55478
  await Promise.all(
55334
- currentPages.filter((page) => page.currentMarkdown !== page.nextMarkdown).map((page) => fs9.writeFile(path82.join(root, page.relPath), page.nextMarkdown, "utf8"))
55479
+ currentPages.filter((page) => page.currentMarkdown !== page.nextMarkdown).map((page) => fs9.writeFile(path83.join(root, page.relPath), page.nextMarkdown, "utf8"))
55335
55480
  );
55336
55481
  const diff2 = diffSnapshots(before, await snapshot(root));
55337
55482
  await writeIndex(root);
@@ -55361,7 +55506,7 @@ async function appendLogEntries(root, diff2, detail, timestamp = (/* @__PURE__ *
55361
55506
  if (entries.length === 0) {
55362
55507
  return;
55363
55508
  }
55364
- const logPath = path82.join(root, MEMORY_LOG_RELPATH);
55509
+ const logPath = path83.join(root, MEMORY_LOG_RELPATH);
55365
55510
  const existing = await fs9.readFile(logPath, "utf8");
55366
55511
  const separator = existing.length === 0 || existing.endsWith("\n") ? "" : "\n";
55367
55512
  await fs9.writeFile(logPath, `${existing}${separator}${entries.join("\n")}
@@ -55385,7 +55530,7 @@ async function writeIndex(root) {
55385
55530
  description: page.frontmatter.description ?? ""
55386
55531
  }))
55387
55532
  );
55388
- await fs9.writeFile(path82.join(root, MEMORY_INDEX_RELPATH), index, "utf8");
55533
+ await fs9.writeFile(path83.join(root, MEMORY_INDEX_RELPATH), index, "utf8");
55389
55534
  }
55390
55535
  function parsePageMarkdown(relPath, markdown) {
55391
55536
  try {
@@ -55437,14 +55582,14 @@ var init_reconcile = __esm({
55437
55582
 
55438
55583
  // packages/memory/src/write.ts
55439
55584
  import * as fs10 from "node:fs/promises";
55440
- import path83 from "node:path";
55585
+ import path84 from "node:path";
55441
55586
  async function writePage(root, relPath, body, opts) {
55442
55587
  const pageRelPath = assertPageRelPath(relPath);
55443
55588
  return withLock(root, async () => {
55444
55589
  const before = await snapshot(root);
55445
- await fs10.mkdir(path83.dirname(path83.join(root, pageRelPath)), { recursive: true });
55590
+ await fs10.mkdir(path84.dirname(path84.join(root, pageRelPath)), { recursive: true });
55446
55591
  await fs10.writeFile(
55447
- path83.join(root, pageRelPath),
55592
+ path84.join(root, pageRelPath),
55448
55593
  serializeFrontmatter(opts.frontmatter ?? {}, body),
55449
55594
  "utf8"
55450
55595
  );
@@ -55455,8 +55600,8 @@ async function appendToPage(root, relPath, content, opts) {
55455
55600
  const pageRelPath = assertPageRelPath(relPath);
55456
55601
  return withLock(root, async () => {
55457
55602
  const before = await snapshot(root);
55458
- const pagePath = path83.join(root, pageRelPath);
55459
- await fs10.mkdir(path83.dirname(pagePath), { recursive: true });
55603
+ const pagePath = path84.join(root, pageRelPath);
55604
+ await fs10.mkdir(path84.dirname(pagePath), { recursive: true });
55460
55605
  const existing = await readMarkdownIfPresent(pagePath);
55461
55606
  const parsed = existing === void 0 ? { frontmatter: {}, body: "" } : parseFrontmatter4(existing);
55462
55607
  await fs10.writeFile(
@@ -55478,7 +55623,7 @@ async function removeChildren(directoryPath) {
55478
55623
  if (entryName === MEMORY_LOCK_RELPATH) {
55479
55624
  continue;
55480
55625
  }
55481
- const entryPath = path83.join(directoryPath, entryName);
55626
+ const entryPath = path84.join(directoryPath, entryName);
55482
55627
  const stat24 = await fs10.stat(entryPath);
55483
55628
  if (stat24.isDirectory()) {
55484
55629
  await removeDirectory3(entryPath);
@@ -55495,7 +55640,7 @@ async function removeDirectory3(directoryPath) {
55495
55640
  }
55496
55641
  function assertPageRelPath(relPath) {
55497
55642
  const normalizedRelPath = assertSafeRelPath(relPath);
55498
- if (!normalizedRelPath.startsWith(`${MEMORY_PAGES_DIR_RELPATH}/`) || path83.posix.extname(normalizedRelPath).toLowerCase() !== ".md") {
55643
+ if (!normalizedRelPath.startsWith(`${MEMORY_PAGES_DIR_RELPATH}/`) || path84.posix.extname(normalizedRelPath).toLowerCase() !== ".md") {
55499
55644
  throw new Error(`Expected a markdown page path under "${MEMORY_PAGES_DIR_RELPATH}/".`);
55500
55645
  }
55501
55646
  return normalizedRelPath;
@@ -55523,7 +55668,7 @@ var init_write2 = __esm({
55523
55668
 
55524
55669
  // packages/memory/src/edit.ts
55525
55670
  import * as fs11 from "node:fs/promises";
55526
- import path84 from "node:path";
55671
+ import path85 from "node:path";
55527
55672
  var init_edit = __esm({
55528
55673
  "packages/memory/src/edit.ts"() {
55529
55674
  "use strict";
@@ -55534,7 +55679,7 @@ var init_edit = __esm({
55534
55679
 
55535
55680
  // packages/memory/src/audit.ts
55536
55681
  import * as fs12 from "node:fs/promises";
55537
- import path85 from "node:path";
55682
+ import path86 from "node:path";
55538
55683
  async function auditClaims(root, repoRoot, options = {}) {
55539
55684
  const minInferredConfidence = options.minInferredConfidence ?? DEFAULT_MIN_INFERRED_CONFIDENCE;
55540
55685
  const rejectUntagged = options.rejectUntagged ?? DEFAULT_REJECT_UNTAGGED;
@@ -55586,10 +55731,10 @@ async function auditSourceRef(source, claimLineNumber, repoRoot, sourceCache) {
55586
55731
  if (isUrlLike(source.path)) {
55587
55732
  return void 0;
55588
55733
  }
55589
- if (path85.isAbsolute(source.path)) {
55734
+ if (path86.isAbsolute(source.path)) {
55590
55735
  return `Claim on line ${claimLineNumber} cites "${serializeSourceRef(source)}", but source paths must be repo-relative or URLs.`;
55591
55736
  }
55592
- const absPath = path85.resolve(repoRoot, source.path);
55737
+ const absPath = path86.resolve(repoRoot, source.path);
55593
55738
  if (!isWithinRoot(repoRoot, absPath)) {
55594
55739
  return `Claim on line ${claimLineNumber} cites "${serializeSourceRef(source)}", which resolves outside the repo root.`;
55595
55740
  }
@@ -55655,8 +55800,8 @@ function isUrlLike(value) {
55655
55800
  return /^[a-z][a-z\d+.-]*:\/\//i.test(value);
55656
55801
  }
55657
55802
  function isWithinRoot(root, absPath) {
55658
- const relative = path85.relative(root, absPath);
55659
- return relative === "" || !relative.startsWith("..") && !path85.isAbsolute(relative);
55803
+ const relative = path86.relative(root, absPath);
55804
+ return relative === "" || !relative.startsWith("..") && !path86.isAbsolute(relative);
55660
55805
  }
55661
55806
  var DEFAULT_MIN_INFERRED_CONFIDENCE, DEFAULT_REJECT_UNTAGGED, DEFAULT_UNTAGGED_BODY_THRESHOLD_CHARS;
55662
55807
  var init_audit = __esm({
@@ -55674,7 +55819,7 @@ var init_audit = __esm({
55674
55819
  // packages/memory/src/cache.ts
55675
55820
  import { createHash as createHash2 } from "node:crypto";
55676
55821
  import * as fs13 from "node:fs/promises";
55677
- import path86 from "node:path";
55822
+ import path87 from "node:path";
55678
55823
  function computeIngestKey(input) {
55679
55824
  const hash = createHash2("sha256");
55680
55825
  hash.update(input.sourceBytes);
@@ -55687,7 +55832,7 @@ function computeIngestKey(input) {
55687
55832
  return hash.digest("hex");
55688
55833
  }
55689
55834
  async function readCacheEntry(root, key2) {
55690
- const cachePath = path86.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH, `${key2}.json`);
55835
+ const cachePath = path87.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH, `${key2}.json`);
55691
55836
  let raw;
55692
55837
  try {
55693
55838
  raw = await fs13.readFile(cachePath, "utf8");
@@ -55706,9 +55851,9 @@ async function readCacheEntry(root, key2) {
55706
55851
  }
55707
55852
  }
55708
55853
  async function writeCacheEntry(root, entry) {
55709
- await fs13.mkdir(path86.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH), { recursive: true });
55854
+ await fs13.mkdir(path87.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH), { recursive: true });
55710
55855
  await fs13.writeFile(
55711
- path86.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH, `${entry.key}.json`),
55856
+ path87.join(root, MEMORY_INGEST_CACHE_DIR_RELPATH, `${entry.key}.json`),
55712
55857
  `${JSON.stringify(entry)}
55713
55858
  `,
55714
55859
  "utf8"
@@ -55824,9 +55969,9 @@ var init_tokenizer = __esm({
55824
55969
  });
55825
55970
 
55826
55971
  // packages/tokenfill/src/corpus.ts
55827
- import { readdirSync, readFileSync as readFileSync2 } from "node:fs";
55972
+ import { readdirSync, readFileSync as readFileSync3 } from "node:fs";
55828
55973
  import { dirname as dirname5, join as join5 } from "node:path";
55829
- import { fileURLToPath as fileURLToPath11 } from "node:url";
55974
+ import { fileURLToPath as fileURLToPath12 } from "node:url";
55830
55975
  function getCorpusFileNames() {
55831
55976
  return readdirSync(corpusDirectoryPath, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".md")).map((entry) => entry.name).sort((left, right) => left.localeCompare(right));
55832
55977
  }
@@ -55835,14 +55980,14 @@ function loadBuiltInCorpusArticles() {
55835
55980
  if (corpusFileNames.length === 0) {
55836
55981
  throw new Error(`No built-in corpus markdown files found in ${corpusDirectoryPath}`);
55837
55982
  }
55838
- return corpusFileNames.map((fileName) => readFileSync2(join5(corpusDirectoryPath, fileName), "utf8").trim());
55983
+ return corpusFileNames.map((fileName) => readFileSync3(join5(corpusDirectoryPath, fileName), "utf8").trim());
55839
55984
  }
55840
55985
  var CORPUS_ARTICLE_SEPARATOR, corpusDirectoryPath, BUILT_IN_CORPUS_ARTICLES;
55841
55986
  var init_corpus = __esm({
55842
55987
  "packages/tokenfill/src/corpus.ts"() {
55843
55988
  "use strict";
55844
55989
  CORPUS_ARTICLE_SEPARATOR = "\n\n";
55845
- corpusDirectoryPath = join5(dirname5(fileURLToPath11(import.meta.url)), "corpus");
55990
+ corpusDirectoryPath = join5(dirname5(fileURLToPath12(import.meta.url)), "corpus");
55846
55991
  BUILT_IN_CORPUS_ARTICLES = loadBuiltInCorpusArticles();
55847
55992
  }
55848
55993
  });
@@ -55870,7 +56015,7 @@ var init_src33 = __esm({
55870
56015
 
55871
56016
  // packages/memory/src/tokens.ts
55872
56017
  import * as fs14 from "node:fs/promises";
55873
- import path87 from "node:path";
56018
+ import path88 from "node:path";
55874
56019
  async function computeTokenStats(root) {
55875
56020
  if (!await pathExists8(root)) {
55876
56021
  return {
@@ -55892,11 +56037,11 @@ async function computeTokenStats(root) {
55892
56037
  }
55893
56038
  }
55894
56039
  }
55895
- const repoRoot = path87.resolve(root, "..", "..");
56040
+ const repoRoot = path88.resolve(root, "..", "..");
55896
56041
  let sourceTokens = 0;
55897
56042
  const missingSources = [];
55898
56043
  for (const sourcePath of sourcePaths) {
55899
- const absPath = path87.isAbsolute(sourcePath) ? sourcePath : path87.resolve(repoRoot, sourcePath);
56044
+ const absPath = path88.isAbsolute(sourcePath) ? sourcePath : path88.resolve(repoRoot, sourcePath);
55900
56045
  try {
55901
56046
  const content = await fs14.readFile(absPath, "utf8");
55902
56047
  sourceTokens += countTokens(content);
@@ -55941,7 +56086,7 @@ var init_tokens2 = __esm({
55941
56086
 
55942
56087
  // packages/memory/src/ingest.ts
55943
56088
  import * as fs15 from "node:fs/promises";
55944
- import path88 from "node:path";
56089
+ import path89 from "node:path";
55945
56090
  function resolveRunners2(overrides) {
55946
56091
  return {
55947
56092
  computeIngestKey: overrides?.computeIngestKey ?? computeIngestKey,
@@ -55955,10 +56100,10 @@ function resolveRunners2(overrides) {
55955
56100
  async function ingest(root, opts, runners) {
55956
56101
  const resolved = resolveRunners2(runners);
55957
56102
  const source = await materializeSource(opts.source);
55958
- const indexMdBytes = await fs15.readFile(path88.join(root, MEMORY_INDEX_RELPATH));
56103
+ const indexMdBytes = await fs15.readFile(path89.join(root, MEMORY_INDEX_RELPATH));
55959
56104
  const configOptions = {
55960
56105
  fs: fs15,
55961
- filePath: path88.join(inferRepoRoot(root), "poe-code.json")
56106
+ filePath: path89.join(inferRepoRoot(root), "poe-code.json")
55962
56107
  };
55963
56108
  const agentId = await resolveAgent(configOptions, opts.agent ?? null) ?? opts.agent ?? "claude-code";
55964
56109
  const key2 = resolved.computeIngestKey({
@@ -56048,7 +56193,7 @@ async function materializeSource(source) {
56048
56193
  throw new Error("URL ingest not implemented yet.");
56049
56194
  }
56050
56195
  function inferRepoRoot(root) {
56051
- return path88.resolve(root, "..", "..");
56196
+ return path89.resolve(root, "..", "..");
56052
56197
  }
56053
56198
  async function runWithTimeout(promise, timeoutMs) {
56054
56199
  return await new Promise((resolve2, reject) => {
@@ -56100,7 +56245,7 @@ var init_install3 = __esm({
56100
56245
 
56101
56246
  // packages/memory/src/query.ts
56102
56247
  import * as fs16 from "node:fs/promises";
56103
- import path89 from "node:path";
56248
+ import path90 from "node:path";
56104
56249
  async function queryMemory(root, options) {
56105
56250
  const pages = await listPages(root);
56106
56251
  if (pages.length === 0) {
@@ -56114,7 +56259,7 @@ async function queryMemory(root, options) {
56114
56259
  }
56115
56260
  const configOptions = {
56116
56261
  fs: fs16,
56117
- filePath: path89.join(inferRepoRoot2(root), "poe-code.json")
56262
+ filePath: path90.join(inferRepoRoot2(root), "poe-code.json")
56118
56263
  };
56119
56264
  const agentId = await resolveAgent(configOptions, options.agent ?? null) ?? options.agent ?? "claude-code";
56120
56265
  const context = await selectQueryContext(root, options.question, options.budget);
@@ -56129,7 +56274,7 @@ async function queryMemory(root, options) {
56129
56274
  }
56130
56275
  async function selectQueryContext(root, question, budget) {
56131
56276
  const [indexText, pages] = await Promise.all([
56132
- fs16.readFile(path89.join(root, MEMORY_INDEX_RELPATH), "utf8"),
56277
+ fs16.readFile(path90.join(root, MEMORY_INDEX_RELPATH), "utf8"),
56133
56278
  listPages(root)
56134
56279
  ]);
56135
56280
  const indexTokens = countTokens(indexText);
@@ -56208,7 +56353,7 @@ function tokenize2(text4) {
56208
56353
  return text4.toLowerCase().split(/[^a-z0-9]+/).filter((token) => token.length > 0);
56209
56354
  }
56210
56355
  function inferRepoRoot2(root) {
56211
- return path89.resolve(root, "..", "..");
56356
+ return path90.resolve(root, "..", "..");
56212
56357
  }
56213
56358
  var init_query = __esm({
56214
56359
  "packages/memory/src/query.ts"() {
@@ -56223,7 +56368,7 @@ var init_query = __esm({
56223
56368
 
56224
56369
  // packages/memory/src/explain.ts
56225
56370
  import * as fs17 from "node:fs/promises";
56226
- import path90 from "node:path";
56371
+ import path91 from "node:path";
56227
56372
  async function explainPage(root, options) {
56228
56373
  const targetPage = await readPageIfPresent(root, options.relPath);
56229
56374
  if (targetPage === void 0) {
@@ -56246,7 +56391,7 @@ async function explainPage(root, options) {
56246
56391
  }
56247
56392
  const configOptions = {
56248
56393
  fs: fs17,
56249
- filePath: path90.join(inferRepoRoot3(root), "poe-code.json")
56394
+ filePath: path91.join(inferRepoRoot3(root), "poe-code.json")
56250
56395
  };
56251
56396
  const agentId = await resolveAgent(configOptions, options.agent ?? null) ?? options.agent ?? "claude-code";
56252
56397
  const response = await spawn3(agentId, { prompt });
@@ -56295,7 +56440,7 @@ async function readPageIfPresent(root, relPath) {
56295
56440
  }
56296
56441
  }
56297
56442
  function inferRepoRoot3(root) {
56298
- return path90.resolve(root, "..", "..");
56443
+ return path91.resolve(root, "..", "..");
56299
56444
  }
56300
56445
  var init_explain = __esm({
56301
56446
  "packages/memory/src/explain.ts"() {
@@ -56317,9 +56462,9 @@ var init_explain_cli = __esm({
56317
56462
  });
56318
56463
 
56319
56464
  // packages/memory/src/handle.ts
56320
- import path91 from "node:path";
56465
+ import path92 from "node:path";
56321
56466
  function openMemory(opts) {
56322
- if (!path91.isAbsolute(opts.root)) {
56467
+ if (!path92.isAbsolute(opts.root)) {
56323
56468
  throw new Error(`openMemory: root must be absolute, got ${opts.root}`);
56324
56469
  }
56325
56470
  const root = opts.root;
@@ -56393,7 +56538,7 @@ var init_src34 = __esm({
56393
56538
  });
56394
56539
 
56395
56540
  // src/cli/commands/memory.ts
56396
- import path92 from "node:path";
56541
+ import path93 from "node:path";
56397
56542
  import * as fs18 from "node:fs/promises";
56398
56543
  async function resolveRoot(container) {
56399
56544
  return resolveConfiguredMemoryRoot({
@@ -56410,7 +56555,7 @@ function resolvePageRelPath(input) {
56410
56555
  throw new ValidationError("Missing page path.");
56411
56556
  }
56412
56557
  const normalized = trimmed.replaceAll("\\", "/");
56413
- const withExt = path92.posix.extname(normalized).length === 0 ? `${normalized}.md` : normalized;
56558
+ const withExt = path93.posix.extname(normalized).length === 0 ? `${normalized}.md` : normalized;
56414
56559
  return withExt.startsWith("pages/") ? withExt : `pages/${withExt}`;
56415
56560
  }
56416
56561
  function displayPageRelPath(relPath) {
@@ -56448,8 +56593,8 @@ function registerMemoryCommand(program, container) {
56448
56593
  }
56449
56594
  await initMemory(root);
56450
56595
  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)}`
56596
+ success: `Initialized memory at ${path93.relative(container.env.cwd, root)}`,
56597
+ dry: `Would initialize memory at ${path93.relative(container.env.cwd, root)}`
56453
56598
  });
56454
56599
  resources.context.finalize();
56455
56600
  });
@@ -56481,7 +56626,7 @@ function registerMemoryCommand(program, container) {
56481
56626
  resources.logger.intro("memory show");
56482
56627
  await assertInitialized(mem);
56483
56628
  const relPath = resolvePageRelPath(pagePath);
56484
- const absPath = path92.join(mem.root, relPath);
56629
+ const absPath = path93.join(mem.root, relPath);
56485
56630
  try {
56486
56631
  const content = await fs18.readFile(absPath, "utf8");
56487
56632
  process.stdout.write(content.endsWith("\n") ? content : `${content}
@@ -56663,7 +56808,7 @@ var init_package2 = __esm({
56663
56808
  "package.json"() {
56664
56809
  package_default2 = {
56665
56810
  name: "poe-code",
56666
- version: "3.0.193",
56811
+ version: "3.0.194",
56667
56812
  description: "CLI tool to configure Poe API for developer workflows.",
56668
56813
  type: "module",
56669
56814
  main: "./dist/index.js",
@@ -56880,22 +57025,22 @@ function formatCommandHeader(cmd) {
56880
57025
  }
56881
57026
  return `Poe - ${parts.reverse().join(" ")}`;
56882
57027
  }
56883
- function findCommandByPath(root, path93) {
57028
+ function findCommandByPath(root, path94) {
56884
57029
  let current = root;
56885
- for (const segment of path93) {
57030
+ for (const segment of path94) {
56886
57031
  const next = current.commands.find(
56887
57032
  (command) => Reflect.get(command, "_hidden") !== true && command.name() === segment
56888
57033
  );
56889
57034
  if (!next) {
56890
- throw new Error(`Root help command is missing: ${path93.join(" ")}`);
57035
+ throw new Error(`Root help command is missing: ${path94.join(" ")}`);
56891
57036
  }
56892
57037
  current = next;
56893
57038
  }
56894
57039
  return current;
56895
57040
  }
56896
- function formatRootHelpCommandName(path93, command) {
57041
+ function formatRootHelpCommandName(path94, command) {
56897
57042
  const leaf = [command.name(), ...command.aliases()].join(", ");
56898
- return path93.length > 1 ? [...path93.slice(0, -1), leaf].join(" ") : leaf;
57043
+ return path94.length > 1 ? [...path94.slice(0, -1), leaf].join(" ") : leaf;
56899
57044
  }
56900
57045
  function splitUsageParts(usage) {
56901
57046
  return usage.split(" ").map((part) => part.trim()).filter((part) => part.length > 0);
@@ -57606,7 +57751,7 @@ init_config4();
57606
57751
  init_constants();
57607
57752
  init_errors2();
57608
57753
  import os8 from "node:os";
57609
- import path67 from "node:path";
57754
+ import path68 from "node:path";
57610
57755
  import fsPromises19 from "node:fs/promises";
57611
57756
  import { Command } from "commander";
57612
57757
  function parseMcpSpawnConfig(input) {
@@ -57678,10 +57823,10 @@ function resolveWorkingDirectory(baseDir, candidate) {
57678
57823
  if (!candidate || candidate.trim().length === 0) {
57679
57824
  return void 0;
57680
57825
  }
57681
- if (path67.isAbsolute(candidate)) {
57826
+ if (path68.isAbsolute(candidate)) {
57682
57827
  return candidate;
57683
57828
  }
57684
- return path67.resolve(baseDir, candidate);
57829
+ return path68.resolve(baseDir, candidate);
57685
57830
  }
57686
57831
  function configurePoeAgentRunOptions(command) {
57687
57832
  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(