poe-code 3.0.125 → 3.0.127

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.
@@ -228,6 +228,17 @@ function toTomlInlineTable(values) {
228
228
  function serializeJsonMcpArgs(servers) {
229
229
  return ["--mcp-config", JSON.stringify({ mcpServers: toJsonMcpServers(servers) })];
230
230
  }
231
+ function serializeOpenCodeMcpEnv(servers) {
232
+ const mcp = {};
233
+ for (const [name, server] of Object.entries(servers)) {
234
+ const entry = { type: "local", command: [server.command, ...server.args ?? []] };
235
+ if (server.env && Object.keys(server.env).length > 0) {
236
+ entry.environment = server.env;
237
+ }
238
+ mcp[name] = entry;
239
+ }
240
+ return { OPENCODE_CONFIG_CONTENT: JSON.stringify({ mcp }) };
241
+ }
231
242
  function serializeCodexMcpArgs(servers) {
232
243
  const args = [];
233
244
  for (const [name, server] of Object.entries(servers)) {
@@ -325,7 +336,8 @@ var openCodeSpawnConfig = {
325
336
  defaultArgs: [],
326
337
  promptFlag: "--prompt"
327
338
  },
328
- resumeCommand: (threadId, cwd) => [cwd, "--session", threadId]
339
+ resumeCommand: (threadId, cwd) => [cwd, "--session", threadId],
340
+ mcpEnv: serializeOpenCodeMcpEnv
329
341
  };
330
342
 
331
343
  // packages/agent-spawn/src/configs/kimi.ts
@@ -377,7 +389,7 @@ function getSpawnConfig(input) {
377
389
  function listMcpSupportedAgents() {
378
390
  const supported = [];
379
391
  for (const config of allSpawnConfigs) {
380
- if (config.kind !== "cli" || typeof config.mcpArgs !== "function") {
392
+ if (config.kind !== "cli" || typeof config.mcpArgs !== "function" && typeof config.mcpEnv !== "function") {
381
393
  continue;
382
394
  }
383
395
  supported.push(config.agentId);
@@ -414,9 +426,12 @@ function getMcpArgs(config, servers) {
414
426
  if (!hasMcpServers(servers)) {
415
427
  return [];
416
428
  }
417
- if (!config.mcpArgs) {
429
+ if (!config.mcpArgs && !config.mcpEnv) {
418
430
  throw new Error(formatUnsupportedMcpSpawnMessage(config.agentId));
419
431
  }
432
+ if (!config.mcpArgs) {
433
+ return [];
434
+ }
420
435
  return config.mcpArgs(servers);
421
436
  }
422
437
  function formatUnsupportedMcpSpawnMessage(agentId) {
@@ -1901,6 +1916,7 @@ function getModelArgs(model) {
1901
1916
  var openCodeService = createProvider({
1902
1917
  ...openCodeAgent,
1903
1918
  supportsStdinPrompt: false,
1919
+ supportsMcpSpawn: true,
1904
1920
  configurePrompts: {
1905
1921
  model: {
1906
1922
  label: "OpenCode model",
@@ -1978,12 +1994,13 @@ var openCodeService = createProvider({
1978
1994
  opts.prompt,
1979
1995
  ...opts.args ?? []
1980
1996
  ];
1981
- if (opts.cwd) {
1982
- return context.command.runCommand("poe-code", ["wrap", "opencode", ...args], {
1983
- cwd: opts.cwd
1984
- });
1997
+ if (!opts.cwd && !opts.mcpServers) {
1998
+ return context.command.runCommand("poe-code", ["wrap", "opencode", ...args]);
1985
1999
  }
1986
- return context.command.runCommand("poe-code", ["wrap", "opencode", ...args]);
2000
+ return context.command.runCommand("poe-code", ["wrap", "opencode", ...args], {
2001
+ cwd: opts.cwd,
2002
+ env: opts.mcpServers ? serializeOpenCodeMcpEnv(opts.mcpServers) : void 0
2003
+ });
1987
2004
  }
1988
2005
  });
1989
2006
  var provider = openCodeService;