poe-code 3.0.107 → 3.0.109
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/cli/commands/config.d.ts +3 -0
- package/dist/cli/commands/config.js +115 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/configure-payload.js +2 -2
- package/dist/cli/commands/configure-payload.js.map +1 -1
- package/dist/cli/commands/shared.d.ts +1 -0
- package/dist/cli/commands/shared.js +1 -1
- package/dist/cli/commands/shared.js.map +1 -1
- package/dist/cli/commands/spawn.js +7 -2
- package/dist/cli/commands/spawn.js.map +1 -1
- package/dist/cli/constants.d.ts +1 -1
- package/dist/cli/constants.js +1 -1
- package/dist/cli/constants.js.map +1 -1
- package/dist/cli/program.js +22 -0
- package/dist/cli/program.js.map +1 -1
- package/dist/index.js +445 -182
- package/dist/index.js.map +4 -4
- package/dist/providers/claude-code.js.map +1 -1
- package/dist/providers/codex.js.map +1 -1
- package/dist/providers/kimi.js.map +1 -1
- package/dist/providers/opencode.js +1 -1
- package/dist/providers/opencode.js.map +1 -1
- package/dist/providers/poe-agent.js.map +1 -1
- package/dist/services/config.d.ts +28 -0
- package/dist/services/config.js +17 -2
- package/dist/services/config.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -558,6 +558,12 @@ var init_src2 = __esm({
|
|
|
558
558
|
});
|
|
559
559
|
|
|
560
560
|
// packages/poe-code-config/src/schema.ts
|
|
561
|
+
function defineScope(scope, schema) {
|
|
562
|
+
return {
|
|
563
|
+
scope,
|
|
564
|
+
schema
|
|
565
|
+
};
|
|
566
|
+
}
|
|
561
567
|
var init_schema = __esm({
|
|
562
568
|
"packages/poe-code-config/src/schema.ts"() {
|
|
563
569
|
"use strict";
|
|
@@ -885,16 +891,16 @@ function getConfigFormat(pathOrFormat) {
|
|
|
885
891
|
}
|
|
886
892
|
return formatRegistry[formatName];
|
|
887
893
|
}
|
|
888
|
-
function detectFormat(
|
|
889
|
-
const ext = getExtension(
|
|
894
|
+
function detectFormat(path28) {
|
|
895
|
+
const ext = getExtension(path28);
|
|
890
896
|
return extensionMap[ext];
|
|
891
897
|
}
|
|
892
|
-
function getExtension(
|
|
893
|
-
const lastDot =
|
|
898
|
+
function getExtension(path28) {
|
|
899
|
+
const lastDot = path28.lastIndexOf(".");
|
|
894
900
|
if (lastDot === -1) {
|
|
895
901
|
return "";
|
|
896
902
|
}
|
|
897
|
-
return
|
|
903
|
+
return path28.slice(lastDot).toLowerCase();
|
|
898
904
|
}
|
|
899
905
|
var formatRegistry, extensionMap;
|
|
900
906
|
var init_formats = __esm({
|
|
@@ -1787,6 +1793,92 @@ var init_models = __esm({
|
|
|
1787
1793
|
}
|
|
1788
1794
|
});
|
|
1789
1795
|
|
|
1796
|
+
// packages/poe-code-config/src/inspect.ts
|
|
1797
|
+
import path4 from "node:path";
|
|
1798
|
+
function collectEnvOverrides(scopes, env) {
|
|
1799
|
+
const document = {};
|
|
1800
|
+
const entries = [];
|
|
1801
|
+
for (const definition of scopes) {
|
|
1802
|
+
const scopeResult = collectScopeEnvOverrides(definition, env);
|
|
1803
|
+
if (Object.keys(scopeResult.values).length === 0) {
|
|
1804
|
+
continue;
|
|
1805
|
+
}
|
|
1806
|
+
document[definition.scope] = scopeResult.values;
|
|
1807
|
+
entries.push(...scopeResult.entries);
|
|
1808
|
+
}
|
|
1809
|
+
return { entries, document };
|
|
1810
|
+
}
|
|
1811
|
+
async function resolveEditTarget(fs3, configPath, projectConfigPath, options) {
|
|
1812
|
+
if (options.global && options.project) {
|
|
1813
|
+
throw new Error("Choose either --global or --project, not both.");
|
|
1814
|
+
}
|
|
1815
|
+
if (options.global) {
|
|
1816
|
+
return configPath;
|
|
1817
|
+
}
|
|
1818
|
+
if (options.project) {
|
|
1819
|
+
return projectConfigPath;
|
|
1820
|
+
}
|
|
1821
|
+
if (await pathExists(fs3, projectConfigPath)) {
|
|
1822
|
+
return projectConfigPath;
|
|
1823
|
+
}
|
|
1824
|
+
return configPath;
|
|
1825
|
+
}
|
|
1826
|
+
async function initProjectConfig(fs3, targetPath) {
|
|
1827
|
+
if (await pathExists(fs3, targetPath)) {
|
|
1828
|
+
return "already-exists";
|
|
1829
|
+
}
|
|
1830
|
+
await fs3.mkdir(path4.dirname(targetPath), { recursive: true });
|
|
1831
|
+
await fs3.writeFile(targetPath, EMPTY_DOCUMENT2, { encoding: "utf8" });
|
|
1832
|
+
return "created";
|
|
1833
|
+
}
|
|
1834
|
+
function collectScopeEnvOverrides(definition, env) {
|
|
1835
|
+
const entries = [];
|
|
1836
|
+
const values = {};
|
|
1837
|
+
for (const [key, field] of Object.entries(definition.schema)) {
|
|
1838
|
+
if (!field.env) {
|
|
1839
|
+
continue;
|
|
1840
|
+
}
|
|
1841
|
+
const value = coerceEnvValue(field.type, env[field.env]);
|
|
1842
|
+
if (value === void 0) {
|
|
1843
|
+
continue;
|
|
1844
|
+
}
|
|
1845
|
+
values[key] = value;
|
|
1846
|
+
entries.push(` ${field.env} = ${String(value)}`);
|
|
1847
|
+
}
|
|
1848
|
+
return { entries, values };
|
|
1849
|
+
}
|
|
1850
|
+
function coerceEnvValue(type, raw) {
|
|
1851
|
+
if (raw === void 0) {
|
|
1852
|
+
return void 0;
|
|
1853
|
+
}
|
|
1854
|
+
if (type === "string") {
|
|
1855
|
+
return raw;
|
|
1856
|
+
}
|
|
1857
|
+
if (type === "number") {
|
|
1858
|
+
if (raw.length === 0) {
|
|
1859
|
+
return void 0;
|
|
1860
|
+
}
|
|
1861
|
+
const parsed = Number(raw);
|
|
1862
|
+
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
1863
|
+
}
|
|
1864
|
+
if (raw === "true" || raw === "1") {
|
|
1865
|
+
return true;
|
|
1866
|
+
}
|
|
1867
|
+
if (raw === "false" || raw === "0") {
|
|
1868
|
+
return false;
|
|
1869
|
+
}
|
|
1870
|
+
return void 0;
|
|
1871
|
+
}
|
|
1872
|
+
var EMPTY_DOCUMENT2;
|
|
1873
|
+
var init_inspect = __esm({
|
|
1874
|
+
"packages/poe-code-config/src/inspect.ts"() {
|
|
1875
|
+
"use strict";
|
|
1876
|
+
init_src3();
|
|
1877
|
+
EMPTY_DOCUMENT2 = `${JSON.stringify({}, null, 2)}
|
|
1878
|
+
`;
|
|
1879
|
+
}
|
|
1880
|
+
});
|
|
1881
|
+
|
|
1790
1882
|
// packages/poe-code-config/src/index.ts
|
|
1791
1883
|
var init_src4 = __esm({
|
|
1792
1884
|
"packages/poe-code-config/src/index.ts"() {
|
|
@@ -1796,6 +1888,7 @@ var init_src4 = __esm({
|
|
|
1796
1888
|
init_merge();
|
|
1797
1889
|
init_models();
|
|
1798
1890
|
init_resolve();
|
|
1891
|
+
init_inspect();
|
|
1799
1892
|
init_store();
|
|
1800
1893
|
}
|
|
1801
1894
|
});
|
|
@@ -1807,38 +1900,38 @@ import { createTwoFilesPatch } from "diff";
|
|
|
1807
1900
|
import chalk from "chalk";
|
|
1808
1901
|
function createDryRunFileSystem(base, recorder) {
|
|
1809
1902
|
const proxy = {
|
|
1810
|
-
async readFile(
|
|
1903
|
+
async readFile(path28, encoding) {
|
|
1811
1904
|
if (encoding) {
|
|
1812
|
-
return base.readFile(
|
|
1905
|
+
return base.readFile(path28, encoding);
|
|
1813
1906
|
}
|
|
1814
|
-
return base.readFile(
|
|
1907
|
+
return base.readFile(path28);
|
|
1815
1908
|
},
|
|
1816
|
-
async writeFile(
|
|
1817
|
-
const previousContent = await tryReadText(base,
|
|
1909
|
+
async writeFile(path28, data, options) {
|
|
1910
|
+
const previousContent = await tryReadText(base, path28);
|
|
1818
1911
|
const nextContent = formatData(data, options?.encoding);
|
|
1819
1912
|
recorder.record({
|
|
1820
1913
|
type: "writeFile",
|
|
1821
|
-
path:
|
|
1914
|
+
path: path28,
|
|
1822
1915
|
nextContent,
|
|
1823
1916
|
previousContent
|
|
1824
1917
|
});
|
|
1825
1918
|
},
|
|
1826
|
-
async mkdir(
|
|
1827
|
-
recorder.record({ type: "mkdir", path:
|
|
1919
|
+
async mkdir(path28, options) {
|
|
1920
|
+
recorder.record({ type: "mkdir", path: path28, options });
|
|
1828
1921
|
},
|
|
1829
|
-
async stat(
|
|
1830
|
-
return base.stat(
|
|
1922
|
+
async stat(path28) {
|
|
1923
|
+
return base.stat(path28);
|
|
1831
1924
|
},
|
|
1832
|
-
async unlink(
|
|
1833
|
-
recorder.record({ type: "unlink", path:
|
|
1925
|
+
async unlink(path28) {
|
|
1926
|
+
recorder.record({ type: "unlink", path: path28 });
|
|
1834
1927
|
},
|
|
1835
|
-
async readdir(
|
|
1836
|
-
return base.readdir(
|
|
1928
|
+
async readdir(path28) {
|
|
1929
|
+
return base.readdir(path28);
|
|
1837
1930
|
}
|
|
1838
1931
|
};
|
|
1839
1932
|
if (typeof base.rm === "function") {
|
|
1840
|
-
proxy.rm = async (
|
|
1841
|
-
recorder.record({ type: "rm", path:
|
|
1933
|
+
proxy.rm = async (path28, options) => {
|
|
1934
|
+
recorder.record({ type: "rm", path: path28, options });
|
|
1842
1935
|
};
|
|
1843
1936
|
}
|
|
1844
1937
|
if (typeof base.copyFile === "function") {
|
|
@@ -1928,8 +2021,8 @@ function describeWriteChange(previous, next) {
|
|
|
1928
2021
|
}
|
|
1929
2022
|
return "update";
|
|
1930
2023
|
}
|
|
1931
|
-
function renderWriteCommand(
|
|
1932
|
-
const command = `cat > ${
|
|
2024
|
+
function renderWriteCommand(path28, change) {
|
|
2025
|
+
const command = `cat > ${path28}`;
|
|
1933
2026
|
if (change === "create") {
|
|
1934
2027
|
return renderOperationCommand(command, chalk.green, "# create");
|
|
1935
2028
|
}
|
|
@@ -2091,9 +2184,9 @@ function redactTomlLine(line) {
|
|
|
2091
2184
|
}
|
|
2092
2185
|
return line;
|
|
2093
2186
|
}
|
|
2094
|
-
async function tryReadText(base,
|
|
2187
|
+
async function tryReadText(base, path28) {
|
|
2095
2188
|
try {
|
|
2096
|
-
return await base.readFile(
|
|
2189
|
+
return await base.readFile(path28, "utf8");
|
|
2097
2190
|
} catch (error2) {
|
|
2098
2191
|
if (isNotFound(error2)) {
|
|
2099
2192
|
return null;
|
|
@@ -2275,7 +2368,7 @@ var init_context = __esm({
|
|
|
2275
2368
|
});
|
|
2276
2369
|
|
|
2277
2370
|
// src/cli/isolated-env.ts
|
|
2278
|
-
import
|
|
2371
|
+
import path5 from "node:path";
|
|
2279
2372
|
async function resolveIsolatedEnvDetails(env, isolated, providerName, readApiKey) {
|
|
2280
2373
|
if (!providerName) {
|
|
2281
2374
|
throw new Error("resolveIsolatedEnvDetails requires providerName.");
|
|
@@ -2297,7 +2390,7 @@ function resolveIsolatedTargetDirectory(input) {
|
|
|
2297
2390
|
const expanded = expandHomeShortcut(input.env, input.targetDirectory);
|
|
2298
2391
|
const baseDir = resolveIsolatedBaseDir(input.env, input.providerName);
|
|
2299
2392
|
const homeDir = input.env.homeDir;
|
|
2300
|
-
const homeDirWithSep = `${homeDir}${
|
|
2393
|
+
const homeDirWithSep = `${homeDir}${path5.sep}`;
|
|
2301
2394
|
if (expanded !== homeDir && !expanded.startsWith(homeDirWithSep)) {
|
|
2302
2395
|
throw new Error(
|
|
2303
2396
|
`Isolated config targets must live under the user's home directory (received "${input.targetDirectory}").`
|
|
@@ -2312,7 +2405,7 @@ function resolveIsolatedTargetDirectory(input) {
|
|
|
2312
2405
|
if (!expanded.startsWith(homeDirWithSep)) {
|
|
2313
2406
|
return expanded;
|
|
2314
2407
|
}
|
|
2315
|
-
const mapped =
|
|
2408
|
+
const mapped = path5.join(baseDir, expanded.slice(homeDirWithSep.length));
|
|
2316
2409
|
return stripAgentHome(mapped, baseDir, input.isolated.agentBinary);
|
|
2317
2410
|
}
|
|
2318
2411
|
function resolveIsolatedBaseDir(env, providerName) {
|
|
@@ -2361,9 +2454,9 @@ async function resolveIsolatedEnvValue(env, baseDir, value, readApiKey) {
|
|
|
2361
2454
|
function resolveIsolatedEnvPath(env, baseDir, value) {
|
|
2362
2455
|
switch (value.kind) {
|
|
2363
2456
|
case "isolatedDir":
|
|
2364
|
-
return value.relativePath ?
|
|
2457
|
+
return value.relativePath ? path5.join(baseDir, value.relativePath) : baseDir;
|
|
2365
2458
|
case "isolatedFile":
|
|
2366
|
-
return
|
|
2459
|
+
return path5.join(baseDir, value.relativePath);
|
|
2367
2460
|
}
|
|
2368
2461
|
}
|
|
2369
2462
|
function isEnvVarReference(value) {
|
|
@@ -2405,10 +2498,10 @@ async function applyIsolatedEnvRepairs(input) {
|
|
|
2405
2498
|
if (repair.kind !== "chmod") {
|
|
2406
2499
|
continue;
|
|
2407
2500
|
}
|
|
2408
|
-
if (
|
|
2501
|
+
if (path5.isAbsolute(repair.relativePath)) {
|
|
2409
2502
|
continue;
|
|
2410
2503
|
}
|
|
2411
|
-
const repairPath =
|
|
2504
|
+
const repairPath = path5.join(baseDir, repair.relativePath);
|
|
2412
2505
|
try {
|
|
2413
2506
|
await input.fs.chmod(repairPath, repair.mode);
|
|
2414
2507
|
} catch (error2) {
|
|
@@ -2459,13 +2552,13 @@ async function resolveCliSettingValue(value, env, readApiKey) {
|
|
|
2459
2552
|
}
|
|
2460
2553
|
function stripAgentHome(mapped, baseDir, agentBinary) {
|
|
2461
2554
|
const agentDir = `.${agentBinary}`;
|
|
2462
|
-
const prefix =
|
|
2555
|
+
const prefix = path5.join(baseDir, agentDir);
|
|
2463
2556
|
if (mapped === prefix) {
|
|
2464
2557
|
return baseDir;
|
|
2465
2558
|
}
|
|
2466
|
-
const withSep = `${prefix}${
|
|
2559
|
+
const withSep = `${prefix}${path5.sep}`;
|
|
2467
2560
|
if (mapped.startsWith(withSep)) {
|
|
2468
|
-
return
|
|
2561
|
+
return path5.join(baseDir, mapped.slice(withSep.length));
|
|
2469
2562
|
}
|
|
2470
2563
|
return mapped;
|
|
2471
2564
|
}
|
|
@@ -2476,11 +2569,11 @@ function expandHomeShortcut(env, input) {
|
|
|
2476
2569
|
if (input === "~") {
|
|
2477
2570
|
return env.homeDir;
|
|
2478
2571
|
}
|
|
2479
|
-
if (input.startsWith("~/") || input.startsWith(`~${
|
|
2480
|
-
return
|
|
2572
|
+
if (input.startsWith("~/") || input.startsWith(`~${path5.sep}`)) {
|
|
2573
|
+
return path5.join(env.homeDir, input.slice(2));
|
|
2481
2574
|
}
|
|
2482
|
-
if (input.startsWith("~./") || input.startsWith(`~.${
|
|
2483
|
-
return
|
|
2575
|
+
if (input.startsWith("~./") || input.startsWith(`~.${path5.sep}`)) {
|
|
2576
|
+
return path5.join(env.homeDir, `.${input.slice(3)}`);
|
|
2484
2577
|
}
|
|
2485
2578
|
return input;
|
|
2486
2579
|
}
|
|
@@ -3923,21 +4016,21 @@ async function* adaptClaude(lines) {
|
|
|
3923
4016
|
if (blockType !== "tool_result") continue;
|
|
3924
4017
|
const kind = toolKindsById.get(item.tool_use_id);
|
|
3925
4018
|
toolKindsById.delete(item.tool_use_id);
|
|
3926
|
-
let
|
|
4019
|
+
let path28;
|
|
3927
4020
|
if (typeof item.content === "string") {
|
|
3928
|
-
|
|
4021
|
+
path28 = item.content;
|
|
3929
4022
|
} else {
|
|
3930
4023
|
try {
|
|
3931
|
-
|
|
4024
|
+
path28 = JSON.stringify(item.content);
|
|
3932
4025
|
} catch {
|
|
3933
|
-
|
|
4026
|
+
path28 = String(item.content);
|
|
3934
4027
|
}
|
|
3935
4028
|
}
|
|
3936
4029
|
yield {
|
|
3937
4030
|
event: "tool_complete",
|
|
3938
4031
|
id: item.tool_use_id,
|
|
3939
4032
|
kind,
|
|
3940
|
-
path:
|
|
4033
|
+
path: path28
|
|
3941
4034
|
};
|
|
3942
4035
|
}
|
|
3943
4036
|
}
|
|
@@ -4059,10 +4152,10 @@ async function* adaptCodex(lines) {
|
|
|
4059
4152
|
const kindFromStart = toolKindById.get(item.id);
|
|
4060
4153
|
const kind = kindFromStart ?? (itemType === "command_execution" ? "exec" : itemType === "file_edit" ? "edit" : "other");
|
|
4061
4154
|
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;
|
|
4062
|
-
const
|
|
4155
|
+
const path28 = titleFromEvent ?? toolTitleById.get(item.id) ?? "";
|
|
4063
4156
|
toolTitleById.delete(item.id);
|
|
4064
4157
|
toolKindById.delete(item.id);
|
|
4065
|
-
yield { event: "tool_complete", id: item.id, kind, path:
|
|
4158
|
+
yield { event: "tool_complete", id: item.id, kind, path: path28 };
|
|
4066
4159
|
}
|
|
4067
4160
|
}
|
|
4068
4161
|
}
|
|
@@ -4504,7 +4597,7 @@ function updateSessionFromEvent(ctx, event, toolCallsById) {
|
|
|
4504
4597
|
}
|
|
4505
4598
|
const id = readString(event.id);
|
|
4506
4599
|
const kind = readString(event.kind);
|
|
4507
|
-
const
|
|
4600
|
+
const path28 = readString(event.path);
|
|
4508
4601
|
let toolCall = id ? toolCallsById.get(id) : void 0;
|
|
4509
4602
|
if (!toolCall) {
|
|
4510
4603
|
toolCall = {};
|
|
@@ -4519,8 +4612,8 @@ function updateSessionFromEvent(ctx, event, toolCallsById) {
|
|
|
4519
4612
|
if (kind) {
|
|
4520
4613
|
toolCall.kind = kind;
|
|
4521
4614
|
}
|
|
4522
|
-
if (
|
|
4523
|
-
toolCall.path =
|
|
4615
|
+
if (path28) {
|
|
4616
|
+
toolCall.path = path28;
|
|
4524
4617
|
}
|
|
4525
4618
|
}
|
|
4526
4619
|
var sessionCapture;
|
|
@@ -4606,7 +4699,7 @@ var init_usage_capture = __esm({
|
|
|
4606
4699
|
});
|
|
4607
4700
|
|
|
4608
4701
|
// packages/agent-spawn/src/acp/middlewares/spawn-log.ts
|
|
4609
|
-
import
|
|
4702
|
+
import path6 from "node:path";
|
|
4610
4703
|
import { homedir as homedir2 } from "node:os";
|
|
4611
4704
|
import { mkdir, open } from "node:fs/promises";
|
|
4612
4705
|
function pad(value, width) {
|
|
@@ -4640,11 +4733,11 @@ function resolveStartedAt(value) {
|
|
|
4640
4733
|
return value;
|
|
4641
4734
|
}
|
|
4642
4735
|
function resolveLogFilePath(ctx) {
|
|
4643
|
-
const baseDir = ctx.logDir ??
|
|
4736
|
+
const baseDir = ctx.logDir ?? path6.join(homedir2(), ".poe-code", "spawn-logs");
|
|
4644
4737
|
const startedAt = resolveStartedAt(ctx.startedAt);
|
|
4645
4738
|
const { day, time: time3, milliseconds } = formatTimestamp(startedAt);
|
|
4646
4739
|
const fileName = `${day}-${time3}-${milliseconds}-${normalizeAgent(ctx.agent)}.jsonl`;
|
|
4647
|
-
return
|
|
4740
|
+
return path6.join(baseDir, fileName);
|
|
4648
4741
|
}
|
|
4649
4742
|
async function writePreloadedEvents(writer, events) {
|
|
4650
4743
|
for (const event of events) {
|
|
@@ -4662,7 +4755,7 @@ var init_spawn_log = __esm({
|
|
|
4662
4755
|
logDirPath;
|
|
4663
4756
|
constructor(ctx) {
|
|
4664
4757
|
this.logFilePath = resolveLogFilePath(ctx);
|
|
4665
|
-
this.logDirPath =
|
|
4758
|
+
this.logDirPath = path6.dirname(this.logFilePath);
|
|
4666
4759
|
}
|
|
4667
4760
|
async writeEvent(event) {
|
|
4668
4761
|
if (this.isDisabled) {
|
|
@@ -4747,7 +4840,7 @@ var init_src6 = __esm({
|
|
|
4747
4840
|
});
|
|
4748
4841
|
|
|
4749
4842
|
// src/cli/commands/shared.ts
|
|
4750
|
-
import
|
|
4843
|
+
import path7 from "node:path";
|
|
4751
4844
|
function resolveCommandFlags(program) {
|
|
4752
4845
|
const opts = program.optsWithGlobals();
|
|
4753
4846
|
return {
|
|
@@ -4820,7 +4913,7 @@ function buildResumeCommand(canonicalService, threadId, cwd) {
|
|
|
4820
4913
|
if (!binaryName) {
|
|
4821
4914
|
return void 0;
|
|
4822
4915
|
}
|
|
4823
|
-
const resumeCwd =
|
|
4916
|
+
const resumeCwd = path7.resolve(cwd);
|
|
4824
4917
|
const args = spawnConfig.resumeCommand(threadId, resumeCwd);
|
|
4825
4918
|
const agentCommand = [binaryName, ...args.map(shlexQuote)].join(" ");
|
|
4826
4919
|
const needsCdPrefix = !args.includes(resumeCwd);
|
|
@@ -4917,7 +5010,7 @@ var init_shared = __esm({
|
|
|
4917
5010
|
});
|
|
4918
5011
|
|
|
4919
5012
|
// src/sdk/spawn-core.ts
|
|
4920
|
-
import
|
|
5013
|
+
import path8 from "node:path";
|
|
4921
5014
|
import chalk10 from "chalk";
|
|
4922
5015
|
async function spawnCore(container, service, options, flags = { dryRun: false, verbose: false }) {
|
|
4923
5016
|
const adapter = container.registry.get(service);
|
|
@@ -5035,10 +5128,10 @@ function resolveSpawnWorkingDirectory(baseDir, candidate) {
|
|
|
5035
5128
|
if (!candidate || candidate.trim().length === 0) {
|
|
5036
5129
|
return void 0;
|
|
5037
5130
|
}
|
|
5038
|
-
if (
|
|
5131
|
+
if (path8.isAbsolute(candidate)) {
|
|
5039
5132
|
return candidate;
|
|
5040
5133
|
}
|
|
5041
|
-
return
|
|
5134
|
+
return path8.resolve(baseDir, candidate);
|
|
5042
5135
|
}
|
|
5043
5136
|
var init_spawn_core = __esm({
|
|
5044
5137
|
"src/sdk/spawn-core.ts"() {
|
|
@@ -5050,7 +5143,7 @@ var init_spawn_core = __esm({
|
|
|
5050
5143
|
});
|
|
5051
5144
|
|
|
5052
5145
|
// src/cli/environment.ts
|
|
5053
|
-
import
|
|
5146
|
+
import path9 from "node:path";
|
|
5054
5147
|
function createCliEnvironment(init) {
|
|
5055
5148
|
const platform = init.platform ?? process.platform;
|
|
5056
5149
|
const variables = init.variables ?? process.env;
|
|
@@ -5058,7 +5151,7 @@ function createCliEnvironment(init) {
|
|
|
5058
5151
|
const projectConfigPath = resolveProjectConfigPath(init.cwd);
|
|
5059
5152
|
const logDir = resolveLogDir(init.homeDir);
|
|
5060
5153
|
const { poeApiBaseUrl, poeBaseUrl } = resolvePoeBaseUrls(variables);
|
|
5061
|
-
const resolveHomePath = (...segments) =>
|
|
5154
|
+
const resolveHomePath = (...segments) => path9.join(init.homeDir, ...segments);
|
|
5062
5155
|
const getVariable = (name) => variables[name];
|
|
5063
5156
|
return {
|
|
5064
5157
|
cwd: init.cwd,
|
|
@@ -5075,7 +5168,7 @@ function createCliEnvironment(init) {
|
|
|
5075
5168
|
};
|
|
5076
5169
|
}
|
|
5077
5170
|
function resolveLogDir(homeDir) {
|
|
5078
|
-
return
|
|
5171
|
+
return path9.join(homeDir, ".poe-code", "logs");
|
|
5079
5172
|
}
|
|
5080
5173
|
function resolvePoeBaseUrls(variables) {
|
|
5081
5174
|
const raw = variables.POE_BASE_URL;
|
|
@@ -5970,7 +6063,7 @@ var init_logger2 = __esm({
|
|
|
5970
6063
|
});
|
|
5971
6064
|
|
|
5972
6065
|
// src/cli/error-logger.ts
|
|
5973
|
-
import
|
|
6066
|
+
import path10 from "node:path";
|
|
5974
6067
|
var DEFAULT_MAX_SIZE, DEFAULT_MAX_BACKUPS, ErrorLogger;
|
|
5975
6068
|
var init_error_logger = __esm({
|
|
5976
6069
|
"src/cli/error-logger.ts"() {
|
|
@@ -5987,7 +6080,7 @@ var init_error_logger = __esm({
|
|
|
5987
6080
|
fileLoggingAvailable;
|
|
5988
6081
|
constructor(options) {
|
|
5989
6082
|
this.fs = options.fs;
|
|
5990
|
-
this.logFilePath =
|
|
6083
|
+
this.logFilePath = path10.join(options.logDir, "errors.log");
|
|
5991
6084
|
this.logToStderr = options.logToStderr ?? true;
|
|
5992
6085
|
this.maxSize = options.maxSize ?? DEFAULT_MAX_SIZE;
|
|
5993
6086
|
this.maxBackups = options.maxBackups ?? DEFAULT_MAX_BACKUPS;
|
|
@@ -6106,7 +6199,7 @@ ${entry.stack}`);
|
|
|
6106
6199
|
return `${this.logFilePath}.${index}`;
|
|
6107
6200
|
}
|
|
6108
6201
|
ensureLogDirectory() {
|
|
6109
|
-
const directory =
|
|
6202
|
+
const directory = path10.dirname(this.logFilePath);
|
|
6110
6203
|
try {
|
|
6111
6204
|
if (!this.fs.existsSync(directory)) {
|
|
6112
6205
|
this.fs.mkdirSync(directory, { recursive: true });
|
|
@@ -6124,7 +6217,7 @@ ${entry.stack}`);
|
|
|
6124
6217
|
});
|
|
6125
6218
|
|
|
6126
6219
|
// src/providers/index.ts
|
|
6127
|
-
import
|
|
6220
|
+
import path11 from "node:path";
|
|
6128
6221
|
import { readdir } from "node:fs/promises";
|
|
6129
6222
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6130
6223
|
function isProviderModule(filename) {
|
|
@@ -6151,7 +6244,7 @@ async function loadProviders() {
|
|
|
6151
6244
|
for (const entry of entries) {
|
|
6152
6245
|
if (!entry.isFile()) continue;
|
|
6153
6246
|
if (!isProviderModule(entry.name)) continue;
|
|
6154
|
-
const moduleUrl = pathToFileURL(
|
|
6247
|
+
const moduleUrl = pathToFileURL(path11.join(currentDir, entry.name)).href;
|
|
6155
6248
|
const moduleExports = await import(moduleUrl);
|
|
6156
6249
|
if (!moduleExports.provider) {
|
|
6157
6250
|
throw new Error(`Provider module "${entry.name}" must export "provider".`);
|
|
@@ -6167,8 +6260,8 @@ var moduleDir, currentDir, defaultProviders;
|
|
|
6167
6260
|
var init_providers = __esm({
|
|
6168
6261
|
async "src/providers/index.ts"() {
|
|
6169
6262
|
"use strict";
|
|
6170
|
-
moduleDir =
|
|
6171
|
-
currentDir =
|
|
6263
|
+
moduleDir = path11.dirname(fileURLToPath(import.meta.url));
|
|
6264
|
+
currentDir = path11.basename(moduleDir) === "providers" ? moduleDir : path11.join(moduleDir, "providers");
|
|
6172
6265
|
defaultProviders = await loadProviders();
|
|
6173
6266
|
}
|
|
6174
6267
|
});
|
|
@@ -6235,7 +6328,7 @@ async function createConfigurePayload(init) {
|
|
|
6235
6328
|
const payload = { env: context.env, apiKey };
|
|
6236
6329
|
const modelPrompt = adapter.configurePrompts?.model;
|
|
6237
6330
|
if (modelPrompt) {
|
|
6238
|
-
const configModel = await
|
|
6331
|
+
const configModel = await resolveModel(
|
|
6239
6332
|
{
|
|
6240
6333
|
fs: container.fs,
|
|
6241
6334
|
filePath: container.env.configPath
|
|
@@ -6518,21 +6611,21 @@ function createSdkContainer(options) {
|
|
|
6518
6611
|
});
|
|
6519
6612
|
loggerFactory.setErrorLogger(errorLogger);
|
|
6520
6613
|
const asyncFs = {
|
|
6521
|
-
readFile: ((
|
|
6614
|
+
readFile: ((path28, encoding) => {
|
|
6522
6615
|
if (encoding) {
|
|
6523
|
-
return fs2.readFile(
|
|
6616
|
+
return fs2.readFile(path28, encoding);
|
|
6524
6617
|
}
|
|
6525
|
-
return fs2.readFile(
|
|
6618
|
+
return fs2.readFile(path28);
|
|
6526
6619
|
}),
|
|
6527
|
-
writeFile: (
|
|
6528
|
-
mkdir: (
|
|
6620
|
+
writeFile: (path28, data, opts) => fs2.writeFile(path28, data, opts),
|
|
6621
|
+
mkdir: (path28, opts) => fs2.mkdir(path28, opts).then(() => {
|
|
6529
6622
|
}),
|
|
6530
|
-
stat: (
|
|
6531
|
-
rm: (
|
|
6532
|
-
unlink: (
|
|
6533
|
-
readdir: (
|
|
6623
|
+
stat: (path28) => fs2.stat(path28),
|
|
6624
|
+
rm: (path28, opts) => fs2.rm(path28, opts),
|
|
6625
|
+
unlink: (path28) => fs2.unlink(path28),
|
|
6626
|
+
readdir: (path28) => fs2.readdir(path28),
|
|
6534
6627
|
copyFile: (src, dest) => fs2.copyFile(src, dest),
|
|
6535
|
-
chmod: (
|
|
6628
|
+
chmod: (path28, mode) => fs2.chmod(path28, mode)
|
|
6536
6629
|
};
|
|
6537
6630
|
const contextFactory = createCommandContextFactory({ fs: asyncFs });
|
|
6538
6631
|
const authFs = {
|
|
@@ -7236,8 +7329,8 @@ function resourceNotFound(resource) {
|
|
|
7236
7329
|
`Resource not found: ${resource}`
|
|
7237
7330
|
);
|
|
7238
7331
|
}
|
|
7239
|
-
function assertAbsolutePath(
|
|
7240
|
-
if (!isAbsolute(
|
|
7332
|
+
function assertAbsolutePath(path28) {
|
|
7333
|
+
if (!isAbsolute(path28)) {
|
|
7241
7334
|
throw invalidParams('"path" must be an absolute path');
|
|
7242
7335
|
}
|
|
7243
7336
|
}
|
|
@@ -8998,7 +9091,7 @@ var init_acp_core = __esm({
|
|
|
8998
9091
|
});
|
|
8999
9092
|
|
|
9000
9093
|
// packages/poe-agent/src/plugins/plugin-args.ts
|
|
9001
|
-
import
|
|
9094
|
+
import path12 from "node:path";
|
|
9002
9095
|
function isObjectRecord3(value) {
|
|
9003
9096
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9004
9097
|
}
|
|
@@ -9029,13 +9122,13 @@ function getOptionalString(args, key) {
|
|
|
9029
9122
|
return value;
|
|
9030
9123
|
}
|
|
9031
9124
|
function resolveAllowedPath(cwd, allowedPaths, inputPath) {
|
|
9032
|
-
const resolvedPath =
|
|
9125
|
+
const resolvedPath = path12.resolve(cwd, inputPath);
|
|
9033
9126
|
const isAllowed = allowedPaths.some((allowedPath) => {
|
|
9034
9127
|
if (allowedPath === resolvedPath) {
|
|
9035
9128
|
return true;
|
|
9036
9129
|
}
|
|
9037
|
-
const rel =
|
|
9038
|
-
return rel.length > 0 && !rel.startsWith("..") && !
|
|
9130
|
+
const rel = path12.relative(allowedPath, resolvedPath);
|
|
9131
|
+
return rel.length > 0 && !rel.startsWith("..") && !path12.isAbsolute(rel);
|
|
9039
9132
|
});
|
|
9040
9133
|
if (!isAllowed) {
|
|
9041
9134
|
throw new Error(`Path is outside allowed paths: ${inputPath}`);
|
|
@@ -9050,7 +9143,7 @@ var init_plugin_args = __esm({
|
|
|
9050
9143
|
|
|
9051
9144
|
// packages/poe-agent/src/plugins/poe-agent-plugin-files.ts
|
|
9052
9145
|
import fsPromises2 from "node:fs/promises";
|
|
9053
|
-
import
|
|
9146
|
+
import path13 from "node:path";
|
|
9054
9147
|
async function fileExists(fs3, filePath) {
|
|
9055
9148
|
try {
|
|
9056
9149
|
await fs3.readFile(filePath, "utf8");
|
|
@@ -9074,9 +9167,9 @@ var init_poe_agent_plugin_files = __esm({
|
|
|
9074
9167
|
"use strict";
|
|
9075
9168
|
init_plugin_args();
|
|
9076
9169
|
filesPlugin = (options = {}) => {
|
|
9077
|
-
const cwd =
|
|
9170
|
+
const cwd = path13.resolve(options.cwd ?? process.cwd());
|
|
9078
9171
|
const allowedPaths = (options.allowedPaths ?? [cwd]).map(
|
|
9079
|
-
(allowedPath) =>
|
|
9172
|
+
(allowedPath) => path13.resolve(cwd, allowedPath)
|
|
9080
9173
|
);
|
|
9081
9174
|
const fs3 = options.fs ?? fsPromises2;
|
|
9082
9175
|
const readFileTool = {
|
|
@@ -9130,7 +9223,7 @@ var init_poe_agent_plugin_files = __esm({
|
|
|
9130
9223
|
async call(args) {
|
|
9131
9224
|
const command = getRequiredString(args, "command");
|
|
9132
9225
|
const filePath = resolveAllowedPath(cwd, allowedPaths, getRequiredString(args, "path"));
|
|
9133
|
-
const displayedPath =
|
|
9226
|
+
const displayedPath = path13.relative(cwd, filePath) || path13.basename(filePath);
|
|
9134
9227
|
if (command === "str_replace") {
|
|
9135
9228
|
const oldStr = getRequiredString(args, "old_str", true);
|
|
9136
9229
|
const newStr = getRequiredString(args, "new_str", true);
|
|
@@ -9150,7 +9243,7 @@ var init_poe_agent_plugin_files = __esm({
|
|
|
9150
9243
|
if (await fileExists(fs3, filePath)) {
|
|
9151
9244
|
throw new Error("File already exists \u2014 use str_replace to edit");
|
|
9152
9245
|
}
|
|
9153
|
-
await fs3.mkdir(
|
|
9246
|
+
await fs3.mkdir(path13.dirname(filePath), { recursive: true });
|
|
9154
9247
|
await fs3.writeFile(filePath, fileText, "utf8");
|
|
9155
9248
|
return `Created file: ${displayedPath}`;
|
|
9156
9249
|
}
|
|
@@ -9191,7 +9284,7 @@ var init_poe_agent_plugin_files = __esm({
|
|
|
9191
9284
|
|
|
9192
9285
|
// packages/poe-agent/src/plugins/poe-agent-plugin-shell.ts
|
|
9193
9286
|
import { exec as execCallback } from "node:child_process";
|
|
9194
|
-
import
|
|
9287
|
+
import path14 from "node:path";
|
|
9195
9288
|
import { promisify } from "node:util";
|
|
9196
9289
|
async function defaultRunCommand(command, cwd) {
|
|
9197
9290
|
try {
|
|
@@ -9224,9 +9317,9 @@ var init_poe_agent_plugin_shell = __esm({
|
|
|
9224
9317
|
init_plugin_args();
|
|
9225
9318
|
exec = promisify(execCallback);
|
|
9226
9319
|
shellPlugin = (options = {}) => {
|
|
9227
|
-
const cwd =
|
|
9320
|
+
const cwd = path14.resolve(options.cwd ?? process.cwd());
|
|
9228
9321
|
const allowedPaths = (options.allowedPaths ?? [cwd]).map(
|
|
9229
|
-
(allowedPath) =>
|
|
9322
|
+
(allowedPath) => path14.resolve(cwd, allowedPath)
|
|
9230
9323
|
);
|
|
9231
9324
|
const runCommand2 = options.runCommand ?? defaultRunCommand;
|
|
9232
9325
|
const runCommandTool = {
|
|
@@ -12614,7 +12707,7 @@ var init_utils2 = __esm({
|
|
|
12614
12707
|
});
|
|
12615
12708
|
|
|
12616
12709
|
// packages/pipeline/src/config/loader.ts
|
|
12617
|
-
import
|
|
12710
|
+
import path15 from "node:path";
|
|
12618
12711
|
import { parse as parse4 } from "yaml";
|
|
12619
12712
|
function asStepMode(value) {
|
|
12620
12713
|
if (value === void 0 || value === null) {
|
|
@@ -12698,8 +12791,8 @@ async function loadStepsFile(fs3, filePath) {
|
|
|
12698
12791
|
return parseStepConfigDocument(filePath, content);
|
|
12699
12792
|
}
|
|
12700
12793
|
async function loadPipelineConfig(options) {
|
|
12701
|
-
const globalPath =
|
|
12702
|
-
const projectPath =
|
|
12794
|
+
const globalPath = path15.join(options.homeDir, ".poe-code", "pipeline", "config.yaml");
|
|
12795
|
+
const projectPath = path15.join(options.cwd, ".poe-code", "pipeline", "config.yaml");
|
|
12703
12796
|
const [globalConfig2, projectConfig] = await Promise.all([
|
|
12704
12797
|
loadConfigFile(options.fs, globalPath),
|
|
12705
12798
|
loadConfigFile(options.fs, projectPath)
|
|
@@ -12710,8 +12803,8 @@ async function loadPipelineConfig(options) {
|
|
|
12710
12803
|
};
|
|
12711
12804
|
}
|
|
12712
12805
|
async function loadResolvedSteps(options) {
|
|
12713
|
-
const globalPath =
|
|
12714
|
-
const projectPath =
|
|
12806
|
+
const globalPath = path15.join(options.homeDir, ".poe-code", "pipeline", "steps.yaml");
|
|
12807
|
+
const projectPath = path15.join(options.cwd, ".poe-code", "pipeline", "steps.yaml");
|
|
12715
12808
|
const [globalSteps, projectSteps] = await Promise.all([
|
|
12716
12809
|
loadStepsFile(options.fs, globalPath),
|
|
12717
12810
|
loadStepsFile(options.fs, projectPath)
|
|
@@ -12804,7 +12897,7 @@ var init_parser = __esm({
|
|
|
12804
12897
|
});
|
|
12805
12898
|
|
|
12806
12899
|
// packages/pipeline/src/plan/discovery.ts
|
|
12807
|
-
import
|
|
12900
|
+
import path16 from "node:path";
|
|
12808
12901
|
import * as fsPromises3 from "node:fs/promises";
|
|
12809
12902
|
function createDefaultFs() {
|
|
12810
12903
|
return {
|
|
@@ -12840,7 +12933,7 @@ function countCompletedTasks(planPath, content) {
|
|
|
12840
12933
|
};
|
|
12841
12934
|
}
|
|
12842
12935
|
async function ensurePlanExists(fs3, cwd, planPath) {
|
|
12843
|
-
const absolutePath =
|
|
12936
|
+
const absolutePath = path16.isAbsolute(planPath) ? planPath : path16.resolve(cwd, planPath);
|
|
12844
12937
|
try {
|
|
12845
12938
|
const stat8 = await fs3.stat(absolutePath);
|
|
12846
12939
|
if (!stat8.isFile()) {
|
|
@@ -12868,20 +12961,20 @@ async function scanPlansDir(fs3, plansDir, displayPrefix) {
|
|
|
12868
12961
|
if (!isPlanCandidateFile(entry)) {
|
|
12869
12962
|
continue;
|
|
12870
12963
|
}
|
|
12871
|
-
const absolutePath =
|
|
12964
|
+
const absolutePath = path16.join(plansDir, entry);
|
|
12872
12965
|
const stat8 = await fs3.stat(absolutePath);
|
|
12873
12966
|
if (!stat8.isFile()) {
|
|
12874
12967
|
continue;
|
|
12875
12968
|
}
|
|
12876
|
-
const displayPath =
|
|
12969
|
+
const displayPath = path16.join(displayPrefix, entry);
|
|
12877
12970
|
const content = await fs3.readFile(absolutePath, "utf8");
|
|
12878
12971
|
candidates.push(countCompletedTasks(displayPath, content));
|
|
12879
12972
|
}
|
|
12880
12973
|
return candidates;
|
|
12881
12974
|
}
|
|
12882
12975
|
async function listPlanCandidates(fs3, cwd, homeDir) {
|
|
12883
|
-
const projectDir =
|
|
12884
|
-
const globalDir =
|
|
12976
|
+
const projectDir = path16.join(cwd, ".poe-code", "pipeline", "plans");
|
|
12977
|
+
const globalDir = path16.join(homeDir, ".poe-code", "pipeline", "plans");
|
|
12885
12978
|
const [projectCandidates, globalCandidates] = await Promise.all([
|
|
12886
12979
|
scanPlansDir(fs3, projectDir, ".poe-code/pipeline/plans"),
|
|
12887
12980
|
scanPlansDir(fs3, globalDir, "~/.poe-code/pipeline/plans")
|
|
@@ -12892,9 +12985,9 @@ async function listPlanCandidates(fs3, cwd, homeDir) {
|
|
|
12892
12985
|
}
|
|
12893
12986
|
function resolveAbsolutePlanPath(planPath, cwd, homeDir) {
|
|
12894
12987
|
if (planPath.startsWith("~/")) {
|
|
12895
|
-
return
|
|
12988
|
+
return path16.join(homeDir, planPath.slice(2));
|
|
12896
12989
|
}
|
|
12897
|
-
return
|
|
12990
|
+
return path16.isAbsolute(planPath) ? planPath : path16.resolve(cwd, planPath);
|
|
12898
12991
|
}
|
|
12899
12992
|
async function resolvePlanPath(options) {
|
|
12900
12993
|
const fs3 = options.fs ?? createDefaultFs();
|
|
@@ -13137,7 +13230,7 @@ var init_lock = __esm({
|
|
|
13137
13230
|
});
|
|
13138
13231
|
|
|
13139
13232
|
// packages/pipeline/src/run/pipeline.ts
|
|
13140
|
-
import
|
|
13233
|
+
import path17 from "node:path";
|
|
13141
13234
|
import * as fsPromises5 from "node:fs/promises";
|
|
13142
13235
|
function createDefaultFs3() {
|
|
13143
13236
|
return {
|
|
@@ -13173,9 +13266,9 @@ function resolveMode(stepName, steps) {
|
|
|
13173
13266
|
return step.mode;
|
|
13174
13267
|
}
|
|
13175
13268
|
async function archivePlan(fs3, absolutePlanPath) {
|
|
13176
|
-
const dir =
|
|
13177
|
-
const archiveDir =
|
|
13178
|
-
const archivePath =
|
|
13269
|
+
const dir = path17.dirname(absolutePlanPath);
|
|
13270
|
+
const archiveDir = path17.join(dir, "archive");
|
|
13271
|
+
const archivePath = path17.join(archiveDir, path17.basename(absolutePlanPath));
|
|
13179
13272
|
await fs3.mkdir(archiveDir, { recursive: true });
|
|
13180
13273
|
await fs3.rename(absolutePlanPath, archivePath);
|
|
13181
13274
|
}
|
|
@@ -13494,7 +13587,7 @@ var init_frontmatter = __esm({
|
|
|
13494
13587
|
});
|
|
13495
13588
|
|
|
13496
13589
|
// packages/ralph/src/discovery/discovery.ts
|
|
13497
|
-
import
|
|
13590
|
+
import path18 from "node:path";
|
|
13498
13591
|
import * as fsPromises6 from "node:fs/promises";
|
|
13499
13592
|
function createDefaultFs4() {
|
|
13500
13593
|
return {
|
|
@@ -13529,12 +13622,12 @@ async function scanDir(fs3, absoluteDir, displayDir) {
|
|
|
13529
13622
|
if (!isMarkdownFile(entry)) {
|
|
13530
13623
|
continue;
|
|
13531
13624
|
}
|
|
13532
|
-
const absolutePath =
|
|
13625
|
+
const absolutePath = path18.join(absoluteDir, entry);
|
|
13533
13626
|
const stat8 = await fs3.stat(absolutePath);
|
|
13534
13627
|
if (!stat8.isFile()) {
|
|
13535
13628
|
continue;
|
|
13536
13629
|
}
|
|
13537
|
-
const displayPath =
|
|
13630
|
+
const displayPath = path18.join(displayDir, entry);
|
|
13538
13631
|
docs.push({
|
|
13539
13632
|
path: displayPath,
|
|
13540
13633
|
displayPath
|
|
@@ -13547,18 +13640,18 @@ async function discoverDocs(options) {
|
|
|
13547
13640
|
const [localDocs, globalDocs] = await Promise.all([
|
|
13548
13641
|
scanDir(
|
|
13549
13642
|
fs3,
|
|
13550
|
-
|
|
13643
|
+
path18.join(options.cwd, ".poe-code", "ralph", "plans"),
|
|
13551
13644
|
".poe-code/ralph/plans"
|
|
13552
13645
|
),
|
|
13553
13646
|
scanDir(
|
|
13554
13647
|
fs3,
|
|
13555
|
-
|
|
13648
|
+
path18.join(options.homeDir, ".poe-code", "ralph", "plans"),
|
|
13556
13649
|
"~/.poe-code/ralph/plans"
|
|
13557
13650
|
)
|
|
13558
13651
|
]);
|
|
13559
13652
|
return [...localDocs, ...globalDocs].sort((left, right) => {
|
|
13560
|
-
const leftName =
|
|
13561
|
-
const rightName =
|
|
13653
|
+
const leftName = path18.basename(left.displayPath).toLowerCase();
|
|
13654
|
+
const rightName = path18.basename(right.displayPath).toLowerCase();
|
|
13562
13655
|
return leftName === rightName ? left.displayPath.localeCompare(right.displayPath) : leftName.localeCompare(rightName);
|
|
13563
13656
|
});
|
|
13564
13657
|
}
|
|
@@ -13600,7 +13693,7 @@ var init_detector = __esm({
|
|
|
13600
13693
|
});
|
|
13601
13694
|
|
|
13602
13695
|
// packages/ralph/src/run/ralph.ts
|
|
13603
|
-
import
|
|
13696
|
+
import path19 from "node:path";
|
|
13604
13697
|
import * as fsPromises7 from "node:fs/promises";
|
|
13605
13698
|
async function runRalph(options) {
|
|
13606
13699
|
const fs3 = options.fs ?? createDefaultFs5();
|
|
@@ -13723,9 +13816,9 @@ function createDefaultFs5() {
|
|
|
13723
13816
|
}
|
|
13724
13817
|
function resolveAbsoluteDocPath(docPath, cwd, homeDir) {
|
|
13725
13818
|
if (docPath.startsWith("~/")) {
|
|
13726
|
-
return
|
|
13819
|
+
return path19.join(homeDir, docPath.slice(2));
|
|
13727
13820
|
}
|
|
13728
|
-
return
|
|
13821
|
+
return path19.isAbsolute(docPath) ? docPath : path19.resolve(cwd, docPath);
|
|
13729
13822
|
}
|
|
13730
13823
|
function assertNotAborted5(signal) {
|
|
13731
13824
|
if (!signal?.aborted) {
|
|
@@ -13746,9 +13839,9 @@ async function updateFrontmatter(fs3, absoluteDocPath, body, status, iteration)
|
|
|
13746
13839
|
await fs3.writeFile(absoluteDocPath, content);
|
|
13747
13840
|
}
|
|
13748
13841
|
async function archivePlan2(fs3, absoluteDocPath) {
|
|
13749
|
-
const dir =
|
|
13750
|
-
const archiveDir =
|
|
13751
|
-
const archivePath =
|
|
13842
|
+
const dir = path19.dirname(absoluteDocPath);
|
|
13843
|
+
const archiveDir = path19.join(dir, "archive");
|
|
13844
|
+
const archivePath = path19.join(archiveDir, path19.basename(absoluteDocPath));
|
|
13752
13845
|
await fs3.mkdir(archiveDir, { recursive: true });
|
|
13753
13846
|
await fs3.rename(absoluteDocPath, archivePath);
|
|
13754
13847
|
}
|
|
@@ -14142,7 +14235,7 @@ var init_container2 = __esm({
|
|
|
14142
14235
|
});
|
|
14143
14236
|
|
|
14144
14237
|
// src/services/config.ts
|
|
14145
|
-
import
|
|
14238
|
+
import path21 from "node:path";
|
|
14146
14239
|
async function deleteConfig(options) {
|
|
14147
14240
|
const { fs: fs3, filePath } = options;
|
|
14148
14241
|
try {
|
|
@@ -14223,7 +14316,7 @@ async function migrateLegacyCredentialsIfNeeded(fs3, filePath) {
|
|
|
14223
14316
|
await migrateLegacyCredentialsFile(fs3, filePath);
|
|
14224
14317
|
}
|
|
14225
14318
|
async function migrateLegacyCredentialsFile(fs3, configPath) {
|
|
14226
|
-
const legacyPath =
|
|
14319
|
+
const legacyPath = path21.join(path21.dirname(configPath), "credentials.json");
|
|
14227
14320
|
const raw = await readFileIfExists(fs3, legacyPath);
|
|
14228
14321
|
if (raw === null) {
|
|
14229
14322
|
return;
|
|
@@ -14288,25 +14381,40 @@ function normalizeConfiguredServices(value) {
|
|
|
14288
14381
|
async function recoverInvalidConfig(fs3, filePath, content) {
|
|
14289
14382
|
const backupPath = createInvalidBackupPath2(filePath);
|
|
14290
14383
|
await fs3.writeFile(backupPath, content, { encoding: "utf8" });
|
|
14291
|
-
await fs3.writeFile(filePath,
|
|
14384
|
+
await fs3.writeFile(filePath, EMPTY_DOCUMENT3, { encoding: "utf8" });
|
|
14292
14385
|
}
|
|
14293
14386
|
function createInvalidBackupPath2(filePath) {
|
|
14294
|
-
const directory =
|
|
14295
|
-
const baseName =
|
|
14296
|
-
return
|
|
14387
|
+
const directory = path21.dirname(filePath);
|
|
14388
|
+
const baseName = path21.basename(filePath);
|
|
14389
|
+
return path21.join(directory, `${baseName}.invalid-${createTimestamp()}.json`);
|
|
14297
14390
|
}
|
|
14298
14391
|
function isRecord5(value) {
|
|
14299
14392
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
14300
14393
|
}
|
|
14301
|
-
var CORE_SCOPE, configuredServicesScope,
|
|
14394
|
+
var coreConfigScope, knownConfigScopes, CORE_SCOPE, configuredServicesScope, EMPTY_DOCUMENT3;
|
|
14302
14395
|
var init_config3 = __esm({
|
|
14303
14396
|
"src/services/config.ts"() {
|
|
14304
14397
|
"use strict";
|
|
14305
14398
|
init_src3();
|
|
14306
14399
|
init_src4();
|
|
14307
|
-
|
|
14400
|
+
coreConfigScope = defineScope("core", {
|
|
14401
|
+
apiKey: {
|
|
14402
|
+
type: "string",
|
|
14403
|
+
default: "",
|
|
14404
|
+
env: "POE_API_KEY",
|
|
14405
|
+
doc: "Poe API key"
|
|
14406
|
+
},
|
|
14407
|
+
poeBaseUrl: {
|
|
14408
|
+
type: "string",
|
|
14409
|
+
default: "https://api.poe.com/v1",
|
|
14410
|
+
env: "POE_BASE_URL",
|
|
14411
|
+
doc: "Poe API base URL"
|
|
14412
|
+
}
|
|
14413
|
+
});
|
|
14414
|
+
knownConfigScopes = [coreConfigScope];
|
|
14415
|
+
CORE_SCOPE = coreConfigScope.scope;
|
|
14308
14416
|
configuredServicesScope = "configured_services";
|
|
14309
|
-
|
|
14417
|
+
EMPTY_DOCUMENT3 = `${JSON.stringify({}, null, 2)}
|
|
14310
14418
|
`;
|
|
14311
14419
|
}
|
|
14312
14420
|
});
|
|
@@ -14540,7 +14648,7 @@ var init_agent2 = __esm({
|
|
|
14540
14648
|
});
|
|
14541
14649
|
|
|
14542
14650
|
// src/cli/commands/spawn.ts
|
|
14543
|
-
import
|
|
14651
|
+
import path22 from "node:path";
|
|
14544
14652
|
function registerSpawnCommand(program, container, options = {}) {
|
|
14545
14653
|
const spawnServices = container.registry.list().filter((service) => typeof service.spawn === "function" || getSpawnConfig(service.name)).map((service) => service.name);
|
|
14546
14654
|
const extraServices = options.extraServices ?? [];
|
|
@@ -14573,7 +14681,7 @@ function registerSpawnCommand(program, container, options = {}) {
|
|
|
14573
14681
|
if (!proceed) {
|
|
14574
14682
|
return;
|
|
14575
14683
|
}
|
|
14576
|
-
const
|
|
14684
|
+
const model2 = await resolveConfiguredModel(
|
|
14577
14685
|
container,
|
|
14578
14686
|
canonicalService2,
|
|
14579
14687
|
commandOptions.model
|
|
@@ -14581,7 +14689,7 @@ function registerSpawnCommand(program, container, options = {}) {
|
|
|
14581
14689
|
const result = await spawnInteractive(canonicalService2, {
|
|
14582
14690
|
prompt: promptText ?? "",
|
|
14583
14691
|
args: forwardedArgs,
|
|
14584
|
-
model,
|
|
14692
|
+
model: model2,
|
|
14585
14693
|
mode: commandOptions.mode,
|
|
14586
14694
|
...mcpServers ? { mcpServers } : {},
|
|
14587
14695
|
cwd: cwdOverride
|
|
@@ -14599,7 +14707,7 @@ function registerSpawnCommand(program, container, options = {}) {
|
|
|
14599
14707
|
if (!promptText) {
|
|
14600
14708
|
throw new Error("No prompt provided via argument or stdin");
|
|
14601
14709
|
}
|
|
14602
|
-
const
|
|
14710
|
+
const directSpawnOptions = {
|
|
14603
14711
|
prompt: promptText,
|
|
14604
14712
|
args: forwardedArgs,
|
|
14605
14713
|
model: commandOptions.model,
|
|
@@ -14615,7 +14723,7 @@ function registerSpawnCommand(program, container, options = {}) {
|
|
|
14615
14723
|
await directHandler({
|
|
14616
14724
|
container,
|
|
14617
14725
|
service,
|
|
14618
|
-
options:
|
|
14726
|
+
options: directSpawnOptions,
|
|
14619
14727
|
flags,
|
|
14620
14728
|
resources: resources2
|
|
14621
14729
|
});
|
|
@@ -14624,6 +14732,15 @@ function registerSpawnCommand(program, container, options = {}) {
|
|
|
14624
14732
|
}
|
|
14625
14733
|
const adapter = resolveServiceAdapter(container, service);
|
|
14626
14734
|
const canonicalService = adapter.name;
|
|
14735
|
+
const model = await resolveConfiguredModel(
|
|
14736
|
+
container,
|
|
14737
|
+
canonicalService,
|
|
14738
|
+
commandOptions.model
|
|
14739
|
+
);
|
|
14740
|
+
const spawnOptions = {
|
|
14741
|
+
...directSpawnOptions,
|
|
14742
|
+
model
|
|
14743
|
+
};
|
|
14627
14744
|
const resources = createExecutionResources(container, flags, `spawn:${canonicalService}`);
|
|
14628
14745
|
resources.logger.intro(`spawn ${canonicalService}`);
|
|
14629
14746
|
const canonicalHandler = options.handlers?.[canonicalService];
|
|
@@ -14733,10 +14850,10 @@ function resolveSpawnWorkingDirectory2(baseDir, candidate) {
|
|
|
14733
14850
|
if (!candidate || candidate.trim().length === 0) {
|
|
14734
14851
|
return void 0;
|
|
14735
14852
|
}
|
|
14736
|
-
if (
|
|
14853
|
+
if (path22.isAbsolute(candidate)) {
|
|
14737
14854
|
return candidate;
|
|
14738
14855
|
}
|
|
14739
|
-
return
|
|
14856
|
+
return path22.resolve(baseDir, candidate);
|
|
14740
14857
|
}
|
|
14741
14858
|
function parseMcpSpawnConfig2(input) {
|
|
14742
14859
|
if (!input) {
|
|
@@ -14854,7 +14971,7 @@ var init_spawn4 = __esm({
|
|
|
14854
14971
|
});
|
|
14855
14972
|
|
|
14856
14973
|
// src/sdk/research.ts
|
|
14857
|
-
import
|
|
14974
|
+
import path23 from "node:path";
|
|
14858
14975
|
async function research(container, options) {
|
|
14859
14976
|
const logger2 = options.logger;
|
|
14860
14977
|
const source = await resolveSource({
|
|
@@ -14889,7 +15006,7 @@ async function research(container, options) {
|
|
|
14889
15006
|
markdown: markdownOutput
|
|
14890
15007
|
});
|
|
14891
15008
|
outputPath = buildOutputPath(container.env.homeDir, options.prompt);
|
|
14892
|
-
await ensureDirectory2(container.fs,
|
|
15009
|
+
await ensureDirectory2(container.fs, path23.dirname(outputPath));
|
|
14893
15010
|
await container.fs.writeFile(outputPath, document, {
|
|
14894
15011
|
encoding: "utf8"
|
|
14895
15012
|
});
|
|
@@ -14964,7 +15081,7 @@ function buildResearchDocument(input) {
|
|
|
14964
15081
|
}
|
|
14965
15082
|
function buildClonePath(homeDir, github) {
|
|
14966
15083
|
const slug = extractRepoSlug(github);
|
|
14967
|
-
return
|
|
15084
|
+
return path23.join(homeDir, ".poe-code", "repos", slug);
|
|
14968
15085
|
}
|
|
14969
15086
|
function extractRepoSlug(value) {
|
|
14970
15087
|
const trimmed = value.trim();
|
|
@@ -15002,7 +15119,7 @@ function extractRepoSlug(value) {
|
|
|
15002
15119
|
function buildOutputPath(homeDir, prompt, now = /* @__PURE__ */ new Date()) {
|
|
15003
15120
|
const timestamp = formatTimestamp2(now);
|
|
15004
15121
|
const slug = buildSlug(prompt);
|
|
15005
|
-
return
|
|
15122
|
+
return path23.join(
|
|
15006
15123
|
homeDir,
|
|
15007
15124
|
".poe-code",
|
|
15008
15125
|
"research",
|
|
@@ -15023,7 +15140,7 @@ async function resolveSource(input) {
|
|
|
15023
15140
|
if (options.github) {
|
|
15024
15141
|
const cloneUrl = resolveGithubCloneUrl(options.github);
|
|
15025
15142
|
const clonePath = buildClonePath(container.env.homeDir, options.github);
|
|
15026
|
-
await ensureDirectory2(container.fs,
|
|
15143
|
+
await ensureDirectory2(container.fs, path23.dirname(clonePath));
|
|
15027
15144
|
const exists = await pathExists2(container.fs, clonePath);
|
|
15028
15145
|
if (!exists) {
|
|
15029
15146
|
const cloneResult = await container.commandRunner(
|
|
@@ -15121,10 +15238,10 @@ function formatYamlString(value) {
|
|
|
15121
15238
|
return JSON.stringify(value);
|
|
15122
15239
|
}
|
|
15123
15240
|
function resolvePath2(baseDir, candidate) {
|
|
15124
|
-
if (
|
|
15241
|
+
if (path23.isAbsolute(candidate)) {
|
|
15125
15242
|
return candidate;
|
|
15126
15243
|
}
|
|
15127
|
-
return
|
|
15244
|
+
return path23.resolve(baseDir, candidate);
|
|
15128
15245
|
}
|
|
15129
15246
|
function teeAcpStream(events) {
|
|
15130
15247
|
const chunks = [];
|
|
@@ -15184,7 +15301,7 @@ async function removePathFallback(fs3, target) {
|
|
|
15184
15301
|
if (stats && typeof stats.isDirectory === "function" && stats.isDirectory()) {
|
|
15185
15302
|
const entries = await fs3.readdir(target);
|
|
15186
15303
|
for (const entry of entries) {
|
|
15187
|
-
await removePathFallback(fs3,
|
|
15304
|
+
await removePathFallback(fs3, path23.join(target, entry));
|
|
15188
15305
|
}
|
|
15189
15306
|
}
|
|
15190
15307
|
try {
|
|
@@ -15834,6 +15951,130 @@ var init_auth = __esm({
|
|
|
15834
15951
|
}
|
|
15835
15952
|
});
|
|
15836
15953
|
|
|
15954
|
+
// src/cli/commands/config.ts
|
|
15955
|
+
import { execSync } from "node:child_process";
|
|
15956
|
+
function registerConfigCommand(program, container) {
|
|
15957
|
+
const config2 = program.command("config").description("Inspect and manage poe-code config files.").action(async () => {
|
|
15958
|
+
await executeConfigInfo(program, container);
|
|
15959
|
+
});
|
|
15960
|
+
config2.command("show").description("Show config inputs and the merged result.").action(async () => {
|
|
15961
|
+
await executeConfigShow(program, container);
|
|
15962
|
+
});
|
|
15963
|
+
config2.command("init").description("Create an empty project config file.").action(async () => {
|
|
15964
|
+
await executeConfigInit(program, container);
|
|
15965
|
+
});
|
|
15966
|
+
config2.command("edit").description("Open a config file in $EDITOR.").option("--global", "Open the global config file.").option("--project", "Open the project config file.").action(async (options) => {
|
|
15967
|
+
await executeConfigEdit(program, container, options);
|
|
15968
|
+
});
|
|
15969
|
+
}
|
|
15970
|
+
async function executeConfigInfo(program, container) {
|
|
15971
|
+
const flags = resolveCommandFlags(program);
|
|
15972
|
+
const resources = createExecutionResources(container, flags, "config");
|
|
15973
|
+
const globalExists = await pathExists(container.fs, container.env.configPath);
|
|
15974
|
+
const projectExists = await pathExists(container.fs, container.env.projectConfigPath);
|
|
15975
|
+
resources.logger.intro("config");
|
|
15976
|
+
resources.logger.resolved(
|
|
15977
|
+
"Global config",
|
|
15978
|
+
`${container.env.configPath} (${globalExists ? "exists" : "missing"})`
|
|
15979
|
+
);
|
|
15980
|
+
resources.logger.resolved(
|
|
15981
|
+
"Project config",
|
|
15982
|
+
`${container.env.projectConfigPath} (${projectExists ? "exists" : "missing"})`
|
|
15983
|
+
);
|
|
15984
|
+
resources.logger.nextSteps([
|
|
15985
|
+
'Run "poe-code config show" to see resolved configuration.'
|
|
15986
|
+
]);
|
|
15987
|
+
}
|
|
15988
|
+
async function executeConfigShow(program, container) {
|
|
15989
|
+
const flags = resolveCommandFlags(program);
|
|
15990
|
+
const resources = createExecutionResources(container, flags, "config:show");
|
|
15991
|
+
const globalDocument = await readDocument(container.fs, container.env.configPath);
|
|
15992
|
+
const projectDocument = await readDocument(container.fs, container.env.projectConfigPath);
|
|
15993
|
+
const mergedDocument = await readMergedDocument(
|
|
15994
|
+
container.fs,
|
|
15995
|
+
container.env.configPath,
|
|
15996
|
+
container.env.projectConfigPath
|
|
15997
|
+
);
|
|
15998
|
+
const envOverrides = collectEnvOverrides(knownConfigScopes, container.env.variables);
|
|
15999
|
+
const resolvedDocument = deepMergeDocuments(mergedDocument, envOverrides.document);
|
|
16000
|
+
resources.logger.intro("config show");
|
|
16001
|
+
resources.logger.info(
|
|
16002
|
+
[
|
|
16003
|
+
formatDocumentSection("Global config", container.env.configPath, globalDocument),
|
|
16004
|
+
formatDocumentSection("Project config", container.env.projectConfigPath, projectDocument),
|
|
16005
|
+
formatEnvSection(envOverrides.entries),
|
|
16006
|
+
formatDocumentSection("Resolved (merged)", void 0, resolvedDocument)
|
|
16007
|
+
].join("\n\n")
|
|
16008
|
+
);
|
|
16009
|
+
}
|
|
16010
|
+
async function executeConfigInit(program, container) {
|
|
16011
|
+
const flags = resolveCommandFlags(program);
|
|
16012
|
+
const resources = createExecutionResources(container, flags, "config:init");
|
|
16013
|
+
const targetPath = container.env.projectConfigPath;
|
|
16014
|
+
resources.logger.intro("config init");
|
|
16015
|
+
if (await pathExists(container.fs, targetPath)) {
|
|
16016
|
+
resources.logger.info(`Project config already exists at ${targetPath}`);
|
|
16017
|
+
return;
|
|
16018
|
+
}
|
|
16019
|
+
if (flags.dryRun) {
|
|
16020
|
+
resources.logger.dryRun(`Dry run: would create project config at ${targetPath}`);
|
|
16021
|
+
return;
|
|
16022
|
+
}
|
|
16023
|
+
await initProjectConfig(container.fs, targetPath);
|
|
16024
|
+
resources.logger.success(`Created project config at ${targetPath}`);
|
|
16025
|
+
}
|
|
16026
|
+
async function executeConfigEdit(program, container, options) {
|
|
16027
|
+
const flags = resolveCommandFlags(program);
|
|
16028
|
+
const resources = createExecutionResources(container, flags, "config:edit");
|
|
16029
|
+
const editor = resolveEditor(container);
|
|
16030
|
+
resources.logger.intro("config edit");
|
|
16031
|
+
const targetPath = await resolveEditTarget(
|
|
16032
|
+
container.fs,
|
|
16033
|
+
container.env.configPath,
|
|
16034
|
+
container.env.projectConfigPath,
|
|
16035
|
+
options
|
|
16036
|
+
);
|
|
16037
|
+
if (flags.dryRun) {
|
|
16038
|
+
resources.logger.dryRun(`Dry run: would open ${targetPath} in ${editor}`);
|
|
16039
|
+
return;
|
|
16040
|
+
}
|
|
16041
|
+
if (!await pathExists(container.fs, targetPath)) {
|
|
16042
|
+
await initProjectConfig(container.fs, targetPath);
|
|
16043
|
+
}
|
|
16044
|
+
execSync(`${editor} ${shlexQuote(targetPath)}`, {
|
|
16045
|
+
stdio: "inherit"
|
|
16046
|
+
});
|
|
16047
|
+
}
|
|
16048
|
+
function formatDocumentSection(title, filePath, document) {
|
|
16049
|
+
const headingText = filePath ? `${title} (${filePath})` : title;
|
|
16050
|
+
const body = Object.keys(document).length === 0 ? text.muted("(empty)") : JSON.stringify(document, null, 2);
|
|
16051
|
+
return `${text.heading(`\u2500\u2500 ${headingText} \u2500\u2500`)}
|
|
16052
|
+
${body}`;
|
|
16053
|
+
}
|
|
16054
|
+
function formatEnvSection(entries) {
|
|
16055
|
+
const body = entries.length > 0 ? entries.join("\n") : text.muted("(empty)");
|
|
16056
|
+
return `${text.heading("\u2500\u2500 Environment variable overrides \u2500\u2500")}
|
|
16057
|
+
${body}`;
|
|
16058
|
+
}
|
|
16059
|
+
function resolveEditor(container) {
|
|
16060
|
+
const editor = container.env.getVariable("EDITOR") ?? container.env.getVariable("VISUAL");
|
|
16061
|
+
const resolved = typeof editor === "string" ? editor.trim() : "";
|
|
16062
|
+
if (resolved.length === 0) {
|
|
16063
|
+
throw new Error("Set $EDITOR to use this command");
|
|
16064
|
+
}
|
|
16065
|
+
return resolved;
|
|
16066
|
+
}
|
|
16067
|
+
var init_config4 = __esm({
|
|
16068
|
+
"src/cli/commands/config.ts"() {
|
|
16069
|
+
"use strict";
|
|
16070
|
+
init_src3();
|
|
16071
|
+
init_src4();
|
|
16072
|
+
init_src5();
|
|
16073
|
+
init_config3();
|
|
16074
|
+
init_shared();
|
|
16075
|
+
}
|
|
16076
|
+
});
|
|
16077
|
+
|
|
15837
16078
|
// src/cli/commands/install.ts
|
|
15838
16079
|
function registerInstallCommand(program, container) {
|
|
15839
16080
|
const serviceNames = container.registry.list().filter((service) => typeof service.install === "function").map((service) => service.name);
|
|
@@ -16030,7 +16271,7 @@ var init_media_download = __esm({
|
|
|
16030
16271
|
});
|
|
16031
16272
|
|
|
16032
16273
|
// src/cli/commands/generate.ts
|
|
16033
|
-
import
|
|
16274
|
+
import path24 from "node:path";
|
|
16034
16275
|
function registerGenerateCommand(program, container) {
|
|
16035
16276
|
const generate2 = program.command("generate").description("Generate content via Poe API").option("--model <model>", `Model identifier (default: ${DEFAULT_TEXT_MODEL})`).option(
|
|
16036
16277
|
"--param <key=value>",
|
|
@@ -16296,11 +16537,11 @@ function getDefaultMimeType(type) {
|
|
|
16296
16537
|
return defaults[type];
|
|
16297
16538
|
}
|
|
16298
16539
|
function resolveOutputPath(filename, cwd) {
|
|
16299
|
-
if (
|
|
16540
|
+
if (path24.isAbsolute(filename)) {
|
|
16300
16541
|
return { path: filename, label: filename };
|
|
16301
16542
|
}
|
|
16302
16543
|
return {
|
|
16303
|
-
path:
|
|
16544
|
+
path: path24.join(cwd, filename),
|
|
16304
16545
|
label: `./${filename}`
|
|
16305
16546
|
};
|
|
16306
16547
|
}
|
|
@@ -17404,8 +17645,8 @@ var init_parseUtil = __esm({
|
|
|
17404
17645
|
init_errors3();
|
|
17405
17646
|
init_en();
|
|
17406
17647
|
makeIssue = (params) => {
|
|
17407
|
-
const { data, path:
|
|
17408
|
-
const fullPath = [...
|
|
17648
|
+
const { data, path: path28, errorMaps, issueData } = params;
|
|
17649
|
+
const fullPath = [...path28, ...issueData.path || []];
|
|
17409
17650
|
const fullIssue = {
|
|
17410
17651
|
...issueData,
|
|
17411
17652
|
path: fullPath
|
|
@@ -17685,11 +17926,11 @@ var init_types4 = __esm({
|
|
|
17685
17926
|
init_parseUtil();
|
|
17686
17927
|
init_util();
|
|
17687
17928
|
ParseInputLazyPath = class {
|
|
17688
|
-
constructor(parent, value,
|
|
17929
|
+
constructor(parent, value, path28, key) {
|
|
17689
17930
|
this._cachedPath = [];
|
|
17690
17931
|
this.parent = parent;
|
|
17691
17932
|
this.data = value;
|
|
17692
|
-
this._path =
|
|
17933
|
+
this._path = path28;
|
|
17693
17934
|
this._key = key;
|
|
17694
17935
|
}
|
|
17695
17936
|
get path() {
|
|
@@ -21193,10 +21434,10 @@ function mergeDefs(...defs) {
|
|
|
21193
21434
|
function cloneDef(schema) {
|
|
21194
21435
|
return mergeDefs(schema._zod.def);
|
|
21195
21436
|
}
|
|
21196
|
-
function getElementAtPath(obj,
|
|
21197
|
-
if (!
|
|
21437
|
+
function getElementAtPath(obj, path28) {
|
|
21438
|
+
if (!path28)
|
|
21198
21439
|
return obj;
|
|
21199
|
-
return
|
|
21440
|
+
return path28.reduce((acc, key) => acc?.[key], obj);
|
|
21200
21441
|
}
|
|
21201
21442
|
function promiseAllObject(promisesObj) {
|
|
21202
21443
|
const keys = Object.keys(promisesObj);
|
|
@@ -21508,11 +21749,11 @@ function aborted(x, startIndex = 0) {
|
|
|
21508
21749
|
}
|
|
21509
21750
|
return false;
|
|
21510
21751
|
}
|
|
21511
|
-
function prefixIssues(
|
|
21752
|
+
function prefixIssues(path28, issues) {
|
|
21512
21753
|
return issues.map((iss) => {
|
|
21513
21754
|
var _a2;
|
|
21514
21755
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
21515
|
-
iss.path.unshift(
|
|
21756
|
+
iss.path.unshift(path28);
|
|
21516
21757
|
return iss;
|
|
21517
21758
|
});
|
|
21518
21759
|
}
|
|
@@ -33673,8 +33914,8 @@ var require_utils = __commonJS({
|
|
|
33673
33914
|
}
|
|
33674
33915
|
return ind;
|
|
33675
33916
|
}
|
|
33676
|
-
function removeDotSegments(
|
|
33677
|
-
let input =
|
|
33917
|
+
function removeDotSegments(path28) {
|
|
33918
|
+
let input = path28;
|
|
33678
33919
|
const output = [];
|
|
33679
33920
|
let nextSlash = -1;
|
|
33680
33921
|
let len = 0;
|
|
@@ -33873,8 +34114,8 @@ var require_schemes = __commonJS({
|
|
|
33873
34114
|
wsComponent.secure = void 0;
|
|
33874
34115
|
}
|
|
33875
34116
|
if (wsComponent.resourceName) {
|
|
33876
|
-
const [
|
|
33877
|
-
wsComponent.path =
|
|
34117
|
+
const [path28, query] = wsComponent.resourceName.split("?");
|
|
34118
|
+
wsComponent.path = path28 && path28 !== "/" ? path28 : void 0;
|
|
33878
34119
|
wsComponent.query = query;
|
|
33879
34120
|
wsComponent.resourceName = void 0;
|
|
33880
34121
|
}
|
|
@@ -37817,9 +38058,9 @@ var init_shapes = __esm({
|
|
|
37817
38058
|
});
|
|
37818
38059
|
|
|
37819
38060
|
// packages/agent-mcp-config/src/apply.ts
|
|
37820
|
-
import
|
|
38061
|
+
import path25 from "node:path";
|
|
37821
38062
|
function getConfigDirectory(configPath) {
|
|
37822
|
-
return
|
|
38063
|
+
return path25.dirname(configPath);
|
|
37823
38064
|
}
|
|
37824
38065
|
function isConfigObject5(value) {
|
|
37825
38066
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
@@ -38109,7 +38350,7 @@ var init_mcp2 = __esm({
|
|
|
38109
38350
|
|
|
38110
38351
|
// packages/agent-skill-config/src/configs.ts
|
|
38111
38352
|
import os2 from "node:os";
|
|
38112
|
-
import
|
|
38353
|
+
import path26 from "node:path";
|
|
38113
38354
|
function resolveAgentSupport2(input, registry2 = agentSkillConfigs) {
|
|
38114
38355
|
const resolvedId = resolveAgentId(input);
|
|
38115
38356
|
if (!resolvedId) {
|
|
@@ -39120,7 +39361,7 @@ var init_models2 = __esm({
|
|
|
39120
39361
|
});
|
|
39121
39362
|
|
|
39122
39363
|
// src/cli/commands/pipeline.ts
|
|
39123
|
-
import
|
|
39364
|
+
import path27 from "node:path";
|
|
39124
39365
|
import { readFile as readFile7, stat as stat7 } from "node:fs/promises";
|
|
39125
39366
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
39126
39367
|
function formatDuration(ms) {
|
|
@@ -39152,11 +39393,11 @@ function resolveMaxRuns(value) {
|
|
|
39152
39393
|
return parsed;
|
|
39153
39394
|
}
|
|
39154
39395
|
function resolvePipelinePaths(scope, cwd, homeDir) {
|
|
39155
|
-
const rootPath = scope === "global" ?
|
|
39396
|
+
const rootPath = scope === "global" ? path27.join(homeDir, ".poe-code", "pipeline") : path27.join(cwd, ".poe-code", "pipeline");
|
|
39156
39397
|
const displayRoot = scope === "global" ? "~/.poe-code/pipeline" : ".poe-code/pipeline";
|
|
39157
39398
|
return {
|
|
39158
|
-
plansPath:
|
|
39159
|
-
stepsPath:
|
|
39399
|
+
plansPath: path27.join(rootPath, "plans"),
|
|
39400
|
+
stepsPath: path27.join(rootPath, "steps.yaml"),
|
|
39160
39401
|
displayPlansPath: `${displayRoot}/plans`,
|
|
39161
39402
|
displayStepsPath: `${displayRoot}/steps.yaml`
|
|
39162
39403
|
};
|
|
@@ -39167,16 +39408,16 @@ async function loadPipelineTemplates() {
|
|
|
39167
39408
|
}
|
|
39168
39409
|
const packageRoot = await findPackageRoot(fileURLToPath4(import.meta.url));
|
|
39169
39410
|
const templateRoots = [
|
|
39170
|
-
|
|
39171
|
-
|
|
39411
|
+
path27.join(packageRoot, "src", "templates", "pipeline"),
|
|
39412
|
+
path27.join(packageRoot, "dist", "templates", "pipeline")
|
|
39172
39413
|
];
|
|
39173
39414
|
for (const templateRoot of templateRoots) {
|
|
39174
39415
|
if (!await pathExistsOnDisk(templateRoot)) {
|
|
39175
39416
|
continue;
|
|
39176
39417
|
}
|
|
39177
39418
|
const [skillPlan, steps] = await Promise.all([
|
|
39178
|
-
readFile7(
|
|
39179
|
-
readFile7(
|
|
39419
|
+
readFile7(path27.join(templateRoot, "SKILL_plan.md"), "utf8"),
|
|
39420
|
+
readFile7(path27.join(templateRoot, "steps.yaml.hbs"), "utf8")
|
|
39180
39421
|
]);
|
|
39181
39422
|
pipelineTemplatesCache = { skillPlan, steps };
|
|
39182
39423
|
return pipelineTemplatesCache;
|
|
@@ -39195,12 +39436,12 @@ async function pathExistsOnDisk(targetPath) {
|
|
|
39195
39436
|
}
|
|
39196
39437
|
}
|
|
39197
39438
|
async function findPackageRoot(entryFilePath) {
|
|
39198
|
-
let currentPath =
|
|
39439
|
+
let currentPath = path27.dirname(entryFilePath);
|
|
39199
39440
|
while (true) {
|
|
39200
|
-
if (await pathExistsOnDisk(
|
|
39441
|
+
if (await pathExistsOnDisk(path27.join(currentPath, "package.json"))) {
|
|
39201
39442
|
return currentPath;
|
|
39202
39443
|
}
|
|
39203
|
-
const parentPath =
|
|
39444
|
+
const parentPath = path27.dirname(currentPath);
|
|
39204
39445
|
if (parentPath === currentPath) {
|
|
39205
39446
|
throw new Error("Unable to locate package root for Pipeline templates.");
|
|
39206
39447
|
}
|
|
@@ -39478,7 +39719,7 @@ function registerPipelineCommand(program, container) {
|
|
|
39478
39719
|
`Would ${stepsExists ? "overwrite" : "create"}: ${pipelinePaths.displayStepsPath}`
|
|
39479
39720
|
);
|
|
39480
39721
|
} else {
|
|
39481
|
-
await container.fs.mkdir(
|
|
39722
|
+
await container.fs.mkdir(path27.dirname(pipelinePaths.stepsPath), {
|
|
39482
39723
|
recursive: true
|
|
39483
39724
|
});
|
|
39484
39725
|
await container.fs.writeFile(pipelinePaths.stepsPath, templates.steps, {
|
|
@@ -39740,7 +39981,7 @@ var init_package = __esm({
|
|
|
39740
39981
|
"package.json"() {
|
|
39741
39982
|
package_default = {
|
|
39742
39983
|
name: "poe-code",
|
|
39743
|
-
version: "3.0.
|
|
39984
|
+
version: "3.0.109",
|
|
39744
39985
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
39745
39986
|
type: "module",
|
|
39746
39987
|
main: "./dist/index.js",
|
|
@@ -39903,6 +40144,26 @@ function formatHelpText(input) {
|
|
|
39903
40144
|
args: "",
|
|
39904
40145
|
description: "Remove all configuration"
|
|
39905
40146
|
},
|
|
40147
|
+
{
|
|
40148
|
+
name: "config",
|
|
40149
|
+
args: "",
|
|
40150
|
+
description: "Show config file paths and usage hints"
|
|
40151
|
+
},
|
|
40152
|
+
{
|
|
40153
|
+
name: "config show",
|
|
40154
|
+
args: "",
|
|
40155
|
+
description: "Show config inputs and resolved result"
|
|
40156
|
+
},
|
|
40157
|
+
{
|
|
40158
|
+
name: "config init",
|
|
40159
|
+
args: "",
|
|
40160
|
+
description: "Create a project config file"
|
|
40161
|
+
},
|
|
40162
|
+
{
|
|
40163
|
+
name: "config edit",
|
|
40164
|
+
args: "",
|
|
40165
|
+
description: "Open a config file in your editor"
|
|
40166
|
+
},
|
|
39906
40167
|
{
|
|
39907
40168
|
name: "auth status",
|
|
39908
40169
|
args: "",
|
|
@@ -40117,6 +40378,7 @@ function bootstrapProgram(container) {
|
|
|
40117
40378
|
registerUnconfigureCommand(program, container);
|
|
40118
40379
|
registerLoginCommand(program, container);
|
|
40119
40380
|
registerLogoutCommand(program, container);
|
|
40381
|
+
registerConfigCommand(program, container);
|
|
40120
40382
|
registerAuthCommand(program, container);
|
|
40121
40383
|
registerMcpCommand(program, container);
|
|
40122
40384
|
registerSkillCommand(program, container);
|
|
@@ -40169,6 +40431,7 @@ var init_program = __esm({
|
|
|
40169
40431
|
init_login();
|
|
40170
40432
|
init_logout();
|
|
40171
40433
|
init_auth();
|
|
40434
|
+
init_config4();
|
|
40172
40435
|
init_install();
|
|
40173
40436
|
init_unconfigure();
|
|
40174
40437
|
init_test();
|
|
@@ -40462,7 +40725,7 @@ init_src6();
|
|
|
40462
40725
|
init_src5();
|
|
40463
40726
|
init_constants();
|
|
40464
40727
|
init_errors();
|
|
40465
|
-
import
|
|
40728
|
+
import path20 from "node:path";
|
|
40466
40729
|
import { Command } from "commander";
|
|
40467
40730
|
function parseMcpSpawnConfig(input) {
|
|
40468
40731
|
if (!input) {
|
|
@@ -40533,10 +40796,10 @@ function resolveWorkingDirectory(baseDir, candidate) {
|
|
|
40533
40796
|
if (!candidate || candidate.trim().length === 0) {
|
|
40534
40797
|
return void 0;
|
|
40535
40798
|
}
|
|
40536
|
-
if (
|
|
40799
|
+
if (path20.isAbsolute(candidate)) {
|
|
40537
40800
|
return candidate;
|
|
40538
40801
|
}
|
|
40539
|
-
return
|
|
40802
|
+
return path20.resolve(baseDir, candidate);
|
|
40540
40803
|
}
|
|
40541
40804
|
function createPoeAgentProgram() {
|
|
40542
40805
|
const program = new Command();
|