poe-code 3.0.168 → 3.0.170
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/bin/poe-goose.js +23 -0
- package/dist/cli/commands/configure-payload.js +10 -0
- package/dist/cli/commands/configure-payload.js.map +1 -1
- package/dist/cli/commands/spawn.js +4 -0
- package/dist/cli/commands/spawn.js.map +1 -1
- package/dist/cli/constants.d.ts +2 -0
- package/dist/cli/constants.js +2 -0
- package/dist/cli/constants.js.map +1 -1
- package/dist/cli/service-registry.d.ts +9 -0
- package/dist/cli/service-registry.js.map +1 -1
- package/dist/index.js +418 -48
- package/dist/index.js.map +4 -4
- package/dist/providers/claude-code.js +185 -15
- package/dist/providers/claude-code.js.map +4 -4
- package/dist/providers/codex.js +190 -20
- package/dist/providers/codex.js.map +4 -4
- package/dist/providers/create-provider.d.ts +1 -0
- package/dist/providers/create-provider.js +1 -0
- package/dist/providers/create-provider.js.map +1 -1
- package/dist/providers/goose.d.ts +16 -0
- package/dist/providers/goose.js +2514 -0
- package/dist/providers/goose.js.map +7 -0
- package/dist/providers/kimi.js +184 -14
- package/dist/providers/kimi.js.map +4 -4
- package/dist/providers/opencode.js +184 -14
- package/dist/providers/opencode.js.map +4 -4
- package/dist/providers/poe-agent.js +83 -4
- package/dist/providers/poe-agent.js.map +4 -4
- package/dist/utils/command-checks.js +4 -2
- package/dist/utils/command-checks.js.map +1 -1
- package/package.json +1 -1
package/dist/providers/kimi.js
CHANGED
|
@@ -111,6 +111,17 @@ var require_config_toml = __commonJS({
|
|
|
111
111
|
// packages/agent-spawn/src/run-command.ts
|
|
112
112
|
import { spawn } from "node:child_process";
|
|
113
113
|
|
|
114
|
+
// packages/agent-spawn/src/types.ts
|
|
115
|
+
function resolveModeConfig(modeConfig) {
|
|
116
|
+
if (Array.isArray(modeConfig)) {
|
|
117
|
+
return { args: modeConfig };
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
args: modeConfig.args ?? [],
|
|
121
|
+
env: modeConfig.env && Object.keys(modeConfig.env).length > 0 ? modeConfig.env : void 0
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
114
125
|
// packages/agent-defs/src/agents/claude-code.ts
|
|
115
126
|
var claudeCodeAgent = {
|
|
116
127
|
id: "claude-code",
|
|
@@ -192,13 +203,30 @@ var kimiAgent = {
|
|
|
192
203
|
}
|
|
193
204
|
};
|
|
194
205
|
|
|
206
|
+
// packages/agent-defs/src/agents/goose.ts
|
|
207
|
+
var gooseAgent = {
|
|
208
|
+
id: "goose",
|
|
209
|
+
name: "goose",
|
|
210
|
+
label: "Goose",
|
|
211
|
+
summary: "Block's open-source AI agent with ACP support.",
|
|
212
|
+
binaryName: "goose",
|
|
213
|
+
configPath: "~/.config/goose/config.yaml",
|
|
214
|
+
branding: {
|
|
215
|
+
colors: {
|
|
216
|
+
dark: "#FF6B35",
|
|
217
|
+
light: "#E85D26"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
195
222
|
// packages/agent-defs/src/registry.ts
|
|
196
223
|
var allAgents = [
|
|
197
224
|
claudeCodeAgent,
|
|
198
225
|
claudeDesktopAgent,
|
|
199
226
|
codexAgent,
|
|
200
227
|
openCodeAgent,
|
|
201
|
-
kimiAgent
|
|
228
|
+
kimiAgent,
|
|
229
|
+
gooseAgent
|
|
202
230
|
];
|
|
203
231
|
var lookup = /* @__PURE__ */ new Map();
|
|
204
232
|
for (const agent of allAgents) {
|
|
@@ -274,6 +302,12 @@ function serializeCodexMcpArgs(servers) {
|
|
|
274
302
|
}
|
|
275
303
|
return args;
|
|
276
304
|
}
|
|
305
|
+
function serializeGooseMcpArgs(servers) {
|
|
306
|
+
return Object.values(servers).flatMap((server) => [
|
|
307
|
+
"--with-extension",
|
|
308
|
+
[server.command, ...server.args ?? []].join(" ")
|
|
309
|
+
]);
|
|
310
|
+
}
|
|
277
311
|
|
|
278
312
|
// packages/agent-spawn/src/configs/claude-code.ts
|
|
279
313
|
var claudeCodeSpawnConfig = {
|
|
@@ -401,12 +435,47 @@ var kimiAcpSpawnConfig = {
|
|
|
401
435
|
acpArgs: ["acp"]
|
|
402
436
|
};
|
|
403
437
|
|
|
438
|
+
// packages/agent-spawn/src/configs/goose.ts
|
|
439
|
+
var gooseSpawnConfig = {
|
|
440
|
+
kind: "cli",
|
|
441
|
+
agentId: "goose",
|
|
442
|
+
adapter: "native",
|
|
443
|
+
promptFlag: "--text",
|
|
444
|
+
modelFlag: "--model",
|
|
445
|
+
modelStripProviderPrefix: false,
|
|
446
|
+
defaultArgs: ["run", "--output-format", "stream-json"],
|
|
447
|
+
defaultArgsPosition: "beforePrompt",
|
|
448
|
+
mcpArgs: serializeGooseMcpArgs,
|
|
449
|
+
mcpArgsPosition: "beforePrompt",
|
|
450
|
+
modes: {
|
|
451
|
+
yolo: { env: { GOOSE_MODE: "auto" } },
|
|
452
|
+
edit: { env: { GOOSE_MODE: "smart_approve" } },
|
|
453
|
+
read: { env: { GOOSE_MODE: "chat" } }
|
|
454
|
+
},
|
|
455
|
+
stdinMode: {
|
|
456
|
+
omitPrompt: true,
|
|
457
|
+
extraArgs: ["--instructions", "-"]
|
|
458
|
+
},
|
|
459
|
+
interactive: {
|
|
460
|
+
defaultArgs: ["session"],
|
|
461
|
+
defaultArgsPosition: "beforePrompt"
|
|
462
|
+
},
|
|
463
|
+
resumeCommand: () => ["run", "--resume", "--text", "continue"]
|
|
464
|
+
};
|
|
465
|
+
var gooseAcpSpawnConfig = {
|
|
466
|
+
kind: "acp",
|
|
467
|
+
agentId: "goose",
|
|
468
|
+
acpArgs: ["acp"],
|
|
469
|
+
skipAuth: true
|
|
470
|
+
};
|
|
471
|
+
|
|
404
472
|
// packages/agent-spawn/src/configs/index.ts
|
|
405
473
|
var allSpawnConfigs = [
|
|
406
474
|
claudeCodeSpawnConfig,
|
|
407
475
|
codexSpawnConfig,
|
|
408
476
|
openCodeSpawnConfig,
|
|
409
|
-
kimiSpawnConfig
|
|
477
|
+
kimiSpawnConfig,
|
|
478
|
+
gooseSpawnConfig
|
|
410
479
|
];
|
|
411
480
|
var lookup2 = /* @__PURE__ */ new Map();
|
|
412
481
|
for (const config of allSpawnConfigs) {
|
|
@@ -415,6 +484,7 @@ for (const config of allSpawnConfigs) {
|
|
|
415
484
|
var acpLookup = /* @__PURE__ */ new Map();
|
|
416
485
|
acpLookup.set(openCodeAcpSpawnConfig.agentId, openCodeAcpSpawnConfig);
|
|
417
486
|
acpLookup.set(kimiAcpSpawnConfig.agentId, kimiAcpSpawnConfig);
|
|
487
|
+
acpLookup.set(gooseAcpSpawnConfig.agentId, gooseAcpSpawnConfig);
|
|
418
488
|
function getSpawnConfig(input) {
|
|
419
489
|
const resolvedId = resolveAgentId(input);
|
|
420
490
|
if (!resolvedId) {
|
|
@@ -501,10 +571,27 @@ function resolveCliConfig(agentId) {
|
|
|
501
571
|
spawnConfig: resolved.spawnConfig
|
|
502
572
|
};
|
|
503
573
|
}
|
|
574
|
+
function getDefaultArgsPosition(config) {
|
|
575
|
+
return config.defaultArgsPosition ?? "afterPrompt";
|
|
576
|
+
}
|
|
577
|
+
function getMcpArgsPosition(config) {
|
|
578
|
+
if (config.mcpArgsPosition) {
|
|
579
|
+
return config.mcpArgsPosition;
|
|
580
|
+
}
|
|
581
|
+
return config.mcpArgsBeforeCommand ? "beforeCommand" : "afterCommand";
|
|
582
|
+
}
|
|
504
583
|
function buildCliArgs(config, options, stdinMode) {
|
|
505
584
|
const mcpArgs = getMcpArgs(config, options.mcpServers);
|
|
585
|
+
const defaultArgsPosition = getDefaultArgsPosition(config);
|
|
586
|
+
const mcpArgsPosition = getMcpArgsPosition(config);
|
|
506
587
|
const args = [];
|
|
507
|
-
if (
|
|
588
|
+
if (mcpArgsPosition === "beforeCommand") {
|
|
589
|
+
args.push(...mcpArgs);
|
|
590
|
+
}
|
|
591
|
+
if (defaultArgsPosition === "beforePrompt") {
|
|
592
|
+
args.push(...config.defaultArgs);
|
|
593
|
+
}
|
|
594
|
+
if (mcpArgsPosition === "beforePrompt") {
|
|
508
595
|
args.push(...mcpArgs);
|
|
509
596
|
}
|
|
510
597
|
if (stdinMode) {
|
|
@@ -521,20 +608,24 @@ function buildCliArgs(config, options, stdinMode) {
|
|
|
521
608
|
if (config.modelTransform) model = config.modelTransform(model);
|
|
522
609
|
args.push(config.modelFlag, model);
|
|
523
610
|
}
|
|
524
|
-
|
|
525
|
-
|
|
611
|
+
if (defaultArgsPosition === "afterPrompt") {
|
|
612
|
+
args.push(...config.defaultArgs);
|
|
613
|
+
}
|
|
614
|
+
if (mcpArgsPosition === "afterCommand") {
|
|
526
615
|
args.push(...mcpArgs);
|
|
527
616
|
}
|
|
528
|
-
|
|
617
|
+
const mode = resolveModeConfig(config.modes[options.mode ?? "yolo"]);
|
|
618
|
+
args.push(...mode.args);
|
|
529
619
|
if (options.args && options.args.length > 0) {
|
|
530
620
|
args.push(...options.args);
|
|
531
621
|
}
|
|
532
|
-
return args;
|
|
622
|
+
return { args, env: mode.env };
|
|
533
623
|
}
|
|
534
624
|
function buildSpawnArgs(agentId, options) {
|
|
535
625
|
const { binaryName, spawnConfig } = resolveCliConfig(agentId);
|
|
536
626
|
const stdinMode = options.useStdin && spawnConfig.stdinMode ? spawnConfig.stdinMode : void 0;
|
|
537
|
-
|
|
627
|
+
const result = buildCliArgs(spawnConfig, options, stdinMode);
|
|
628
|
+
return { binaryName, args: result.args, env: result.env };
|
|
538
629
|
}
|
|
539
630
|
|
|
540
631
|
// packages/agent-spawn/src/spawn-interactive.ts
|
|
@@ -993,7 +1084,7 @@ ${stderr}`;
|
|
|
993
1084
|
}
|
|
994
1085
|
function createSpawnHealthCheck(agentId, options) {
|
|
995
1086
|
const prompt = `Output exactly: ${options.expectedOutput}`;
|
|
996
|
-
const { binaryName, args } = buildSpawnArgs(agentId, {
|
|
1087
|
+
const { binaryName, args, env: modeEnv } = buildSpawnArgs(agentId, {
|
|
997
1088
|
prompt,
|
|
998
1089
|
model: options.model,
|
|
999
1090
|
mode: "yolo"
|
|
@@ -1008,7 +1099,7 @@ function createSpawnHealthCheck(agentId, options) {
|
|
|
1008
1099
|
);
|
|
1009
1100
|
return;
|
|
1010
1101
|
}
|
|
1011
|
-
const result = await context.runCommand(binaryName, args);
|
|
1102
|
+
const result = modeEnv ? await context.runCommand(binaryName, args, { env: modeEnv }) : await context.runCommand(binaryName, args);
|
|
1012
1103
|
if (result.exitCode !== 0) {
|
|
1013
1104
|
throw new Error(
|
|
1014
1105
|
`spawn ${agentId} failed with exit code ${result.exitCode}.
|
|
@@ -1313,14 +1404,92 @@ var tomlFormat = {
|
|
|
1313
1404
|
prune: prune3
|
|
1314
1405
|
};
|
|
1315
1406
|
|
|
1407
|
+
// packages/config-mutations/src/formats/yaml.ts
|
|
1408
|
+
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
1409
|
+
function isConfigObject3(value) {
|
|
1410
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1411
|
+
}
|
|
1412
|
+
function parse5(content) {
|
|
1413
|
+
if (!content || content.trim() === "") {
|
|
1414
|
+
return {};
|
|
1415
|
+
}
|
|
1416
|
+
const parsed = parseYaml(content);
|
|
1417
|
+
if (parsed === null || parsed === void 0) {
|
|
1418
|
+
return {};
|
|
1419
|
+
}
|
|
1420
|
+
if (!isConfigObject3(parsed)) {
|
|
1421
|
+
throw new Error("Expected YAML object.");
|
|
1422
|
+
}
|
|
1423
|
+
return parsed;
|
|
1424
|
+
}
|
|
1425
|
+
function serialize3(obj) {
|
|
1426
|
+
const serialized = stringifyYaml(obj);
|
|
1427
|
+
return serialized.endsWith("\n") ? serialized : `${serialized}
|
|
1428
|
+
`;
|
|
1429
|
+
}
|
|
1430
|
+
function merge4(base, patch) {
|
|
1431
|
+
const result = { ...base };
|
|
1432
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
1433
|
+
if (value === void 0) {
|
|
1434
|
+
continue;
|
|
1435
|
+
}
|
|
1436
|
+
const existing = result[key];
|
|
1437
|
+
if (isConfigObject3(existing) && isConfigObject3(value)) {
|
|
1438
|
+
result[key] = merge4(existing, value);
|
|
1439
|
+
continue;
|
|
1440
|
+
}
|
|
1441
|
+
result[key] = value;
|
|
1442
|
+
}
|
|
1443
|
+
return result;
|
|
1444
|
+
}
|
|
1445
|
+
function prune4(obj, shape) {
|
|
1446
|
+
let changed = false;
|
|
1447
|
+
const result = { ...obj };
|
|
1448
|
+
for (const [key, pattern] of Object.entries(shape)) {
|
|
1449
|
+
if (!(key in result)) {
|
|
1450
|
+
continue;
|
|
1451
|
+
}
|
|
1452
|
+
const current = result[key];
|
|
1453
|
+
if (isConfigObject3(pattern) && Object.keys(pattern).length === 0) {
|
|
1454
|
+
delete result[key];
|
|
1455
|
+
changed = true;
|
|
1456
|
+
continue;
|
|
1457
|
+
}
|
|
1458
|
+
if (isConfigObject3(pattern) && isConfigObject3(current)) {
|
|
1459
|
+
const { changed: childChanged, result: childResult } = prune4(current, pattern);
|
|
1460
|
+
if (childChanged) {
|
|
1461
|
+
changed = true;
|
|
1462
|
+
}
|
|
1463
|
+
if (Object.keys(childResult).length === 0) {
|
|
1464
|
+
delete result[key];
|
|
1465
|
+
} else {
|
|
1466
|
+
result[key] = childResult;
|
|
1467
|
+
}
|
|
1468
|
+
continue;
|
|
1469
|
+
}
|
|
1470
|
+
delete result[key];
|
|
1471
|
+
changed = true;
|
|
1472
|
+
}
|
|
1473
|
+
return { changed, result };
|
|
1474
|
+
}
|
|
1475
|
+
var yamlFormat = {
|
|
1476
|
+
parse: parse5,
|
|
1477
|
+
serialize: serialize3,
|
|
1478
|
+
merge: merge4,
|
|
1479
|
+
prune: prune4
|
|
1480
|
+
};
|
|
1481
|
+
|
|
1316
1482
|
// packages/config-mutations/src/formats/index.ts
|
|
1317
1483
|
var formatRegistry = {
|
|
1318
1484
|
json: jsonFormat,
|
|
1319
|
-
toml: tomlFormat
|
|
1485
|
+
toml: tomlFormat,
|
|
1486
|
+
yaml: yamlFormat
|
|
1320
1487
|
};
|
|
1321
1488
|
var extensionMap = {
|
|
1322
1489
|
".json": "json",
|
|
1323
|
-
".toml": "toml"
|
|
1490
|
+
".toml": "toml",
|
|
1491
|
+
".yaml": "yaml",
|
|
1492
|
+
".yml": "yaml"
|
|
1324
1493
|
};
|
|
1325
1494
|
function getConfigFormat(pathOrFormat) {
|
|
1326
1495
|
if (pathOrFormat in formatRegistry) {
|
|
@@ -1469,7 +1638,7 @@ function pruneKeysByPrefix(table, prefix) {
|
|
|
1469
1638
|
}
|
|
1470
1639
|
return result;
|
|
1471
1640
|
}
|
|
1472
|
-
function
|
|
1641
|
+
function isConfigObject4(value) {
|
|
1473
1642
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1474
1643
|
}
|
|
1475
1644
|
function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
|
|
@@ -1478,7 +1647,7 @@ function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
|
|
|
1478
1647
|
for (const [key, value] of Object.entries(patch)) {
|
|
1479
1648
|
const current = result[key];
|
|
1480
1649
|
const prefix = prefixMap[key];
|
|
1481
|
-
if (
|
|
1650
|
+
if (isConfigObject4(current) && isConfigObject4(value)) {
|
|
1482
1651
|
if (prefix) {
|
|
1483
1652
|
const pruned = pruneKeysByPrefix(current, prefix);
|
|
1484
1653
|
result[key] = { ...pruned, ...value };
|
|
@@ -2131,6 +2300,7 @@ function createProvider(opts) {
|
|
|
2131
2300
|
supportsMcpSpawn: opts.supportsMcpSpawn,
|
|
2132
2301
|
configurePrompts: opts.configurePrompts,
|
|
2133
2302
|
postConfigureMessages: opts.postConfigureMessages,
|
|
2303
|
+
extendConfigurePayload: opts.extendConfigurePayload,
|
|
2134
2304
|
isolatedEnv: opts.isolatedEnv,
|
|
2135
2305
|
async configure(context, runOptions) {
|
|
2136
2306
|
await runMutations(opts.manifest.configure, {
|