poe-code 3.0.106 → 3.0.108
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/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/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 +431 -177
- 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
|
});
|
|
@@ -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 ?? [];
|
|
@@ -14733,10 +14841,10 @@ function resolveSpawnWorkingDirectory2(baseDir, candidate) {
|
|
|
14733
14841
|
if (!candidate || candidate.trim().length === 0) {
|
|
14734
14842
|
return void 0;
|
|
14735
14843
|
}
|
|
14736
|
-
if (
|
|
14844
|
+
if (path22.isAbsolute(candidate)) {
|
|
14737
14845
|
return candidate;
|
|
14738
14846
|
}
|
|
14739
|
-
return
|
|
14847
|
+
return path22.resolve(baseDir, candidate);
|
|
14740
14848
|
}
|
|
14741
14849
|
function parseMcpSpawnConfig2(input) {
|
|
14742
14850
|
if (!input) {
|
|
@@ -14854,7 +14962,7 @@ var init_spawn4 = __esm({
|
|
|
14854
14962
|
});
|
|
14855
14963
|
|
|
14856
14964
|
// src/sdk/research.ts
|
|
14857
|
-
import
|
|
14965
|
+
import path23 from "node:path";
|
|
14858
14966
|
async function research(container, options) {
|
|
14859
14967
|
const logger2 = options.logger;
|
|
14860
14968
|
const source = await resolveSource({
|
|
@@ -14889,7 +14997,7 @@ async function research(container, options) {
|
|
|
14889
14997
|
markdown: markdownOutput
|
|
14890
14998
|
});
|
|
14891
14999
|
outputPath = buildOutputPath(container.env.homeDir, options.prompt);
|
|
14892
|
-
await ensureDirectory2(container.fs,
|
|
15000
|
+
await ensureDirectory2(container.fs, path23.dirname(outputPath));
|
|
14893
15001
|
await container.fs.writeFile(outputPath, document, {
|
|
14894
15002
|
encoding: "utf8"
|
|
14895
15003
|
});
|
|
@@ -14964,7 +15072,7 @@ function buildResearchDocument(input) {
|
|
|
14964
15072
|
}
|
|
14965
15073
|
function buildClonePath(homeDir, github) {
|
|
14966
15074
|
const slug = extractRepoSlug(github);
|
|
14967
|
-
return
|
|
15075
|
+
return path23.join(homeDir, ".poe-code", "repos", slug);
|
|
14968
15076
|
}
|
|
14969
15077
|
function extractRepoSlug(value) {
|
|
14970
15078
|
const trimmed = value.trim();
|
|
@@ -15002,7 +15110,7 @@ function extractRepoSlug(value) {
|
|
|
15002
15110
|
function buildOutputPath(homeDir, prompt, now = /* @__PURE__ */ new Date()) {
|
|
15003
15111
|
const timestamp = formatTimestamp2(now);
|
|
15004
15112
|
const slug = buildSlug(prompt);
|
|
15005
|
-
return
|
|
15113
|
+
return path23.join(
|
|
15006
15114
|
homeDir,
|
|
15007
15115
|
".poe-code",
|
|
15008
15116
|
"research",
|
|
@@ -15023,7 +15131,7 @@ async function resolveSource(input) {
|
|
|
15023
15131
|
if (options.github) {
|
|
15024
15132
|
const cloneUrl = resolveGithubCloneUrl(options.github);
|
|
15025
15133
|
const clonePath = buildClonePath(container.env.homeDir, options.github);
|
|
15026
|
-
await ensureDirectory2(container.fs,
|
|
15134
|
+
await ensureDirectory2(container.fs, path23.dirname(clonePath));
|
|
15027
15135
|
const exists = await pathExists2(container.fs, clonePath);
|
|
15028
15136
|
if (!exists) {
|
|
15029
15137
|
const cloneResult = await container.commandRunner(
|
|
@@ -15121,10 +15229,10 @@ function formatYamlString(value) {
|
|
|
15121
15229
|
return JSON.stringify(value);
|
|
15122
15230
|
}
|
|
15123
15231
|
function resolvePath2(baseDir, candidate) {
|
|
15124
|
-
if (
|
|
15232
|
+
if (path23.isAbsolute(candidate)) {
|
|
15125
15233
|
return candidate;
|
|
15126
15234
|
}
|
|
15127
|
-
return
|
|
15235
|
+
return path23.resolve(baseDir, candidate);
|
|
15128
15236
|
}
|
|
15129
15237
|
function teeAcpStream(events) {
|
|
15130
15238
|
const chunks = [];
|
|
@@ -15184,7 +15292,7 @@ async function removePathFallback(fs3, target) {
|
|
|
15184
15292
|
if (stats && typeof stats.isDirectory === "function" && stats.isDirectory()) {
|
|
15185
15293
|
const entries = await fs3.readdir(target);
|
|
15186
15294
|
for (const entry of entries) {
|
|
15187
|
-
await removePathFallback(fs3,
|
|
15295
|
+
await removePathFallback(fs3, path23.join(target, entry));
|
|
15188
15296
|
}
|
|
15189
15297
|
}
|
|
15190
15298
|
try {
|
|
@@ -15834,6 +15942,130 @@ var init_auth = __esm({
|
|
|
15834
15942
|
}
|
|
15835
15943
|
});
|
|
15836
15944
|
|
|
15945
|
+
// src/cli/commands/config.ts
|
|
15946
|
+
import { execSync } from "node:child_process";
|
|
15947
|
+
function registerConfigCommand(program, container) {
|
|
15948
|
+
const config2 = program.command("config").description("Inspect and manage poe-code config files.").action(async () => {
|
|
15949
|
+
await executeConfigInfo(program, container);
|
|
15950
|
+
});
|
|
15951
|
+
config2.command("show").description("Show config inputs and the merged result.").action(async () => {
|
|
15952
|
+
await executeConfigShow(program, container);
|
|
15953
|
+
});
|
|
15954
|
+
config2.command("init").description("Create an empty project config file.").action(async () => {
|
|
15955
|
+
await executeConfigInit(program, container);
|
|
15956
|
+
});
|
|
15957
|
+
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) => {
|
|
15958
|
+
await executeConfigEdit(program, container, options);
|
|
15959
|
+
});
|
|
15960
|
+
}
|
|
15961
|
+
async function executeConfigInfo(program, container) {
|
|
15962
|
+
const flags = resolveCommandFlags(program);
|
|
15963
|
+
const resources = createExecutionResources(container, flags, "config");
|
|
15964
|
+
const globalExists = await pathExists(container.fs, container.env.configPath);
|
|
15965
|
+
const projectExists = await pathExists(container.fs, container.env.projectConfigPath);
|
|
15966
|
+
resources.logger.intro("config");
|
|
15967
|
+
resources.logger.resolved(
|
|
15968
|
+
"Global config",
|
|
15969
|
+
`${container.env.configPath} (${globalExists ? "exists" : "missing"})`
|
|
15970
|
+
);
|
|
15971
|
+
resources.logger.resolved(
|
|
15972
|
+
"Project config",
|
|
15973
|
+
`${container.env.projectConfigPath} (${projectExists ? "exists" : "missing"})`
|
|
15974
|
+
);
|
|
15975
|
+
resources.logger.nextSteps([
|
|
15976
|
+
'Run "poe-code config show" to see resolved configuration.'
|
|
15977
|
+
]);
|
|
15978
|
+
}
|
|
15979
|
+
async function executeConfigShow(program, container) {
|
|
15980
|
+
const flags = resolveCommandFlags(program);
|
|
15981
|
+
const resources = createExecutionResources(container, flags, "config:show");
|
|
15982
|
+
const globalDocument = await readDocument(container.fs, container.env.configPath);
|
|
15983
|
+
const projectDocument = await readDocument(container.fs, container.env.projectConfigPath);
|
|
15984
|
+
const mergedDocument = await readMergedDocument(
|
|
15985
|
+
container.fs,
|
|
15986
|
+
container.env.configPath,
|
|
15987
|
+
container.env.projectConfigPath
|
|
15988
|
+
);
|
|
15989
|
+
const envOverrides = collectEnvOverrides(knownConfigScopes, container.env.variables);
|
|
15990
|
+
const resolvedDocument = deepMergeDocuments(mergedDocument, envOverrides.document);
|
|
15991
|
+
resources.logger.intro("config show");
|
|
15992
|
+
resources.logger.info(
|
|
15993
|
+
[
|
|
15994
|
+
formatDocumentSection("Global config", container.env.configPath, globalDocument),
|
|
15995
|
+
formatDocumentSection("Project config", container.env.projectConfigPath, projectDocument),
|
|
15996
|
+
formatEnvSection(envOverrides.entries),
|
|
15997
|
+
formatDocumentSection("Resolved (merged)", void 0, resolvedDocument)
|
|
15998
|
+
].join("\n\n")
|
|
15999
|
+
);
|
|
16000
|
+
}
|
|
16001
|
+
async function executeConfigInit(program, container) {
|
|
16002
|
+
const flags = resolveCommandFlags(program);
|
|
16003
|
+
const resources = createExecutionResources(container, flags, "config:init");
|
|
16004
|
+
const targetPath = container.env.projectConfigPath;
|
|
16005
|
+
resources.logger.intro("config init");
|
|
16006
|
+
if (await pathExists(container.fs, targetPath)) {
|
|
16007
|
+
resources.logger.info(`Project config already exists at ${targetPath}`);
|
|
16008
|
+
return;
|
|
16009
|
+
}
|
|
16010
|
+
if (flags.dryRun) {
|
|
16011
|
+
resources.logger.dryRun(`Dry run: would create project config at ${targetPath}`);
|
|
16012
|
+
return;
|
|
16013
|
+
}
|
|
16014
|
+
await initProjectConfig(container.fs, targetPath);
|
|
16015
|
+
resources.logger.success(`Created project config at ${targetPath}`);
|
|
16016
|
+
}
|
|
16017
|
+
async function executeConfigEdit(program, container, options) {
|
|
16018
|
+
const flags = resolveCommandFlags(program);
|
|
16019
|
+
const resources = createExecutionResources(container, flags, "config:edit");
|
|
16020
|
+
const editor = resolveEditor(container);
|
|
16021
|
+
resources.logger.intro("config edit");
|
|
16022
|
+
const targetPath = await resolveEditTarget(
|
|
16023
|
+
container.fs,
|
|
16024
|
+
container.env.configPath,
|
|
16025
|
+
container.env.projectConfigPath,
|
|
16026
|
+
options
|
|
16027
|
+
);
|
|
16028
|
+
if (flags.dryRun) {
|
|
16029
|
+
resources.logger.dryRun(`Dry run: would open ${targetPath} in ${editor}`);
|
|
16030
|
+
return;
|
|
16031
|
+
}
|
|
16032
|
+
if (!await pathExists(container.fs, targetPath)) {
|
|
16033
|
+
await initProjectConfig(container.fs, targetPath);
|
|
16034
|
+
}
|
|
16035
|
+
execSync(`${editor} ${shlexQuote(targetPath)}`, {
|
|
16036
|
+
stdio: "inherit"
|
|
16037
|
+
});
|
|
16038
|
+
}
|
|
16039
|
+
function formatDocumentSection(title, filePath, document) {
|
|
16040
|
+
const headingText = filePath ? `${title} (${filePath})` : title;
|
|
16041
|
+
const body = Object.keys(document).length === 0 ? text.muted("(empty)") : JSON.stringify(document, null, 2);
|
|
16042
|
+
return `${text.heading(`\u2500\u2500 ${headingText} \u2500\u2500`)}
|
|
16043
|
+
${body}`;
|
|
16044
|
+
}
|
|
16045
|
+
function formatEnvSection(entries) {
|
|
16046
|
+
const body = entries.length > 0 ? entries.join("\n") : text.muted("(empty)");
|
|
16047
|
+
return `${text.heading("\u2500\u2500 Environment variable overrides \u2500\u2500")}
|
|
16048
|
+
${body}`;
|
|
16049
|
+
}
|
|
16050
|
+
function resolveEditor(container) {
|
|
16051
|
+
const editor = container.env.getVariable("EDITOR") ?? container.env.getVariable("VISUAL");
|
|
16052
|
+
const resolved = typeof editor === "string" ? editor.trim() : "";
|
|
16053
|
+
if (resolved.length === 0) {
|
|
16054
|
+
throw new Error("Set $EDITOR to use this command");
|
|
16055
|
+
}
|
|
16056
|
+
return resolved;
|
|
16057
|
+
}
|
|
16058
|
+
var init_config4 = __esm({
|
|
16059
|
+
"src/cli/commands/config.ts"() {
|
|
16060
|
+
"use strict";
|
|
16061
|
+
init_src3();
|
|
16062
|
+
init_src4();
|
|
16063
|
+
init_src5();
|
|
16064
|
+
init_config3();
|
|
16065
|
+
init_shared();
|
|
16066
|
+
}
|
|
16067
|
+
});
|
|
16068
|
+
|
|
15837
16069
|
// src/cli/commands/install.ts
|
|
15838
16070
|
function registerInstallCommand(program, container) {
|
|
15839
16071
|
const serviceNames = container.registry.list().filter((service) => typeof service.install === "function").map((service) => service.name);
|
|
@@ -16030,7 +16262,7 @@ var init_media_download = __esm({
|
|
|
16030
16262
|
});
|
|
16031
16263
|
|
|
16032
16264
|
// src/cli/commands/generate.ts
|
|
16033
|
-
import
|
|
16265
|
+
import path24 from "node:path";
|
|
16034
16266
|
function registerGenerateCommand(program, container) {
|
|
16035
16267
|
const generate2 = program.command("generate").description("Generate content via Poe API").option("--model <model>", `Model identifier (default: ${DEFAULT_TEXT_MODEL})`).option(
|
|
16036
16268
|
"--param <key=value>",
|
|
@@ -16296,11 +16528,11 @@ function getDefaultMimeType(type) {
|
|
|
16296
16528
|
return defaults[type];
|
|
16297
16529
|
}
|
|
16298
16530
|
function resolveOutputPath(filename, cwd) {
|
|
16299
|
-
if (
|
|
16531
|
+
if (path24.isAbsolute(filename)) {
|
|
16300
16532
|
return { path: filename, label: filename };
|
|
16301
16533
|
}
|
|
16302
16534
|
return {
|
|
16303
|
-
path:
|
|
16535
|
+
path: path24.join(cwd, filename),
|
|
16304
16536
|
label: `./${filename}`
|
|
16305
16537
|
};
|
|
16306
16538
|
}
|
|
@@ -17404,8 +17636,8 @@ var init_parseUtil = __esm({
|
|
|
17404
17636
|
init_errors3();
|
|
17405
17637
|
init_en();
|
|
17406
17638
|
makeIssue = (params) => {
|
|
17407
|
-
const { data, path:
|
|
17408
|
-
const fullPath = [...
|
|
17639
|
+
const { data, path: path28, errorMaps, issueData } = params;
|
|
17640
|
+
const fullPath = [...path28, ...issueData.path || []];
|
|
17409
17641
|
const fullIssue = {
|
|
17410
17642
|
...issueData,
|
|
17411
17643
|
path: fullPath
|
|
@@ -17685,11 +17917,11 @@ var init_types4 = __esm({
|
|
|
17685
17917
|
init_parseUtil();
|
|
17686
17918
|
init_util();
|
|
17687
17919
|
ParseInputLazyPath = class {
|
|
17688
|
-
constructor(parent, value,
|
|
17920
|
+
constructor(parent, value, path28, key) {
|
|
17689
17921
|
this._cachedPath = [];
|
|
17690
17922
|
this.parent = parent;
|
|
17691
17923
|
this.data = value;
|
|
17692
|
-
this._path =
|
|
17924
|
+
this._path = path28;
|
|
17693
17925
|
this._key = key;
|
|
17694
17926
|
}
|
|
17695
17927
|
get path() {
|
|
@@ -21193,10 +21425,10 @@ function mergeDefs(...defs) {
|
|
|
21193
21425
|
function cloneDef(schema) {
|
|
21194
21426
|
return mergeDefs(schema._zod.def);
|
|
21195
21427
|
}
|
|
21196
|
-
function getElementAtPath(obj,
|
|
21197
|
-
if (!
|
|
21428
|
+
function getElementAtPath(obj, path28) {
|
|
21429
|
+
if (!path28)
|
|
21198
21430
|
return obj;
|
|
21199
|
-
return
|
|
21431
|
+
return path28.reduce((acc, key) => acc?.[key], obj);
|
|
21200
21432
|
}
|
|
21201
21433
|
function promiseAllObject(promisesObj) {
|
|
21202
21434
|
const keys = Object.keys(promisesObj);
|
|
@@ -21508,11 +21740,11 @@ function aborted(x, startIndex = 0) {
|
|
|
21508
21740
|
}
|
|
21509
21741
|
return false;
|
|
21510
21742
|
}
|
|
21511
|
-
function prefixIssues(
|
|
21743
|
+
function prefixIssues(path28, issues) {
|
|
21512
21744
|
return issues.map((iss) => {
|
|
21513
21745
|
var _a2;
|
|
21514
21746
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
21515
|
-
iss.path.unshift(
|
|
21747
|
+
iss.path.unshift(path28);
|
|
21516
21748
|
return iss;
|
|
21517
21749
|
});
|
|
21518
21750
|
}
|
|
@@ -33673,8 +33905,8 @@ var require_utils = __commonJS({
|
|
|
33673
33905
|
}
|
|
33674
33906
|
return ind;
|
|
33675
33907
|
}
|
|
33676
|
-
function removeDotSegments(
|
|
33677
|
-
let input =
|
|
33908
|
+
function removeDotSegments(path28) {
|
|
33909
|
+
let input = path28;
|
|
33678
33910
|
const output = [];
|
|
33679
33911
|
let nextSlash = -1;
|
|
33680
33912
|
let len = 0;
|
|
@@ -33873,8 +34105,8 @@ var require_schemes = __commonJS({
|
|
|
33873
34105
|
wsComponent.secure = void 0;
|
|
33874
34106
|
}
|
|
33875
34107
|
if (wsComponent.resourceName) {
|
|
33876
|
-
const [
|
|
33877
|
-
wsComponent.path =
|
|
34108
|
+
const [path28, query] = wsComponent.resourceName.split("?");
|
|
34109
|
+
wsComponent.path = path28 && path28 !== "/" ? path28 : void 0;
|
|
33878
34110
|
wsComponent.query = query;
|
|
33879
34111
|
wsComponent.resourceName = void 0;
|
|
33880
34112
|
}
|
|
@@ -37817,9 +38049,9 @@ var init_shapes = __esm({
|
|
|
37817
38049
|
});
|
|
37818
38050
|
|
|
37819
38051
|
// packages/agent-mcp-config/src/apply.ts
|
|
37820
|
-
import
|
|
38052
|
+
import path25 from "node:path";
|
|
37821
38053
|
function getConfigDirectory(configPath) {
|
|
37822
|
-
return
|
|
38054
|
+
return path25.dirname(configPath);
|
|
37823
38055
|
}
|
|
37824
38056
|
function isConfigObject5(value) {
|
|
37825
38057
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
@@ -38109,7 +38341,7 @@ var init_mcp2 = __esm({
|
|
|
38109
38341
|
|
|
38110
38342
|
// packages/agent-skill-config/src/configs.ts
|
|
38111
38343
|
import os2 from "node:os";
|
|
38112
|
-
import
|
|
38344
|
+
import path26 from "node:path";
|
|
38113
38345
|
function resolveAgentSupport2(input, registry2 = agentSkillConfigs) {
|
|
38114
38346
|
const resolvedId = resolveAgentId(input);
|
|
38115
38347
|
if (!resolvedId) {
|
|
@@ -39120,7 +39352,7 @@ var init_models2 = __esm({
|
|
|
39120
39352
|
});
|
|
39121
39353
|
|
|
39122
39354
|
// src/cli/commands/pipeline.ts
|
|
39123
|
-
import
|
|
39355
|
+
import path27 from "node:path";
|
|
39124
39356
|
import { readFile as readFile7, stat as stat7 } from "node:fs/promises";
|
|
39125
39357
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
39126
39358
|
function formatDuration(ms) {
|
|
@@ -39152,11 +39384,11 @@ function resolveMaxRuns(value) {
|
|
|
39152
39384
|
return parsed;
|
|
39153
39385
|
}
|
|
39154
39386
|
function resolvePipelinePaths(scope, cwd, homeDir) {
|
|
39155
|
-
const rootPath = scope === "global" ?
|
|
39387
|
+
const rootPath = scope === "global" ? path27.join(homeDir, ".poe-code", "pipeline") : path27.join(cwd, ".poe-code", "pipeline");
|
|
39156
39388
|
const displayRoot = scope === "global" ? "~/.poe-code/pipeline" : ".poe-code/pipeline";
|
|
39157
39389
|
return {
|
|
39158
|
-
plansPath:
|
|
39159
|
-
stepsPath:
|
|
39390
|
+
plansPath: path27.join(rootPath, "plans"),
|
|
39391
|
+
stepsPath: path27.join(rootPath, "steps.yaml"),
|
|
39160
39392
|
displayPlansPath: `${displayRoot}/plans`,
|
|
39161
39393
|
displayStepsPath: `${displayRoot}/steps.yaml`
|
|
39162
39394
|
};
|
|
@@ -39167,16 +39399,16 @@ async function loadPipelineTemplates() {
|
|
|
39167
39399
|
}
|
|
39168
39400
|
const packageRoot = await findPackageRoot(fileURLToPath4(import.meta.url));
|
|
39169
39401
|
const templateRoots = [
|
|
39170
|
-
|
|
39171
|
-
|
|
39402
|
+
path27.join(packageRoot, "src", "templates", "pipeline"),
|
|
39403
|
+
path27.join(packageRoot, "dist", "templates", "pipeline")
|
|
39172
39404
|
];
|
|
39173
39405
|
for (const templateRoot of templateRoots) {
|
|
39174
39406
|
if (!await pathExistsOnDisk(templateRoot)) {
|
|
39175
39407
|
continue;
|
|
39176
39408
|
}
|
|
39177
39409
|
const [skillPlan, steps] = await Promise.all([
|
|
39178
|
-
readFile7(
|
|
39179
|
-
readFile7(
|
|
39410
|
+
readFile7(path27.join(templateRoot, "SKILL_plan.md"), "utf8"),
|
|
39411
|
+
readFile7(path27.join(templateRoot, "steps.yaml.hbs"), "utf8")
|
|
39180
39412
|
]);
|
|
39181
39413
|
pipelineTemplatesCache = { skillPlan, steps };
|
|
39182
39414
|
return pipelineTemplatesCache;
|
|
@@ -39195,12 +39427,12 @@ async function pathExistsOnDisk(targetPath) {
|
|
|
39195
39427
|
}
|
|
39196
39428
|
}
|
|
39197
39429
|
async function findPackageRoot(entryFilePath) {
|
|
39198
|
-
let currentPath =
|
|
39430
|
+
let currentPath = path27.dirname(entryFilePath);
|
|
39199
39431
|
while (true) {
|
|
39200
|
-
if (await pathExistsOnDisk(
|
|
39432
|
+
if (await pathExistsOnDisk(path27.join(currentPath, "package.json"))) {
|
|
39201
39433
|
return currentPath;
|
|
39202
39434
|
}
|
|
39203
|
-
const parentPath =
|
|
39435
|
+
const parentPath = path27.dirname(currentPath);
|
|
39204
39436
|
if (parentPath === currentPath) {
|
|
39205
39437
|
throw new Error("Unable to locate package root for Pipeline templates.");
|
|
39206
39438
|
}
|
|
@@ -39478,7 +39710,7 @@ function registerPipelineCommand(program, container) {
|
|
|
39478
39710
|
`Would ${stepsExists ? "overwrite" : "create"}: ${pipelinePaths.displayStepsPath}`
|
|
39479
39711
|
);
|
|
39480
39712
|
} else {
|
|
39481
|
-
await container.fs.mkdir(
|
|
39713
|
+
await container.fs.mkdir(path27.dirname(pipelinePaths.stepsPath), {
|
|
39482
39714
|
recursive: true
|
|
39483
39715
|
});
|
|
39484
39716
|
await container.fs.writeFile(pipelinePaths.stepsPath, templates.steps, {
|
|
@@ -39740,7 +39972,7 @@ var init_package = __esm({
|
|
|
39740
39972
|
"package.json"() {
|
|
39741
39973
|
package_default = {
|
|
39742
39974
|
name: "poe-code",
|
|
39743
|
-
version: "3.0.
|
|
39975
|
+
version: "3.0.108",
|
|
39744
39976
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
39745
39977
|
type: "module",
|
|
39746
39978
|
main: "./dist/index.js",
|
|
@@ -39903,6 +40135,26 @@ function formatHelpText(input) {
|
|
|
39903
40135
|
args: "",
|
|
39904
40136
|
description: "Remove all configuration"
|
|
39905
40137
|
},
|
|
40138
|
+
{
|
|
40139
|
+
name: "config",
|
|
40140
|
+
args: "",
|
|
40141
|
+
description: "Show config file paths and usage hints"
|
|
40142
|
+
},
|
|
40143
|
+
{
|
|
40144
|
+
name: "config show",
|
|
40145
|
+
args: "",
|
|
40146
|
+
description: "Show config inputs and resolved result"
|
|
40147
|
+
},
|
|
40148
|
+
{
|
|
40149
|
+
name: "config init",
|
|
40150
|
+
args: "",
|
|
40151
|
+
description: "Create a project config file"
|
|
40152
|
+
},
|
|
40153
|
+
{
|
|
40154
|
+
name: "config edit",
|
|
40155
|
+
args: "",
|
|
40156
|
+
description: "Open a config file in your editor"
|
|
40157
|
+
},
|
|
39906
40158
|
{
|
|
39907
40159
|
name: "auth status",
|
|
39908
40160
|
args: "",
|
|
@@ -40117,6 +40369,7 @@ function bootstrapProgram(container) {
|
|
|
40117
40369
|
registerUnconfigureCommand(program, container);
|
|
40118
40370
|
registerLoginCommand(program, container);
|
|
40119
40371
|
registerLogoutCommand(program, container);
|
|
40372
|
+
registerConfigCommand(program, container);
|
|
40120
40373
|
registerAuthCommand(program, container);
|
|
40121
40374
|
registerMcpCommand(program, container);
|
|
40122
40375
|
registerSkillCommand(program, container);
|
|
@@ -40169,6 +40422,7 @@ var init_program = __esm({
|
|
|
40169
40422
|
init_login();
|
|
40170
40423
|
init_logout();
|
|
40171
40424
|
init_auth();
|
|
40425
|
+
init_config4();
|
|
40172
40426
|
init_install();
|
|
40173
40427
|
init_unconfigure();
|
|
40174
40428
|
init_test();
|
|
@@ -40462,7 +40716,7 @@ init_src6();
|
|
|
40462
40716
|
init_src5();
|
|
40463
40717
|
init_constants();
|
|
40464
40718
|
init_errors();
|
|
40465
|
-
import
|
|
40719
|
+
import path20 from "node:path";
|
|
40466
40720
|
import { Command } from "commander";
|
|
40467
40721
|
function parseMcpSpawnConfig(input) {
|
|
40468
40722
|
if (!input) {
|
|
@@ -40533,10 +40787,10 @@ function resolveWorkingDirectory(baseDir, candidate) {
|
|
|
40533
40787
|
if (!candidate || candidate.trim().length === 0) {
|
|
40534
40788
|
return void 0;
|
|
40535
40789
|
}
|
|
40536
|
-
if (
|
|
40790
|
+
if (path20.isAbsolute(candidate)) {
|
|
40537
40791
|
return candidate;
|
|
40538
40792
|
}
|
|
40539
|
-
return
|
|
40793
|
+
return path20.resolve(baseDir, candidate);
|
|
40540
40794
|
}
|
|
40541
40795
|
function createPoeAgentProgram() {
|
|
40542
40796
|
const program = new Command();
|