Flesh out debug logs
This commit is contained in:
+2
-1
@@ -19,7 +19,7 @@ export const claude = agent({
|
||||
delete process.env.ANTHROPIC_API_KEY;
|
||||
|
||||
const prompt = addInstructions({ payload, prepResults, repo });
|
||||
log.group("Full prompt", () => log.info(prompt));
|
||||
log.group("» Full prompt", () => log.info(prompt));
|
||||
|
||||
// configure sandbox mode if enabled
|
||||
const sandboxOptions: Options = payload.sandbox
|
||||
@@ -63,6 +63,7 @@ export const claude = agent({
|
||||
|
||||
// Stream the results
|
||||
for await (const message of queryInstance) {
|
||||
log.debug(JSON.stringify(message, null, 2));
|
||||
const handler = messageHandlers[message.type];
|
||||
await handler(message as never);
|
||||
}
|
||||
|
||||
+4
-3
@@ -167,7 +167,7 @@ export const cursor = agent({
|
||||
|
||||
try {
|
||||
const fullPrompt = addInstructions({ payload, prepResults, repo });
|
||||
log.group("Full prompt", () => log.info(fullPrompt));
|
||||
log.group("» Full prompt", () => log.info(fullPrompt));
|
||||
|
||||
// configure sandbox mode if enabled
|
||||
// in sandbox mode: remove --force flag and rely on cli-config.json sandbox settings
|
||||
@@ -212,6 +212,7 @@ export const cursor = agent({
|
||||
|
||||
try {
|
||||
const event = JSON.parse(text) as CursorEvent;
|
||||
log.debug(JSON.stringify(event, null, 2));
|
||||
|
||||
// skip empty thinking deltas
|
||||
if (event.type === "thinking" && event.subtype === "delta" && !event.text) {
|
||||
@@ -308,7 +309,7 @@ function configureCursorMcpServers({ mcpServers }: ConfigureMcpServersParams) {
|
||||
}
|
||||
|
||||
writeFileSync(mcpConfigPath, JSON.stringify({ mcpServers: cursorMcpServers }, null, 2), "utf-8");
|
||||
log.info(`MCP config written to ${mcpConfigPath}`);
|
||||
log.info(`» MCP config written to ${mcpConfigPath}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -347,5 +348,5 @@ function configureCursorSandbox({ sandbox }: { sandbox: boolean }): void {
|
||||
};
|
||||
|
||||
writeFileSync(cliConfigPath, JSON.stringify(config, null, 2), "utf-8");
|
||||
log.info(`CLI config written to ${cliConfigPath} (sandbox: ${sandbox})`);
|
||||
log.info(`» CLI config written to ${cliConfigPath} (sandbox: ${sandbox})`);
|
||||
}
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ export const gemini = agent({
|
||||
}
|
||||
|
||||
const sessionPrompt = addInstructions({ payload, prepResults, repo });
|
||||
log.group("Full prompt", () => log.info(sessionPrompt));
|
||||
log.group("» Full prompt", () => log.info(sessionPrompt));
|
||||
|
||||
// configure sandbox mode if enabled
|
||||
// --allowed-tools restricts which tools are available (removes others from registry entirely)
|
||||
|
||||
+3
-5
@@ -30,7 +30,7 @@ export const opencode = agent({
|
||||
configureOpenCode({ mcpServers, sandbox: payload.sandbox ?? false });
|
||||
|
||||
const prompt = addInstructions({ payload, prepResults, repo });
|
||||
log.group("Full prompt", () => log.info(prompt));
|
||||
log.group("» Full prompt", () => log.info(prompt));
|
||||
|
||||
// message positional must come right after "run", before flags
|
||||
const args = ["run", prompt, "--format", "json"];
|
||||
@@ -105,9 +105,7 @@ export const opencode = agent({
|
||||
eventCount++;
|
||||
|
||||
// debug log all events to diagnose ordering and missing MCP/bash tool calls
|
||||
log.debug(
|
||||
`» event: type=${event.type} data=${JSON.stringify(event).substring(0, 300)}`
|
||||
);
|
||||
log.debug(JSON.stringify(event, null, 2));
|
||||
|
||||
const timeSinceLastActivity = Date.now() - lastActivityTime;
|
||||
if (timeSinceLastActivity > 10000) {
|
||||
@@ -253,7 +251,7 @@ function configureOpenCode({ mcpServers, sandbox }: ConfigureOpenCodeParams): vo
|
||||
throw error;
|
||||
}
|
||||
|
||||
log.info(`OpenCode config written to ${configPath} (sandbox: ${sandbox})`);
|
||||
log.info(`» OpenCode config written to ${configPath} (sandbox: ${sandbox})`);
|
||||
log.debug(`OpenCode config contents:\n${configJson}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user