This commit is contained in:
Shawn Morreau
2025-11-18 19:20:26 -05:00
parent c72d44382f
commit 3982b147f9
3 changed files with 18 additions and 24 deletions
-1
View File
@@ -1,5 +1,4 @@
import { spawnSync } from "node:child_process"; import { spawnSync } from "node:child_process";
import type { McpServerConfig } from "@anthropic-ai/claude-agent-sdk";
import { Codex, type CodexOptions, type ThreadEvent } from "@openai/codex-sdk"; import { Codex, type CodexOptions, type ThreadEvent } from "@openai/codex-sdk";
import { log } from "../utils/cli.ts"; import { log } from "../utils/cli.ts";
import { addInstructions } from "./instructions.ts"; import { addInstructions } from "./instructions.ts";
+1 -1
View File
@@ -3,7 +3,7 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { join, resolve } from "node:path"; import { join, resolve } from "node:path";
import { log } from "../utils/cli.ts"; import { log } from "../utils/cli.ts";
import { addInstructions } from "./instructions.ts"; import { addInstructions } from "./instructions.ts";
import { agent, installFromCurl, type AddMcpServerParams } from "./shared.ts"; import { type AddMcpServerParams, agent, installFromCurl } from "./shared.ts";
export const cursor = agent({ export const cursor = agent({
name: "cursor", name: "cursor",
+2 -7
View File
@@ -52,14 +52,12 @@ function logToolCall({
request: unknown; request: unknown;
error?: unknown; error?: unknown;
success?: boolean; success?: boolean;
}): void { }) {
try {
const logPath = getLogPath(); const logPath = getLogPath();
const timestamp = new Date().toISOString(); const timestamp = new Date().toISOString();
const requestStr = JSON.stringify(request, null, 2); const requestStr = JSON.stringify(request, null, 2);
let logEntry = `[${timestamp}] Tool: ${toolName}\n`; let logEntry = `[${timestamp}] Tool: ${toolName}\nRequest: ${requestStr}\n`;
logEntry += `Request: ${requestStr}\n`;
if (error) { if (error) {
const errorMessage = error instanceof Error ? error.message : String(error); const errorMessage = error instanceof Error ? error.message : String(error);
@@ -75,9 +73,6 @@ function logToolCall({
logEntry += `${"=".repeat(80)}\n\n`; logEntry += `${"=".repeat(80)}\n\n`;
appendFileSync(logPath, logEntry, "utf-8"); appendFileSync(logPath, logEntry, "utf-8");
} catch {
// Silently fail if logging fails to avoid breaking the tool
}
} }
export const tool = <const params>(toolDef: Tool<any, StandardSchemaV1<params>>) => { export const tool = <const params>(toolDef: Tool<any, StandardSchemaV1<params>>) => {