poe-code 3.0.104 → 3.0.106
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 +548 -526
- 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,7 +13443,7 @@ 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
|
});
|
|
@@ -13699,7 +13803,7 @@ var init_ralph2 = __esm({
|
|
|
13699
13803
|
async "src/sdk/ralph.ts"() {
|
|
13700
13804
|
"use strict";
|
|
13701
13805
|
init_src12();
|
|
13702
|
-
|
|
13806
|
+
init_src6();
|
|
13703
13807
|
await init_spawn3();
|
|
13704
13808
|
}
|
|
13705
13809
|
});
|
|
@@ -13906,7 +14010,7 @@ var init_oauth_login = __esm({
|
|
|
13906
14010
|
"src/cli/oauth-login.ts"() {
|
|
13907
14011
|
"use strict";
|
|
13908
14012
|
init_src7();
|
|
13909
|
-
|
|
14013
|
+
init_src5();
|
|
13910
14014
|
}
|
|
13911
14015
|
});
|
|
13912
14016
|
|
|
@@ -14028,8 +14132,8 @@ var init_container2 = __esm({
|
|
|
14028
14132
|
init_options();
|
|
14029
14133
|
init_logger2();
|
|
14030
14134
|
init_error_logger();
|
|
14135
|
+
init_src6();
|
|
14031
14136
|
init_src5();
|
|
14032
|
-
init_src4();
|
|
14033
14137
|
await init_providers();
|
|
14034
14138
|
init_poe_code_command_runner();
|
|
14035
14139
|
init_errors();
|
|
@@ -14052,18 +14156,16 @@ async function deleteConfig(options) {
|
|
|
14052
14156
|
}
|
|
14053
14157
|
}
|
|
14054
14158
|
async function loadConfiguredServices(options) {
|
|
14055
|
-
const { fs: fs3, filePath } = options;
|
|
14159
|
+
const { fs: fs3, filePath, projectFilePath } = options;
|
|
14056
14160
|
await migrateLegacyCredentialsIfNeeded(fs3, filePath);
|
|
14057
|
-
const document = await
|
|
14161
|
+
const document = await readMergedDocument(fs3, filePath, projectFilePath);
|
|
14058
14162
|
return normalizeConfiguredServices(document[configuredServicesScope]);
|
|
14059
14163
|
}
|
|
14060
14164
|
async function saveConfiguredService(options) {
|
|
14061
14165
|
const { fs: fs3, filePath, service, metadata } = options;
|
|
14062
14166
|
await migrateLegacyConfigIfNeeded(fs3, filePath);
|
|
14063
14167
|
const document = await readDocument(fs3, filePath);
|
|
14064
|
-
const services = normalizeConfiguredServices(
|
|
14065
|
-
document[configuredServicesScope]
|
|
14066
|
-
);
|
|
14168
|
+
const services = normalizeConfiguredServices(document[configuredServicesScope]);
|
|
14067
14169
|
services[service] = normalizeConfiguredServiceMetadata(metadata);
|
|
14068
14170
|
await writeScope(fs3, filePath, configuredServicesScope, services);
|
|
14069
14171
|
}
|
|
@@ -14071,9 +14173,7 @@ async function unconfigureService(options) {
|
|
|
14071
14173
|
const { fs: fs3, filePath, service } = options;
|
|
14072
14174
|
await migrateLegacyConfigIfNeeded(fs3, filePath);
|
|
14073
14175
|
const document = await readDocument(fs3, filePath);
|
|
14074
|
-
const services = normalizeConfiguredServices(
|
|
14075
|
-
document[configuredServicesScope]
|
|
14076
|
-
);
|
|
14176
|
+
const services = normalizeConfiguredServices(document[configuredServicesScope]);
|
|
14077
14177
|
if (!(service in services)) {
|
|
14078
14178
|
return false;
|
|
14079
14179
|
}
|
|
@@ -14101,9 +14201,7 @@ async function migrateLegacyConfigIfNeeded(fs3, filePath) {
|
|
|
14101
14201
|
if (currentRaw === null) {
|
|
14102
14202
|
return;
|
|
14103
14203
|
}
|
|
14104
|
-
const legacyDocument = normalizeLegacyConfigDocument(
|
|
14105
|
-
parseLegacyConfigDocument(currentRaw)
|
|
14106
|
-
);
|
|
14204
|
+
const legacyDocument = normalizeLegacyConfigDocument(parseLegacyConfigDocument(currentRaw));
|
|
14107
14205
|
if (!legacyDocument.apiKey) {
|
|
14108
14206
|
return;
|
|
14109
14207
|
}
|
|
@@ -14142,12 +14240,7 @@ async function migrateLegacyCredentialsFile(fs3, configPath) {
|
|
|
14142
14240
|
throw error2;
|
|
14143
14241
|
}
|
|
14144
14242
|
if (legacyDocument.configured_services) {
|
|
14145
|
-
await writeScope(
|
|
14146
|
-
fs3,
|
|
14147
|
-
configPath,
|
|
14148
|
-
configuredServicesScope,
|
|
14149
|
-
legacyDocument.configured_services
|
|
14150
|
-
);
|
|
14243
|
+
await writeScope(fs3, configPath, configuredServicesScope, legacyDocument.configured_services);
|
|
14151
14244
|
}
|
|
14152
14245
|
if (legacyDocument.apiKey) {
|
|
14153
14246
|
await writeScope(fs3, configPath, CORE_SCOPE, {
|
|
@@ -14209,8 +14302,8 @@ var CORE_SCOPE, configuredServicesScope, EMPTY_DOCUMENT2;
|
|
|
14209
14302
|
var init_config3 = __esm({
|
|
14210
14303
|
"src/services/config.ts"() {
|
|
14211
14304
|
"use strict";
|
|
14212
|
-
|
|
14213
|
-
|
|
14305
|
+
init_src3();
|
|
14306
|
+
init_src4();
|
|
14214
14307
|
CORE_SCOPE = "core";
|
|
14215
14308
|
configuredServicesScope = "configured_services";
|
|
14216
14309
|
EMPTY_DOCUMENT2 = `${JSON.stringify({}, null, 2)}
|
|
@@ -14222,37 +14315,21 @@ var init_config3 = __esm({
|
|
|
14222
14315
|
function registerConfigureCommand(program, container) {
|
|
14223
14316
|
const serviceNames = container.registry.list().map((service) => service.name);
|
|
14224
14317
|
const serviceDescription = `Agent to configure${formatServiceList(serviceNames)}`;
|
|
14225
|
-
const configureCommand = program.command("configure").description("Configure developer tooling for Poe API.").argument(
|
|
14226
|
-
|
|
14227
|
-
|
|
14228
|
-
|
|
14229
|
-
|
|
14230
|
-
|
|
14231
|
-
program,
|
|
14232
|
-
container,
|
|
14233
|
-
service,
|
|
14234
|
-
{ action: "configure" }
|
|
14235
|
-
);
|
|
14236
|
-
await executeConfigure(program, container, resolved, options);
|
|
14237
|
-
}
|
|
14238
|
-
);
|
|
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
|
+
});
|
|
14239
14324
|
return configureCommand;
|
|
14240
14325
|
}
|
|
14241
14326
|
async function executeConfigure(program, container, service, options) {
|
|
14242
14327
|
const adapter = resolveServiceAdapter(container, service);
|
|
14243
14328
|
const canonicalService = adapter.name;
|
|
14244
14329
|
const flags = resolveCommandFlags(program);
|
|
14245
|
-
const resources = createExecutionResources(
|
|
14246
|
-
container,
|
|
14247
|
-
flags,
|
|
14248
|
-
`configure:${canonicalService}`
|
|
14249
|
-
);
|
|
14330
|
+
const resources = createExecutionResources(container, flags, `configure:${canonicalService}`);
|
|
14250
14331
|
resources.logger.intro(`configure ${canonicalService}`);
|
|
14251
|
-
const providerContext = buildProviderContext(
|
|
14252
|
-
container,
|
|
14253
|
-
adapter,
|
|
14254
|
-
resources
|
|
14255
|
-
);
|
|
14332
|
+
const providerContext = buildProviderContext(container, adapter, resources);
|
|
14256
14333
|
const payload = await createConfigurePayload({
|
|
14257
14334
|
container,
|
|
14258
14335
|
flags,
|
|
@@ -14283,6 +14360,7 @@ async function executeConfigure(program, container, service, options) {
|
|
|
14283
14360
|
await saveConfiguredService({
|
|
14284
14361
|
fs: container.fs,
|
|
14285
14362
|
filePath: providerContext.env.configPath,
|
|
14363
|
+
projectFilePath: providerContext.env.projectConfigPath,
|
|
14286
14364
|
service: canonicalService,
|
|
14287
14365
|
metadata: {
|
|
14288
14366
|
files: tracker.files()
|
|
@@ -14293,10 +14371,7 @@ async function executeConfigure(program, container, service, options) {
|
|
|
14293
14371
|
if (isolated && isolated.requiresConfig !== false) {
|
|
14294
14372
|
const isolatedTracker = createMutationTracker();
|
|
14295
14373
|
const isolatedLogger = createMutationReporter(resources.logger);
|
|
14296
|
-
const isolatedObservers = combineMutationObservers(
|
|
14297
|
-
isolatedTracker.observers,
|
|
14298
|
-
isolatedLogger
|
|
14299
|
-
);
|
|
14374
|
+
const isolatedObservers = combineMutationObservers(isolatedTracker.observers, isolatedLogger);
|
|
14300
14375
|
await applyIsolatedConfiguration({
|
|
14301
14376
|
adapter: entry,
|
|
14302
14377
|
providerContext,
|
|
@@ -14459,7 +14534,7 @@ function toAcpEvents(update, started) {
|
|
|
14459
14534
|
var init_agent2 = __esm({
|
|
14460
14535
|
"src/cli/commands/agent.ts"() {
|
|
14461
14536
|
"use strict";
|
|
14462
|
-
|
|
14537
|
+
init_src6();
|
|
14463
14538
|
init_shared();
|
|
14464
14539
|
}
|
|
14465
14540
|
});
|
|
@@ -14471,23 +14546,11 @@ function registerSpawnCommand(program, container, options = {}) {
|
|
|
14471
14546
|
const extraServices = options.extraServices ?? [];
|
|
14472
14547
|
const serviceList = [...spawnServices, ...extraServices];
|
|
14473
14548
|
const serviceDescription = `Agent to spawn${formatServiceList(serviceList)}`;
|
|
14474
|
-
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(
|
|
14475
|
-
"--mcp-config <json>",
|
|
14476
|
-
"MCP server config JSON: {name: {command, args?, env?}}"
|
|
14477
|
-
).argument(
|
|
14478
|
-
"<agent>",
|
|
14479
|
-
serviceDescription
|
|
14480
|
-
).argument("[prompt]", "Prompt text to send (or '-' / stdin)").argument(
|
|
14481
|
-
"[agentArgs...]",
|
|
14482
|
-
"Additional arguments forwarded to the agent CLI"
|
|
14483
|
-
).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 = []) {
|
|
14484
14550
|
const flags = resolveCommandFlags(program);
|
|
14485
14551
|
const commandOptions = this.opts();
|
|
14486
14552
|
const mcpServers = parseMcpSpawnConfig2(commandOptions.mcpConfig);
|
|
14487
|
-
const cwdOverride = resolveSpawnWorkingDirectory2(
|
|
14488
|
-
container.env.cwd,
|
|
14489
|
-
commandOptions.cwd
|
|
14490
|
-
);
|
|
14553
|
+
const cwdOverride = resolveSpawnWorkingDirectory2(container.env.cwd, commandOptions.cwd);
|
|
14491
14554
|
const wantsStdinFlag = commandOptions.stdin === true;
|
|
14492
14555
|
const shouldReadFromStdin = wantsStdinFlag || promptText === "-" || !promptText && !process.stdin.isTTY;
|
|
14493
14556
|
const forwardedArgs = wantsStdinFlag ? [...promptText ? [promptText] : [], ...agentArgs] : agentArgs;
|
|
@@ -14510,10 +14573,15 @@ function registerSpawnCommand(program, container, options = {}) {
|
|
|
14510
14573
|
if (!proceed) {
|
|
14511
14574
|
return;
|
|
14512
14575
|
}
|
|
14576
|
+
const model = await resolveConfiguredModel(
|
|
14577
|
+
container,
|
|
14578
|
+
canonicalService2,
|
|
14579
|
+
commandOptions.model
|
|
14580
|
+
);
|
|
14513
14581
|
const result = await spawnInteractive(canonicalService2, {
|
|
14514
14582
|
prompt: promptText ?? "",
|
|
14515
14583
|
args: forwardedArgs,
|
|
14516
|
-
model
|
|
14584
|
+
model,
|
|
14517
14585
|
mode: commandOptions.mode,
|
|
14518
14586
|
...mcpServers ? { mcpServers } : {},
|
|
14519
14587
|
cwd: cwdOverride
|
|
@@ -14542,11 +14610,7 @@ function registerSpawnCommand(program, container, options = {}) {
|
|
|
14542
14610
|
};
|
|
14543
14611
|
const directHandler = options.handlers?.[service];
|
|
14544
14612
|
if (directHandler) {
|
|
14545
|
-
const resources2 = createExecutionResources(
|
|
14546
|
-
container,
|
|
14547
|
-
flags,
|
|
14548
|
-
`spawn:${service}`
|
|
14549
|
-
);
|
|
14613
|
+
const resources2 = createExecutionResources(container, flags, `spawn:${service}`);
|
|
14550
14614
|
resources2.logger.intro(`spawn ${service}`);
|
|
14551
14615
|
await directHandler({
|
|
14552
14616
|
container,
|
|
@@ -14560,11 +14624,7 @@ function registerSpawnCommand(program, container, options = {}) {
|
|
|
14560
14624
|
}
|
|
14561
14625
|
const adapter = resolveServiceAdapter(container, service);
|
|
14562
14626
|
const canonicalService = adapter.name;
|
|
14563
|
-
const resources = createExecutionResources(
|
|
14564
|
-
container,
|
|
14565
|
-
flags,
|
|
14566
|
-
`spawn:${canonicalService}`
|
|
14567
|
-
);
|
|
14627
|
+
const resources = createExecutionResources(container, flags, `spawn:${canonicalService}`);
|
|
14568
14628
|
resources.logger.intro(`spawn ${canonicalService}`);
|
|
14569
14629
|
const canonicalHandler = options.handlers?.[canonicalService];
|
|
14570
14630
|
if (canonicalHandler) {
|
|
@@ -14582,11 +14642,7 @@ function registerSpawnCommand(program, container, options = {}) {
|
|
|
14582
14642
|
}
|
|
14583
14643
|
}
|
|
14584
14644
|
try {
|
|
14585
|
-
assertSpawnSupport(
|
|
14586
|
-
adapter.label,
|
|
14587
|
-
canonicalService,
|
|
14588
|
-
typeof adapter.spawn === "function"
|
|
14589
|
-
);
|
|
14645
|
+
assertSpawnSupport(adapter.label, canonicalService, typeof adapter.spawn === "function");
|
|
14590
14646
|
assertMcpSpawnSupport(
|
|
14591
14647
|
adapter.label,
|
|
14592
14648
|
canonicalService,
|
|
@@ -14656,7 +14712,8 @@ Resume: ${resumeCommand}`));
|
|
|
14656
14712
|
async function confirmUnconfiguredService(container, service, label, flags) {
|
|
14657
14713
|
const configuredServices = await loadConfiguredServices({
|
|
14658
14714
|
fs: container.fs,
|
|
14659
|
-
filePath: container.env.configPath
|
|
14715
|
+
filePath: container.env.configPath,
|
|
14716
|
+
projectFilePath: container.env.projectConfigPath
|
|
14660
14717
|
});
|
|
14661
14718
|
if (service in configuredServices) {
|
|
14662
14719
|
return true;
|
|
@@ -14714,9 +14771,7 @@ function parseMcpSpawnConfig2(input) {
|
|
|
14714
14771
|
let args;
|
|
14715
14772
|
if ("args" in value && value.args !== void 0) {
|
|
14716
14773
|
if (!Array.isArray(value.args)) {
|
|
14717
|
-
throw new ValidationError(
|
|
14718
|
-
`--mcp-config entry "${name}".args must be an array of strings`
|
|
14719
|
-
);
|
|
14774
|
+
throw new ValidationError(`--mcp-config entry "${name}".args must be an array of strings`);
|
|
14720
14775
|
}
|
|
14721
14776
|
args = [];
|
|
14722
14777
|
for (const arg of value.args) {
|
|
@@ -14787,9 +14842,9 @@ function isObjectRecord5(value) {
|
|
|
14787
14842
|
var init_spawn4 = __esm({
|
|
14788
14843
|
async "src/cli/commands/spawn.ts"() {
|
|
14789
14844
|
"use strict";
|
|
14845
|
+
init_src6();
|
|
14846
|
+
init_src2();
|
|
14790
14847
|
init_src5();
|
|
14791
|
-
init_src3();
|
|
14792
|
-
init_src4();
|
|
14793
14848
|
init_config3();
|
|
14794
14849
|
init_shared();
|
|
14795
14850
|
init_spawn_core();
|
|
@@ -15153,9 +15208,7 @@ var init_research = __esm({
|
|
|
15153
15208
|
|
|
15154
15209
|
// src/cli/commands/research.ts
|
|
15155
15210
|
function registerResearchCommand(program, container) {
|
|
15156
|
-
const spawnServices = container.registry.list().filter(
|
|
15157
|
-
(service) => typeof service.spawn === "function" || getSpawnConfig(service.name)
|
|
15158
|
-
).map((service) => service.name);
|
|
15211
|
+
const spawnServices = container.registry.list().filter((service) => typeof service.spawn === "function" || getSpawnConfig(service.name)).map((service) => service.name);
|
|
15159
15212
|
const serviceDescription = `Agent to research with${formatServiceList(spawnServices)}`;
|
|
15160
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 = []) {
|
|
15161
15214
|
const flags = resolveCommandFlags(program);
|
|
@@ -15186,11 +15239,7 @@ function registerResearchCommand(program, container) {
|
|
|
15186
15239
|
});
|
|
15187
15240
|
const adapter = resolveServiceAdapter(container, resolvedAgent);
|
|
15188
15241
|
const canonicalService = adapter.name;
|
|
15189
|
-
const resources = createExecutionResources(
|
|
15190
|
-
container,
|
|
15191
|
-
flags,
|
|
15192
|
-
`research:${canonicalService}`
|
|
15193
|
-
);
|
|
15242
|
+
const resources = createExecutionResources(container, flags, `research:${canonicalService}`);
|
|
15194
15243
|
resources.logger.intro(`research ${canonicalService}`);
|
|
15195
15244
|
const model = await resolveResearchModel({
|
|
15196
15245
|
container,
|
|
@@ -15224,20 +15273,17 @@ async function resolveResearchAgent(input) {
|
|
|
15224
15273
|
if (input.agent) {
|
|
15225
15274
|
return input.agent;
|
|
15226
15275
|
}
|
|
15227
|
-
const spawnable = input.container.registry.list().filter(
|
|
15228
|
-
(service) => typeof service.spawn === "function" || getSpawnConfig(service.name)
|
|
15229
|
-
);
|
|
15276
|
+
const spawnable = input.container.registry.list().filter((service) => typeof service.spawn === "function" || getSpawnConfig(service.name));
|
|
15230
15277
|
if (spawnable.length === 0) {
|
|
15231
15278
|
throw new Error("No spawn-capable agents available.");
|
|
15232
15279
|
}
|
|
15233
15280
|
if (input.flags.assumeYes) {
|
|
15234
15281
|
const configured = await loadConfiguredServices({
|
|
15235
15282
|
fs: input.container.fs,
|
|
15236
|
-
filePath: input.container.env.configPath
|
|
15283
|
+
filePath: input.container.env.configPath,
|
|
15284
|
+
projectFilePath: input.container.env.projectConfigPath
|
|
15237
15285
|
});
|
|
15238
|
-
const configuredService = spawnable.find(
|
|
15239
|
-
(service) => service.name in configured
|
|
15240
|
-
);
|
|
15286
|
+
const configuredService = spawnable.find((service) => service.name in configured);
|
|
15241
15287
|
return configuredService?.name ?? spawnable[0].name;
|
|
15242
15288
|
}
|
|
15243
15289
|
const choices = spawnable.map((service) => ({
|
|
@@ -15295,7 +15341,7 @@ async function resolveResearchModel(input) {
|
|
|
15295
15341
|
var init_research2 = __esm({
|
|
15296
15342
|
async "src/cli/commands/research.ts"() {
|
|
15297
15343
|
"use strict";
|
|
15298
|
-
|
|
15344
|
+
init_src6();
|
|
15299
15345
|
init_config3();
|
|
15300
15346
|
await init_research();
|
|
15301
15347
|
init_errors();
|
|
@@ -15362,7 +15408,7 @@ async function configExists(fs3, filePath) {
|
|
|
15362
15408
|
var init_isolated_env_runner = __esm({
|
|
15363
15409
|
"src/cli/isolated-env-runner.ts"() {
|
|
15364
15410
|
"use strict";
|
|
15365
|
-
|
|
15411
|
+
init_src3();
|
|
15366
15412
|
init_isolated_env();
|
|
15367
15413
|
init_cli_settings_merge();
|
|
15368
15414
|
}
|
|
@@ -15437,11 +15483,7 @@ function registerLoginCommand(program, container) {
|
|
|
15437
15483
|
}
|
|
15438
15484
|
async function executeLogin(program, container, options) {
|
|
15439
15485
|
const flags = resolveCommandFlags(program);
|
|
15440
|
-
const resources = createExecutionResources(
|
|
15441
|
-
container,
|
|
15442
|
-
flags,
|
|
15443
|
-
"login"
|
|
15444
|
-
);
|
|
15486
|
+
const resources = createExecutionResources(container, flags, "login");
|
|
15445
15487
|
resources.logger.intro("login");
|
|
15446
15488
|
try {
|
|
15447
15489
|
const apiKey = await container.options.resolveApiKey({
|
|
@@ -15453,7 +15495,8 @@ async function executeLogin(program, container, options) {
|
|
|
15453
15495
|
});
|
|
15454
15496
|
const configuredServices = await loadConfiguredServices({
|
|
15455
15497
|
fs: container.fs,
|
|
15456
|
-
filePath: container.env.configPath
|
|
15498
|
+
filePath: container.env.configPath,
|
|
15499
|
+
projectFilePath: container.env.projectConfigPath
|
|
15457
15500
|
});
|
|
15458
15501
|
await reconfigureServices({
|
|
15459
15502
|
program,
|
|
@@ -15535,10 +15578,7 @@ var init_login = __esm({
|
|
|
15535
15578
|
function registerUnconfigureCommand(program, container) {
|
|
15536
15579
|
const serviceNames = container.registry.list().map((service) => service.name);
|
|
15537
15580
|
const serviceDescription = `Agent to unconfigure${formatServiceList(serviceNames)}`;
|
|
15538
|
-
return program.command("unconfigure").description("Remove existing Poe API tooling configuration.").argument(
|
|
15539
|
-
"<agent>",
|
|
15540
|
-
serviceDescription
|
|
15541
|
-
).action(async (service, options) => {
|
|
15581
|
+
return program.command("unconfigure").description("Remove existing Poe API tooling configuration.").argument("<agent>", serviceDescription).action(async (service, options) => {
|
|
15542
15582
|
await executeUnconfigure(program, container, service, options);
|
|
15543
15583
|
});
|
|
15544
15584
|
}
|
|
@@ -15546,17 +15586,9 @@ async function executeUnconfigure(program, container, service, options) {
|
|
|
15546
15586
|
const adapter = resolveServiceAdapter(container, service);
|
|
15547
15587
|
const canonicalService = adapter.name;
|
|
15548
15588
|
const flags = resolveCommandFlags(program);
|
|
15549
|
-
const resources = createExecutionResources(
|
|
15550
|
-
container,
|
|
15551
|
-
flags,
|
|
15552
|
-
`unconfigure:${canonicalService}`
|
|
15553
|
-
);
|
|
15589
|
+
const resources = createExecutionResources(container, flags, `unconfigure:${canonicalService}`);
|
|
15554
15590
|
resources.logger.intro(`unconfigure ${canonicalService}`);
|
|
15555
|
-
const providerContext = buildProviderContext(
|
|
15556
|
-
container,
|
|
15557
|
-
adapter,
|
|
15558
|
-
resources
|
|
15559
|
-
);
|
|
15591
|
+
const providerContext = buildProviderContext(container, adapter, resources);
|
|
15560
15592
|
const mutationLogger = createMutationReporter(resources.logger);
|
|
15561
15593
|
const payload = await createUnconfigurePayload({
|
|
15562
15594
|
service: canonicalService,
|
|
@@ -15607,6 +15639,7 @@ async function executeUnconfigure(program, container, service, options) {
|
|
|
15607
15639
|
await unconfigureService({
|
|
15608
15640
|
fs: container.fs,
|
|
15609
15641
|
filePath: providerContext.env.configPath,
|
|
15642
|
+
projectFilePath: providerContext.env.projectConfigPath,
|
|
15610
15643
|
service: canonicalService
|
|
15611
15644
|
});
|
|
15612
15645
|
}
|
|
@@ -15666,15 +15699,12 @@ function registerLogoutCommand(program, container) {
|
|
|
15666
15699
|
}
|
|
15667
15700
|
async function executeLogout(program, container) {
|
|
15668
15701
|
const flags = resolveCommandFlags(program);
|
|
15669
|
-
const resources = createExecutionResources(
|
|
15670
|
-
container,
|
|
15671
|
-
flags,
|
|
15672
|
-
"logout"
|
|
15673
|
-
);
|
|
15702
|
+
const resources = createExecutionResources(container, flags, "logout");
|
|
15674
15703
|
resources.logger.intro("logout");
|
|
15675
15704
|
const configuredServices = await loadConfiguredServices({
|
|
15676
15705
|
fs: container.fs,
|
|
15677
|
-
filePath: container.env.configPath
|
|
15706
|
+
filePath: container.env.configPath,
|
|
15707
|
+
projectFilePath: container.env.projectConfigPath
|
|
15678
15708
|
});
|
|
15679
15709
|
for (const serviceName of Object.keys(configuredServices)) {
|
|
15680
15710
|
const adapter = container.registry.get(serviceName);
|
|
@@ -15739,9 +15769,7 @@ async function executeStatus(program, container) {
|
|
|
15739
15769
|
resources.logger.info(loggedIn ? "Logged in" : "Not logged in");
|
|
15740
15770
|
if (loggedIn) {
|
|
15741
15771
|
if (flags.dryRun) {
|
|
15742
|
-
resources.logger.dryRun(
|
|
15743
|
-
"Dry run: would fetch usage balance from Poe API."
|
|
15744
|
-
);
|
|
15772
|
+
resources.logger.dryRun("Dry run: would fetch usage balance from Poe API.");
|
|
15745
15773
|
} else {
|
|
15746
15774
|
const response = await container.httpClient(
|
|
15747
15775
|
`${container.env.poeBaseUrl}/usage/current_balance`,
|
|
@@ -15753,32 +15781,26 @@ async function executeStatus(program, container) {
|
|
|
15753
15781
|
}
|
|
15754
15782
|
);
|
|
15755
15783
|
if (!response.ok) {
|
|
15756
|
-
throw new ApiError(
|
|
15757
|
-
|
|
15758
|
-
|
|
15759
|
-
|
|
15760
|
-
endpoint: "/usage/current_balance"
|
|
15761
|
-
}
|
|
15762
|
-
);
|
|
15784
|
+
throw new ApiError(`Failed to fetch usage balance (HTTP ${response.status})`, {
|
|
15785
|
+
httpStatus: response.status,
|
|
15786
|
+
endpoint: "/usage/current_balance"
|
|
15787
|
+
});
|
|
15763
15788
|
}
|
|
15764
15789
|
const data = await response.json();
|
|
15765
|
-
const formattedBalance = data.current_point_balance.toLocaleString(
|
|
15766
|
-
"en-US"
|
|
15767
|
-
);
|
|
15790
|
+
const formattedBalance = data.current_point_balance.toLocaleString("en-US");
|
|
15768
15791
|
resources.logger.info(`Current balance: ${formattedBalance} points`);
|
|
15769
15792
|
}
|
|
15770
15793
|
}
|
|
15771
15794
|
const configuredServices = await loadConfiguredServices({
|
|
15772
15795
|
fs: container.fs,
|
|
15773
|
-
filePath: container.env.configPath
|
|
15796
|
+
filePath: container.env.configPath,
|
|
15797
|
+
projectFilePath: container.env.projectConfigPath
|
|
15774
15798
|
});
|
|
15775
15799
|
const configuredAgentNames = Object.keys(configuredServices).sort();
|
|
15776
15800
|
if (configuredAgentNames.length === 0) {
|
|
15777
15801
|
resources.logger.info("No agents configured.");
|
|
15778
15802
|
} else {
|
|
15779
|
-
resources.logger.info(
|
|
15780
|
-
`Configured agents: ${configuredAgentNames.join(", ")}`
|
|
15781
|
-
);
|
|
15803
|
+
resources.logger.info(`Configured agents: ${configuredAgentNames.join(", ")}`);
|
|
15782
15804
|
}
|
|
15783
15805
|
resources.context.finalize();
|
|
15784
15806
|
} catch (error2) {
|
|
@@ -15955,7 +15977,7 @@ var init_test = __esm({
|
|
|
15955
15977
|
init_shared();
|
|
15956
15978
|
init_configure();
|
|
15957
15979
|
init_isolated_env();
|
|
15958
|
-
|
|
15980
|
+
init_src5();
|
|
15959
15981
|
}
|
|
15960
15982
|
});
|
|
15961
15983
|
|
|
@@ -16021,7 +16043,7 @@ function registerGenerateCommand(program, container) {
|
|
|
16021
16043
|
const prompt = ensurePrompt(promptArg, { type: "text", isDefault: true });
|
|
16022
16044
|
const opts = resolveGenerateOptions(this);
|
|
16023
16045
|
const params = parseParams(normalizeParamList(opts.param));
|
|
16024
|
-
const model =
|
|
16046
|
+
const model = resolveModel2("text", opts, container.env.variables);
|
|
16025
16047
|
if (flags.dryRun) {
|
|
16026
16048
|
resources.logger.dryRun(
|
|
16027
16049
|
`Dry run: would generate text with model ${model} and prompt (${prompt.length} chars)`
|
|
@@ -16052,7 +16074,7 @@ function registerGenerateCommand(program, container) {
|
|
|
16052
16074
|
const prompt = ensurePrompt(promptArg, { type: "text", isDefault: false });
|
|
16053
16075
|
const opts = resolveGenerateOptions(this);
|
|
16054
16076
|
const params = parseParams(normalizeParamList(opts.param));
|
|
16055
|
-
const model =
|
|
16077
|
+
const model = resolveModel2("text", opts, container.env.variables);
|
|
16056
16078
|
if (flags.dryRun) {
|
|
16057
16079
|
resources.logger.dryRun(
|
|
16058
16080
|
`Dry run: would generate text with model ${model} and prompt (${prompt.length} chars)`
|
|
@@ -16089,7 +16111,7 @@ function registerMediaSubcommand(generate2, program, container, type) {
|
|
|
16089
16111
|
const prompt = ensurePrompt(promptArg, { type, isDefault: false });
|
|
16090
16112
|
const opts = resolveGenerateOptions(this);
|
|
16091
16113
|
const params = parseParams(normalizeParamList(opts.param));
|
|
16092
|
-
const model =
|
|
16114
|
+
const model = resolveModel2(type, opts, container.env.variables);
|
|
16093
16115
|
if (flags.dryRun) {
|
|
16094
16116
|
resources.logger.dryRun(
|
|
16095
16117
|
`Dry run: would generate ${type} with model ${model} and prompt (${prompt.length} chars)`
|
|
@@ -16207,7 +16229,7 @@ function resolveApiBaseUrl(container) {
|
|
|
16207
16229
|
}
|
|
16208
16230
|
return container.env.poeApiBaseUrl;
|
|
16209
16231
|
}
|
|
16210
|
-
function
|
|
16232
|
+
function resolveModel2(type, options, variables) {
|
|
16211
16233
|
if (options.model) {
|
|
16212
16234
|
return options.model;
|
|
16213
16235
|
}
|
|
@@ -16286,7 +16308,7 @@ var MODEL_ENV_KEYS2, DEFAULT_MODELS2;
|
|
|
16286
16308
|
var init_generate = __esm({
|
|
16287
16309
|
"src/cli/commands/generate.ts"() {
|
|
16288
16310
|
"use strict";
|
|
16289
|
-
|
|
16311
|
+
init_src5();
|
|
16290
16312
|
init_constants();
|
|
16291
16313
|
init_shared();
|
|
16292
16314
|
init_client_instance();
|
|
@@ -37647,7 +37669,7 @@ ${panel.footer}`);
|
|
|
37647
37669
|
var init_command_not_found = __esm({
|
|
37648
37670
|
"src/cli/command-not-found.ts"() {
|
|
37649
37671
|
"use strict";
|
|
37650
|
-
|
|
37672
|
+
init_src5();
|
|
37651
37673
|
init_execution_context();
|
|
37652
37674
|
init_errors();
|
|
37653
37675
|
}
|
|
@@ -37682,7 +37704,7 @@ var agentMcpConfigs, supportedAgents;
|
|
|
37682
37704
|
var init_configs2 = __esm({
|
|
37683
37705
|
"packages/agent-mcp-config/src/configs.ts"() {
|
|
37684
37706
|
"use strict";
|
|
37685
|
-
|
|
37707
|
+
init_src2();
|
|
37686
37708
|
agentMcpConfigs = {
|
|
37687
37709
|
"claude-code": {
|
|
37688
37710
|
configFile: "~/.claude.json",
|
|
@@ -37886,7 +37908,7 @@ var UnsupportedAgentError;
|
|
|
37886
37908
|
var init_apply = __esm({
|
|
37887
37909
|
"packages/agent-mcp-config/src/apply.ts"() {
|
|
37888
37910
|
"use strict";
|
|
37889
|
-
|
|
37911
|
+
init_src3();
|
|
37890
37912
|
init_configs2();
|
|
37891
37913
|
init_shapes();
|
|
37892
37914
|
UnsupportedAgentError = class extends Error {
|
|
@@ -38073,7 +38095,7 @@ var DEFAULT_MCP_AGENT;
|
|
|
38073
38095
|
var init_mcp2 = __esm({
|
|
38074
38096
|
"src/cli/commands/mcp.ts"() {
|
|
38075
38097
|
"use strict";
|
|
38076
|
-
|
|
38098
|
+
init_src5();
|
|
38077
38099
|
init_client_instance();
|
|
38078
38100
|
init_mcp_server();
|
|
38079
38101
|
init_shared();
|
|
@@ -38103,7 +38125,7 @@ var agentSkillConfigs, supportedAgents2;
|
|
|
38103
38125
|
var init_configs3 = __esm({
|
|
38104
38126
|
"packages/agent-skill-config/src/configs.ts"() {
|
|
38105
38127
|
"use strict";
|
|
38106
|
-
|
|
38128
|
+
init_src2();
|
|
38107
38129
|
agentSkillConfigs = {
|
|
38108
38130
|
"claude-code": {
|
|
38109
38131
|
globalSkillDir: "~/.claude/skills",
|
|
@@ -38264,7 +38286,7 @@ var UnsupportedAgentError2, bundledSkillTemplateIds, SKILL_TEMPLATE_ID;
|
|
|
38264
38286
|
var init_apply2 = __esm({
|
|
38265
38287
|
"packages/agent-skill-config/src/apply.ts"() {
|
|
38266
38288
|
"use strict";
|
|
38267
|
-
|
|
38289
|
+
init_src3();
|
|
38268
38290
|
init_configs3();
|
|
38269
38291
|
init_templates();
|
|
38270
38292
|
UnsupportedAgentError2 = class extends Error {
|
|
@@ -38503,7 +38525,7 @@ var DEFAULT_SKILL_AGENT;
|
|
|
38503
38525
|
var init_skill = __esm({
|
|
38504
38526
|
"src/cli/commands/skill.ts"() {
|
|
38505
38527
|
"use strict";
|
|
38506
|
-
|
|
38528
|
+
init_src5();
|
|
38507
38529
|
init_src15();
|
|
38508
38530
|
init_shared();
|
|
38509
38531
|
init_command_not_found();
|
|
@@ -38594,7 +38616,7 @@ async function displayVersion(container, currentVersion) {
|
|
|
38594
38616
|
var init_version2 = __esm({
|
|
38595
38617
|
"src/cli/commands/version.ts"() {
|
|
38596
38618
|
"use strict";
|
|
38597
|
-
|
|
38619
|
+
init_src5();
|
|
38598
38620
|
init_version();
|
|
38599
38621
|
init_exit_signals();
|
|
38600
38622
|
}
|
|
@@ -38801,7 +38823,7 @@ var init_usage = __esm({
|
|
|
38801
38823
|
"use strict";
|
|
38802
38824
|
init_shared();
|
|
38803
38825
|
init_errors();
|
|
38804
|
-
|
|
38826
|
+
init_src5();
|
|
38805
38827
|
}
|
|
38806
38828
|
});
|
|
38807
38829
|
|
|
@@ -39086,12 +39108,12 @@ function registerModelsCommand(program, container) {
|
|
|
39086
39108
|
});
|
|
39087
39109
|
}
|
|
39088
39110
|
var MAX_VALUES_LENGTH, MAX_DEFAULT_LENGTH;
|
|
39089
|
-
var
|
|
39111
|
+
var init_models2 = __esm({
|
|
39090
39112
|
"src/cli/commands/models.ts"() {
|
|
39091
39113
|
"use strict";
|
|
39092
39114
|
init_shared();
|
|
39093
39115
|
init_errors();
|
|
39094
|
-
|
|
39116
|
+
init_src5();
|
|
39095
39117
|
MAX_VALUES_LENGTH = 105;
|
|
39096
39118
|
MAX_DEFAULT_LENGTH = 36;
|
|
39097
39119
|
}
|
|
@@ -39479,8 +39501,8 @@ var DEFAULT_PIPELINE_AGENT, DEFAULT_PIPELINE_SCOPE, pipelineTemplatesCache;
|
|
|
39479
39501
|
var init_pipeline4 = __esm({
|
|
39480
39502
|
async "src/cli/commands/pipeline.ts"() {
|
|
39481
39503
|
"use strict";
|
|
39482
|
-
|
|
39483
|
-
|
|
39504
|
+
init_src5();
|
|
39505
|
+
init_src2();
|
|
39484
39506
|
init_src15();
|
|
39485
39507
|
init_errors();
|
|
39486
39508
|
init_shared();
|
|
@@ -39701,9 +39723,9 @@ var DEFAULT_RALPH_AGENT;
|
|
|
39701
39723
|
var init_ralph3 = __esm({
|
|
39702
39724
|
async "src/cli/commands/ralph.ts"() {
|
|
39703
39725
|
"use strict";
|
|
39704
|
-
init_src4();
|
|
39705
|
-
init_src3();
|
|
39706
39726
|
init_src5();
|
|
39727
|
+
init_src2();
|
|
39728
|
+
init_src6();
|
|
39707
39729
|
init_src12();
|
|
39708
39730
|
init_errors();
|
|
39709
39731
|
init_shared();
|
|
@@ -39718,7 +39740,7 @@ var init_package = __esm({
|
|
|
39718
39740
|
"package.json"() {
|
|
39719
39741
|
package_default = {
|
|
39720
39742
|
name: "poe-code",
|
|
39721
|
-
version: "3.0.
|
|
39743
|
+
version: "3.0.106",
|
|
39722
39744
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
39723
39745
|
type: "module",
|
|
39724
39746
|
main: "./dist/index.js",
|
|
@@ -40138,7 +40160,7 @@ var init_program = __esm({
|
|
|
40138
40160
|
async "src/cli/program.ts"() {
|
|
40139
40161
|
"use strict";
|
|
40140
40162
|
await init_container2();
|
|
40141
|
-
|
|
40163
|
+
init_src5();
|
|
40142
40164
|
init_configure();
|
|
40143
40165
|
init_agent2();
|
|
40144
40166
|
await init_spawn4();
|
|
@@ -40155,7 +40177,7 @@ var init_program = __esm({
|
|
|
40155
40177
|
init_skill();
|
|
40156
40178
|
init_version2();
|
|
40157
40179
|
init_usage();
|
|
40158
|
-
|
|
40180
|
+
init_models2();
|
|
40159
40181
|
await init_pipeline4();
|
|
40160
40182
|
await init_ralph3();
|
|
40161
40183
|
init_package();
|
|
@@ -40238,7 +40260,7 @@ function createPromptRunner(adapter = {
|
|
|
40238
40260
|
var init_prompt_runner = __esm({
|
|
40239
40261
|
"src/cli/prompt-runner.ts"() {
|
|
40240
40262
|
"use strict";
|
|
40241
|
-
|
|
40263
|
+
init_src5();
|
|
40242
40264
|
init_errors();
|
|
40243
40265
|
}
|
|
40244
40266
|
});
|
|
@@ -40320,7 +40342,7 @@ var fsAdapter;
|
|
|
40320
40342
|
var init_bootstrap = __esm({
|
|
40321
40343
|
"src/cli/bootstrap.ts"() {
|
|
40322
40344
|
"use strict";
|
|
40323
|
-
|
|
40345
|
+
init_src5();
|
|
40324
40346
|
init_error_logger();
|
|
40325
40347
|
init_errors();
|
|
40326
40348
|
init_prompt_runner();
|
|
@@ -40436,8 +40458,8 @@ function normalizeBaseUrl(value) {
|
|
|
40436
40458
|
init_credentials();
|
|
40437
40459
|
|
|
40438
40460
|
// src/cli/poe-agent-main.ts
|
|
40461
|
+
init_src6();
|
|
40439
40462
|
init_src5();
|
|
40440
|
-
init_src4();
|
|
40441
40463
|
init_constants();
|
|
40442
40464
|
init_errors();
|
|
40443
40465
|
import path19 from "node:path";
|