poe-code 3.0.192 → 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 +718 -559
- package/dist/index.js.map +4 -4
- package/dist/providers/poe-agent.js +162 -71
- package/dist/providers/poe-agent.js.map +4 -4
- package/package.json +1 -1
|
@@ -609,8 +609,8 @@ function resourceNotFound(resource) {
|
|
|
609
609
|
`Resource not found: ${resource}`
|
|
610
610
|
);
|
|
611
611
|
}
|
|
612
|
-
function assertAbsolutePath(
|
|
613
|
-
if (!isAbsolute(
|
|
612
|
+
function assertAbsolutePath(path30) {
|
|
613
|
+
if (!isAbsolute(path30)) {
|
|
614
614
|
throw invalidParams('"path" must be an absolute path');
|
|
615
615
|
}
|
|
616
616
|
}
|
|
@@ -16843,21 +16843,21 @@ async function* adaptClaude(lines) {
|
|
|
16843
16843
|
if (blockType !== "tool_result") continue;
|
|
16844
16844
|
const kind = toolKindsById.get(item.tool_use_id);
|
|
16845
16845
|
toolKindsById.delete(item.tool_use_id);
|
|
16846
|
-
let
|
|
16846
|
+
let path30;
|
|
16847
16847
|
if (typeof item.content === "string") {
|
|
16848
|
-
|
|
16848
|
+
path30 = item.content;
|
|
16849
16849
|
} else {
|
|
16850
16850
|
try {
|
|
16851
|
-
|
|
16851
|
+
path30 = JSON.stringify(item.content);
|
|
16852
16852
|
} catch {
|
|
16853
|
-
|
|
16853
|
+
path30 = String(item.content);
|
|
16854
16854
|
}
|
|
16855
16855
|
}
|
|
16856
16856
|
yield {
|
|
16857
16857
|
event: "tool_complete",
|
|
16858
16858
|
id: item.tool_use_id,
|
|
16859
16859
|
kind,
|
|
16860
|
-
path:
|
|
16860
|
+
path: path30
|
|
16861
16861
|
};
|
|
16862
16862
|
}
|
|
16863
16863
|
}
|
|
@@ -16980,10 +16980,10 @@ async function* adaptCodex(lines) {
|
|
|
16980
16980
|
const kindFromStart = toolKindById.get(item.id);
|
|
16981
16981
|
const kind = kindFromStart ?? (itemType === "command_execution" ? "exec" : itemType === "file_edit" ? "edit" : "other");
|
|
16982
16982
|
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;
|
|
16983
|
-
const
|
|
16983
|
+
const path30 = titleFromEvent ?? toolTitleById.get(item.id) ?? "";
|
|
16984
16984
|
toolTitleById.delete(item.id);
|
|
16985
16985
|
toolKindById.delete(item.id);
|
|
16986
|
-
yield { event: "tool_complete", id: item.id, kind, path:
|
|
16986
|
+
yield { event: "tool_complete", id: item.id, kind, path: path30 };
|
|
16987
16987
|
}
|
|
16988
16988
|
}
|
|
16989
16989
|
}
|
|
@@ -17507,7 +17507,7 @@ function updateSessionFromEvent(ctx, event, toolCallsById) {
|
|
|
17507
17507
|
}
|
|
17508
17508
|
const id = readString(event.id);
|
|
17509
17509
|
const kind = readString(event.kind);
|
|
17510
|
-
const
|
|
17510
|
+
const path30 = readString(event.path);
|
|
17511
17511
|
let toolCall = id ? toolCallsById.get(id) : void 0;
|
|
17512
17512
|
if (!toolCall) {
|
|
17513
17513
|
toolCall = {};
|
|
@@ -17522,8 +17522,8 @@ function updateSessionFromEvent(ctx, event, toolCallsById) {
|
|
|
17522
17522
|
if (kind) {
|
|
17523
17523
|
toolCall.kind = kind;
|
|
17524
17524
|
}
|
|
17525
|
-
if (
|
|
17526
|
-
toolCall.path =
|
|
17525
|
+
if (path30) {
|
|
17526
|
+
toolCall.path = path30;
|
|
17527
17527
|
}
|
|
17528
17528
|
}
|
|
17529
17529
|
var sessionCapture;
|
|
@@ -18183,11 +18183,11 @@ function stripBom(content) {
|
|
|
18183
18183
|
function mergeLayers(layers) {
|
|
18184
18184
|
return mergeObjectLayers(layers, []);
|
|
18185
18185
|
}
|
|
18186
|
-
function mergeObjectLayers(layers,
|
|
18186
|
+
function mergeObjectLayers(layers, path30) {
|
|
18187
18187
|
const data = {};
|
|
18188
18188
|
const sources = {};
|
|
18189
18189
|
for (const key2 of collectKeys(layers)) {
|
|
18190
|
-
const resolved = resolveKey(layers, key2,
|
|
18190
|
+
const resolved = resolveKey(layers, key2, path30);
|
|
18191
18191
|
if (resolved === void 0) {
|
|
18192
18192
|
continue;
|
|
18193
18193
|
}
|
|
@@ -18205,7 +18205,7 @@ function collectKeys(layers) {
|
|
|
18205
18205
|
}
|
|
18206
18206
|
return [...keys];
|
|
18207
18207
|
}
|
|
18208
|
-
function resolveKey(layers, key2,
|
|
18208
|
+
function resolveKey(layers, key2, path30) {
|
|
18209
18209
|
let winningSource;
|
|
18210
18210
|
let winningValue;
|
|
18211
18211
|
const objectLayers = [];
|
|
@@ -18235,9 +18235,9 @@ function resolveKey(layers, key2, path29) {
|
|
|
18235
18235
|
if (winningSource === void 0) {
|
|
18236
18236
|
return void 0;
|
|
18237
18237
|
}
|
|
18238
|
-
const fullPath = buildPath(
|
|
18238
|
+
const fullPath = buildPath(path30, key2);
|
|
18239
18239
|
if (isPlainObject(winningValue)) {
|
|
18240
|
-
const merged = mergeObjectLayers(objectLayers, [...
|
|
18240
|
+
const merged = mergeObjectLayers(objectLayers, [...path30, key2]);
|
|
18241
18241
|
return {
|
|
18242
18242
|
value: merged.data,
|
|
18243
18243
|
sources: {
|
|
@@ -18262,8 +18262,8 @@ function isWinningCandidate(key2, value) {
|
|
|
18262
18262
|
}
|
|
18263
18263
|
return true;
|
|
18264
18264
|
}
|
|
18265
|
-
function buildPath(
|
|
18266
|
-
return [...
|
|
18265
|
+
function buildPath(path30, key2) {
|
|
18266
|
+
return [...path30, key2].join(".");
|
|
18267
18267
|
}
|
|
18268
18268
|
function isPlainObject(value) {
|
|
18269
18269
|
if (value === null || Array.isArray(value) || typeof value !== "object") {
|
|
@@ -18858,16 +18858,16 @@ function getConfigFormat(pathOrFormat) {
|
|
|
18858
18858
|
}
|
|
18859
18859
|
return formatRegistry[formatName];
|
|
18860
18860
|
}
|
|
18861
|
-
function detectFormat2(
|
|
18862
|
-
const ext = getExtension(
|
|
18861
|
+
function detectFormat2(path30) {
|
|
18862
|
+
const ext = getExtension(path30);
|
|
18863
18863
|
return extensionMap[ext];
|
|
18864
18864
|
}
|
|
18865
|
-
function getExtension(
|
|
18866
|
-
const lastDot =
|
|
18865
|
+
function getExtension(path30) {
|
|
18866
|
+
const lastDot = path30.lastIndexOf(".");
|
|
18867
18867
|
if (lastDot === -1) {
|
|
18868
18868
|
return "";
|
|
18869
18869
|
}
|
|
18870
|
-
return
|
|
18870
|
+
return path30.slice(lastDot).toLowerCase();
|
|
18871
18871
|
}
|
|
18872
18872
|
|
|
18873
18873
|
// packages/config-mutations/src/execution/path-utils.ts
|
|
@@ -19926,7 +19926,7 @@ function createInstallRunner(definition) {
|
|
|
19926
19926
|
}
|
|
19927
19927
|
|
|
19928
19928
|
// src/services/config.ts
|
|
19929
|
-
import
|
|
19929
|
+
import path29 from "node:path";
|
|
19930
19930
|
init_src8();
|
|
19931
19931
|
|
|
19932
19932
|
// packages/superintendent/src/document/parse.ts
|
|
@@ -19944,6 +19944,17 @@ function parseSuperintendentDoc(filePath, content) {
|
|
|
19944
19944
|
frontmatter: parseFrontmatter(resolvedFilePath, parsedFrontmatter)
|
|
19945
19945
|
};
|
|
19946
19946
|
}
|
|
19947
|
+
function readExplicitBuilderAgent(filePath, content) {
|
|
19948
|
+
const resolvedFilePath = path17.resolve(filePath);
|
|
19949
|
+
const { frontmatterText } = splitFrontmatter(resolvedFilePath, content);
|
|
19950
|
+
const parsedFrontmatter = parseYamlFrontmatter(resolvedFilePath, frontmatterText);
|
|
19951
|
+
const frontmatter = expectRecord(parsedFrontmatter, "frontmatter", resolvedFilePath);
|
|
19952
|
+
if (frontmatter.builder === void 0) {
|
|
19953
|
+
return void 0;
|
|
19954
|
+
}
|
|
19955
|
+
const builder = expectRecord(frontmatter.builder, "builder", resolvedFilePath);
|
|
19956
|
+
return builder.agent === void 0 ? void 0 : expectString(builder.agent, "builder.agent", resolvedFilePath);
|
|
19957
|
+
}
|
|
19947
19958
|
function splitFrontmatter(filePath, content) {
|
|
19948
19959
|
const normalizedContent = content.startsWith("\uFEFF") ? content.slice(1) : content;
|
|
19949
19960
|
const openingLineBreak = readOpeningLineBreak(normalizedContent);
|
|
@@ -20480,22 +20491,83 @@ function backoff(attempt, minTimeout, maxTimeout) {
|
|
|
20480
20491
|
function hasErrorCode(error2, code) {
|
|
20481
20492
|
return !!error2 && typeof error2 === "object" && "code" in error2 && error2.code === code;
|
|
20482
20493
|
}
|
|
20494
|
+
function hasAnyErrorCode(error2, codes) {
|
|
20495
|
+
return codes.some((code) => hasErrorCode(error2, code));
|
|
20496
|
+
}
|
|
20497
|
+
function isPidRunning(pid) {
|
|
20498
|
+
try {
|
|
20499
|
+
process.kill(pid, 0);
|
|
20500
|
+
return true;
|
|
20501
|
+
} catch (error2) {
|
|
20502
|
+
return !hasErrorCode(error2, "ESRCH");
|
|
20503
|
+
}
|
|
20504
|
+
}
|
|
20483
20505
|
function createDefaultFs() {
|
|
20484
20506
|
return {
|
|
20485
|
-
open: (
|
|
20507
|
+
open: (path30, flags) => fsPromises5.open(path30, flags),
|
|
20508
|
+
readFile: (path30, encoding) => fsPromises5.readFile(path30, encoding),
|
|
20486
20509
|
stat: fsPromises5.stat,
|
|
20487
20510
|
unlink: fsPromises5.unlink
|
|
20488
20511
|
};
|
|
20489
20512
|
}
|
|
20490
|
-
async function removeLockFile(fs4, lockPath) {
|
|
20513
|
+
async function removeLockFile(fs4, lockPath, signal) {
|
|
20514
|
+
for (let attempt = 0; attempt <= 4; attempt += 1) {
|
|
20515
|
+
throwIfAborted(signal);
|
|
20516
|
+
try {
|
|
20517
|
+
await fs4.unlink(lockPath);
|
|
20518
|
+
return;
|
|
20519
|
+
} catch (error2) {
|
|
20520
|
+
if (hasErrorCode(error2, "ENOENT")) {
|
|
20521
|
+
return;
|
|
20522
|
+
}
|
|
20523
|
+
if (!hasAnyErrorCode(error2, ["EPERM", "EBUSY"]) || attempt === 4) {
|
|
20524
|
+
throw error2;
|
|
20525
|
+
}
|
|
20526
|
+
}
|
|
20527
|
+
await sleep(25 * 2 ** attempt, signal);
|
|
20528
|
+
}
|
|
20529
|
+
}
|
|
20530
|
+
function parseLockMetadata(content) {
|
|
20531
|
+
try {
|
|
20532
|
+
const parsed = JSON.parse(content);
|
|
20533
|
+
if (!parsed || typeof parsed !== "object" || !("host" in parsed) || !("pid" in parsed)) {
|
|
20534
|
+
return void 0;
|
|
20535
|
+
}
|
|
20536
|
+
const { host, pid } = parsed;
|
|
20537
|
+
if (typeof host === "string" && typeof pid === "number" && Number.isSafeInteger(pid) && pid > 0) {
|
|
20538
|
+
return {
|
|
20539
|
+
host,
|
|
20540
|
+
pid
|
|
20541
|
+
};
|
|
20542
|
+
}
|
|
20543
|
+
} catch (ignoredError) {
|
|
20544
|
+
void ignoredError;
|
|
20545
|
+
}
|
|
20546
|
+
return void 0;
|
|
20547
|
+
}
|
|
20548
|
+
async function readLockMetadata(fs4, lockPath) {
|
|
20549
|
+
if (!fs4.readFile) {
|
|
20550
|
+
return void 0;
|
|
20551
|
+
}
|
|
20491
20552
|
try {
|
|
20492
|
-
await fs4.
|
|
20553
|
+
return parseLockMetadata(await fs4.readFile(lockPath, "utf8"));
|
|
20493
20554
|
} catch (error2) {
|
|
20494
|
-
if (
|
|
20495
|
-
|
|
20555
|
+
if (hasErrorCode(error2, "ENOENT")) {
|
|
20556
|
+
return null;
|
|
20496
20557
|
}
|
|
20558
|
+
return void 0;
|
|
20497
20559
|
}
|
|
20498
20560
|
}
|
|
20561
|
+
async function shouldReclaimLock(options) {
|
|
20562
|
+
const metadata = await readLockMetadata(options.fs, options.lockPath);
|
|
20563
|
+
if (metadata === null) {
|
|
20564
|
+
return "missing";
|
|
20565
|
+
}
|
|
20566
|
+
if (metadata?.host === os2.hostname()) {
|
|
20567
|
+
return !options.isPidRunning(metadata.pid);
|
|
20568
|
+
}
|
|
20569
|
+
return Date.now() - options.stat.mtimeMs > options.staleMs;
|
|
20570
|
+
}
|
|
20499
20571
|
async function writeLockMetadata(handle) {
|
|
20500
20572
|
try {
|
|
20501
20573
|
await handle.writeFile(
|
|
@@ -20516,7 +20588,8 @@ async function acquireFileLock(filePath, options = {}) {
|
|
|
20516
20588
|
const retries = options.retries ?? 20;
|
|
20517
20589
|
const minTimeout = options.minTimeout ?? 25;
|
|
20518
20590
|
const maxTimeout = options.maxTimeout ?? 250;
|
|
20519
|
-
const staleMs = options.staleMs ??
|
|
20591
|
+
const staleMs = options.staleMs ?? 1e3;
|
|
20592
|
+
const pidIsRunning = options.isPidRunning ?? isPidRunning;
|
|
20520
20593
|
const lockPath = `${filePath}.lock`;
|
|
20521
20594
|
let attempt = 0;
|
|
20522
20595
|
while (attempt <= retries) {
|
|
@@ -20530,7 +20603,7 @@ async function acquireFileLock(filePath, options = {}) {
|
|
|
20530
20603
|
return;
|
|
20531
20604
|
}
|
|
20532
20605
|
released = true;
|
|
20533
|
-
await removeLockFile(fs4, lockPath);
|
|
20606
|
+
await removeLockFile(fs4, lockPath, options.signal);
|
|
20534
20607
|
};
|
|
20535
20608
|
} catch (error2) {
|
|
20536
20609
|
if (!hasErrorCode(error2, "EEXIST")) {
|
|
@@ -20546,8 +20619,18 @@ async function acquireFileLock(filePath, options = {}) {
|
|
|
20546
20619
|
}
|
|
20547
20620
|
throw statError;
|
|
20548
20621
|
}
|
|
20549
|
-
|
|
20550
|
-
|
|
20622
|
+
const reclaimLock = await shouldReclaimLock({
|
|
20623
|
+
fs: fs4,
|
|
20624
|
+
isPidRunning: pidIsRunning,
|
|
20625
|
+
lockPath,
|
|
20626
|
+
staleMs,
|
|
20627
|
+
stat: stat7
|
|
20628
|
+
});
|
|
20629
|
+
if (reclaimLock === "missing") {
|
|
20630
|
+
continue;
|
|
20631
|
+
}
|
|
20632
|
+
if (reclaimLock) {
|
|
20633
|
+
await removeLockFile(fs4, lockPath, options.signal);
|
|
20551
20634
|
continue;
|
|
20552
20635
|
}
|
|
20553
20636
|
if (attempt >= retries) {
|
|
@@ -21898,7 +21981,7 @@ async function withInjectedAgentRunner(options, operation) {
|
|
|
21898
21981
|
}
|
|
21899
21982
|
|
|
21900
21983
|
// packages/toolcraft/src/index.ts
|
|
21901
|
-
import { fileURLToPath as
|
|
21984
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
21902
21985
|
|
|
21903
21986
|
// packages/toolcraft/src/user-error.ts
|
|
21904
21987
|
var UserError = class extends Error {
|
|
@@ -22053,6 +22136,11 @@ var S = {
|
|
|
22053
22136
|
Json
|
|
22054
22137
|
};
|
|
22055
22138
|
|
|
22139
|
+
// packages/toolcraft/src/package-metadata.ts
|
|
22140
|
+
import { existsSync, readFileSync as readFileSync2, statSync } from "node:fs";
|
|
22141
|
+
import path23 from "node:path";
|
|
22142
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
22143
|
+
|
|
22056
22144
|
// packages/toolcraft/src/index.ts
|
|
22057
22145
|
var commandConfigSymbol = /* @__PURE__ */ Symbol("toolcraft.command.config");
|
|
22058
22146
|
var groupConfigSymbol = /* @__PURE__ */ Symbol("toolcraft.group.config");
|
|
@@ -22138,7 +22226,7 @@ function validateRenameMap(rename3) {
|
|
|
22138
22226
|
function parseStackPath(candidate) {
|
|
22139
22227
|
if (candidate.startsWith("file://")) {
|
|
22140
22228
|
try {
|
|
22141
|
-
return
|
|
22229
|
+
return fileURLToPath3(candidate);
|
|
22142
22230
|
} catch {
|
|
22143
22231
|
return void 0;
|
|
22144
22232
|
}
|
|
@@ -22467,14 +22555,14 @@ function hasCode2(error2, code) {
|
|
|
22467
22555
|
}
|
|
22468
22556
|
|
|
22469
22557
|
// packages/superintendent/src/commands/install.ts
|
|
22470
|
-
import
|
|
22471
|
-
import { readFile as
|
|
22472
|
-
import { fileURLToPath as
|
|
22558
|
+
import path26 from "node:path";
|
|
22559
|
+
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";
|
|
22560
|
+
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
22473
22561
|
|
|
22474
22562
|
// packages/agent-skill-config/src/configs.ts
|
|
22475
22563
|
init_src5();
|
|
22476
22564
|
import os3 from "node:os";
|
|
22477
|
-
import
|
|
22565
|
+
import path24 from "node:path";
|
|
22478
22566
|
var agentSkillConfigs = {
|
|
22479
22567
|
"claude-code": {
|
|
22480
22568
|
globalSkillDir: "~/.claude/skills",
|
|
@@ -22507,9 +22595,9 @@ function resolveAgentSupport(input, registry = agentSkillConfigs) {
|
|
|
22507
22595
|
}
|
|
22508
22596
|
|
|
22509
22597
|
// packages/agent-skill-config/src/templates.ts
|
|
22510
|
-
import { readFile as
|
|
22511
|
-
import
|
|
22512
|
-
import { fileURLToPath as
|
|
22598
|
+
import { readFile as readFile4, stat as stat3 } from "node:fs/promises";
|
|
22599
|
+
import path25 from "node:path";
|
|
22600
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
22513
22601
|
|
|
22514
22602
|
// packages/agent-skill-config/src/apply.ts
|
|
22515
22603
|
var UnsupportedAgentError = class extends Error {
|
|
@@ -22567,7 +22655,7 @@ async function installSkill(agentId, skill, options) {
|
|
|
22567
22655
|
|
|
22568
22656
|
// packages/superintendent/src/commands/install.ts
|
|
22569
22657
|
var fs2 = {
|
|
22570
|
-
readFile: (p, encoding) =>
|
|
22658
|
+
readFile: (p, encoding) => readFile5(p, encoding),
|
|
22571
22659
|
writeFile: (p, content) => writeFile2(p, content),
|
|
22572
22660
|
mkdir: (p, options) => mkdir4(p, options).then(() => void 0),
|
|
22573
22661
|
unlink: (p) => unlink3(p),
|
|
@@ -22662,9 +22750,9 @@ async function resolvePlanDirectory(cwd, homeDir, env) {
|
|
|
22662
22750
|
}
|
|
22663
22751
|
function resolveAbsoluteDirectory(dir, cwd, homeDir) {
|
|
22664
22752
|
if (dir.startsWith("~/")) {
|
|
22665
|
-
return
|
|
22753
|
+
return path26.join(homeDir, dir.slice(2));
|
|
22666
22754
|
}
|
|
22667
|
-
return
|
|
22755
|
+
return path26.isAbsolute(dir) ? dir : path26.resolve(cwd, dir);
|
|
22668
22756
|
}
|
|
22669
22757
|
async function pathExists2(targetPath) {
|
|
22670
22758
|
try {
|
|
@@ -22682,17 +22770,17 @@ async function loadSkillTemplate() {
|
|
|
22682
22770
|
if (skillTemplateCache) {
|
|
22683
22771
|
return skillTemplateCache;
|
|
22684
22772
|
}
|
|
22685
|
-
const packageRoot = await findPackageRoot(
|
|
22773
|
+
const packageRoot = await findPackageRoot(fileURLToPath5(import.meta.url));
|
|
22686
22774
|
const templateRoots = [
|
|
22687
|
-
|
|
22688
|
-
|
|
22775
|
+
path26.join(packageRoot, "src", "templates"),
|
|
22776
|
+
path26.join(packageRoot, "dist", "templates")
|
|
22689
22777
|
];
|
|
22690
22778
|
for (const templateRoot of templateRoots) {
|
|
22691
22779
|
if (!await pathExists2(templateRoot)) {
|
|
22692
22780
|
continue;
|
|
22693
22781
|
}
|
|
22694
|
-
skillTemplateCache = await
|
|
22695
|
-
|
|
22782
|
+
skillTemplateCache = await readFile5(
|
|
22783
|
+
path26.join(templateRoot, "SKILL_superintendent.md"),
|
|
22696
22784
|
"utf8"
|
|
22697
22785
|
);
|
|
22698
22786
|
return skillTemplateCache;
|
|
@@ -22700,12 +22788,12 @@ async function loadSkillTemplate() {
|
|
|
22700
22788
|
throw new Error("Unable to locate Superintendent skill template.");
|
|
22701
22789
|
}
|
|
22702
22790
|
async function findPackageRoot(entryFilePath) {
|
|
22703
|
-
let currentPath =
|
|
22791
|
+
let currentPath = path26.dirname(entryFilePath);
|
|
22704
22792
|
while (true) {
|
|
22705
|
-
if (await pathExists2(
|
|
22793
|
+
if (await pathExists2(path26.join(currentPath, "package.json"))) {
|
|
22706
22794
|
return currentPath;
|
|
22707
22795
|
}
|
|
22708
|
-
const parentPath =
|
|
22796
|
+
const parentPath = path26.dirname(currentPath);
|
|
22709
22797
|
if (parentPath === currentPath) {
|
|
22710
22798
|
throw new Error("Unable to locate package root for Superintendent templates.");
|
|
22711
22799
|
}
|
|
@@ -22903,10 +22991,10 @@ function hasCode4(error2, code) {
|
|
|
22903
22991
|
}
|
|
22904
22992
|
|
|
22905
22993
|
// packages/superintendent/src/commands/plan-path.ts
|
|
22906
|
-
import
|
|
22907
|
-
import { readFile as
|
|
22994
|
+
import path27 from "node:path";
|
|
22995
|
+
import { readFile as readFile6, writeFile as writeFile3, mkdir as mkdir5, unlink as unlink4, stat as stat5, readdir as readdir4 } from "node:fs/promises";
|
|
22908
22996
|
var fs3 = {
|
|
22909
|
-
readFile: (p, encoding) =>
|
|
22997
|
+
readFile: (p, encoding) => readFile6(p, encoding),
|
|
22910
22998
|
writeFile: (p, content) => writeFile3(p, content),
|
|
22911
22999
|
mkdir: (p, options) => mkdir5(p, options).then(() => void 0),
|
|
22912
23000
|
unlink: (p) => unlink4(p),
|
|
@@ -22938,13 +23026,13 @@ var planPathCommand = defineCommand({
|
|
|
22938
23026
|
});
|
|
22939
23027
|
function resolveAbsoluteDirectory2(dir, cwd, homeDir) {
|
|
22940
23028
|
if (dir.startsWith("~/")) {
|
|
22941
|
-
return
|
|
23029
|
+
return path27.join(homeDir, dir.slice(2));
|
|
22942
23030
|
}
|
|
22943
|
-
return
|
|
23031
|
+
return path27.isAbsolute(dir) ? dir : path27.resolve(cwd, dir);
|
|
22944
23032
|
}
|
|
22945
23033
|
|
|
22946
23034
|
// packages/superintendent/src/commands/run.ts
|
|
22947
|
-
import
|
|
23035
|
+
import path28 from "node:path";
|
|
22948
23036
|
import * as fsPromises7 from "node:fs/promises";
|
|
22949
23037
|
import { spawn as nodeSpawn, spawnSync as nodeSpawnSync } from "node:child_process";
|
|
22950
23038
|
init_src7();
|
|
@@ -23173,10 +23261,13 @@ async function runSuperintendentCommand(options) {
|
|
|
23173
23261
|
runner: "superintendent",
|
|
23174
23262
|
homeDir: options.homeDir
|
|
23175
23263
|
});
|
|
23176
|
-
const
|
|
23264
|
+
const documentContent = await fs4.readFile(selectedDocPath, "utf8");
|
|
23265
|
+
const document = parseSuperintendentDoc(selectedDocPath, documentContent);
|
|
23177
23266
|
const selectedBuilder = await resolveLoopAgent({
|
|
23178
23267
|
providedAgent: normalizeAgentSelection(options.builderAgent),
|
|
23179
|
-
frontmatterAgent: normalizeAgentSelection(
|
|
23268
|
+
frontmatterAgent: normalizeAgentSelection(
|
|
23269
|
+
readExplicitBuilderAgent(selectedDocPath, documentContent)
|
|
23270
|
+
),
|
|
23180
23271
|
configuredDefaultAgent: normalizeAgentSelection(options.configuredDefaultAgent) ?? null,
|
|
23181
23272
|
assumeYes,
|
|
23182
23273
|
fallbackAgent: "claude-code",
|
|
@@ -23452,7 +23543,7 @@ async function runSuperintendentCommand(options) {
|
|
|
23452
23543
|
session.pauseRequested = true;
|
|
23453
23544
|
}
|
|
23454
23545
|
editPlan(session.dashboard, session.latestLogFile, env, options.openInEditor);
|
|
23455
|
-
appendEvent("info", `Log opened: ${
|
|
23546
|
+
appendEvent("info", `Log opened: ${path28.basename(session.latestLogFile)}`);
|
|
23456
23547
|
syncStats();
|
|
23457
23548
|
}
|
|
23458
23549
|
};
|
|
@@ -23601,13 +23692,13 @@ async function listPlanDirectoryDocs(fs4, planDirectory, cwd, homeDir) {
|
|
|
23601
23692
|
}
|
|
23602
23693
|
throw error2;
|
|
23603
23694
|
}
|
|
23604
|
-
return entries.filter((entry) => entry.toLowerCase().endsWith(".md")).map((entry) =>
|
|
23695
|
+
return entries.filter((entry) => entry.toLowerCase().endsWith(".md")).map((entry) => path28.join(absoluteDir, entry)).sort((left, right) => left.localeCompare(right));
|
|
23605
23696
|
}
|
|
23606
23697
|
function resolveAbsolutePlanDirectory(dir, cwd, homeDir) {
|
|
23607
23698
|
if (dir.startsWith("~/")) {
|
|
23608
|
-
return
|
|
23699
|
+
return path28.join(homeDir, dir.slice(2));
|
|
23609
23700
|
}
|
|
23610
|
-
return
|
|
23701
|
+
return path28.isAbsolute(dir) ? dir : path28.resolve(cwd, dir);
|
|
23611
23702
|
}
|
|
23612
23703
|
function normalizeAgentSelection(value) {
|
|
23613
23704
|
if (typeof value !== "string") {
|
|
@@ -23844,7 +23935,7 @@ function resolveEditor(env) {
|
|
|
23844
23935
|
const parts = raw.split(/\s+/);
|
|
23845
23936
|
const command = parts[0] ?? "vi";
|
|
23846
23937
|
const args = parts.slice(1);
|
|
23847
|
-
const binary =
|
|
23938
|
+
const binary = path28.basename(command);
|
|
23848
23939
|
const mode = GUI_EDITOR_BINARIES.has(binary) ? "gui" : "tty";
|
|
23849
23940
|
return { command, args, mode };
|
|
23850
23941
|
}
|
|
@@ -23871,11 +23962,11 @@ function stripStopReason(result) {
|
|
|
23871
23962
|
};
|
|
23872
23963
|
}
|
|
23873
23964
|
function displayPath(filePath, cwd, homeDir) {
|
|
23874
|
-
if (filePath.startsWith(`${cwd}${
|
|
23875
|
-
return
|
|
23965
|
+
if (filePath.startsWith(`${cwd}${path28.sep}`)) {
|
|
23966
|
+
return path28.relative(cwd, filePath);
|
|
23876
23967
|
}
|
|
23877
|
-
if (filePath.startsWith(`${homeDir}${
|
|
23878
|
-
return `~/${
|
|
23968
|
+
if (filePath.startsWith(`${homeDir}${path28.sep}`)) {
|
|
23969
|
+
return `~/${path28.relative(homeDir, filePath)}`;
|
|
23879
23970
|
}
|
|
23880
23971
|
return filePath;
|
|
23881
23972
|
}
|