multiagents 0.1.4 → 0.1.6
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/orchestrator/launcher.ts +4 -41
- package/package.json +1 -1
package/orchestrator/launcher.ts
CHANGED
|
@@ -286,55 +286,18 @@ export function buildCliArgs(agentType: AgentType, task: string): string[] {
|
|
|
286
286
|
];
|
|
287
287
|
}
|
|
288
288
|
case "codex": {
|
|
289
|
-
// Inject multiagents MCP
|
|
290
|
-
//
|
|
291
|
-
//
|
|
292
|
-
//
|
|
293
|
-
//
|
|
294
|
-
// 1. Entries with `url` (like figma) are remote MCP — not supported
|
|
295
|
-
// in stdio mode, causes connection errors.
|
|
296
|
-
// 2. Entries with slow `npx` commands (like chrome-devtools) cause
|
|
297
|
-
// 10s+ timeouts during MCP handshake.
|
|
298
|
-
// 3. NEVER use `echo "disabled"` as a dummy — Codex reads stdout as
|
|
299
|
-
// JSON-RPC and "disabled" fails to parse, crashing the agent.
|
|
300
|
-
//
|
|
301
|
-
// The fix: read ~/.codex/config.toml, find all [mcp_servers.*] keys,
|
|
302
|
-
// and override each non-multiagents entry with noop-mcp.ts — a tiny
|
|
303
|
-
// MCP server that completes the JSON-RPC handshake instantly with zero
|
|
304
|
-
// tools, then stays alive. This avoids:
|
|
305
|
-
// - /usr/bin/true: exits immediately → 10s MCP handshake timeout
|
|
306
|
-
// - echo "disabled": stdout parsed as JSON-RPC → deserialization crash
|
|
307
|
-
const noopMcpPath = path.resolve(import.meta.dir, "..", "noop-mcp.ts");
|
|
289
|
+
// Inject multiagents MCP via dotted-path config overrides.
|
|
290
|
+
// We ONLY add our own MCP server — never touch other user-configured servers.
|
|
291
|
+
// The multiagents entry is already in ~/.codex/config.toml (written by install-mcp),
|
|
292
|
+
// but we override here to ensure the spawned agent uses the correct binary path.
|
|
308
293
|
const codexMcp = mcpServerCommand("codex");
|
|
309
294
|
const argsJson = JSON.stringify(codexMcp.args);
|
|
310
295
|
const overrides: string[] = [
|
|
311
|
-
// Our MCP server
|
|
312
296
|
`mcp_servers.multiagents.command="${codexMcp.command}"`,
|
|
313
297
|
`mcp_servers.multiagents.args=${argsJson}`,
|
|
314
298
|
'model_reasoning_effort="high"',
|
|
315
299
|
];
|
|
316
300
|
|
|
317
|
-
// Neutralize global MCP servers by reading config
|
|
318
|
-
const globalConfigPath = path.join(process.env.HOME ?? "", ".codex", "config.toml");
|
|
319
|
-
try {
|
|
320
|
-
const configText = fs.readFileSync(globalConfigPath, "utf-8");
|
|
321
|
-
// Find all [mcp_servers.XXX] section names
|
|
322
|
-
const mcpPattern = /\[mcp_servers\.(\w[\w-]*)\]/g;
|
|
323
|
-
let match;
|
|
324
|
-
while ((match = mcpPattern.exec(configText)) !== null) {
|
|
325
|
-
const serverName = match[1];
|
|
326
|
-
if (serverName !== "multiagents") {
|
|
327
|
-
// Override with noop-mcp.ts — instant handshake, zero tools
|
|
328
|
-
overrides.push(`mcp_servers.${serverName}.command="bun"`);
|
|
329
|
-
overrides.push(`mcp_servers.${serverName}.args=["${noopMcpPath}"]`);
|
|
330
|
-
// Clear url field if present (remote MCP entries)
|
|
331
|
-
overrides.push(`mcp_servers.${serverName}.url=""`);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
} catch {
|
|
335
|
-
// No global config — nothing to neutralize
|
|
336
|
-
}
|
|
337
|
-
|
|
338
301
|
const args: string[] = [
|
|
339
302
|
"exec",
|
|
340
303
|
"--sandbox", "workspace-write",
|