poe-code 3.0.126 → 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.
package/dist/index.js CHANGED
@@ -2757,6 +2757,17 @@ function toTomlInlineTable(values) {
2757
2757
  function serializeJsonMcpArgs(servers) {
2758
2758
  return ["--mcp-config", JSON.stringify({ mcpServers: toJsonMcpServers(servers) })];
2759
2759
  }
2760
+ function serializeOpenCodeMcpEnv(servers) {
2761
+ const mcp = {};
2762
+ for (const [name, server] of Object.entries(servers)) {
2763
+ const entry = { type: "local", command: [server.command, ...server.args ?? []] };
2764
+ if (server.env && Object.keys(server.env).length > 0) {
2765
+ entry.environment = server.env;
2766
+ }
2767
+ mcp[name] = entry;
2768
+ }
2769
+ return { OPENCODE_CONFIG_CONTENT: JSON.stringify({ mcp }) };
2770
+ }
2760
2771
  function serializeCodexMcpArgs(servers) {
2761
2772
  const args = [];
2762
2773
  for (const [name, server] of Object.entries(servers)) {
@@ -2854,6 +2865,7 @@ var openCodeSpawnConfig;
2854
2865
  var init_opencode2 = __esm({
2855
2866
  "packages/agent-spawn/src/configs/opencode.ts"() {
2856
2867
  "use strict";
2868
+ init_mcp();
2857
2869
  openCodeSpawnConfig = {
2858
2870
  kind: "cli",
2859
2871
  agentId: "opencode",
@@ -2877,7 +2889,8 @@ var init_opencode2 = __esm({
2877
2889
  defaultArgs: [],
2878
2890
  promptFlag: "--prompt"
2879
2891
  },
2880
- resumeCommand: (threadId, cwd) => [cwd, "--session", threadId]
2892
+ resumeCommand: (threadId, cwd) => [cwd, "--session", threadId],
2893
+ mcpEnv: serializeOpenCodeMcpEnv
2881
2894
  };
2882
2895
  }
2883
2896
  });
@@ -2927,12 +2940,12 @@ function getSpawnConfig(input) {
2927
2940
  }
2928
2941
  function supportsMcpAtSpawn(input) {
2929
2942
  const config = getSpawnConfig(input);
2930
- return !!config && config.kind === "cli" && typeof config.mcpArgs === "function";
2943
+ return !!config && config.kind === "cli" && (typeof config.mcpArgs === "function" || typeof config.mcpEnv === "function");
2931
2944
  }
2932
2945
  function listMcpSupportedAgents() {
2933
2946
  const supported = [];
2934
2947
  for (const config of allSpawnConfigs) {
2935
- if (config.kind !== "cli" || typeof config.mcpArgs !== "function") {
2948
+ if (config.kind !== "cli" || typeof config.mcpArgs !== "function" && typeof config.mcpEnv !== "function") {
2936
2949
  continue;
2937
2950
  }
2938
2951
  supported.push(config.agentId);
@@ -2994,11 +3007,20 @@ function getMcpArgs(config, servers) {
2994
3007
  if (!hasMcpServers(servers)) {
2995
3008
  return [];
2996
3009
  }
2997
- if (!config.mcpArgs) {
3010
+ if (!config.mcpArgs && !config.mcpEnv) {
2998
3011
  throw new Error(formatUnsupportedMcpSpawnMessage(config.agentId));
2999
3012
  }
3013
+ if (!config.mcpArgs) {
3014
+ return [];
3015
+ }
3000
3016
  return config.mcpArgs(servers);
3001
3017
  }
3018
+ function getMcpEnv(config, servers) {
3019
+ if (!hasMcpServers(servers) || !config.mcpEnv) {
3020
+ return {};
3021
+ }
3022
+ return config.mcpEnv(servers);
3023
+ }
3002
3024
  function formatUnsupportedMcpSpawnMessage(agentId) {
3003
3025
  const supported = listMcpSupportedAgents();
3004
3026
  const supportedText = supported.length > 0 ? supported.join(", ") : "(none)";
@@ -4549,6 +4571,7 @@ function spawnStreaming(options) {
4549
4571
  throw new Error(`Agent "${agentId}" has no binaryName.`);
4550
4572
  }
4551
4573
  const mcpArgs = getMcpArgs(spawnConfig, options.mcpServers);
4574
+ const mcpEnvVars = getMcpEnv(spawnConfig, options.mcpServers);
4552
4575
  const args = [];
4553
4576
  if (spawnConfig.mcpArgsBeforeCommand) {
4554
4577
  args.push(...mcpArgs);
@@ -4577,7 +4600,8 @@ function spawnStreaming(options) {
4577
4600
  }
4578
4601
  const child = spawnChildProcess3(binaryName, args, {
4579
4602
  cwd: options.cwd,
4580
- stdio: ["pipe", "pipe", "pipe"]
4603
+ stdio: ["pipe", "pipe", "pipe"],
4604
+ env: Object.keys(mcpEnvVars).length > 0 ? { ...process.env, ...mcpEnvVars } : void 0
4581
4605
  });
4582
4606
  let aborted = false;
4583
4607
  const onAbort = () => {
@@ -4939,6 +4963,7 @@ var init_src6 = __esm({
4939
4963
  "use strict";
4940
4964
  init_run_command();
4941
4965
  init_configs();
4966
+ init_mcp();
4942
4967
  init_spawn();
4943
4968
  init_spawn();
4944
4969
  init_spawn_interactive();
@@ -24043,7 +24068,7 @@ var init_package = __esm({
24043
24068
  "package.json"() {
24044
24069
  package_default = {
24045
24070
  name: "poe-code",
24046
- version: "3.0.126",
24071
+ version: "3.0.127",
24047
24072
  description: "CLI tool to configure Poe API for developer workflows.",
24048
24073
  type: "module",
24049
24074
  main: "./dist/index.js",