poe-code 3.0.103 → 3.0.105
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/auth.js +2 -1
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/configure-payload.js +6 -1
- package/dist/cli/commands/configure-payload.js.map +1 -1
- package/dist/cli/commands/configure.js +4 -1
- package/dist/cli/commands/configure.js.map +1 -1
- package/dist/cli/commands/login.js +2 -1
- package/dist/cli/commands/login.js.map +1 -1
- package/dist/cli/commands/logout.js +2 -1
- package/dist/cli/commands/logout.js.map +1 -1
- package/dist/cli/commands/research.js +3 -4
- package/dist/cli/commands/research.js.map +1 -1
- package/dist/cli/commands/spawn.js +7 -9
- package/dist/cli/commands/spawn.js.map +1 -1
- package/dist/cli/commands/unconfigure.js +2 -3
- package/dist/cli/commands/unconfigure.js.map +1 -1
- package/dist/cli/environment.d.ts +1 -0
- package/dist/cli/environment.js +4 -4
- package/dist/cli/environment.js.map +1 -1
- package/dist/index.js +679 -576
- package/dist/index.js.map +4 -4
- package/dist/sdk/spawn-core.d.ts +1 -0
- package/dist/sdk/spawn-core.js +23 -6
- package/dist/sdk/spawn-core.js.map +1 -1
- package/dist/sdk/spawn.js +19 -9
- package/dist/sdk/spawn.js.map +1 -1
- package/dist/services/config.d.ts +1 -0
- package/dist/services/config.js +5 -5
- package/dist/services/config.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -393,6 +393,177 @@ var init_credentials = __esm({
|
|
|
393
393
|
}
|
|
394
394
|
});
|
|
395
395
|
|
|
396
|
+
// packages/agent-defs/src/agents/claude-code.ts
|
|
397
|
+
var claudeCodeAgent;
|
|
398
|
+
var init_claude_code = __esm({
|
|
399
|
+
"packages/agent-defs/src/agents/claude-code.ts"() {
|
|
400
|
+
"use strict";
|
|
401
|
+
claudeCodeAgent = {
|
|
402
|
+
id: "claude-code",
|
|
403
|
+
name: "claude-code",
|
|
404
|
+
label: "Claude Code",
|
|
405
|
+
summary: "Configure Claude Code to route through Poe.",
|
|
406
|
+
aliases: ["claude"],
|
|
407
|
+
binaryName: "claude",
|
|
408
|
+
configPath: "~/.claude/settings.json",
|
|
409
|
+
branding: {
|
|
410
|
+
colors: {
|
|
411
|
+
dark: "#C15F3C",
|
|
412
|
+
light: "#C15F3C"
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
// packages/agent-defs/src/agents/claude-desktop.ts
|
|
420
|
+
var claudeDesktopAgent;
|
|
421
|
+
var init_claude_desktop = __esm({
|
|
422
|
+
"packages/agent-defs/src/agents/claude-desktop.ts"() {
|
|
423
|
+
"use strict";
|
|
424
|
+
claudeDesktopAgent = {
|
|
425
|
+
id: "claude-desktop",
|
|
426
|
+
name: "claude-desktop",
|
|
427
|
+
label: "Claude Desktop",
|
|
428
|
+
summary: "Anthropic's official desktop application for Claude",
|
|
429
|
+
configPath: "~/.claude/settings.json",
|
|
430
|
+
branding: {
|
|
431
|
+
colors: {
|
|
432
|
+
dark: "#D97757",
|
|
433
|
+
light: "#D97757"
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
// packages/agent-defs/src/agents/codex.ts
|
|
441
|
+
var codexAgent;
|
|
442
|
+
var init_codex = __esm({
|
|
443
|
+
"packages/agent-defs/src/agents/codex.ts"() {
|
|
444
|
+
"use strict";
|
|
445
|
+
codexAgent = {
|
|
446
|
+
id: "codex",
|
|
447
|
+
name: "codex",
|
|
448
|
+
label: "Codex",
|
|
449
|
+
summary: "Configure Codex to use Poe as the model provider.",
|
|
450
|
+
binaryName: "codex",
|
|
451
|
+
configPath: "~/.codex/config.toml",
|
|
452
|
+
branding: {
|
|
453
|
+
colors: {
|
|
454
|
+
dark: "#D5D9DF",
|
|
455
|
+
light: "#7A7F86"
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
// packages/agent-defs/src/agents/opencode.ts
|
|
463
|
+
var openCodeAgent;
|
|
464
|
+
var init_opencode = __esm({
|
|
465
|
+
"packages/agent-defs/src/agents/opencode.ts"() {
|
|
466
|
+
"use strict";
|
|
467
|
+
openCodeAgent = {
|
|
468
|
+
id: "opencode",
|
|
469
|
+
name: "opencode",
|
|
470
|
+
label: "OpenCode CLI",
|
|
471
|
+
summary: "Configure OpenCode CLI to use the Poe API.",
|
|
472
|
+
binaryName: "opencode",
|
|
473
|
+
configPath: "~/.config/opencode/config.json",
|
|
474
|
+
branding: {
|
|
475
|
+
colors: {
|
|
476
|
+
dark: "#4A4F55",
|
|
477
|
+
light: "#2F3338"
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
// packages/agent-defs/src/agents/kimi.ts
|
|
485
|
+
var kimiAgent;
|
|
486
|
+
var init_kimi = __esm({
|
|
487
|
+
"packages/agent-defs/src/agents/kimi.ts"() {
|
|
488
|
+
"use strict";
|
|
489
|
+
kimiAgent = {
|
|
490
|
+
id: "kimi",
|
|
491
|
+
name: "kimi",
|
|
492
|
+
label: "Kimi",
|
|
493
|
+
summary: "Configure Kimi CLI to use Poe API",
|
|
494
|
+
aliases: ["kimi-cli"],
|
|
495
|
+
binaryName: "kimi",
|
|
496
|
+
configPath: "~/.kimi/config.toml",
|
|
497
|
+
branding: {
|
|
498
|
+
colors: {
|
|
499
|
+
dark: "#7B68EE",
|
|
500
|
+
light: "#6A5ACD"
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
// packages/agent-defs/src/agents/index.ts
|
|
508
|
+
var init_agents = __esm({
|
|
509
|
+
"packages/agent-defs/src/agents/index.ts"() {
|
|
510
|
+
"use strict";
|
|
511
|
+
init_claude_code();
|
|
512
|
+
init_claude_desktop();
|
|
513
|
+
init_codex();
|
|
514
|
+
init_opencode();
|
|
515
|
+
init_kimi();
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
// packages/agent-defs/src/registry.ts
|
|
520
|
+
function resolveAgentId(input) {
|
|
521
|
+
if (!input) {
|
|
522
|
+
return void 0;
|
|
523
|
+
}
|
|
524
|
+
return lookup.get(input.toLowerCase());
|
|
525
|
+
}
|
|
526
|
+
var allAgents, lookup;
|
|
527
|
+
var init_registry = __esm({
|
|
528
|
+
"packages/agent-defs/src/registry.ts"() {
|
|
529
|
+
"use strict";
|
|
530
|
+
init_agents();
|
|
531
|
+
allAgents = [
|
|
532
|
+
claudeCodeAgent,
|
|
533
|
+
claudeDesktopAgent,
|
|
534
|
+
codexAgent,
|
|
535
|
+
openCodeAgent,
|
|
536
|
+
kimiAgent
|
|
537
|
+
];
|
|
538
|
+
lookup = /* @__PURE__ */ new Map();
|
|
539
|
+
for (const agent2 of allAgents) {
|
|
540
|
+
const values = [agent2.id, agent2.name, ...agent2.aliases ?? []];
|
|
541
|
+
for (const value of values) {
|
|
542
|
+
const normalized = value.toLowerCase();
|
|
543
|
+
if (!lookup.has(normalized)) {
|
|
544
|
+
lookup.set(normalized, agent2.id);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
// packages/agent-defs/src/index.ts
|
|
552
|
+
var init_src2 = __esm({
|
|
553
|
+
"packages/agent-defs/src/index.ts"() {
|
|
554
|
+
"use strict";
|
|
555
|
+
init_agents();
|
|
556
|
+
init_registry();
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
// packages/poe-code-config/src/schema.ts
|
|
561
|
+
var init_schema = __esm({
|
|
562
|
+
"packages/poe-code-config/src/schema.ts"() {
|
|
563
|
+
"use strict";
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
|
|
396
567
|
// packages/config-mutations/src/mutations/config-mutation.ts
|
|
397
568
|
function merge(options) {
|
|
398
569
|
return {
|
|
@@ -1430,7 +1601,7 @@ var init_types = __esm({
|
|
|
1430
1601
|
});
|
|
1431
1602
|
|
|
1432
1603
|
// packages/config-mutations/src/index.ts
|
|
1433
|
-
var
|
|
1604
|
+
var init_src3 = __esm({
|
|
1434
1605
|
"packages/config-mutations/src/index.ts"() {
|
|
1435
1606
|
"use strict";
|
|
1436
1607
|
init_config_mutation();
|
|
@@ -1443,6 +1614,192 @@ var init_src2 = __esm({
|
|
|
1443
1614
|
}
|
|
1444
1615
|
});
|
|
1445
1616
|
|
|
1617
|
+
// packages/poe-code-config/src/merge.ts
|
|
1618
|
+
function deepMergeDocuments(base, override) {
|
|
1619
|
+
const merged = {};
|
|
1620
|
+
const scopes = /* @__PURE__ */ new Set([...Object.keys(base), ...Object.keys(override)]);
|
|
1621
|
+
for (const scope of scopes) {
|
|
1622
|
+
const baseScope = base[scope] ?? {};
|
|
1623
|
+
const overrideScope = override[scope] ?? {};
|
|
1624
|
+
const scopeEntries = Object.entries(overrideScope).filter(([, value]) => value !== void 0);
|
|
1625
|
+
const nextScope = {
|
|
1626
|
+
...baseScope,
|
|
1627
|
+
...Object.fromEntries(scopeEntries)
|
|
1628
|
+
};
|
|
1629
|
+
if (Object.keys(nextScope).length > 0) {
|
|
1630
|
+
merged[scope] = nextScope;
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
return merged;
|
|
1634
|
+
}
|
|
1635
|
+
var init_merge = __esm({
|
|
1636
|
+
"packages/poe-code-config/src/merge.ts"() {
|
|
1637
|
+
"use strict";
|
|
1638
|
+
}
|
|
1639
|
+
});
|
|
1640
|
+
|
|
1641
|
+
// packages/poe-code-config/src/store.ts
|
|
1642
|
+
import path3 from "node:path";
|
|
1643
|
+
async function readDocument(fs3, filePath) {
|
|
1644
|
+
try {
|
|
1645
|
+
const raw = await fs3.readFile(filePath, "utf8");
|
|
1646
|
+
return await parseDocument(fs3, filePath, raw);
|
|
1647
|
+
} catch (error2) {
|
|
1648
|
+
if (isNotFound(error2)) {
|
|
1649
|
+
return {};
|
|
1650
|
+
}
|
|
1651
|
+
throw error2;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
async function writeScope(fs3, filePath, scope, values) {
|
|
1655
|
+
const document = await readDocument(fs3, filePath);
|
|
1656
|
+
const normalizedValues = normalizeScopeValues(values);
|
|
1657
|
+
if (Object.keys(normalizedValues).length === 0) {
|
|
1658
|
+
delete document[scope];
|
|
1659
|
+
} else {
|
|
1660
|
+
document[scope] = normalizedValues;
|
|
1661
|
+
}
|
|
1662
|
+
await writeDocument(fs3, filePath, document);
|
|
1663
|
+
}
|
|
1664
|
+
async function readMergedDocument(fs3, globalPath, projectPath) {
|
|
1665
|
+
const globalDocument = await readDocument(fs3, globalPath);
|
|
1666
|
+
if (!projectPath) {
|
|
1667
|
+
return globalDocument;
|
|
1668
|
+
}
|
|
1669
|
+
const projectDocument = await readDocument(fs3, projectPath);
|
|
1670
|
+
return deepMergeDocuments(globalDocument, projectDocument);
|
|
1671
|
+
}
|
|
1672
|
+
async function parseDocument(fs3, filePath, raw) {
|
|
1673
|
+
try {
|
|
1674
|
+
return normalizeDocument(JSON.parse(raw));
|
|
1675
|
+
} catch (error2) {
|
|
1676
|
+
if (error2 instanceof SyntaxError) {
|
|
1677
|
+
await recoverInvalidDocument(fs3, filePath, raw);
|
|
1678
|
+
return {};
|
|
1679
|
+
}
|
|
1680
|
+
throw error2;
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
function normalizeDocument(value) {
|
|
1684
|
+
if (!isRecord2(value)) {
|
|
1685
|
+
return {};
|
|
1686
|
+
}
|
|
1687
|
+
const document = {};
|
|
1688
|
+
for (const [scope, scopeValues] of Object.entries(value)) {
|
|
1689
|
+
const normalizedValues = normalizeScopeValues(scopeValues);
|
|
1690
|
+
if (Object.keys(normalizedValues).length > 0) {
|
|
1691
|
+
document[scope] = normalizedValues;
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
return document;
|
|
1695
|
+
}
|
|
1696
|
+
function normalizeScopeValues(value) {
|
|
1697
|
+
if (!isRecord2(value)) {
|
|
1698
|
+
return {};
|
|
1699
|
+
}
|
|
1700
|
+
const normalized = {};
|
|
1701
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
1702
|
+
if (entry !== void 0) {
|
|
1703
|
+
normalized[key] = entry;
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
return normalized;
|
|
1707
|
+
}
|
|
1708
|
+
async function writeDocument(fs3, filePath, document) {
|
|
1709
|
+
await fs3.mkdir(path3.dirname(filePath), { recursive: true });
|
|
1710
|
+
await fs3.writeFile(filePath, `${JSON.stringify(document, null, 2)}
|
|
1711
|
+
`, {
|
|
1712
|
+
encoding: "utf8"
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
async function recoverInvalidDocument(fs3, filePath, content) {
|
|
1716
|
+
await fs3.mkdir(path3.dirname(filePath), { recursive: true });
|
|
1717
|
+
const backupPath = createInvalidBackupPath(filePath);
|
|
1718
|
+
await fs3.writeFile(backupPath, content, { encoding: "utf8" });
|
|
1719
|
+
await fs3.writeFile(filePath, EMPTY_DOCUMENT, { encoding: "utf8" });
|
|
1720
|
+
}
|
|
1721
|
+
function createInvalidBackupPath(filePath) {
|
|
1722
|
+
const directory = path3.dirname(filePath);
|
|
1723
|
+
const baseName = path3.basename(filePath);
|
|
1724
|
+
return path3.join(directory, `${baseName}.invalid-${createTimestamp()}.json`);
|
|
1725
|
+
}
|
|
1726
|
+
function isRecord2(value) {
|
|
1727
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
1728
|
+
}
|
|
1729
|
+
function resolveConfigPath(homeDir) {
|
|
1730
|
+
return path3.join(homeDir, ".poe-code", "config.json");
|
|
1731
|
+
}
|
|
1732
|
+
function resolveProjectConfigPath(cwd) {
|
|
1733
|
+
return path3.join(cwd, ".poe-code", "config.json");
|
|
1734
|
+
}
|
|
1735
|
+
var EMPTY_DOCUMENT;
|
|
1736
|
+
var init_store = __esm({
|
|
1737
|
+
"packages/poe-code-config/src/store.ts"() {
|
|
1738
|
+
"use strict";
|
|
1739
|
+
init_src3();
|
|
1740
|
+
init_merge();
|
|
1741
|
+
EMPTY_DOCUMENT = `${JSON.stringify({}, null, 2)}
|
|
1742
|
+
`;
|
|
1743
|
+
}
|
|
1744
|
+
});
|
|
1745
|
+
|
|
1746
|
+
// packages/poe-code-config/src/resolve.ts
|
|
1747
|
+
var init_resolve = __esm({
|
|
1748
|
+
"packages/poe-code-config/src/resolve.ts"() {
|
|
1749
|
+
"use strict";
|
|
1750
|
+
}
|
|
1751
|
+
});
|
|
1752
|
+
|
|
1753
|
+
// packages/poe-code-config/src/config.ts
|
|
1754
|
+
var init_config = __esm({
|
|
1755
|
+
"packages/poe-code-config/src/config.ts"() {
|
|
1756
|
+
"use strict";
|
|
1757
|
+
init_store();
|
|
1758
|
+
init_resolve();
|
|
1759
|
+
}
|
|
1760
|
+
});
|
|
1761
|
+
|
|
1762
|
+
// packages/poe-code-config/src/models.ts
|
|
1763
|
+
async function loadAgentModel(options, agentId) {
|
|
1764
|
+
const models = await readModelsScope(options);
|
|
1765
|
+
const value = models[agentId];
|
|
1766
|
+
return typeof value === "string" ? value : null;
|
|
1767
|
+
}
|
|
1768
|
+
async function loadDefaultModel(options) {
|
|
1769
|
+
const models = await readModelsScope(options);
|
|
1770
|
+
const value = models[DEFAULT_KEY];
|
|
1771
|
+
return typeof value === "string" ? value : null;
|
|
1772
|
+
}
|
|
1773
|
+
async function resolveModel(options, agentId) {
|
|
1774
|
+
return await loadAgentModel(options, agentId) ?? await loadDefaultModel(options);
|
|
1775
|
+
}
|
|
1776
|
+
async function readModelsScope(options) {
|
|
1777
|
+
const document = await readDocument(options.fs, options.filePath);
|
|
1778
|
+
return document[SCOPE] ?? {};
|
|
1779
|
+
}
|
|
1780
|
+
var SCOPE, DEFAULT_KEY;
|
|
1781
|
+
var init_models = __esm({
|
|
1782
|
+
"packages/poe-code-config/src/models.ts"() {
|
|
1783
|
+
"use strict";
|
|
1784
|
+
init_store();
|
|
1785
|
+
SCOPE = "models";
|
|
1786
|
+
DEFAULT_KEY = "default";
|
|
1787
|
+
}
|
|
1788
|
+
});
|
|
1789
|
+
|
|
1790
|
+
// packages/poe-code-config/src/index.ts
|
|
1791
|
+
var init_src4 = __esm({
|
|
1792
|
+
"packages/poe-code-config/src/index.ts"() {
|
|
1793
|
+
"use strict";
|
|
1794
|
+
init_schema();
|
|
1795
|
+
init_config();
|
|
1796
|
+
init_merge();
|
|
1797
|
+
init_models();
|
|
1798
|
+
init_resolve();
|
|
1799
|
+
init_store();
|
|
1800
|
+
}
|
|
1801
|
+
});
|
|
1802
|
+
|
|
1446
1803
|
// src/utils/dry-run.ts
|
|
1447
1804
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
1448
1805
|
import { basename, extname } from "node:path";
|
|
@@ -1762,7 +2119,7 @@ var REDACTED_PLACEHOLDER, JSON_SENSITIVE_KEYS, AUTH_SENSITIVE_KEYS, TOML_SENSITI
|
|
|
1762
2119
|
var init_dry_run = __esm({
|
|
1763
2120
|
"src/utils/dry-run.ts"() {
|
|
1764
2121
|
"use strict";
|
|
1765
|
-
|
|
2122
|
+
init_src3();
|
|
1766
2123
|
REDACTED_PLACEHOLDER = "<redacted>";
|
|
1767
2124
|
JSON_SENSITIVE_KEYS = ["apiKey", "api_key", "apiKeyHelper"];
|
|
1768
2125
|
AUTH_SENSITIVE_KEYS = ["key"];
|
|
@@ -1918,7 +2275,7 @@ var init_context = __esm({
|
|
|
1918
2275
|
});
|
|
1919
2276
|
|
|
1920
2277
|
// src/cli/isolated-env.ts
|
|
1921
|
-
import
|
|
2278
|
+
import path4 from "node:path";
|
|
1922
2279
|
async function resolveIsolatedEnvDetails(env, isolated, providerName, readApiKey) {
|
|
1923
2280
|
if (!providerName) {
|
|
1924
2281
|
throw new Error("resolveIsolatedEnvDetails requires providerName.");
|
|
@@ -1940,7 +2297,7 @@ function resolveIsolatedTargetDirectory(input) {
|
|
|
1940
2297
|
const expanded = expandHomeShortcut(input.env, input.targetDirectory);
|
|
1941
2298
|
const baseDir = resolveIsolatedBaseDir(input.env, input.providerName);
|
|
1942
2299
|
const homeDir = input.env.homeDir;
|
|
1943
|
-
const homeDirWithSep = `${homeDir}${
|
|
2300
|
+
const homeDirWithSep = `${homeDir}${path4.sep}`;
|
|
1944
2301
|
if (expanded !== homeDir && !expanded.startsWith(homeDirWithSep)) {
|
|
1945
2302
|
throw new Error(
|
|
1946
2303
|
`Isolated config targets must live under the user's home directory (received "${input.targetDirectory}").`
|
|
@@ -1955,7 +2312,7 @@ function resolveIsolatedTargetDirectory(input) {
|
|
|
1955
2312
|
if (!expanded.startsWith(homeDirWithSep)) {
|
|
1956
2313
|
return expanded;
|
|
1957
2314
|
}
|
|
1958
|
-
const mapped =
|
|
2315
|
+
const mapped = path4.join(baseDir, expanded.slice(homeDirWithSep.length));
|
|
1959
2316
|
return stripAgentHome(mapped, baseDir, input.isolated.agentBinary);
|
|
1960
2317
|
}
|
|
1961
2318
|
function resolveIsolatedBaseDir(env, providerName) {
|
|
@@ -2004,9 +2361,9 @@ async function resolveIsolatedEnvValue(env, baseDir, value, readApiKey) {
|
|
|
2004
2361
|
function resolveIsolatedEnvPath(env, baseDir, value) {
|
|
2005
2362
|
switch (value.kind) {
|
|
2006
2363
|
case "isolatedDir":
|
|
2007
|
-
return value.relativePath ?
|
|
2364
|
+
return value.relativePath ? path4.join(baseDir, value.relativePath) : baseDir;
|
|
2008
2365
|
case "isolatedFile":
|
|
2009
|
-
return
|
|
2366
|
+
return path4.join(baseDir, value.relativePath);
|
|
2010
2367
|
}
|
|
2011
2368
|
}
|
|
2012
2369
|
function isEnvVarReference(value) {
|
|
@@ -2048,10 +2405,10 @@ async function applyIsolatedEnvRepairs(input) {
|
|
|
2048
2405
|
if (repair.kind !== "chmod") {
|
|
2049
2406
|
continue;
|
|
2050
2407
|
}
|
|
2051
|
-
if (
|
|
2408
|
+
if (path4.isAbsolute(repair.relativePath)) {
|
|
2052
2409
|
continue;
|
|
2053
2410
|
}
|
|
2054
|
-
const repairPath =
|
|
2411
|
+
const repairPath = path4.join(baseDir, repair.relativePath);
|
|
2055
2412
|
try {
|
|
2056
2413
|
await input.fs.chmod(repairPath, repair.mode);
|
|
2057
2414
|
} catch (error2) {
|
|
@@ -2102,13 +2459,13 @@ async function resolveCliSettingValue(value, env, readApiKey) {
|
|
|
2102
2459
|
}
|
|
2103
2460
|
function stripAgentHome(mapped, baseDir, agentBinary) {
|
|
2104
2461
|
const agentDir = `.${agentBinary}`;
|
|
2105
|
-
const prefix =
|
|
2462
|
+
const prefix = path4.join(baseDir, agentDir);
|
|
2106
2463
|
if (mapped === prefix) {
|
|
2107
2464
|
return baseDir;
|
|
2108
2465
|
}
|
|
2109
|
-
const withSep = `${prefix}${
|
|
2466
|
+
const withSep = `${prefix}${path4.sep}`;
|
|
2110
2467
|
if (mapped.startsWith(withSep)) {
|
|
2111
|
-
return
|
|
2468
|
+
return path4.join(baseDir, mapped.slice(withSep.length));
|
|
2112
2469
|
}
|
|
2113
2470
|
return mapped;
|
|
2114
2471
|
}
|
|
@@ -2119,18 +2476,18 @@ function expandHomeShortcut(env, input) {
|
|
|
2119
2476
|
if (input === "~") {
|
|
2120
2477
|
return env.homeDir;
|
|
2121
2478
|
}
|
|
2122
|
-
if (input.startsWith("~/") || input.startsWith(`~${
|
|
2123
|
-
return
|
|
2479
|
+
if (input.startsWith("~/") || input.startsWith(`~${path4.sep}`)) {
|
|
2480
|
+
return path4.join(env.homeDir, input.slice(2));
|
|
2124
2481
|
}
|
|
2125
|
-
if (input.startsWith("~./") || input.startsWith(`~.${
|
|
2126
|
-
return
|
|
2482
|
+
if (input.startsWith("~./") || input.startsWith(`~.${path4.sep}`)) {
|
|
2483
|
+
return path4.join(env.homeDir, `.${input.slice(3)}`);
|
|
2127
2484
|
}
|
|
2128
2485
|
return input;
|
|
2129
2486
|
}
|
|
2130
2487
|
var init_isolated_env = __esm({
|
|
2131
2488
|
"src/cli/isolated-env.ts"() {
|
|
2132
2489
|
"use strict";
|
|
2133
|
-
|
|
2490
|
+
init_src3();
|
|
2134
2491
|
}
|
|
2135
2492
|
});
|
|
2136
2493
|
|
|
@@ -2186,170 +2543,6 @@ var init_run_command = __esm({
|
|
|
2186
2543
|
}
|
|
2187
2544
|
});
|
|
2188
2545
|
|
|
2189
|
-
// packages/agent-defs/src/agents/claude-code.ts
|
|
2190
|
-
var claudeCodeAgent;
|
|
2191
|
-
var init_claude_code = __esm({
|
|
2192
|
-
"packages/agent-defs/src/agents/claude-code.ts"() {
|
|
2193
|
-
"use strict";
|
|
2194
|
-
claudeCodeAgent = {
|
|
2195
|
-
id: "claude-code",
|
|
2196
|
-
name: "claude-code",
|
|
2197
|
-
label: "Claude Code",
|
|
2198
|
-
summary: "Configure Claude Code to route through Poe.",
|
|
2199
|
-
aliases: ["claude"],
|
|
2200
|
-
binaryName: "claude",
|
|
2201
|
-
configPath: "~/.claude/settings.json",
|
|
2202
|
-
branding: {
|
|
2203
|
-
colors: {
|
|
2204
|
-
dark: "#C15F3C",
|
|
2205
|
-
light: "#C15F3C"
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
};
|
|
2209
|
-
}
|
|
2210
|
-
});
|
|
2211
|
-
|
|
2212
|
-
// packages/agent-defs/src/agents/claude-desktop.ts
|
|
2213
|
-
var claudeDesktopAgent;
|
|
2214
|
-
var init_claude_desktop = __esm({
|
|
2215
|
-
"packages/agent-defs/src/agents/claude-desktop.ts"() {
|
|
2216
|
-
"use strict";
|
|
2217
|
-
claudeDesktopAgent = {
|
|
2218
|
-
id: "claude-desktop",
|
|
2219
|
-
name: "claude-desktop",
|
|
2220
|
-
label: "Claude Desktop",
|
|
2221
|
-
summary: "Anthropic's official desktop application for Claude",
|
|
2222
|
-
configPath: "~/.claude/settings.json",
|
|
2223
|
-
branding: {
|
|
2224
|
-
colors: {
|
|
2225
|
-
dark: "#D97757",
|
|
2226
|
-
light: "#D97757"
|
|
2227
|
-
}
|
|
2228
|
-
}
|
|
2229
|
-
};
|
|
2230
|
-
}
|
|
2231
|
-
});
|
|
2232
|
-
|
|
2233
|
-
// packages/agent-defs/src/agents/codex.ts
|
|
2234
|
-
var codexAgent;
|
|
2235
|
-
var init_codex = __esm({
|
|
2236
|
-
"packages/agent-defs/src/agents/codex.ts"() {
|
|
2237
|
-
"use strict";
|
|
2238
|
-
codexAgent = {
|
|
2239
|
-
id: "codex",
|
|
2240
|
-
name: "codex",
|
|
2241
|
-
label: "Codex",
|
|
2242
|
-
summary: "Configure Codex to use Poe as the model provider.",
|
|
2243
|
-
binaryName: "codex",
|
|
2244
|
-
configPath: "~/.codex/config.toml",
|
|
2245
|
-
branding: {
|
|
2246
|
-
colors: {
|
|
2247
|
-
dark: "#D5D9DF",
|
|
2248
|
-
light: "#7A7F86"
|
|
2249
|
-
}
|
|
2250
|
-
}
|
|
2251
|
-
};
|
|
2252
|
-
}
|
|
2253
|
-
});
|
|
2254
|
-
|
|
2255
|
-
// packages/agent-defs/src/agents/opencode.ts
|
|
2256
|
-
var openCodeAgent;
|
|
2257
|
-
var init_opencode = __esm({
|
|
2258
|
-
"packages/agent-defs/src/agents/opencode.ts"() {
|
|
2259
|
-
"use strict";
|
|
2260
|
-
openCodeAgent = {
|
|
2261
|
-
id: "opencode",
|
|
2262
|
-
name: "opencode",
|
|
2263
|
-
label: "OpenCode CLI",
|
|
2264
|
-
summary: "Configure OpenCode CLI to use the Poe API.",
|
|
2265
|
-
binaryName: "opencode",
|
|
2266
|
-
configPath: "~/.config/opencode/config.json",
|
|
2267
|
-
branding: {
|
|
2268
|
-
colors: {
|
|
2269
|
-
dark: "#4A4F55",
|
|
2270
|
-
light: "#2F3338"
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
};
|
|
2274
|
-
}
|
|
2275
|
-
});
|
|
2276
|
-
|
|
2277
|
-
// packages/agent-defs/src/agents/kimi.ts
|
|
2278
|
-
var kimiAgent;
|
|
2279
|
-
var init_kimi = __esm({
|
|
2280
|
-
"packages/agent-defs/src/agents/kimi.ts"() {
|
|
2281
|
-
"use strict";
|
|
2282
|
-
kimiAgent = {
|
|
2283
|
-
id: "kimi",
|
|
2284
|
-
name: "kimi",
|
|
2285
|
-
label: "Kimi",
|
|
2286
|
-
summary: "Configure Kimi CLI to use Poe API",
|
|
2287
|
-
aliases: ["kimi-cli"],
|
|
2288
|
-
binaryName: "kimi",
|
|
2289
|
-
configPath: "~/.kimi/config.toml",
|
|
2290
|
-
branding: {
|
|
2291
|
-
colors: {
|
|
2292
|
-
dark: "#7B68EE",
|
|
2293
|
-
light: "#6A5ACD"
|
|
2294
|
-
}
|
|
2295
|
-
}
|
|
2296
|
-
};
|
|
2297
|
-
}
|
|
2298
|
-
});
|
|
2299
|
-
|
|
2300
|
-
// packages/agent-defs/src/agents/index.ts
|
|
2301
|
-
var init_agents = __esm({
|
|
2302
|
-
"packages/agent-defs/src/agents/index.ts"() {
|
|
2303
|
-
"use strict";
|
|
2304
|
-
init_claude_code();
|
|
2305
|
-
init_claude_desktop();
|
|
2306
|
-
init_codex();
|
|
2307
|
-
init_opencode();
|
|
2308
|
-
init_kimi();
|
|
2309
|
-
}
|
|
2310
|
-
});
|
|
2311
|
-
|
|
2312
|
-
// packages/agent-defs/src/registry.ts
|
|
2313
|
-
function resolveAgentId(input) {
|
|
2314
|
-
if (!input) {
|
|
2315
|
-
return void 0;
|
|
2316
|
-
}
|
|
2317
|
-
return lookup.get(input.toLowerCase());
|
|
2318
|
-
}
|
|
2319
|
-
var allAgents, lookup;
|
|
2320
|
-
var init_registry = __esm({
|
|
2321
|
-
"packages/agent-defs/src/registry.ts"() {
|
|
2322
|
-
"use strict";
|
|
2323
|
-
init_agents();
|
|
2324
|
-
allAgents = [
|
|
2325
|
-
claudeCodeAgent,
|
|
2326
|
-
claudeDesktopAgent,
|
|
2327
|
-
codexAgent,
|
|
2328
|
-
openCodeAgent,
|
|
2329
|
-
kimiAgent
|
|
2330
|
-
];
|
|
2331
|
-
lookup = /* @__PURE__ */ new Map();
|
|
2332
|
-
for (const agent2 of allAgents) {
|
|
2333
|
-
const values = [agent2.id, agent2.name, ...agent2.aliases ?? []];
|
|
2334
|
-
for (const value of values) {
|
|
2335
|
-
const normalized = value.toLowerCase();
|
|
2336
|
-
if (!lookup.has(normalized)) {
|
|
2337
|
-
lookup.set(normalized, agent2.id);
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
}
|
|
2341
|
-
}
|
|
2342
|
-
});
|
|
2343
|
-
|
|
2344
|
-
// packages/agent-defs/src/index.ts
|
|
2345
|
-
var init_src3 = __esm({
|
|
2346
|
-
"packages/agent-defs/src/index.ts"() {
|
|
2347
|
-
"use strict";
|
|
2348
|
-
init_agents();
|
|
2349
|
-
init_registry();
|
|
2350
|
-
}
|
|
2351
|
-
});
|
|
2352
|
-
|
|
2353
2546
|
// packages/agent-spawn/src/configs/mcp.ts
|
|
2354
2547
|
function toJsonMcpServers(servers) {
|
|
2355
2548
|
const out = {};
|
|
@@ -2567,7 +2760,7 @@ var allSpawnConfigs, lookup2;
|
|
|
2567
2760
|
var init_configs = __esm({
|
|
2568
2761
|
"packages/agent-spawn/src/configs/index.ts"() {
|
|
2569
2762
|
"use strict";
|
|
2570
|
-
|
|
2763
|
+
init_src2();
|
|
2571
2764
|
init_claude_code2();
|
|
2572
2765
|
init_codex2();
|
|
2573
2766
|
init_opencode2();
|
|
@@ -2602,7 +2795,7 @@ function resolveConfig(agentId) {
|
|
|
2602
2795
|
var init_resolve_config = __esm({
|
|
2603
2796
|
"packages/agent-spawn/src/configs/resolve-config.ts"() {
|
|
2604
2797
|
"use strict";
|
|
2605
|
-
|
|
2798
|
+
init_src2();
|
|
2606
2799
|
init_configs();
|
|
2607
2800
|
}
|
|
2608
2801
|
});
|
|
@@ -3525,7 +3718,7 @@ var init_static = __esm({
|
|
|
3525
3718
|
});
|
|
3526
3719
|
|
|
3527
3720
|
// packages/design-system/src/index.ts
|
|
3528
|
-
var
|
|
3721
|
+
var init_src5 = __esm({
|
|
3529
3722
|
"packages/design-system/src/index.ts"() {
|
|
3530
3723
|
"use strict";
|
|
3531
3724
|
init_tokens();
|
|
@@ -3618,7 +3811,7 @@ async function renderAcpStream(events) {
|
|
|
3618
3811
|
var init_renderer = __esm({
|
|
3619
3812
|
"packages/agent-spawn/src/acp/renderer.ts"() {
|
|
3620
3813
|
"use strict";
|
|
3621
|
-
|
|
3814
|
+
init_src5();
|
|
3622
3815
|
}
|
|
3623
3816
|
});
|
|
3624
3817
|
|
|
@@ -4413,7 +4606,7 @@ var init_usage_capture = __esm({
|
|
|
4413
4606
|
});
|
|
4414
4607
|
|
|
4415
4608
|
// packages/agent-spawn/src/acp/middlewares/spawn-log.ts
|
|
4416
|
-
import
|
|
4609
|
+
import path5 from "node:path";
|
|
4417
4610
|
import { homedir as homedir2 } from "node:os";
|
|
4418
4611
|
import { mkdir, open } from "node:fs/promises";
|
|
4419
4612
|
function pad(value, width) {
|
|
@@ -4447,11 +4640,11 @@ function resolveStartedAt(value) {
|
|
|
4447
4640
|
return value;
|
|
4448
4641
|
}
|
|
4449
4642
|
function resolveLogFilePath(ctx) {
|
|
4450
|
-
const baseDir = ctx.logDir ??
|
|
4643
|
+
const baseDir = ctx.logDir ?? path5.join(homedir2(), ".poe-code", "spawn-logs");
|
|
4451
4644
|
const startedAt = resolveStartedAt(ctx.startedAt);
|
|
4452
4645
|
const { day, time: time3, milliseconds } = formatTimestamp(startedAt);
|
|
4453
4646
|
const fileName = `${day}-${time3}-${milliseconds}-${normalizeAgent(ctx.agent)}.jsonl`;
|
|
4454
|
-
return
|
|
4647
|
+
return path5.join(baseDir, fileName);
|
|
4455
4648
|
}
|
|
4456
4649
|
async function writePreloadedEvents(writer, events) {
|
|
4457
4650
|
for (const event of events) {
|
|
@@ -4469,7 +4662,7 @@ var init_spawn_log = __esm({
|
|
|
4469
4662
|
logDirPath;
|
|
4470
4663
|
constructor(ctx) {
|
|
4471
4664
|
this.logFilePath = resolveLogFilePath(ctx);
|
|
4472
|
-
this.logDirPath =
|
|
4665
|
+
this.logDirPath = path5.dirname(this.logFilePath);
|
|
4473
4666
|
}
|
|
4474
4667
|
async writeEvent(event) {
|
|
4475
4668
|
if (this.isDisabled) {
|
|
@@ -4534,7 +4727,7 @@ var init_spawn_log = __esm({
|
|
|
4534
4727
|
});
|
|
4535
4728
|
|
|
4536
4729
|
// packages/agent-spawn/src/index.ts
|
|
4537
|
-
var
|
|
4730
|
+
var init_src6 = __esm({
|
|
4538
4731
|
"packages/agent-spawn/src/index.ts"() {
|
|
4539
4732
|
"use strict";
|
|
4540
4733
|
init_run_command();
|
|
@@ -4554,7 +4747,7 @@ var init_src5 = __esm({
|
|
|
4554
4747
|
});
|
|
4555
4748
|
|
|
4556
4749
|
// src/cli/commands/shared.ts
|
|
4557
|
-
import
|
|
4750
|
+
import path6 from "node:path";
|
|
4558
4751
|
function resolveCommandFlags(program) {
|
|
4559
4752
|
const opts = program.optsWithGlobals();
|
|
4560
4753
|
return {
|
|
@@ -4627,7 +4820,7 @@ function buildResumeCommand(canonicalService, threadId, cwd) {
|
|
|
4627
4820
|
if (!binaryName) {
|
|
4628
4821
|
return void 0;
|
|
4629
4822
|
}
|
|
4630
|
-
const resumeCwd =
|
|
4823
|
+
const resumeCwd = path6.resolve(cwd);
|
|
4631
4824
|
const args = spawnConfig.resumeCommand(threadId, resumeCwd);
|
|
4632
4825
|
const agentCommand = [binaryName, ...args.map(shlexQuote)].join(" ");
|
|
4633
4826
|
const needsCdPrefix = !args.includes(resumeCwd);
|
|
@@ -4718,15 +4911,20 @@ var init_shared = __esm({
|
|
|
4718
4911
|
"use strict";
|
|
4719
4912
|
init_context();
|
|
4720
4913
|
init_isolated_env();
|
|
4721
|
-
|
|
4722
|
-
|
|
4914
|
+
init_src6();
|
|
4915
|
+
init_src2();
|
|
4723
4916
|
}
|
|
4724
4917
|
});
|
|
4725
4918
|
|
|
4726
4919
|
// src/sdk/spawn-core.ts
|
|
4727
|
-
import
|
|
4920
|
+
import path7 from "node:path";
|
|
4728
4921
|
import chalk10 from "chalk";
|
|
4729
4922
|
async function spawnCore(container, service, options, flags = { dryRun: false, verbose: false }) {
|
|
4923
|
+
const adapter = container.registry.get(service);
|
|
4924
|
+
if (!adapter) {
|
|
4925
|
+
throw new Error(`Unknown service "${service}".`);
|
|
4926
|
+
}
|
|
4927
|
+
const model = await resolveConfiguredModel(container, service, options.model);
|
|
4730
4928
|
const cwdOverride = resolveSpawnWorkingDirectory(
|
|
4731
4929
|
container.env.cwd,
|
|
4732
4930
|
options.cwd
|
|
@@ -4734,16 +4932,12 @@ async function spawnCore(container, service, options, flags = { dryRun: false, v
|
|
|
4734
4932
|
const spawnOptions = {
|
|
4735
4933
|
prompt: options.prompt,
|
|
4736
4934
|
args: options.args,
|
|
4737
|
-
model
|
|
4935
|
+
model,
|
|
4738
4936
|
mode: options.mode,
|
|
4739
4937
|
mcpServers: options.mcpServers,
|
|
4740
4938
|
cwd: cwdOverride,
|
|
4741
4939
|
useStdin: options.useStdin ?? false
|
|
4742
4940
|
};
|
|
4743
|
-
const adapter = container.registry.get(service);
|
|
4744
|
-
if (!adapter) {
|
|
4745
|
-
throw new Error(`Unknown service "${service}".`);
|
|
4746
|
-
}
|
|
4747
4941
|
const commandFlags = { dryRun: flags.dryRun, assumeYes: true, verbose: flags.verbose };
|
|
4748
4942
|
const resources = createExecutionResources(
|
|
4749
4943
|
container,
|
|
@@ -4792,6 +4986,24 @@ async function spawnCore(container, service, options, flags = { dryRun: false, v
|
|
|
4792
4986
|
exitCode: result.exitCode
|
|
4793
4987
|
};
|
|
4794
4988
|
}
|
|
4989
|
+
async function resolveConfiguredModel(container, service, model) {
|
|
4990
|
+
if (model != null) {
|
|
4991
|
+
return model;
|
|
4992
|
+
}
|
|
4993
|
+
const adapter = container.registry.get(service);
|
|
4994
|
+
const agentId = adapter?.name ?? resolveAgentId(service) ?? service;
|
|
4995
|
+
const configuredModel = await resolveModel(
|
|
4996
|
+
{
|
|
4997
|
+
fs: container.fs,
|
|
4998
|
+
filePath: container.env.configPath
|
|
4999
|
+
},
|
|
5000
|
+
agentId
|
|
5001
|
+
);
|
|
5002
|
+
if (configuredModel) {
|
|
5003
|
+
return configuredModel;
|
|
5004
|
+
}
|
|
5005
|
+
return adapter?.configurePrompts?.model?.defaultValue;
|
|
5006
|
+
}
|
|
4795
5007
|
function formatSpawnDryRunMessage(label, options) {
|
|
4796
5008
|
const lines = [`Dry run: would spawn ${label}.`];
|
|
4797
5009
|
const details = [];
|
|
@@ -4823,142 +5035,17 @@ function resolveSpawnWorkingDirectory(baseDir, candidate) {
|
|
|
4823
5035
|
if (!candidate || candidate.trim().length === 0) {
|
|
4824
5036
|
return void 0;
|
|
4825
5037
|
}
|
|
4826
|
-
if (
|
|
5038
|
+
if (path7.isAbsolute(candidate)) {
|
|
4827
5039
|
return candidate;
|
|
4828
5040
|
}
|
|
4829
|
-
return
|
|
5041
|
+
return path7.resolve(baseDir, candidate);
|
|
4830
5042
|
}
|
|
4831
5043
|
var init_spawn_core = __esm({
|
|
4832
5044
|
"src/sdk/spawn-core.ts"() {
|
|
4833
|
-
"use strict";
|
|
4834
|
-
init_shared();
|
|
4835
|
-
}
|
|
4836
|
-
});
|
|
4837
|
-
|
|
4838
|
-
// packages/poe-code-config/src/schema.ts
|
|
4839
|
-
var init_schema = __esm({
|
|
4840
|
-
"packages/poe-code-config/src/schema.ts"() {
|
|
4841
|
-
"use strict";
|
|
4842
|
-
}
|
|
4843
|
-
});
|
|
4844
|
-
|
|
4845
|
-
// packages/poe-code-config/src/store.ts
|
|
4846
|
-
import path7 from "node:path";
|
|
4847
|
-
async function readDocument(fs3, filePath) {
|
|
4848
|
-
try {
|
|
4849
|
-
const raw = await fs3.readFile(filePath, "utf8");
|
|
4850
|
-
return await parseDocument(fs3, filePath, raw);
|
|
4851
|
-
} catch (error2) {
|
|
4852
|
-
if (isNotFound(error2)) {
|
|
4853
|
-
return {};
|
|
4854
|
-
}
|
|
4855
|
-
throw error2;
|
|
4856
|
-
}
|
|
4857
|
-
}
|
|
4858
|
-
async function writeScope(fs3, filePath, scope, values) {
|
|
4859
|
-
const document = await readDocument(fs3, filePath);
|
|
4860
|
-
const normalizedValues = normalizeScopeValues(values);
|
|
4861
|
-
if (Object.keys(normalizedValues).length === 0) {
|
|
4862
|
-
delete document[scope];
|
|
4863
|
-
} else {
|
|
4864
|
-
document[scope] = normalizedValues;
|
|
4865
|
-
}
|
|
4866
|
-
await writeDocument(fs3, filePath, document);
|
|
4867
|
-
}
|
|
4868
|
-
async function parseDocument(fs3, filePath, raw) {
|
|
4869
|
-
try {
|
|
4870
|
-
return normalizeDocument(JSON.parse(raw));
|
|
4871
|
-
} catch (error2) {
|
|
4872
|
-
if (error2 instanceof SyntaxError) {
|
|
4873
|
-
await recoverInvalidDocument(fs3, filePath, raw);
|
|
4874
|
-
return {};
|
|
4875
|
-
}
|
|
4876
|
-
throw error2;
|
|
4877
|
-
}
|
|
4878
|
-
}
|
|
4879
|
-
function normalizeDocument(value) {
|
|
4880
|
-
if (!isRecord2(value)) {
|
|
4881
|
-
return {};
|
|
4882
|
-
}
|
|
4883
|
-
const document = {};
|
|
4884
|
-
for (const [scope, scopeValues] of Object.entries(value)) {
|
|
4885
|
-
const normalizedValues = normalizeScopeValues(scopeValues);
|
|
4886
|
-
if (Object.keys(normalizedValues).length > 0) {
|
|
4887
|
-
document[scope] = normalizedValues;
|
|
4888
|
-
}
|
|
4889
|
-
}
|
|
4890
|
-
return document;
|
|
4891
|
-
}
|
|
4892
|
-
function normalizeScopeValues(value) {
|
|
4893
|
-
if (!isRecord2(value)) {
|
|
4894
|
-
return {};
|
|
4895
|
-
}
|
|
4896
|
-
const normalized = {};
|
|
4897
|
-
for (const [key, entry] of Object.entries(value)) {
|
|
4898
|
-
if (entry !== void 0) {
|
|
4899
|
-
normalized[key] = entry;
|
|
4900
|
-
}
|
|
4901
|
-
}
|
|
4902
|
-
return normalized;
|
|
4903
|
-
}
|
|
4904
|
-
async function writeDocument(fs3, filePath, document) {
|
|
4905
|
-
await fs3.mkdir(path7.dirname(filePath), { recursive: true });
|
|
4906
|
-
await fs3.writeFile(filePath, `${JSON.stringify(document, null, 2)}
|
|
4907
|
-
`, {
|
|
4908
|
-
encoding: "utf8"
|
|
4909
|
-
});
|
|
4910
|
-
}
|
|
4911
|
-
async function recoverInvalidDocument(fs3, filePath, content) {
|
|
4912
|
-
await fs3.mkdir(path7.dirname(filePath), { recursive: true });
|
|
4913
|
-
const backupPath = createInvalidBackupPath(filePath);
|
|
4914
|
-
await fs3.writeFile(backupPath, content, { encoding: "utf8" });
|
|
4915
|
-
await fs3.writeFile(filePath, EMPTY_DOCUMENT, { encoding: "utf8" });
|
|
4916
|
-
}
|
|
4917
|
-
function createInvalidBackupPath(filePath) {
|
|
4918
|
-
const directory = path7.dirname(filePath);
|
|
4919
|
-
const baseName = path7.basename(filePath);
|
|
4920
|
-
return path7.join(directory, `${baseName}.invalid-${createTimestamp()}.json`);
|
|
4921
|
-
}
|
|
4922
|
-
function isRecord2(value) {
|
|
4923
|
-
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
4924
|
-
}
|
|
4925
|
-
function resolveConfigPath(homeDir) {
|
|
4926
|
-
return path7.join(homeDir, ".poe-code", "config.json");
|
|
4927
|
-
}
|
|
4928
|
-
var EMPTY_DOCUMENT;
|
|
4929
|
-
var init_store = __esm({
|
|
4930
|
-
"packages/poe-code-config/src/store.ts"() {
|
|
4931
5045
|
"use strict";
|
|
4932
5046
|
init_src2();
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
}
|
|
4936
|
-
});
|
|
4937
|
-
|
|
4938
|
-
// packages/poe-code-config/src/resolve.ts
|
|
4939
|
-
var init_resolve = __esm({
|
|
4940
|
-
"packages/poe-code-config/src/resolve.ts"() {
|
|
4941
|
-
"use strict";
|
|
4942
|
-
}
|
|
4943
|
-
});
|
|
4944
|
-
|
|
4945
|
-
// packages/poe-code-config/src/config.ts
|
|
4946
|
-
var init_config = __esm({
|
|
4947
|
-
"packages/poe-code-config/src/config.ts"() {
|
|
4948
|
-
"use strict";
|
|
4949
|
-
init_store();
|
|
4950
|
-
init_resolve();
|
|
4951
|
-
}
|
|
4952
|
-
});
|
|
4953
|
-
|
|
4954
|
-
// packages/poe-code-config/src/index.ts
|
|
4955
|
-
var init_src6 = __esm({
|
|
4956
|
-
"packages/poe-code-config/src/index.ts"() {
|
|
4957
|
-
"use strict";
|
|
4958
|
-
init_schema();
|
|
4959
|
-
init_config();
|
|
4960
|
-
init_resolve();
|
|
4961
|
-
init_store();
|
|
5047
|
+
init_src4();
|
|
5048
|
+
init_shared();
|
|
4962
5049
|
}
|
|
4963
5050
|
});
|
|
4964
5051
|
|
|
@@ -4968,6 +5055,7 @@ function createCliEnvironment(init) {
|
|
|
4968
5055
|
const platform = init.platform ?? process.platform;
|
|
4969
5056
|
const variables = init.variables ?? process.env;
|
|
4970
5057
|
const configPath = resolveConfigPath(init.homeDir);
|
|
5058
|
+
const projectConfigPath = resolveProjectConfigPath(init.cwd);
|
|
4971
5059
|
const logDir = resolveLogDir(init.homeDir);
|
|
4972
5060
|
const { poeApiBaseUrl, poeBaseUrl } = resolvePoeBaseUrls(variables);
|
|
4973
5061
|
const resolveHomePath = (...segments) => path8.join(init.homeDir, ...segments);
|
|
@@ -4977,6 +5065,7 @@ function createCliEnvironment(init) {
|
|
|
4977
5065
|
homeDir: init.homeDir,
|
|
4978
5066
|
platform,
|
|
4979
5067
|
configPath,
|
|
5068
|
+
projectConfigPath,
|
|
4980
5069
|
logDir,
|
|
4981
5070
|
poeApiBaseUrl,
|
|
4982
5071
|
poeBaseUrl,
|
|
@@ -5065,7 +5154,7 @@ var DEFAULT_POE_API_BASE_URL;
|
|
|
5065
5154
|
var init_environment = __esm({
|
|
5066
5155
|
"src/cli/environment.ts"() {
|
|
5067
5156
|
"use strict";
|
|
5068
|
-
|
|
5157
|
+
init_src4();
|
|
5069
5158
|
DEFAULT_POE_API_BASE_URL = "https://api.poe.com/v1";
|
|
5070
5159
|
}
|
|
5071
5160
|
});
|
|
@@ -5155,7 +5244,7 @@ function createServiceRegistry() {
|
|
|
5155
5244
|
var init_service_registry = __esm({
|
|
5156
5245
|
"src/cli/service-registry.ts"() {
|
|
5157
5246
|
"use strict";
|
|
5158
|
-
|
|
5247
|
+
init_src2();
|
|
5159
5248
|
}
|
|
5160
5249
|
});
|
|
5161
5250
|
|
|
@@ -5227,11 +5316,8 @@ async function checkAuth(options) {
|
|
|
5227
5316
|
return null;
|
|
5228
5317
|
}
|
|
5229
5318
|
const data = await response.json();
|
|
5230
|
-
if (typeof data.email !== "string" || data.email.length === 0) {
|
|
5231
|
-
return null;
|
|
5232
|
-
}
|
|
5233
5319
|
return {
|
|
5234
|
-
email: data.email,
|
|
5320
|
+
email: typeof data.email === "string" && data.email.length > 0 ? data.email : null,
|
|
5235
5321
|
balance: typeof data.current_point_balance === "number" ? data.current_point_balance : null
|
|
5236
5322
|
};
|
|
5237
5323
|
} catch {
|
|
@@ -5246,7 +5332,7 @@ var DEFAULT_BASE_URL;
|
|
|
5246
5332
|
var init_check_auth = __esm({
|
|
5247
5333
|
"packages/poe-oauth/src/check-auth.ts"() {
|
|
5248
5334
|
"use strict";
|
|
5249
|
-
DEFAULT_BASE_URL = "https://poe.com";
|
|
5335
|
+
DEFAULT_BASE_URL = "https://api.poe.com";
|
|
5250
5336
|
}
|
|
5251
5337
|
});
|
|
5252
5338
|
|
|
@@ -5552,7 +5638,7 @@ function createOptionResolvers(init) {
|
|
|
5552
5638
|
return apiKey;
|
|
5553
5639
|
}
|
|
5554
5640
|
};
|
|
5555
|
-
const
|
|
5641
|
+
const resolveModel3 = async ({
|
|
5556
5642
|
value,
|
|
5557
5643
|
assumeDefault,
|
|
5558
5644
|
defaultValue,
|
|
@@ -5603,7 +5689,7 @@ function createOptionResolvers(init) {
|
|
|
5603
5689
|
});
|
|
5604
5690
|
return {
|
|
5605
5691
|
ensure,
|
|
5606
|
-
resolveModel:
|
|
5692
|
+
resolveModel: resolveModel3,
|
|
5607
5693
|
resolveReasoning,
|
|
5608
5694
|
resolveConfigName,
|
|
5609
5695
|
resolveApiKey: resolveApiKey2
|
|
@@ -5878,7 +5964,7 @@ function createLoggerFactory(emitter, theme) {
|
|
|
5878
5964
|
var init_logger2 = __esm({
|
|
5879
5965
|
"src/cli/logger.ts"() {
|
|
5880
5966
|
"use strict";
|
|
5881
|
-
|
|
5967
|
+
init_src5();
|
|
5882
5968
|
init_errors();
|
|
5883
5969
|
}
|
|
5884
5970
|
});
|
|
@@ -6149,10 +6235,17 @@ async function createConfigurePayload(init) {
|
|
|
6149
6235
|
const payload = { env: context.env, apiKey };
|
|
6150
6236
|
const modelPrompt = adapter.configurePrompts?.model;
|
|
6151
6237
|
if (modelPrompt) {
|
|
6238
|
+
const configModel = await loadAgentModel(
|
|
6239
|
+
{
|
|
6240
|
+
fs: container.fs,
|
|
6241
|
+
filePath: container.env.configPath
|
|
6242
|
+
},
|
|
6243
|
+
adapter.name
|
|
6244
|
+
);
|
|
6152
6245
|
const model = await container.options.resolveModel({
|
|
6153
6246
|
value: options.model,
|
|
6154
6247
|
assumeDefault: flags.assumeYes,
|
|
6155
|
-
defaultValue: modelPrompt.defaultValue,
|
|
6248
|
+
defaultValue: configModel ?? modelPrompt.defaultValue,
|
|
6156
6249
|
choices: modelPrompt.choices,
|
|
6157
6250
|
label: modelPrompt.label,
|
|
6158
6251
|
onResolve: (label, value) => logger2.resolved(label, value)
|
|
@@ -6173,6 +6266,7 @@ async function createConfigurePayload(init) {
|
|
|
6173
6266
|
var init_configure_payload = __esm({
|
|
6174
6267
|
"src/cli/commands/configure-payload.ts"() {
|
|
6175
6268
|
"use strict";
|
|
6269
|
+
init_src4();
|
|
6176
6270
|
}
|
|
6177
6271
|
});
|
|
6178
6272
|
|
|
@@ -6536,7 +6630,7 @@ var init_container = __esm({
|
|
|
6536
6630
|
init_options();
|
|
6537
6631
|
init_logger2();
|
|
6538
6632
|
init_error_logger();
|
|
6539
|
-
|
|
6633
|
+
init_src6();
|
|
6540
6634
|
await init_providers();
|
|
6541
6635
|
init_poe_code_command_runner();
|
|
6542
6636
|
init_src();
|
|
@@ -8072,7 +8166,7 @@ var templateImports;
|
|
|
8072
8166
|
var init_create_provider = __esm({
|
|
8073
8167
|
"src/providers/create-provider.ts"() {
|
|
8074
8168
|
"use strict";
|
|
8075
|
-
|
|
8169
|
+
init_src3();
|
|
8076
8170
|
init_service_install();
|
|
8077
8171
|
templateImports = {
|
|
8078
8172
|
"python/env.hbs": () => Promise.resolve().then(() => __toESM(require_env(), 1)),
|
|
@@ -12346,12 +12440,19 @@ function spawn5(service, promptOrOptions, maybeOptions) {
|
|
|
12346
12440
|
const result = (async () => {
|
|
12347
12441
|
try {
|
|
12348
12442
|
await getPoeApiKey();
|
|
12443
|
+
let container;
|
|
12444
|
+
const getContainer = () => {
|
|
12445
|
+
container ??= createSdkContainer({ cwd: options.cwd });
|
|
12446
|
+
return container;
|
|
12447
|
+
};
|
|
12448
|
+
const resolveModel3 = async () => options.model ?? await resolveConfiguredModel(getContainer(), service);
|
|
12349
12449
|
if (options.interactive) {
|
|
12350
12450
|
resolveEventsOnce(emptyEvents);
|
|
12451
|
+
const model2 = await resolveModel3();
|
|
12351
12452
|
const interactiveResult = await spawnInteractive(service, {
|
|
12352
12453
|
prompt: options.prompt,
|
|
12353
12454
|
cwd: options.cwd,
|
|
12354
|
-
model:
|
|
12455
|
+
model: model2,
|
|
12355
12456
|
mode: options.mode,
|
|
12356
12457
|
signal: options.signal,
|
|
12357
12458
|
args: options.args,
|
|
@@ -12365,11 +12466,12 @@ function spawn5(service, promptOrOptions, maybeOptions) {
|
|
|
12365
12466
|
};
|
|
12366
12467
|
}
|
|
12367
12468
|
if (service === "poe-agent") {
|
|
12469
|
+
const model2 = await resolveModel3();
|
|
12368
12470
|
const poeBaseUrl = typeof process.env.POE_BASE_URL === "string" ? process.env.POE_BASE_URL.trim() || void 0 : void 0;
|
|
12369
12471
|
const { events: innerEvents, done } = spawnPoeAgentWithAcp({
|
|
12370
12472
|
prompt: options.prompt,
|
|
12371
12473
|
cwd: options.cwd,
|
|
12372
|
-
model:
|
|
12474
|
+
model: model2,
|
|
12373
12475
|
...poeBaseUrl ? { baseUrl: poeBaseUrl } : {},
|
|
12374
12476
|
...options.mcpServers ? { mcpServers: options.mcpServers } : {}
|
|
12375
12477
|
});
|
|
@@ -12387,11 +12489,12 @@ function spawn5(service, promptOrOptions, maybeOptions) {
|
|
|
12387
12489
|
const spawnConfig = getSpawnConfig(service);
|
|
12388
12490
|
const supportsStreaming = !!spawnConfig && spawnConfig.kind === "cli" && typeof spawnConfig.adapter === "string";
|
|
12389
12491
|
if (supportsStreaming) {
|
|
12492
|
+
const model2 = await resolveModel3();
|
|
12390
12493
|
const { events: rawEvents, done } = spawnStreaming({
|
|
12391
12494
|
agentId: service,
|
|
12392
12495
|
prompt: options.prompt,
|
|
12393
12496
|
cwd: options.cwd,
|
|
12394
|
-
model:
|
|
12497
|
+
model: model2,
|
|
12395
12498
|
mode: options.mode,
|
|
12396
12499
|
args: options.args,
|
|
12397
12500
|
signal: options.signal,
|
|
@@ -12409,7 +12512,7 @@ function spawn5(service, promptOrOptions, maybeOptions) {
|
|
|
12409
12512
|
},
|
|
12410
12513
|
eventStream: rawEvents,
|
|
12411
12514
|
prompt: options.prompt,
|
|
12412
|
-
model:
|
|
12515
|
+
model: model2,
|
|
12413
12516
|
mode: options.mode,
|
|
12414
12517
|
cwd: options.cwd,
|
|
12415
12518
|
startedAt: /* @__PURE__ */ new Date()
|
|
@@ -12430,10 +12533,11 @@ function spawn5(service, promptOrOptions, maybeOptions) {
|
|
|
12430
12533
|
}
|
|
12431
12534
|
if (spawnConfig && spawnConfig.kind === "cli") {
|
|
12432
12535
|
resolveEventsOnce(emptyEvents);
|
|
12536
|
+
const model2 = await resolveModel3();
|
|
12433
12537
|
return spawn3(service, {
|
|
12434
12538
|
prompt: options.prompt,
|
|
12435
12539
|
cwd: options.cwd,
|
|
12436
|
-
model:
|
|
12540
|
+
model: model2,
|
|
12437
12541
|
mode: options.mode,
|
|
12438
12542
|
args: options.args,
|
|
12439
12543
|
signal: options.signal,
|
|
@@ -12442,11 +12546,11 @@ function spawn5(service, promptOrOptions, maybeOptions) {
|
|
|
12442
12546
|
});
|
|
12443
12547
|
}
|
|
12444
12548
|
resolveEventsOnce(emptyEvents);
|
|
12445
|
-
const
|
|
12446
|
-
return spawnCore(
|
|
12549
|
+
const model = await resolveModel3();
|
|
12550
|
+
return spawnCore(getContainer(), service, {
|
|
12447
12551
|
prompt: options.prompt,
|
|
12448
12552
|
cwd: options.cwd,
|
|
12449
|
-
model
|
|
12553
|
+
model,
|
|
12450
12554
|
mode: options.mode,
|
|
12451
12555
|
args: options.args,
|
|
12452
12556
|
...options.mcpServers ? { mcpServers: options.mcpServers } : {},
|
|
@@ -12466,7 +12570,7 @@ var init_spawn3 = __esm({
|
|
|
12466
12570
|
init_spawn_core();
|
|
12467
12571
|
await init_container();
|
|
12468
12572
|
init_poe_agent();
|
|
12469
|
-
|
|
12573
|
+
init_src6();
|
|
12470
12574
|
spawn5.pretty = async function pretty(service, promptOrOptions, maybeOptions) {
|
|
12471
12575
|
const { events, result } = spawn5(service, promptOrOptions, maybeOptions);
|
|
12472
12576
|
await renderAcpStream(events);
|
|
@@ -13339,17 +13443,61 @@ var init_pipeline2 = __esm({
|
|
|
13339
13443
|
async "src/sdk/pipeline.ts"() {
|
|
13340
13444
|
"use strict";
|
|
13341
13445
|
init_src11();
|
|
13342
|
-
|
|
13446
|
+
init_src6();
|
|
13343
13447
|
await init_spawn3();
|
|
13344
13448
|
}
|
|
13345
13449
|
});
|
|
13346
13450
|
|
|
13451
|
+
// packages/ralph/src/frontmatter/frontmatter.ts
|
|
13452
|
+
import { stringify, parse as parse6 } from "yaml";
|
|
13453
|
+
function parseFrontmatter(content) {
|
|
13454
|
+
const defaults = { status: "pending", iteration: 0 };
|
|
13455
|
+
if (!content.startsWith(`${FENCE}
|
|
13456
|
+
`)) {
|
|
13457
|
+
return { data: defaults, body: content };
|
|
13458
|
+
}
|
|
13459
|
+
const closingIndex = content.indexOf(`
|
|
13460
|
+
${FENCE}
|
|
13461
|
+
`, FENCE.length);
|
|
13462
|
+
if (closingIndex === -1) {
|
|
13463
|
+
return { data: defaults, body: content };
|
|
13464
|
+
}
|
|
13465
|
+
const yamlBlock = content.slice(FENCE.length + 1, closingIndex);
|
|
13466
|
+
const body = content.slice(closingIndex + FENCE.length + 2);
|
|
13467
|
+
const parsed = parse6(yamlBlock);
|
|
13468
|
+
return {
|
|
13469
|
+
data: {
|
|
13470
|
+
status: isValidStatus(parsed?.status) ? parsed.status : defaults.status,
|
|
13471
|
+
iteration: typeof parsed?.iteration === "number" ? parsed.iteration : defaults.iteration
|
|
13472
|
+
},
|
|
13473
|
+
body
|
|
13474
|
+
};
|
|
13475
|
+
}
|
|
13476
|
+
function writeFrontmatter(data, body) {
|
|
13477
|
+
const yaml = stringify(data).trimEnd();
|
|
13478
|
+
return `${FENCE}
|
|
13479
|
+
${yaml}
|
|
13480
|
+
${FENCE}
|
|
13481
|
+
${body}`;
|
|
13482
|
+
}
|
|
13483
|
+
function isValidStatus(value) {
|
|
13484
|
+
return typeof value === "string" && ["pending", "in_progress", "completed", "overbake_abort", "cancelled"].includes(
|
|
13485
|
+
value
|
|
13486
|
+
);
|
|
13487
|
+
}
|
|
13488
|
+
var FENCE;
|
|
13489
|
+
var init_frontmatter = __esm({
|
|
13490
|
+
"packages/ralph/src/frontmatter/frontmatter.ts"() {
|
|
13491
|
+
"use strict";
|
|
13492
|
+
FENCE = "---";
|
|
13493
|
+
}
|
|
13494
|
+
});
|
|
13495
|
+
|
|
13347
13496
|
// packages/ralph/src/discovery/discovery.ts
|
|
13348
13497
|
import path17 from "node:path";
|
|
13349
13498
|
import * as fsPromises6 from "node:fs/promises";
|
|
13350
13499
|
function createDefaultFs4() {
|
|
13351
13500
|
return {
|
|
13352
|
-
readFile: fsPromises6.readFile,
|
|
13353
13501
|
readdir: fsPromises6.readdir,
|
|
13354
13502
|
stat: async (filePath) => {
|
|
13355
13503
|
const stat8 = await fsPromises6.stat(filePath);
|
|
@@ -13472,10 +13620,31 @@ async function runRalph(options) {
|
|
|
13472
13620
|
options.cwd,
|
|
13473
13621
|
options.homeDir
|
|
13474
13622
|
);
|
|
13475
|
-
const
|
|
13623
|
+
const rawContent = await fs3.readFile(absoluteDocPath, "utf8");
|
|
13624
|
+
const { body: prompt } = parseFrontmatter(rawContent);
|
|
13476
13625
|
const detector = new OverbakingDetector(threshold);
|
|
13477
13626
|
const startTime = Date.now();
|
|
13478
13627
|
let iterationsCompleted = 0;
|
|
13628
|
+
await updateFrontmatter(fs3, absoluteDocPath, prompt, "in_progress", 0);
|
|
13629
|
+
async function finalize2(stopReason) {
|
|
13630
|
+
const status = stopReasonToStatus(stopReason);
|
|
13631
|
+
await updateFrontmatter(
|
|
13632
|
+
fs3,
|
|
13633
|
+
absoluteDocPath,
|
|
13634
|
+
prompt,
|
|
13635
|
+
status,
|
|
13636
|
+
iterationsCompleted
|
|
13637
|
+
);
|
|
13638
|
+
if (stopReason === "max_iterations" && iterationsCompleted > 0) {
|
|
13639
|
+
await archivePlan2(fs3, absoluteDocPath);
|
|
13640
|
+
}
|
|
13641
|
+
return {
|
|
13642
|
+
stopReason,
|
|
13643
|
+
docPath: options.docPath,
|
|
13644
|
+
iterationsCompleted,
|
|
13645
|
+
totalDurationMs: Date.now() - startTime
|
|
13646
|
+
};
|
|
13647
|
+
}
|
|
13479
13648
|
try {
|
|
13480
13649
|
for (let iteration = 1; iteration <= options.maxIterations; iteration += 1) {
|
|
13481
13650
|
assertNotAborted5(options.signal);
|
|
@@ -13492,17 +13661,19 @@ async function runRalph(options) {
|
|
|
13492
13661
|
});
|
|
13493
13662
|
} catch (error2) {
|
|
13494
13663
|
if (isAbortError2(error2)) {
|
|
13495
|
-
return
|
|
13496
|
-
stopReason: "cancelled",
|
|
13497
|
-
docPath: options.docPath,
|
|
13498
|
-
iterationsCompleted,
|
|
13499
|
-
totalDurationMs: Date.now() - startTime
|
|
13500
|
-
};
|
|
13664
|
+
return finalize2("cancelled");
|
|
13501
13665
|
}
|
|
13502
13666
|
throw error2;
|
|
13503
13667
|
}
|
|
13504
13668
|
const success2 = result.exitCode === 0;
|
|
13505
13669
|
iterationsCompleted += 1;
|
|
13670
|
+
await updateFrontmatter(
|
|
13671
|
+
fs3,
|
|
13672
|
+
absoluteDocPath,
|
|
13673
|
+
prompt,
|
|
13674
|
+
"in_progress",
|
|
13675
|
+
iterationsCompleted
|
|
13676
|
+
);
|
|
13506
13677
|
options.onIterationComplete?.(
|
|
13507
13678
|
iteration,
|
|
13508
13679
|
Date.now() - iterationStart,
|
|
@@ -13521,35 +13692,21 @@ async function runRalph(options) {
|
|
|
13521
13692
|
threshold
|
|
13522
13693
|
}) : "abort";
|
|
13523
13694
|
if (action === "abort") {
|
|
13524
|
-
return
|
|
13525
|
-
stopReason: "overbake_abort",
|
|
13526
|
-
docPath: options.docPath,
|
|
13527
|
-
iterationsCompleted,
|
|
13528
|
-
totalDurationMs: Date.now() - startTime
|
|
13529
|
-
};
|
|
13695
|
+
return finalize2("overbake_abort");
|
|
13530
13696
|
}
|
|
13531
13697
|
}
|
|
13532
13698
|
} catch (error2) {
|
|
13533
13699
|
if (isAbortError2(error2)) {
|
|
13534
|
-
return
|
|
13535
|
-
stopReason: "cancelled",
|
|
13536
|
-
docPath: options.docPath,
|
|
13537
|
-
iterationsCompleted,
|
|
13538
|
-
totalDurationMs: Date.now() - startTime
|
|
13539
|
-
};
|
|
13700
|
+
return finalize2("cancelled");
|
|
13540
13701
|
}
|
|
13541
13702
|
throw error2;
|
|
13542
13703
|
}
|
|
13543
|
-
return
|
|
13544
|
-
stopReason: "max_iterations",
|
|
13545
|
-
docPath: options.docPath,
|
|
13546
|
-
iterationsCompleted,
|
|
13547
|
-
totalDurationMs: Date.now() - startTime
|
|
13548
|
-
};
|
|
13704
|
+
return finalize2("max_iterations");
|
|
13549
13705
|
}
|
|
13550
13706
|
function createDefaultFs5() {
|
|
13551
13707
|
return {
|
|
13552
13708
|
readFile: fsPromises7.readFile,
|
|
13709
|
+
writeFile: (filePath, content) => fsPromises7.writeFile(filePath, content, "utf8"),
|
|
13553
13710
|
readdir: fsPromises7.readdir,
|
|
13554
13711
|
stat: async (filePath) => {
|
|
13555
13712
|
const stat8 = await fsPromises7.stat(filePath);
|
|
@@ -13557,7 +13714,11 @@ function createDefaultFs5() {
|
|
|
13557
13714
|
isFile: () => stat8.isFile(),
|
|
13558
13715
|
mtimeMs: stat8.mtimeMs
|
|
13559
13716
|
};
|
|
13560
|
-
}
|
|
13717
|
+
},
|
|
13718
|
+
mkdir: async (filePath, options) => {
|
|
13719
|
+
await fsPromises7.mkdir(filePath, options);
|
|
13720
|
+
},
|
|
13721
|
+
rename: fsPromises7.rename
|
|
13561
13722
|
};
|
|
13562
13723
|
}
|
|
13563
13724
|
function resolveAbsoluteDocPath(docPath, cwd, homeDir) {
|
|
@@ -13580,10 +13741,33 @@ function createAbortError4() {
|
|
|
13580
13741
|
function isAbortError2(error2) {
|
|
13581
13742
|
return error2 instanceof Error && error2.name === "AbortError";
|
|
13582
13743
|
}
|
|
13744
|
+
async function updateFrontmatter(fs3, absoluteDocPath, body, status, iteration) {
|
|
13745
|
+
const content = writeFrontmatter({ status, iteration }, body);
|
|
13746
|
+
await fs3.writeFile(absoluteDocPath, content);
|
|
13747
|
+
}
|
|
13748
|
+
async function archivePlan2(fs3, absoluteDocPath) {
|
|
13749
|
+
const dir = path18.dirname(absoluteDocPath);
|
|
13750
|
+
const archiveDir = path18.join(dir, "archive");
|
|
13751
|
+
const archivePath = path18.join(archiveDir, path18.basename(absoluteDocPath));
|
|
13752
|
+
await fs3.mkdir(archiveDir, { recursive: true });
|
|
13753
|
+
await fs3.rename(absoluteDocPath, archivePath);
|
|
13754
|
+
}
|
|
13755
|
+
function stopReasonToStatus(stopReason) {
|
|
13756
|
+
switch (stopReason) {
|
|
13757
|
+
case "completed":
|
|
13758
|
+
case "max_iterations":
|
|
13759
|
+
return "completed";
|
|
13760
|
+
case "overbake_abort":
|
|
13761
|
+
return "overbake_abort";
|
|
13762
|
+
case "cancelled":
|
|
13763
|
+
return "cancelled";
|
|
13764
|
+
}
|
|
13765
|
+
}
|
|
13583
13766
|
var init_ralph = __esm({
|
|
13584
13767
|
"packages/ralph/src/run/ralph.ts"() {
|
|
13585
13768
|
"use strict";
|
|
13586
13769
|
init_detector();
|
|
13770
|
+
init_frontmatter();
|
|
13587
13771
|
}
|
|
13588
13772
|
});
|
|
13589
13773
|
|
|
@@ -13591,6 +13775,7 @@ var init_ralph = __esm({
|
|
|
13591
13775
|
var init_src12 = __esm({
|
|
13592
13776
|
"packages/ralph/src/index.ts"() {
|
|
13593
13777
|
"use strict";
|
|
13778
|
+
init_frontmatter();
|
|
13594
13779
|
init_discovery2();
|
|
13595
13780
|
init_detector();
|
|
13596
13781
|
init_ralph();
|
|
@@ -13618,7 +13803,7 @@ var init_ralph2 = __esm({
|
|
|
13618
13803
|
async "src/sdk/ralph.ts"() {
|
|
13619
13804
|
"use strict";
|
|
13620
13805
|
init_src12();
|
|
13621
|
-
|
|
13806
|
+
init_src6();
|
|
13622
13807
|
await init_spawn3();
|
|
13623
13808
|
}
|
|
13624
13809
|
});
|
|
@@ -13825,7 +14010,7 @@ var init_oauth_login = __esm({
|
|
|
13825
14010
|
"src/cli/oauth-login.ts"() {
|
|
13826
14011
|
"use strict";
|
|
13827
14012
|
init_src7();
|
|
13828
|
-
|
|
14013
|
+
init_src5();
|
|
13829
14014
|
}
|
|
13830
14015
|
});
|
|
13831
14016
|
|
|
@@ -13947,8 +14132,8 @@ var init_container2 = __esm({
|
|
|
13947
14132
|
init_options();
|
|
13948
14133
|
init_logger2();
|
|
13949
14134
|
init_error_logger();
|
|
14135
|
+
init_src6();
|
|
13950
14136
|
init_src5();
|
|
13951
|
-
init_src4();
|
|
13952
14137
|
await init_providers();
|
|
13953
14138
|
init_poe_code_command_runner();
|
|
13954
14139
|
init_errors();
|
|
@@ -13971,18 +14156,16 @@ async function deleteConfig(options) {
|
|
|
13971
14156
|
}
|
|
13972
14157
|
}
|
|
13973
14158
|
async function loadConfiguredServices(options) {
|
|
13974
|
-
const { fs: fs3, filePath } = options;
|
|
14159
|
+
const { fs: fs3, filePath, projectFilePath } = options;
|
|
13975
14160
|
await migrateLegacyCredentialsIfNeeded(fs3, filePath);
|
|
13976
|
-
const document = await
|
|
14161
|
+
const document = await readMergedDocument(fs3, filePath, projectFilePath);
|
|
13977
14162
|
return normalizeConfiguredServices(document[configuredServicesScope]);
|
|
13978
14163
|
}
|
|
13979
14164
|
async function saveConfiguredService(options) {
|
|
13980
14165
|
const { fs: fs3, filePath, service, metadata } = options;
|
|
13981
14166
|
await migrateLegacyConfigIfNeeded(fs3, filePath);
|
|
13982
14167
|
const document = await readDocument(fs3, filePath);
|
|
13983
|
-
const services = normalizeConfiguredServices(
|
|
13984
|
-
document[configuredServicesScope]
|
|
13985
|
-
);
|
|
14168
|
+
const services = normalizeConfiguredServices(document[configuredServicesScope]);
|
|
13986
14169
|
services[service] = normalizeConfiguredServiceMetadata(metadata);
|
|
13987
14170
|
await writeScope(fs3, filePath, configuredServicesScope, services);
|
|
13988
14171
|
}
|
|
@@ -13990,9 +14173,7 @@ async function unconfigureService(options) {
|
|
|
13990
14173
|
const { fs: fs3, filePath, service } = options;
|
|
13991
14174
|
await migrateLegacyConfigIfNeeded(fs3, filePath);
|
|
13992
14175
|
const document = await readDocument(fs3, filePath);
|
|
13993
|
-
const services = normalizeConfiguredServices(
|
|
13994
|
-
document[configuredServicesScope]
|
|
13995
|
-
);
|
|
14176
|
+
const services = normalizeConfiguredServices(document[configuredServicesScope]);
|
|
13996
14177
|
if (!(service in services)) {
|
|
13997
14178
|
return false;
|
|
13998
14179
|
}
|
|
@@ -14020,9 +14201,7 @@ async function migrateLegacyConfigIfNeeded(fs3, filePath) {
|
|
|
14020
14201
|
if (currentRaw === null) {
|
|
14021
14202
|
return;
|
|
14022
14203
|
}
|
|
14023
|
-
const legacyDocument = normalizeLegacyConfigDocument(
|
|
14024
|
-
parseLegacyConfigDocument(currentRaw)
|
|
14025
|
-
);
|
|
14204
|
+
const legacyDocument = normalizeLegacyConfigDocument(parseLegacyConfigDocument(currentRaw));
|
|
14026
14205
|
if (!legacyDocument.apiKey) {
|
|
14027
14206
|
return;
|
|
14028
14207
|
}
|
|
@@ -14061,12 +14240,7 @@ async function migrateLegacyCredentialsFile(fs3, configPath) {
|
|
|
14061
14240
|
throw error2;
|
|
14062
14241
|
}
|
|
14063
14242
|
if (legacyDocument.configured_services) {
|
|
14064
|
-
await writeScope(
|
|
14065
|
-
fs3,
|
|
14066
|
-
configPath,
|
|
14067
|
-
configuredServicesScope,
|
|
14068
|
-
legacyDocument.configured_services
|
|
14069
|
-
);
|
|
14243
|
+
await writeScope(fs3, configPath, configuredServicesScope, legacyDocument.configured_services);
|
|
14070
14244
|
}
|
|
14071
14245
|
if (legacyDocument.apiKey) {
|
|
14072
14246
|
await writeScope(fs3, configPath, CORE_SCOPE, {
|
|
@@ -14128,8 +14302,8 @@ var CORE_SCOPE, configuredServicesScope, EMPTY_DOCUMENT2;
|
|
|
14128
14302
|
var init_config3 = __esm({
|
|
14129
14303
|
"src/services/config.ts"() {
|
|
14130
14304
|
"use strict";
|
|
14131
|
-
|
|
14132
|
-
|
|
14305
|
+
init_src3();
|
|
14306
|
+
init_src4();
|
|
14133
14307
|
CORE_SCOPE = "core";
|
|
14134
14308
|
configuredServicesScope = "configured_services";
|
|
14135
14309
|
EMPTY_DOCUMENT2 = `${JSON.stringify({}, null, 2)}
|
|
@@ -14141,37 +14315,21 @@ var init_config3 = __esm({
|
|
|
14141
14315
|
function registerConfigureCommand(program, container) {
|
|
14142
14316
|
const serviceNames = container.registry.list().map((service) => service.name);
|
|
14143
14317
|
const serviceDescription = `Agent to configure${formatServiceList(serviceNames)}`;
|
|
14144
|
-
const configureCommand = program.command("configure").description("Configure developer tooling for Poe API.").argument(
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
program,
|
|
14151
|
-
container,
|
|
14152
|
-
service,
|
|
14153
|
-
{ action: "configure" }
|
|
14154
|
-
);
|
|
14155
|
-
await executeConfigure(program, container, resolved, options);
|
|
14156
|
-
}
|
|
14157
|
-
);
|
|
14318
|
+
const configureCommand = program.command("configure").description("Configure developer tooling for Poe API.").argument("[agent]", serviceDescription).option("--api-key <key>", "Poe API key").option("--model <model>", "Model identifier").option("--reasoning-effort <level>", "Reasoning effort level").action(async (service, options) => {
|
|
14319
|
+
const resolved = await resolveServiceArgument(program, container, service, {
|
|
14320
|
+
action: "configure"
|
|
14321
|
+
});
|
|
14322
|
+
await executeConfigure(program, container, resolved, options);
|
|
14323
|
+
});
|
|
14158
14324
|
return configureCommand;
|
|
14159
14325
|
}
|
|
14160
14326
|
async function executeConfigure(program, container, service, options) {
|
|
14161
14327
|
const adapter = resolveServiceAdapter(container, service);
|
|
14162
14328
|
const canonicalService = adapter.name;
|
|
14163
14329
|
const flags = resolveCommandFlags(program);
|
|
14164
|
-
const resources = createExecutionResources(
|
|
14165
|
-
container,
|
|
14166
|
-
flags,
|
|
14167
|
-
`configure:${canonicalService}`
|
|
14168
|
-
);
|
|
14330
|
+
const resources = createExecutionResources(container, flags, `configure:${canonicalService}`);
|
|
14169
14331
|
resources.logger.intro(`configure ${canonicalService}`);
|
|
14170
|
-
const providerContext = buildProviderContext(
|
|
14171
|
-
container,
|
|
14172
|
-
adapter,
|
|
14173
|
-
resources
|
|
14174
|
-
);
|
|
14332
|
+
const providerContext = buildProviderContext(container, adapter, resources);
|
|
14175
14333
|
const payload = await createConfigurePayload({
|
|
14176
14334
|
container,
|
|
14177
14335
|
flags,
|
|
@@ -14202,6 +14360,7 @@ async function executeConfigure(program, container, service, options) {
|
|
|
14202
14360
|
await saveConfiguredService({
|
|
14203
14361
|
fs: container.fs,
|
|
14204
14362
|
filePath: providerContext.env.configPath,
|
|
14363
|
+
projectFilePath: providerContext.env.projectConfigPath,
|
|
14205
14364
|
service: canonicalService,
|
|
14206
14365
|
metadata: {
|
|
14207
14366
|
files: tracker.files()
|
|
@@ -14212,10 +14371,7 @@ async function executeConfigure(program, container, service, options) {
|
|
|
14212
14371
|
if (isolated && isolated.requiresConfig !== false) {
|
|
14213
14372
|
const isolatedTracker = createMutationTracker();
|
|
14214
14373
|
const isolatedLogger = createMutationReporter(resources.logger);
|
|
14215
|
-
const isolatedObservers = combineMutationObservers(
|
|
14216
|
-
isolatedTracker.observers,
|
|
14217
|
-
isolatedLogger
|
|
14218
|
-
);
|
|
14374
|
+
const isolatedObservers = combineMutationObservers(isolatedTracker.observers, isolatedLogger);
|
|
14219
14375
|
await applyIsolatedConfiguration({
|
|
14220
14376
|
adapter: entry,
|
|
14221
14377
|
providerContext,
|
|
@@ -14378,7 +14534,7 @@ function toAcpEvents(update, started) {
|
|
|
14378
14534
|
var init_agent2 = __esm({
|
|
14379
14535
|
"src/cli/commands/agent.ts"() {
|
|
14380
14536
|
"use strict";
|
|
14381
|
-
|
|
14537
|
+
init_src6();
|
|
14382
14538
|
init_shared();
|
|
14383
14539
|
}
|
|
14384
14540
|
});
|
|
@@ -14390,23 +14546,11 @@ function registerSpawnCommand(program, container, options = {}) {
|
|
|
14390
14546
|
const extraServices = options.extraServices ?? [];
|
|
14391
14547
|
const serviceList = [...spawnServices, ...extraServices];
|
|
14392
14548
|
const serviceDescription = `Agent to spawn${formatServiceList(serviceList)}`;
|
|
14393
|
-
program.command("spawn").description("Run a single prompt through a configured agent CLI.").option("--model <model>", "Model identifier override passed to the agent CLI").option("-C, --cwd <path>", "Working directory for the agent CLI").option("--stdin", "Read the prompt from stdin").option("-i, --interactive", "Launch the agent in interactive TUI mode").option("--mode <mode>", "Permission mode: yolo | edit | read (default: yolo)").option(
|
|
14394
|
-
"--mcp-config <json>",
|
|
14395
|
-
"MCP server config JSON: {name: {command, args?, env?}}"
|
|
14396
|
-
).argument(
|
|
14397
|
-
"<agent>",
|
|
14398
|
-
serviceDescription
|
|
14399
|
-
).argument("[prompt]", "Prompt text to send (or '-' / stdin)").argument(
|
|
14400
|
-
"[agentArgs...]",
|
|
14401
|
-
"Additional arguments forwarded to the agent CLI"
|
|
14402
|
-
).action(async function(service, promptText, agentArgs = []) {
|
|
14549
|
+
program.command("spawn").description("Run a single prompt through a configured agent CLI.").option("--model <model>", "Model identifier override passed to the agent CLI").option("-C, --cwd <path>", "Working directory for the agent CLI").option("--stdin", "Read the prompt from stdin").option("-i, --interactive", "Launch the agent in interactive TUI mode").option("--mode <mode>", "Permission mode: yolo | edit | read (default: yolo)").option("--mcp-config <json>", "MCP server config JSON: {name: {command, args?, env?}}").argument("<agent>", serviceDescription).argument("[prompt]", "Prompt text to send (or '-' / stdin)").argument("[agentArgs...]", "Additional arguments forwarded to the agent CLI").action(async function(service, promptText, agentArgs = []) {
|
|
14403
14550
|
const flags = resolveCommandFlags(program);
|
|
14404
14551
|
const commandOptions = this.opts();
|
|
14405
14552
|
const mcpServers = parseMcpSpawnConfig2(commandOptions.mcpConfig);
|
|
14406
|
-
const cwdOverride = resolveSpawnWorkingDirectory2(
|
|
14407
|
-
container.env.cwd,
|
|
14408
|
-
commandOptions.cwd
|
|
14409
|
-
);
|
|
14553
|
+
const cwdOverride = resolveSpawnWorkingDirectory2(container.env.cwd, commandOptions.cwd);
|
|
14410
14554
|
const wantsStdinFlag = commandOptions.stdin === true;
|
|
14411
14555
|
const shouldReadFromStdin = wantsStdinFlag || promptText === "-" || !promptText && !process.stdin.isTTY;
|
|
14412
14556
|
const forwardedArgs = wantsStdinFlag ? [...promptText ? [promptText] : [], ...agentArgs] : agentArgs;
|
|
@@ -14429,10 +14573,15 @@ function registerSpawnCommand(program, container, options = {}) {
|
|
|
14429
14573
|
if (!proceed) {
|
|
14430
14574
|
return;
|
|
14431
14575
|
}
|
|
14576
|
+
const model = await resolveConfiguredModel(
|
|
14577
|
+
container,
|
|
14578
|
+
canonicalService2,
|
|
14579
|
+
commandOptions.model
|
|
14580
|
+
);
|
|
14432
14581
|
const result = await spawnInteractive(canonicalService2, {
|
|
14433
14582
|
prompt: promptText ?? "",
|
|
14434
14583
|
args: forwardedArgs,
|
|
14435
|
-
model
|
|
14584
|
+
model,
|
|
14436
14585
|
mode: commandOptions.mode,
|
|
14437
14586
|
...mcpServers ? { mcpServers } : {},
|
|
14438
14587
|
cwd: cwdOverride
|
|
@@ -14461,11 +14610,7 @@ function registerSpawnCommand(program, container, options = {}) {
|
|
|
14461
14610
|
};
|
|
14462
14611
|
const directHandler = options.handlers?.[service];
|
|
14463
14612
|
if (directHandler) {
|
|
14464
|
-
const resources2 = createExecutionResources(
|
|
14465
|
-
container,
|
|
14466
|
-
flags,
|
|
14467
|
-
`spawn:${service}`
|
|
14468
|
-
);
|
|
14613
|
+
const resources2 = createExecutionResources(container, flags, `spawn:${service}`);
|
|
14469
14614
|
resources2.logger.intro(`spawn ${service}`);
|
|
14470
14615
|
await directHandler({
|
|
14471
14616
|
container,
|
|
@@ -14479,11 +14624,7 @@ function registerSpawnCommand(program, container, options = {}) {
|
|
|
14479
14624
|
}
|
|
14480
14625
|
const adapter = resolveServiceAdapter(container, service);
|
|
14481
14626
|
const canonicalService = adapter.name;
|
|
14482
|
-
const resources = createExecutionResources(
|
|
14483
|
-
container,
|
|
14484
|
-
flags,
|
|
14485
|
-
`spawn:${canonicalService}`
|
|
14486
|
-
);
|
|
14627
|
+
const resources = createExecutionResources(container, flags, `spawn:${canonicalService}`);
|
|
14487
14628
|
resources.logger.intro(`spawn ${canonicalService}`);
|
|
14488
14629
|
const canonicalHandler = options.handlers?.[canonicalService];
|
|
14489
14630
|
if (canonicalHandler) {
|
|
@@ -14501,11 +14642,7 @@ function registerSpawnCommand(program, container, options = {}) {
|
|
|
14501
14642
|
}
|
|
14502
14643
|
}
|
|
14503
14644
|
try {
|
|
14504
|
-
assertSpawnSupport(
|
|
14505
|
-
adapter.label,
|
|
14506
|
-
canonicalService,
|
|
14507
|
-
typeof adapter.spawn === "function"
|
|
14508
|
-
);
|
|
14645
|
+
assertSpawnSupport(adapter.label, canonicalService, typeof adapter.spawn === "function");
|
|
14509
14646
|
assertMcpSpawnSupport(
|
|
14510
14647
|
adapter.label,
|
|
14511
14648
|
canonicalService,
|
|
@@ -14575,7 +14712,8 @@ Resume: ${resumeCommand}`));
|
|
|
14575
14712
|
async function confirmUnconfiguredService(container, service, label, flags) {
|
|
14576
14713
|
const configuredServices = await loadConfiguredServices({
|
|
14577
14714
|
fs: container.fs,
|
|
14578
|
-
filePath: container.env.configPath
|
|
14715
|
+
filePath: container.env.configPath,
|
|
14716
|
+
projectFilePath: container.env.projectConfigPath
|
|
14579
14717
|
});
|
|
14580
14718
|
if (service in configuredServices) {
|
|
14581
14719
|
return true;
|
|
@@ -14633,9 +14771,7 @@ function parseMcpSpawnConfig2(input) {
|
|
|
14633
14771
|
let args;
|
|
14634
14772
|
if ("args" in value && value.args !== void 0) {
|
|
14635
14773
|
if (!Array.isArray(value.args)) {
|
|
14636
|
-
throw new ValidationError(
|
|
14637
|
-
`--mcp-config entry "${name}".args must be an array of strings`
|
|
14638
|
-
);
|
|
14774
|
+
throw new ValidationError(`--mcp-config entry "${name}".args must be an array of strings`);
|
|
14639
14775
|
}
|
|
14640
14776
|
args = [];
|
|
14641
14777
|
for (const arg of value.args) {
|
|
@@ -14706,9 +14842,9 @@ function isObjectRecord5(value) {
|
|
|
14706
14842
|
var init_spawn4 = __esm({
|
|
14707
14843
|
async "src/cli/commands/spawn.ts"() {
|
|
14708
14844
|
"use strict";
|
|
14845
|
+
init_src6();
|
|
14846
|
+
init_src2();
|
|
14709
14847
|
init_src5();
|
|
14710
|
-
init_src3();
|
|
14711
|
-
init_src4();
|
|
14712
14848
|
init_config3();
|
|
14713
14849
|
init_shared();
|
|
14714
14850
|
init_spawn_core();
|
|
@@ -15072,9 +15208,7 @@ var init_research = __esm({
|
|
|
15072
15208
|
|
|
15073
15209
|
// src/cli/commands/research.ts
|
|
15074
15210
|
function registerResearchCommand(program, container) {
|
|
15075
|
-
const spawnServices = container.registry.list().filter(
|
|
15076
|
-
(service) => typeof service.spawn === "function" || getSpawnConfig(service.name)
|
|
15077
|
-
).map((service) => service.name);
|
|
15211
|
+
const spawnServices = container.registry.list().filter((service) => typeof service.spawn === "function" || getSpawnConfig(service.name)).map((service) => service.name);
|
|
15078
15212
|
const serviceDescription = `Agent to research with${formatServiceList(spawnServices)}`;
|
|
15079
15213
|
program.command("research").description("Research a codebase using a coding agent.").option("--agent <agent>", serviceDescription).option("--model <model>", "Model identifier override passed to the agent CLI").option("--mode <mode>", "Permission mode: yolo | edit | read (default: read)").option("-C, --cwd <path>", "Working directory override").option("--path <path>", "Local directory to research").option("--github <repo>", "Clone and research a GitHub repo").option("--stdin", "Read the prompt from stdin").option("--keep", "Keep the cloned repo when using --github").argument("[prompt]", "Prompt text to send (or '-' / stdin)").argument("[agentArgs...]", "Additional arguments forwarded to the agent CLI").action(async function(promptText, agentArgs = []) {
|
|
15080
15214
|
const flags = resolveCommandFlags(program);
|
|
@@ -15105,11 +15239,7 @@ function registerResearchCommand(program, container) {
|
|
|
15105
15239
|
});
|
|
15106
15240
|
const adapter = resolveServiceAdapter(container, resolvedAgent);
|
|
15107
15241
|
const canonicalService = adapter.name;
|
|
15108
|
-
const resources = createExecutionResources(
|
|
15109
|
-
container,
|
|
15110
|
-
flags,
|
|
15111
|
-
`research:${canonicalService}`
|
|
15112
|
-
);
|
|
15242
|
+
const resources = createExecutionResources(container, flags, `research:${canonicalService}`);
|
|
15113
15243
|
resources.logger.intro(`research ${canonicalService}`);
|
|
15114
15244
|
const model = await resolveResearchModel({
|
|
15115
15245
|
container,
|
|
@@ -15143,20 +15273,17 @@ async function resolveResearchAgent(input) {
|
|
|
15143
15273
|
if (input.agent) {
|
|
15144
15274
|
return input.agent;
|
|
15145
15275
|
}
|
|
15146
|
-
const spawnable = input.container.registry.list().filter(
|
|
15147
|
-
(service) => typeof service.spawn === "function" || getSpawnConfig(service.name)
|
|
15148
|
-
);
|
|
15276
|
+
const spawnable = input.container.registry.list().filter((service) => typeof service.spawn === "function" || getSpawnConfig(service.name));
|
|
15149
15277
|
if (spawnable.length === 0) {
|
|
15150
15278
|
throw new Error("No spawn-capable agents available.");
|
|
15151
15279
|
}
|
|
15152
15280
|
if (input.flags.assumeYes) {
|
|
15153
15281
|
const configured = await loadConfiguredServices({
|
|
15154
15282
|
fs: input.container.fs,
|
|
15155
|
-
filePath: input.container.env.configPath
|
|
15283
|
+
filePath: input.container.env.configPath,
|
|
15284
|
+
projectFilePath: input.container.env.projectConfigPath
|
|
15156
15285
|
});
|
|
15157
|
-
const configuredService = spawnable.find(
|
|
15158
|
-
(service) => service.name in configured
|
|
15159
|
-
);
|
|
15286
|
+
const configuredService = spawnable.find((service) => service.name in configured);
|
|
15160
15287
|
return configuredService?.name ?? spawnable[0].name;
|
|
15161
15288
|
}
|
|
15162
15289
|
const choices = spawnable.map((service) => ({
|
|
@@ -15214,7 +15341,7 @@ async function resolveResearchModel(input) {
|
|
|
15214
15341
|
var init_research2 = __esm({
|
|
15215
15342
|
async "src/cli/commands/research.ts"() {
|
|
15216
15343
|
"use strict";
|
|
15217
|
-
|
|
15344
|
+
init_src6();
|
|
15218
15345
|
init_config3();
|
|
15219
15346
|
await init_research();
|
|
15220
15347
|
init_errors();
|
|
@@ -15281,7 +15408,7 @@ async function configExists(fs3, filePath) {
|
|
|
15281
15408
|
var init_isolated_env_runner = __esm({
|
|
15282
15409
|
"src/cli/isolated-env-runner.ts"() {
|
|
15283
15410
|
"use strict";
|
|
15284
|
-
|
|
15411
|
+
init_src3();
|
|
15285
15412
|
init_isolated_env();
|
|
15286
15413
|
init_cli_settings_merge();
|
|
15287
15414
|
}
|
|
@@ -15356,11 +15483,7 @@ function registerLoginCommand(program, container) {
|
|
|
15356
15483
|
}
|
|
15357
15484
|
async function executeLogin(program, container, options) {
|
|
15358
15485
|
const flags = resolveCommandFlags(program);
|
|
15359
|
-
const resources = createExecutionResources(
|
|
15360
|
-
container,
|
|
15361
|
-
flags,
|
|
15362
|
-
"login"
|
|
15363
|
-
);
|
|
15486
|
+
const resources = createExecutionResources(container, flags, "login");
|
|
15364
15487
|
resources.logger.intro("login");
|
|
15365
15488
|
try {
|
|
15366
15489
|
const apiKey = await container.options.resolveApiKey({
|
|
@@ -15372,7 +15495,8 @@ async function executeLogin(program, container, options) {
|
|
|
15372
15495
|
});
|
|
15373
15496
|
const configuredServices = await loadConfiguredServices({
|
|
15374
15497
|
fs: container.fs,
|
|
15375
|
-
filePath: container.env.configPath
|
|
15498
|
+
filePath: container.env.configPath,
|
|
15499
|
+
projectFilePath: container.env.projectConfigPath
|
|
15376
15500
|
});
|
|
15377
15501
|
await reconfigureServices({
|
|
15378
15502
|
program,
|
|
@@ -15454,10 +15578,7 @@ var init_login = __esm({
|
|
|
15454
15578
|
function registerUnconfigureCommand(program, container) {
|
|
15455
15579
|
const serviceNames = container.registry.list().map((service) => service.name);
|
|
15456
15580
|
const serviceDescription = `Agent to unconfigure${formatServiceList(serviceNames)}`;
|
|
15457
|
-
return program.command("unconfigure").description("Remove existing Poe API tooling configuration.").argument(
|
|
15458
|
-
"<agent>",
|
|
15459
|
-
serviceDescription
|
|
15460
|
-
).action(async (service, options) => {
|
|
15581
|
+
return program.command("unconfigure").description("Remove existing Poe API tooling configuration.").argument("<agent>", serviceDescription).action(async (service, options) => {
|
|
15461
15582
|
await executeUnconfigure(program, container, service, options);
|
|
15462
15583
|
});
|
|
15463
15584
|
}
|
|
@@ -15465,17 +15586,9 @@ async function executeUnconfigure(program, container, service, options) {
|
|
|
15465
15586
|
const adapter = resolveServiceAdapter(container, service);
|
|
15466
15587
|
const canonicalService = adapter.name;
|
|
15467
15588
|
const flags = resolveCommandFlags(program);
|
|
15468
|
-
const resources = createExecutionResources(
|
|
15469
|
-
container,
|
|
15470
|
-
flags,
|
|
15471
|
-
`unconfigure:${canonicalService}`
|
|
15472
|
-
);
|
|
15589
|
+
const resources = createExecutionResources(container, flags, `unconfigure:${canonicalService}`);
|
|
15473
15590
|
resources.logger.intro(`unconfigure ${canonicalService}`);
|
|
15474
|
-
const providerContext = buildProviderContext(
|
|
15475
|
-
container,
|
|
15476
|
-
adapter,
|
|
15477
|
-
resources
|
|
15478
|
-
);
|
|
15591
|
+
const providerContext = buildProviderContext(container, adapter, resources);
|
|
15479
15592
|
const mutationLogger = createMutationReporter(resources.logger);
|
|
15480
15593
|
const payload = await createUnconfigurePayload({
|
|
15481
15594
|
service: canonicalService,
|
|
@@ -15526,6 +15639,7 @@ async function executeUnconfigure(program, container, service, options) {
|
|
|
15526
15639
|
await unconfigureService({
|
|
15527
15640
|
fs: container.fs,
|
|
15528
15641
|
filePath: providerContext.env.configPath,
|
|
15642
|
+
projectFilePath: providerContext.env.projectConfigPath,
|
|
15529
15643
|
service: canonicalService
|
|
15530
15644
|
});
|
|
15531
15645
|
}
|
|
@@ -15585,15 +15699,12 @@ function registerLogoutCommand(program, container) {
|
|
|
15585
15699
|
}
|
|
15586
15700
|
async function executeLogout(program, container) {
|
|
15587
15701
|
const flags = resolveCommandFlags(program);
|
|
15588
|
-
const resources = createExecutionResources(
|
|
15589
|
-
container,
|
|
15590
|
-
flags,
|
|
15591
|
-
"logout"
|
|
15592
|
-
);
|
|
15702
|
+
const resources = createExecutionResources(container, flags, "logout");
|
|
15593
15703
|
resources.logger.intro("logout");
|
|
15594
15704
|
const configuredServices = await loadConfiguredServices({
|
|
15595
15705
|
fs: container.fs,
|
|
15596
|
-
filePath: container.env.configPath
|
|
15706
|
+
filePath: container.env.configPath,
|
|
15707
|
+
projectFilePath: container.env.projectConfigPath
|
|
15597
15708
|
});
|
|
15598
15709
|
for (const serviceName of Object.keys(configuredServices)) {
|
|
15599
15710
|
const adapter = container.registry.get(serviceName);
|
|
@@ -15658,9 +15769,7 @@ async function executeStatus(program, container) {
|
|
|
15658
15769
|
resources.logger.info(loggedIn ? "Logged in" : "Not logged in");
|
|
15659
15770
|
if (loggedIn) {
|
|
15660
15771
|
if (flags.dryRun) {
|
|
15661
|
-
resources.logger.dryRun(
|
|
15662
|
-
"Dry run: would fetch usage balance from Poe API."
|
|
15663
|
-
);
|
|
15772
|
+
resources.logger.dryRun("Dry run: would fetch usage balance from Poe API.");
|
|
15664
15773
|
} else {
|
|
15665
15774
|
const response = await container.httpClient(
|
|
15666
15775
|
`${container.env.poeBaseUrl}/usage/current_balance`,
|
|
@@ -15672,32 +15781,26 @@ async function executeStatus(program, container) {
|
|
|
15672
15781
|
}
|
|
15673
15782
|
);
|
|
15674
15783
|
if (!response.ok) {
|
|
15675
|
-
throw new ApiError(
|
|
15676
|
-
|
|
15677
|
-
|
|
15678
|
-
|
|
15679
|
-
endpoint: "/usage/current_balance"
|
|
15680
|
-
}
|
|
15681
|
-
);
|
|
15784
|
+
throw new ApiError(`Failed to fetch usage balance (HTTP ${response.status})`, {
|
|
15785
|
+
httpStatus: response.status,
|
|
15786
|
+
endpoint: "/usage/current_balance"
|
|
15787
|
+
});
|
|
15682
15788
|
}
|
|
15683
15789
|
const data = await response.json();
|
|
15684
|
-
const formattedBalance = data.current_point_balance.toLocaleString(
|
|
15685
|
-
"en-US"
|
|
15686
|
-
);
|
|
15790
|
+
const formattedBalance = data.current_point_balance.toLocaleString("en-US");
|
|
15687
15791
|
resources.logger.info(`Current balance: ${formattedBalance} points`);
|
|
15688
15792
|
}
|
|
15689
15793
|
}
|
|
15690
15794
|
const configuredServices = await loadConfiguredServices({
|
|
15691
15795
|
fs: container.fs,
|
|
15692
|
-
filePath: container.env.configPath
|
|
15796
|
+
filePath: container.env.configPath,
|
|
15797
|
+
projectFilePath: container.env.projectConfigPath
|
|
15693
15798
|
});
|
|
15694
15799
|
const configuredAgentNames = Object.keys(configuredServices).sort();
|
|
15695
15800
|
if (configuredAgentNames.length === 0) {
|
|
15696
15801
|
resources.logger.info("No agents configured.");
|
|
15697
15802
|
} else {
|
|
15698
|
-
resources.logger.info(
|
|
15699
|
-
`Configured agents: ${configuredAgentNames.join(", ")}`
|
|
15700
|
-
);
|
|
15803
|
+
resources.logger.info(`Configured agents: ${configuredAgentNames.join(", ")}`);
|
|
15701
15804
|
}
|
|
15702
15805
|
resources.context.finalize();
|
|
15703
15806
|
} catch (error2) {
|
|
@@ -15874,7 +15977,7 @@ var init_test = __esm({
|
|
|
15874
15977
|
init_shared();
|
|
15875
15978
|
init_configure();
|
|
15876
15979
|
init_isolated_env();
|
|
15877
|
-
|
|
15980
|
+
init_src5();
|
|
15878
15981
|
}
|
|
15879
15982
|
});
|
|
15880
15983
|
|
|
@@ -15940,7 +16043,7 @@ function registerGenerateCommand(program, container) {
|
|
|
15940
16043
|
const prompt = ensurePrompt(promptArg, { type: "text", isDefault: true });
|
|
15941
16044
|
const opts = resolveGenerateOptions(this);
|
|
15942
16045
|
const params = parseParams(normalizeParamList(opts.param));
|
|
15943
|
-
const model =
|
|
16046
|
+
const model = resolveModel2("text", opts, container.env.variables);
|
|
15944
16047
|
if (flags.dryRun) {
|
|
15945
16048
|
resources.logger.dryRun(
|
|
15946
16049
|
`Dry run: would generate text with model ${model} and prompt (${prompt.length} chars)`
|
|
@@ -15971,7 +16074,7 @@ function registerGenerateCommand(program, container) {
|
|
|
15971
16074
|
const prompt = ensurePrompt(promptArg, { type: "text", isDefault: false });
|
|
15972
16075
|
const opts = resolveGenerateOptions(this);
|
|
15973
16076
|
const params = parseParams(normalizeParamList(opts.param));
|
|
15974
|
-
const model =
|
|
16077
|
+
const model = resolveModel2("text", opts, container.env.variables);
|
|
15975
16078
|
if (flags.dryRun) {
|
|
15976
16079
|
resources.logger.dryRun(
|
|
15977
16080
|
`Dry run: would generate text with model ${model} and prompt (${prompt.length} chars)`
|
|
@@ -16008,7 +16111,7 @@ function registerMediaSubcommand(generate2, program, container, type) {
|
|
|
16008
16111
|
const prompt = ensurePrompt(promptArg, { type, isDefault: false });
|
|
16009
16112
|
const opts = resolveGenerateOptions(this);
|
|
16010
16113
|
const params = parseParams(normalizeParamList(opts.param));
|
|
16011
|
-
const model =
|
|
16114
|
+
const model = resolveModel2(type, opts, container.env.variables);
|
|
16012
16115
|
if (flags.dryRun) {
|
|
16013
16116
|
resources.logger.dryRun(
|
|
16014
16117
|
`Dry run: would generate ${type} with model ${model} and prompt (${prompt.length} chars)`
|
|
@@ -16126,7 +16229,7 @@ function resolveApiBaseUrl(container) {
|
|
|
16126
16229
|
}
|
|
16127
16230
|
return container.env.poeApiBaseUrl;
|
|
16128
16231
|
}
|
|
16129
|
-
function
|
|
16232
|
+
function resolveModel2(type, options, variables) {
|
|
16130
16233
|
if (options.model) {
|
|
16131
16234
|
return options.model;
|
|
16132
16235
|
}
|
|
@@ -16205,7 +16308,7 @@ var MODEL_ENV_KEYS2, DEFAULT_MODELS2;
|
|
|
16205
16308
|
var init_generate = __esm({
|
|
16206
16309
|
"src/cli/commands/generate.ts"() {
|
|
16207
16310
|
"use strict";
|
|
16208
|
-
|
|
16311
|
+
init_src5();
|
|
16209
16312
|
init_constants();
|
|
16210
16313
|
init_shared();
|
|
16211
16314
|
init_client_instance();
|
|
@@ -21676,7 +21779,7 @@ var init_errors4 = __esm({
|
|
|
21676
21779
|
});
|
|
21677
21780
|
|
|
21678
21781
|
// node_modules/zod/v4/core/parse.js
|
|
21679
|
-
var _parse,
|
|
21782
|
+
var _parse, parse7, _parseAsync, parseAsync, _safeParse, safeParse, _safeParseAsync, safeParseAsync, _encode, _decode, _encodeAsync, _decodeAsync, _safeEncode, _safeDecode, _safeEncodeAsync, _safeDecodeAsync;
|
|
21680
21783
|
var init_parse = __esm({
|
|
21681
21784
|
"node_modules/zod/v4/core/parse.js"() {
|
|
21682
21785
|
init_core();
|
|
@@ -21695,7 +21798,7 @@ var init_parse = __esm({
|
|
|
21695
21798
|
}
|
|
21696
21799
|
return result.value;
|
|
21697
21800
|
};
|
|
21698
|
-
|
|
21801
|
+
parse7 = /* @__PURE__ */ _parse($ZodRealError);
|
|
21699
21802
|
_parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
21700
21803
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
21701
21804
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -24414,10 +24517,10 @@ var init_schemas = __esm({
|
|
|
24414
24517
|
throw new Error("implement() must be called with a function");
|
|
24415
24518
|
}
|
|
24416
24519
|
return function(...args) {
|
|
24417
|
-
const parsedArgs = inst._def.input ?
|
|
24520
|
+
const parsedArgs = inst._def.input ? parse7(inst._def.input, args) : args;
|
|
24418
24521
|
const result = Reflect.apply(func, this, parsedArgs);
|
|
24419
24522
|
if (inst._def.output) {
|
|
24420
|
-
return
|
|
24523
|
+
return parse7(inst._def.output, result);
|
|
24421
24524
|
}
|
|
24422
24525
|
return result;
|
|
24423
24526
|
};
|
|
@@ -26973,12 +27076,12 @@ var init_errors5 = __esm({
|
|
|
26973
27076
|
});
|
|
26974
27077
|
|
|
26975
27078
|
// node_modules/zod/v4/classic/parse.js
|
|
26976
|
-
var
|
|
27079
|
+
var parse8, parseAsync2, safeParse2, safeParseAsync2, encode2, decode2, encodeAsync2, decodeAsync2, safeEncode2, safeDecode2, safeEncodeAsync2, safeDecodeAsync2;
|
|
26977
27080
|
var init_parse3 = __esm({
|
|
26978
27081
|
"node_modules/zod/v4/classic/parse.js"() {
|
|
26979
27082
|
init_core2();
|
|
26980
27083
|
init_errors5();
|
|
26981
|
-
|
|
27084
|
+
parse8 = /* @__PURE__ */ _parse(ZodRealError);
|
|
26982
27085
|
parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
26983
27086
|
safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
26984
27087
|
safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
@@ -27654,7 +27757,7 @@ var init_schemas3 = __esm({
|
|
|
27654
27757
|
reg.add(inst, meta3);
|
|
27655
27758
|
return inst;
|
|
27656
27759
|
});
|
|
27657
|
-
inst.parse = (data, params) =>
|
|
27760
|
+
inst.parse = (data, params) => parse8(inst, data, params, { callee: inst.parse });
|
|
27658
27761
|
inst.safeParse = (data, params) => safeParse2(inst, data, params);
|
|
27659
27762
|
inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
|
|
27660
27763
|
inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
|
|
@@ -30505,10 +30608,10 @@ var require_code = __commonJS({
|
|
|
30505
30608
|
function interpolate2(x) {
|
|
30506
30609
|
return typeof x == "number" || typeof x == "boolean" || x === null ? x : safeStringify2(Array.isArray(x) ? x.join(",") : x);
|
|
30507
30610
|
}
|
|
30508
|
-
function
|
|
30611
|
+
function stringify2(x) {
|
|
30509
30612
|
return new _Code(safeStringify2(x));
|
|
30510
30613
|
}
|
|
30511
|
-
exports.stringify =
|
|
30614
|
+
exports.stringify = stringify2;
|
|
30512
30615
|
function safeStringify2(x) {
|
|
30513
30616
|
return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
30514
30617
|
}
|
|
@@ -33923,24 +34026,24 @@ var require_fast_uri = __commonJS({
|
|
|
33923
34026
|
function normalize(uri, options) {
|
|
33924
34027
|
if (typeof uri === "string") {
|
|
33925
34028
|
uri = /** @type {T} */
|
|
33926
|
-
serialize3(
|
|
34029
|
+
serialize3(parse9(uri, options), options);
|
|
33927
34030
|
} else if (typeof uri === "object") {
|
|
33928
34031
|
uri = /** @type {T} */
|
|
33929
|
-
|
|
34032
|
+
parse9(serialize3(uri, options), options);
|
|
33930
34033
|
}
|
|
33931
34034
|
return uri;
|
|
33932
34035
|
}
|
|
33933
34036
|
function resolve(baseURI, relativeURI, options) {
|
|
33934
34037
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
33935
|
-
const resolved = resolveComponent(
|
|
34038
|
+
const resolved = resolveComponent(parse9(baseURI, schemelessOptions), parse9(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
33936
34039
|
schemelessOptions.skipEscape = true;
|
|
33937
34040
|
return serialize3(resolved, schemelessOptions);
|
|
33938
34041
|
}
|
|
33939
34042
|
function resolveComponent(base, relative, options, skipNormalization) {
|
|
33940
34043
|
const target = {};
|
|
33941
34044
|
if (!skipNormalization) {
|
|
33942
|
-
base =
|
|
33943
|
-
relative =
|
|
34045
|
+
base = parse9(serialize3(base, options), options);
|
|
34046
|
+
relative = parse9(serialize3(relative, options), options);
|
|
33944
34047
|
}
|
|
33945
34048
|
options = options || {};
|
|
33946
34049
|
if (!options.tolerant && relative.scheme) {
|
|
@@ -33992,13 +34095,13 @@ var require_fast_uri = __commonJS({
|
|
|
33992
34095
|
function equal(uriA, uriB, options) {
|
|
33993
34096
|
if (typeof uriA === "string") {
|
|
33994
34097
|
uriA = unescape(uriA);
|
|
33995
|
-
uriA = serialize3(normalizeComponentEncoding(
|
|
34098
|
+
uriA = serialize3(normalizeComponentEncoding(parse9(uriA, options), true), { ...options, skipEscape: true });
|
|
33996
34099
|
} else if (typeof uriA === "object") {
|
|
33997
34100
|
uriA = serialize3(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
|
|
33998
34101
|
}
|
|
33999
34102
|
if (typeof uriB === "string") {
|
|
34000
34103
|
uriB = unescape(uriB);
|
|
34001
|
-
uriB = serialize3(normalizeComponentEncoding(
|
|
34104
|
+
uriB = serialize3(normalizeComponentEncoding(parse9(uriB, options), true), { ...options, skipEscape: true });
|
|
34002
34105
|
} else if (typeof uriB === "object") {
|
|
34003
34106
|
uriB = serialize3(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
|
|
34004
34107
|
}
|
|
@@ -34067,7 +34170,7 @@ var require_fast_uri = __commonJS({
|
|
|
34067
34170
|
return uriTokens.join("");
|
|
34068
34171
|
}
|
|
34069
34172
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
34070
|
-
function
|
|
34173
|
+
function parse9(uri, opts) {
|
|
34071
34174
|
const options = Object.assign({}, opts);
|
|
34072
34175
|
const parsed = {
|
|
34073
34176
|
scheme: void 0,
|
|
@@ -34161,7 +34264,7 @@ var require_fast_uri = __commonJS({
|
|
|
34161
34264
|
resolveComponent,
|
|
34162
34265
|
equal,
|
|
34163
34266
|
serialize: serialize3,
|
|
34164
|
-
parse:
|
|
34267
|
+
parse: parse9
|
|
34165
34268
|
};
|
|
34166
34269
|
module.exports = fastUri;
|
|
34167
34270
|
module.exports.default = fastUri;
|
|
@@ -37566,7 +37669,7 @@ ${panel.footer}`);
|
|
|
37566
37669
|
var init_command_not_found = __esm({
|
|
37567
37670
|
"src/cli/command-not-found.ts"() {
|
|
37568
37671
|
"use strict";
|
|
37569
|
-
|
|
37672
|
+
init_src5();
|
|
37570
37673
|
init_execution_context();
|
|
37571
37674
|
init_errors();
|
|
37572
37675
|
}
|
|
@@ -37601,7 +37704,7 @@ var agentMcpConfigs, supportedAgents;
|
|
|
37601
37704
|
var init_configs2 = __esm({
|
|
37602
37705
|
"packages/agent-mcp-config/src/configs.ts"() {
|
|
37603
37706
|
"use strict";
|
|
37604
|
-
|
|
37707
|
+
init_src2();
|
|
37605
37708
|
agentMcpConfigs = {
|
|
37606
37709
|
"claude-code": {
|
|
37607
37710
|
configFile: "~/.claude.json",
|
|
@@ -37805,7 +37908,7 @@ var UnsupportedAgentError;
|
|
|
37805
37908
|
var init_apply = __esm({
|
|
37806
37909
|
"packages/agent-mcp-config/src/apply.ts"() {
|
|
37807
37910
|
"use strict";
|
|
37808
|
-
|
|
37911
|
+
init_src3();
|
|
37809
37912
|
init_configs2();
|
|
37810
37913
|
init_shapes();
|
|
37811
37914
|
UnsupportedAgentError = class extends Error {
|
|
@@ -37992,7 +38095,7 @@ var DEFAULT_MCP_AGENT;
|
|
|
37992
38095
|
var init_mcp2 = __esm({
|
|
37993
38096
|
"src/cli/commands/mcp.ts"() {
|
|
37994
38097
|
"use strict";
|
|
37995
|
-
|
|
38098
|
+
init_src5();
|
|
37996
38099
|
init_client_instance();
|
|
37997
38100
|
init_mcp_server();
|
|
37998
38101
|
init_shared();
|
|
@@ -38022,7 +38125,7 @@ var agentSkillConfigs, supportedAgents2;
|
|
|
38022
38125
|
var init_configs3 = __esm({
|
|
38023
38126
|
"packages/agent-skill-config/src/configs.ts"() {
|
|
38024
38127
|
"use strict";
|
|
38025
|
-
|
|
38128
|
+
init_src2();
|
|
38026
38129
|
agentSkillConfigs = {
|
|
38027
38130
|
"claude-code": {
|
|
38028
38131
|
globalSkillDir: "~/.claude/skills",
|
|
@@ -38042,7 +38145,7 @@ var init_configs3 = __esm({
|
|
|
38042
38145
|
});
|
|
38043
38146
|
|
|
38044
38147
|
// packages/agent-skill-config/src/templates.ts
|
|
38045
|
-
import { readFile as
|
|
38148
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
38046
38149
|
async function getTemplates() {
|
|
38047
38150
|
if (templatesCache) {
|
|
38048
38151
|
return templatesCache;
|
|
@@ -38051,7 +38154,7 @@ async function getTemplates() {
|
|
|
38051
38154
|
"./templates/poe-generate.md",
|
|
38052
38155
|
import.meta.url
|
|
38053
38156
|
);
|
|
38054
|
-
const poeGenerateTemplate = await
|
|
38157
|
+
const poeGenerateTemplate = await readFile6(poeGenerateTemplateUrl, "utf8");
|
|
38055
38158
|
templatesCache = {
|
|
38056
38159
|
"poe-generate.md": poeGenerateTemplate
|
|
38057
38160
|
};
|
|
@@ -38183,7 +38286,7 @@ var UnsupportedAgentError2, bundledSkillTemplateIds, SKILL_TEMPLATE_ID;
|
|
|
38183
38286
|
var init_apply2 = __esm({
|
|
38184
38287
|
"packages/agent-skill-config/src/apply.ts"() {
|
|
38185
38288
|
"use strict";
|
|
38186
|
-
|
|
38289
|
+
init_src3();
|
|
38187
38290
|
init_configs3();
|
|
38188
38291
|
init_templates();
|
|
38189
38292
|
UnsupportedAgentError2 = class extends Error {
|
|
@@ -38422,7 +38525,7 @@ var DEFAULT_SKILL_AGENT;
|
|
|
38422
38525
|
var init_skill = __esm({
|
|
38423
38526
|
"src/cli/commands/skill.ts"() {
|
|
38424
38527
|
"use strict";
|
|
38425
|
-
|
|
38528
|
+
init_src5();
|
|
38426
38529
|
init_src15();
|
|
38427
38530
|
init_shared();
|
|
38428
38531
|
init_command_not_found();
|
|
@@ -38513,7 +38616,7 @@ async function displayVersion(container, currentVersion) {
|
|
|
38513
38616
|
var init_version2 = __esm({
|
|
38514
38617
|
"src/cli/commands/version.ts"() {
|
|
38515
38618
|
"use strict";
|
|
38516
|
-
|
|
38619
|
+
init_src5();
|
|
38517
38620
|
init_version();
|
|
38518
38621
|
init_exit_signals();
|
|
38519
38622
|
}
|
|
@@ -38720,7 +38823,7 @@ var init_usage = __esm({
|
|
|
38720
38823
|
"use strict";
|
|
38721
38824
|
init_shared();
|
|
38722
38825
|
init_errors();
|
|
38723
|
-
|
|
38826
|
+
init_src5();
|
|
38724
38827
|
}
|
|
38725
38828
|
});
|
|
38726
38829
|
|
|
@@ -39005,12 +39108,12 @@ function registerModelsCommand(program, container) {
|
|
|
39005
39108
|
});
|
|
39006
39109
|
}
|
|
39007
39110
|
var MAX_VALUES_LENGTH, MAX_DEFAULT_LENGTH;
|
|
39008
|
-
var
|
|
39111
|
+
var init_models2 = __esm({
|
|
39009
39112
|
"src/cli/commands/models.ts"() {
|
|
39010
39113
|
"use strict";
|
|
39011
39114
|
init_shared();
|
|
39012
39115
|
init_errors();
|
|
39013
|
-
|
|
39116
|
+
init_src5();
|
|
39014
39117
|
MAX_VALUES_LENGTH = 105;
|
|
39015
39118
|
MAX_DEFAULT_LENGTH = 36;
|
|
39016
39119
|
}
|
|
@@ -39018,7 +39121,7 @@ var init_models = __esm({
|
|
|
39018
39121
|
|
|
39019
39122
|
// src/cli/commands/pipeline.ts
|
|
39020
39123
|
import path26 from "node:path";
|
|
39021
|
-
import { readFile as
|
|
39124
|
+
import { readFile as readFile7, stat as stat7 } from "node:fs/promises";
|
|
39022
39125
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
39023
39126
|
function formatDuration(ms) {
|
|
39024
39127
|
const totalSeconds = Math.round(ms / 1e3);
|
|
@@ -39072,8 +39175,8 @@ async function loadPipelineTemplates() {
|
|
|
39072
39175
|
continue;
|
|
39073
39176
|
}
|
|
39074
39177
|
const [skillPlan, steps] = await Promise.all([
|
|
39075
|
-
|
|
39076
|
-
|
|
39178
|
+
readFile7(path26.join(templateRoot, "SKILL_plan.md"), "utf8"),
|
|
39179
|
+
readFile7(path26.join(templateRoot, "steps.yaml.hbs"), "utf8")
|
|
39077
39180
|
]);
|
|
39078
39181
|
pipelineTemplatesCache = { skillPlan, steps };
|
|
39079
39182
|
return pipelineTemplatesCache;
|
|
@@ -39398,8 +39501,8 @@ var DEFAULT_PIPELINE_AGENT, DEFAULT_PIPELINE_SCOPE, pipelineTemplatesCache;
|
|
|
39398
39501
|
var init_pipeline4 = __esm({
|
|
39399
39502
|
async "src/cli/commands/pipeline.ts"() {
|
|
39400
39503
|
"use strict";
|
|
39401
|
-
|
|
39402
|
-
|
|
39504
|
+
init_src5();
|
|
39505
|
+
init_src2();
|
|
39403
39506
|
init_src15();
|
|
39404
39507
|
init_errors();
|
|
39405
39508
|
init_shared();
|
|
@@ -39620,9 +39723,9 @@ var DEFAULT_RALPH_AGENT;
|
|
|
39620
39723
|
var init_ralph3 = __esm({
|
|
39621
39724
|
async "src/cli/commands/ralph.ts"() {
|
|
39622
39725
|
"use strict";
|
|
39623
|
-
init_src4();
|
|
39624
|
-
init_src3();
|
|
39625
39726
|
init_src5();
|
|
39727
|
+
init_src2();
|
|
39728
|
+
init_src6();
|
|
39626
39729
|
init_src12();
|
|
39627
39730
|
init_errors();
|
|
39628
39731
|
init_shared();
|
|
@@ -39637,7 +39740,7 @@ var init_package = __esm({
|
|
|
39637
39740
|
"package.json"() {
|
|
39638
39741
|
package_default = {
|
|
39639
39742
|
name: "poe-code",
|
|
39640
|
-
version: "3.0.
|
|
39743
|
+
version: "3.0.105",
|
|
39641
39744
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
39642
39745
|
type: "module",
|
|
39643
39746
|
main: "./dist/index.js",
|
|
@@ -40057,7 +40160,7 @@ var init_program = __esm({
|
|
|
40057
40160
|
async "src/cli/program.ts"() {
|
|
40058
40161
|
"use strict";
|
|
40059
40162
|
await init_container2();
|
|
40060
|
-
|
|
40163
|
+
init_src5();
|
|
40061
40164
|
init_configure();
|
|
40062
40165
|
init_agent2();
|
|
40063
40166
|
await init_spawn4();
|
|
@@ -40074,7 +40177,7 @@ var init_program = __esm({
|
|
|
40074
40177
|
init_skill();
|
|
40075
40178
|
init_version2();
|
|
40076
40179
|
init_usage();
|
|
40077
|
-
|
|
40180
|
+
init_models2();
|
|
40078
40181
|
await init_pipeline4();
|
|
40079
40182
|
await init_ralph3();
|
|
40080
40183
|
init_package();
|
|
@@ -40157,7 +40260,7 @@ function createPromptRunner(adapter = {
|
|
|
40157
40260
|
var init_prompt_runner = __esm({
|
|
40158
40261
|
"src/cli/prompt-runner.ts"() {
|
|
40159
40262
|
"use strict";
|
|
40160
|
-
|
|
40263
|
+
init_src5();
|
|
40161
40264
|
init_errors();
|
|
40162
40265
|
}
|
|
40163
40266
|
});
|
|
@@ -40239,7 +40342,7 @@ var fsAdapter;
|
|
|
40239
40342
|
var init_bootstrap = __esm({
|
|
40240
40343
|
"src/cli/bootstrap.ts"() {
|
|
40241
40344
|
"use strict";
|
|
40242
|
-
|
|
40345
|
+
init_src5();
|
|
40243
40346
|
init_error_logger();
|
|
40244
40347
|
init_errors();
|
|
40245
40348
|
init_prompt_runner();
|
|
@@ -40355,8 +40458,8 @@ function normalizeBaseUrl(value) {
|
|
|
40355
40458
|
init_credentials();
|
|
40356
40459
|
|
|
40357
40460
|
// src/cli/poe-agent-main.ts
|
|
40461
|
+
init_src6();
|
|
40358
40462
|
init_src5();
|
|
40359
|
-
init_src4();
|
|
40360
40463
|
init_constants();
|
|
40361
40464
|
init_errors();
|
|
40362
40465
|
import path19 from "node:path";
|