remove slop

This commit is contained in:
Shawn Morreau
2025-11-18 20:18:00 -05:00
parent 0ac4975b50
commit 7bbca2fdeb
4 changed files with 45 additions and 54 deletions
+4 -22
View File
@@ -1,9 +1,8 @@
import { spawnSync } from "node:child_process";
import type { McpStdioServerConfig } from "@anthropic-ai/claude-agent-sdk";
import { Codex, type CodexOptions, type ThreadEvent } from "@openai/codex-sdk";
import { log } from "../utils/cli.ts";
import { addInstructions } from "./instructions.ts";
import { agent, installFromNpmTarball } from "./shared.ts";
import { agent, type ConfigureMcpServersParams, installFromNpmTarball } from "./shared.ts";
export const codex = agent({
name: "codex",
@@ -16,22 +15,11 @@ export const codex = agent({
});
},
run: async ({ prompt, mcpServers, apiKey, cliPath, githubInstallationToken }) => {
// Configure MCP servers if provided
if (mcpServers && Object.keys(mcpServers).length > 0) {
// Filter to only stdio servers
const stdioServers: Record<string, McpStdioServerConfig> = {};
for (const [serverName, serverConfig] of Object.entries(mcpServers)) {
if ("command" in serverConfig) {
stdioServers[serverName] = serverConfig;
}
}
if (Object.keys(stdioServers).length > 0) {
configureCodexMcpServers({ mcpServers: stdioServers, cliPath });
}
}
process.env.OPENAI_API_KEY = apiKey;
process.env.GITHUB_INSTALLATION_TOKEN = githubInstallationToken;
configureCodexMcpServers({ mcpServers, cliPath });
// Configure Codex
const codexOptions: CodexOptions = {
apiKey,
@@ -173,13 +161,7 @@ const messageHandlers: {
* Configure MCP servers for Codex using the CLI.
* Codex CLI syntax: codex mcp add <name> --env KEY=value -- <command> [args...]
*/
function configureCodexMcpServers({
mcpServers,
cliPath,
}: {
mcpServers: Record<string, McpStdioServerConfig>;
cliPath: string;
}): void {
function configureCodexMcpServers({ mcpServers, cliPath }: ConfigureMcpServersParams): void {
for (const [serverName, serverConfig] of Object.entries(mcpServers)) {
const command = serverConfig.command;
const args = serverConfig.args || [];