poe-code 3.0.169 → 3.0.171

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.
Files changed (36) hide show
  1. package/dist/bin/poe-goose.js +23 -0
  2. package/dist/cli/commands/configure-payload.js +10 -0
  3. package/dist/cli/commands/configure-payload.js.map +1 -1
  4. package/dist/cli/commands/experiment.js +1 -1
  5. package/dist/cli/commands/experiment.js.map +1 -1
  6. package/dist/cli/commands/pipeline.js +1 -1
  7. package/dist/cli/commands/pipeline.js.map +1 -1
  8. package/dist/cli/commands/spawn.js +4 -0
  9. package/dist/cli/commands/spawn.js.map +1 -1
  10. package/dist/cli/constants.d.ts +2 -0
  11. package/dist/cli/constants.js +2 -0
  12. package/dist/cli/constants.js.map +1 -1
  13. package/dist/cli/service-registry.d.ts +9 -0
  14. package/dist/cli/service-registry.js.map +1 -1
  15. package/dist/index.js +434 -91
  16. package/dist/index.js.map +4 -4
  17. package/dist/providers/claude-code.js +197 -27
  18. package/dist/providers/claude-code.js.map +4 -4
  19. package/dist/providers/codex.js +203 -33
  20. package/dist/providers/codex.js.map +4 -4
  21. package/dist/providers/create-provider.d.ts +1 -0
  22. package/dist/providers/create-provider.js +6 -5
  23. package/dist/providers/create-provider.js.map +1 -1
  24. package/dist/providers/goose.d.ts +16 -0
  25. package/dist/providers/goose.js +2514 -0
  26. package/dist/providers/goose.js.map +7 -0
  27. package/dist/providers/kimi.js +196 -26
  28. package/dist/providers/kimi.js.map +4 -4
  29. package/dist/providers/opencode.js +196 -26
  30. package/dist/providers/opencode.js.map +4 -4
  31. package/dist/providers/poe-agent.js +96 -43
  32. package/dist/providers/poe-agent.js.map +4 -4
  33. package/dist/utils/command-checks.js +4 -2
  34. package/dist/utils/command-checks.js.map +1 -1
  35. package/package.json +2 -2
  36. /package/dist/templates/pipeline/{steps.yaml.hbs → steps.yaml.mustache} +0 -0
@@ -80,30 +80,30 @@ var require_src = __commonJS({
80
80
  }
81
81
  });
82
82
 
83
- // src/templates/py-poe-spawn/env.hbs
83
+ // src/templates/py-poe-spawn/env.mustache
84
84
  var require_env = __commonJS({
85
- "src/templates/py-poe-spawn/env.hbs"(exports, module) {
85
+ "src/templates/py-poe-spawn/env.mustache"(exports, module) {
86
86
  module.exports = "POE_API_KEY={{apiKey}}\nPOE_BASE_URL=https://api.poe.com/v1\nMODEL={{model}}\n";
87
87
  }
88
88
  });
89
89
 
90
- // src/templates/py-poe-spawn/main.py.hbs
90
+ // src/templates/py-poe-spawn/main.py.mustache
91
91
  var require_main_py = __commonJS({
92
- "src/templates/py-poe-spawn/main.py.hbs"(exports, module) {
92
+ "src/templates/py-poe-spawn/main.py.mustache"(exports, module) {
93
93
  module.exports = 'import os\nfrom openai import OpenAI\nfrom dotenv import load_dotenv\n\nload_dotenv()\n\nclient = OpenAI(\n api_key=os.getenv("POE_API_KEY"),\n base_url=os.getenv("POE_BASE_URL")\n)\n\nresponse = client.chat.completions.create(\n model=os.getenv("MODEL", "{{model}}"),\n messages=[{"role": "user", "content": "Tell me a joke"}]\n)\n\nprint(response.choices[0].message.content)\n';
94
94
  }
95
95
  });
96
96
 
97
- // src/templates/py-poe-spawn/requirements.txt.hbs
97
+ // src/templates/py-poe-spawn/requirements.txt.mustache
98
98
  var require_requirements_txt = __commonJS({
99
- "src/templates/py-poe-spawn/requirements.txt.hbs"(exports, module) {
99
+ "src/templates/py-poe-spawn/requirements.txt.mustache"(exports, module) {
100
100
  module.exports = "openai>=1.0.0\npython-dotenv>=1.0.0\n";
101
101
  }
102
102
  });
103
103
 
104
- // src/templates/codex/config.toml.hbs
104
+ // src/templates/codex/config.toml.mustache
105
105
  var require_config_toml = __commonJS({
106
- "src/templates/codex/config.toml.hbs"(exports, module) {
106
+ "src/templates/codex/config.toml.mustache"(exports, module) {
107
107
  module.exports = 'model_provider = "poe"\n\n[profiles."{{{profileName}}}"]\nmodel = "{{{model}}}"\nmodel_provider = "poe"\nmodel_reasoning_effort = "{{reasoningEffort}}"\nmodel_verbosity = "medium"\n\n[model_providers.poe]\nname = "poe"\nbase_url = "{{{baseUrl}}}"\nwire_api = "responses"\nexperimental_bearer_token = "{{apiKey}}"\nrequires_openai_auth = false\nsupports_websockets = false\n';
108
108
  }
109
109
  });
@@ -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 (config.mcpArgsBeforeCommand) {
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
- args.push(...config.defaultArgs);
525
- if (!config.mcpArgsBeforeCommand) {
611
+ if (defaultArgsPosition === "afterPrompt") {
612
+ args.push(...config.defaultArgs);
613
+ }
614
+ if (mcpArgsPosition === "afterCommand") {
526
615
  args.push(...mcpArgs);
527
616
  }
528
- args.push(...config.modes[options.mode ?? "yolo"]);
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
- return { binaryName, args: buildCliArgs(spawnConfig, options, stdinMode) };
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}.
@@ -1347,14 +1438,92 @@ var tomlFormat = {
1347
1438
  prune: prune3
1348
1439
  };
1349
1440
 
1441
+ // packages/config-mutations/src/formats/yaml.ts
1442
+ import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
1443
+ function isConfigObject3(value) {
1444
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1445
+ }
1446
+ function parse5(content) {
1447
+ if (!content || content.trim() === "") {
1448
+ return {};
1449
+ }
1450
+ const parsed = parseYaml(content);
1451
+ if (parsed === null || parsed === void 0) {
1452
+ return {};
1453
+ }
1454
+ if (!isConfigObject3(parsed)) {
1455
+ throw new Error("Expected YAML object.");
1456
+ }
1457
+ return parsed;
1458
+ }
1459
+ function serialize3(obj) {
1460
+ const serialized = stringifyYaml(obj);
1461
+ return serialized.endsWith("\n") ? serialized : `${serialized}
1462
+ `;
1463
+ }
1464
+ function merge4(base, patch) {
1465
+ const result = { ...base };
1466
+ for (const [key, value] of Object.entries(patch)) {
1467
+ if (value === void 0) {
1468
+ continue;
1469
+ }
1470
+ const existing = result[key];
1471
+ if (isConfigObject3(existing) && isConfigObject3(value)) {
1472
+ result[key] = merge4(existing, value);
1473
+ continue;
1474
+ }
1475
+ result[key] = value;
1476
+ }
1477
+ return result;
1478
+ }
1479
+ function prune4(obj, shape) {
1480
+ let changed = false;
1481
+ const result = { ...obj };
1482
+ for (const [key, pattern] of Object.entries(shape)) {
1483
+ if (!(key in result)) {
1484
+ continue;
1485
+ }
1486
+ const current = result[key];
1487
+ if (isConfigObject3(pattern) && Object.keys(pattern).length === 0) {
1488
+ delete result[key];
1489
+ changed = true;
1490
+ continue;
1491
+ }
1492
+ if (isConfigObject3(pattern) && isConfigObject3(current)) {
1493
+ const { changed: childChanged, result: childResult } = prune4(current, pattern);
1494
+ if (childChanged) {
1495
+ changed = true;
1496
+ }
1497
+ if (Object.keys(childResult).length === 0) {
1498
+ delete result[key];
1499
+ } else {
1500
+ result[key] = childResult;
1501
+ }
1502
+ continue;
1503
+ }
1504
+ delete result[key];
1505
+ changed = true;
1506
+ }
1507
+ return { changed, result };
1508
+ }
1509
+ var yamlFormat = {
1510
+ parse: parse5,
1511
+ serialize: serialize3,
1512
+ merge: merge4,
1513
+ prune: prune4
1514
+ };
1515
+
1350
1516
  // packages/config-mutations/src/formats/index.ts
1351
1517
  var formatRegistry = {
1352
1518
  json: jsonFormat,
1353
- toml: tomlFormat
1519
+ toml: tomlFormat,
1520
+ yaml: yamlFormat
1354
1521
  };
1355
1522
  var extensionMap = {
1356
1523
  ".json": "json",
1357
- ".toml": "toml"
1524
+ ".toml": "toml",
1525
+ ".yaml": "yaml",
1526
+ ".yml": "yaml"
1358
1527
  };
1359
1528
  function getConfigFormat(pathOrFormat) {
1360
1529
  if (pathOrFormat in formatRegistry) {
@@ -1503,7 +1672,7 @@ function pruneKeysByPrefix(table, prefix) {
1503
1672
  }
1504
1673
  return result;
1505
1674
  }
1506
- function isConfigObject3(value) {
1675
+ function isConfigObject4(value) {
1507
1676
  return typeof value === "object" && value !== null && !Array.isArray(value);
1508
1677
  }
1509
1678
  function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
@@ -1512,7 +1681,7 @@ function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
1512
1681
  for (const [key, value] of Object.entries(patch)) {
1513
1682
  const current = result[key];
1514
1683
  const prefix = prefixMap[key];
1515
- if (isConfigObject3(current) && isConfigObject3(value)) {
1684
+ if (isConfigObject4(current) && isConfigObject4(value)) {
1516
1685
  if (prefix) {
1517
1686
  const pruned = pruneKeysByPrefix(current, prefix);
1518
1687
  result[key] = { ...pruned, ...value };
@@ -2029,7 +2198,7 @@ import Mustache2 from "mustache";
2029
2198
  var originalEscape = Mustache2.escape;
2030
2199
 
2031
2200
  // packages/config-mutations/src/types.ts
2032
- function isConfigObject4(value) {
2201
+ function isConfigObject5(value) {
2033
2202
  return typeof value === "object" && value !== null && !Array.isArray(value);
2034
2203
  }
2035
2204
 
@@ -2111,10 +2280,10 @@ async function runInstallStep(step, context) {
2111
2280
 
2112
2281
  // src/providers/create-provider.ts
2113
2282
  var templateImports = {
2114
- "py-poe-spawn/env.hbs": () => Promise.resolve().then(() => __toESM(require_env(), 1)),
2115
- "py-poe-spawn/main.py.hbs": () => Promise.resolve().then(() => __toESM(require_main_py(), 1)),
2116
- "py-poe-spawn/requirements.txt.hbs": () => Promise.resolve().then(() => __toESM(require_requirements_txt(), 1)),
2117
- "codex/config.toml.hbs": () => Promise.resolve().then(() => __toESM(require_config_toml(), 1))
2283
+ "py-poe-spawn/env.mustache": () => Promise.resolve().then(() => __toESM(require_env(), 1)),
2284
+ "py-poe-spawn/main.py.mustache": () => Promise.resolve().then(() => __toESM(require_main_py(), 1)),
2285
+ "py-poe-spawn/requirements.txt.mustache": () => Promise.resolve().then(() => __toESM(require_requirements_txt(), 1)),
2286
+ "codex/config.toml.mustache": () => Promise.resolve().then(() => __toESM(require_config_toml(), 1))
2118
2287
  };
2119
2288
  async function loadTemplate(templateId) {
2120
2289
  const loader = templateImports[templateId];
@@ -2137,6 +2306,7 @@ function createProvider(opts) {
2137
2306
  supportsMcpSpawn: opts.supportsMcpSpawn,
2138
2307
  configurePrompts: opts.configurePrompts,
2139
2308
  postConfigureMessages: opts.postConfigureMessages,
2309
+ extendConfigurePayload: opts.extendConfigurePayload,
2140
2310
  isolatedEnv: opts.isolatedEnv,
2141
2311
  async configure(context, runOptions) {
2142
2312
  await runMutations(opts.manifest.configure, {
@@ -2247,7 +2417,7 @@ var CODEX_INSTALL_DEFINITION = {
2247
2417
  successMessage: "Installed Codex CLI via npm."
2248
2418
  };
2249
2419
  function stripCodexConfiguration(document) {
2250
- if (!isConfigObject4(document)) {
2420
+ if (!isConfigObject5(document)) {
2251
2421
  return { changed: false, empty: false };
2252
2422
  }
2253
2423
  let changed = false;
@@ -2259,10 +2429,10 @@ function stripCodexConfiguration(document) {
2259
2429
  changed = true;
2260
2430
  }
2261
2431
  const profiles = document["profiles"];
2262
- if (isConfigObject4(profiles)) {
2432
+ if (isConfigObject5(profiles)) {
2263
2433
  for (const name of Object.keys(profiles)) {
2264
2434
  const profile = profiles[name];
2265
- if (isConfigObject4(profile) && profile["model_provider"] === CODEX_PROVIDER_ID) {
2435
+ if (isConfigObject5(profile) && profile["model_provider"] === CODEX_PROVIDER_ID) {
2266
2436
  delete profiles[name];
2267
2437
  changed = true;
2268
2438
  }
@@ -2272,7 +2442,7 @@ function stripCodexConfiguration(document) {
2272
2442
  }
2273
2443
  }
2274
2444
  const providers = document["model_providers"];
2275
- if (isConfigObject4(providers) && CODEX_PROVIDER_ID in providers) {
2445
+ if (isConfigObject5(providers) && CODEX_PROVIDER_ID in providers) {
2276
2446
  delete providers[CODEX_PROVIDER_ID];
2277
2447
  if (isTableEmpty(providers)) {
2278
2448
  delete document["model_providers"];
@@ -2285,7 +2455,7 @@ function stripCodexConfiguration(document) {
2285
2455
  };
2286
2456
  }
2287
2457
  function isTableEmpty(value) {
2288
- return isConfigObject4(value) && Object.keys(value).length === 0;
2458
+ return isConfigObject5(value) && Object.keys(value).length === 0;
2289
2459
  }
2290
2460
  var codexService = createProvider({
2291
2461
  ...codexAgent,
@@ -2333,7 +2503,7 @@ var codexService = createProvider({
2333
2503
  }),
2334
2504
  templateMutation.mergeToml({
2335
2505
  target: "~/.codex/config.toml",
2336
- templateId: "codex/config.toml.hbs",
2506
+ templateId: "codex/config.toml.mustache",
2337
2507
  context: (ctx) => {
2338
2508
  const options = ctx;
2339
2509
  const model = options.model ?? DEFAULT_CODEX_MODEL;