diff --git a/.changeset/patch-display-agent-response-in-logs.md b/.changeset/patch-display-agent-response-in-logs.md new file mode 100644 index 0000000000..96fc552139 --- /dev/null +++ b/.changeset/patch-display-agent-response-in-logs.md @@ -0,0 +1,14 @@ +--- +"gh-aw": patch +--- + +Display agent response text in action logs as a conversation-style summary. + +This change updates the action log rendering so agent replies are shown +inline with tool calls, making logs read like a chat conversation. Agent +responses are prefixed with "Agent:", tool calls use ✓/✗, shell commands +are shown as `$ command`, and long outputs are truncated to keep logs +concise. + +This is an internal, non-breaking improvement to log formatting. + diff --git a/.github/workflows/ai-moderator.lock.yml b/.github/workflows/ai-moderator.lock.yml index e1e116a408..27e74502ad 100644 --- a/.github/workflows/ai-moderator.lock.yml +++ b/.github/workflows/ai-moderator.lock.yml @@ -5430,73 +5430,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5507,48 +5440,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5562,6 +5519,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/archie.lock.yml b/.github/workflows/archie.lock.yml index 3b7267bf27..b62456a687 100644 --- a/.github/workflows/archie.lock.yml +++ b/.github/workflows/archie.lock.yml @@ -6161,73 +6161,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6238,48 +6171,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6293,6 +6250,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/artifacts-summary.lock.yml b/.github/workflows/artifacts-summary.lock.yml index 34735defaa..8c12c3fb22 100644 --- a/.github/workflows/artifacts-summary.lock.yml +++ b/.github/workflows/artifacts-summary.lock.yml @@ -4442,73 +4442,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4519,48 +4452,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4574,6 +4531,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/audit-workflows.lock.yml b/.github/workflows/audit-workflows.lock.yml index f7bbc75fc5..513de49844 100644 --- a/.github/workflows/audit-workflows.lock.yml +++ b/.github/workflows/audit-workflows.lock.yml @@ -5998,73 +5998,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6075,48 +6008,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6130,6 +6087,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/blog-auditor.lock.yml b/.github/workflows/blog-auditor.lock.yml index 44e40321c0..cfde4124a9 100644 --- a/.github/workflows/blog-auditor.lock.yml +++ b/.github/workflows/blog-auditor.lock.yml @@ -5058,73 +5058,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5135,48 +5068,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5190,6 +5147,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/brave.lock.yml b/.github/workflows/brave.lock.yml index 08e2814156..1c23ba39c8 100644 --- a/.github/workflows/brave.lock.yml +++ b/.github/workflows/brave.lock.yml @@ -5951,73 +5951,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6028,48 +5961,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6083,6 +6040,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/breaking-change-checker.lock.yml b/.github/workflows/breaking-change-checker.lock.yml index 3ea8502056..6fda9c13c2 100644 --- a/.github/workflows/breaking-change-checker.lock.yml +++ b/.github/workflows/breaking-change-checker.lock.yml @@ -4526,73 +4526,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4603,48 +4536,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4658,6 +4615,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/changeset.lock.yml b/.github/workflows/changeset.lock.yml index 58bcb70aa6..98cf6963c3 100644 --- a/.github/workflows/changeset.lock.yml +++ b/.github/workflows/changeset.lock.yml @@ -5463,73 +5463,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5540,48 +5473,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5595,6 +5552,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/ci-coach.lock.yml b/.github/workflows/ci-coach.lock.yml index d5f3bb892d..72fb132fa9 100644 --- a/.github/workflows/ci-coach.lock.yml +++ b/.github/workflows/ci-coach.lock.yml @@ -5728,73 +5728,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5805,48 +5738,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5860,6 +5817,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/ci-doctor.lock.yml b/.github/workflows/ci-doctor.lock.yml index 8a1518456c..4dda453b34 100644 --- a/.github/workflows/ci-doctor.lock.yml +++ b/.github/workflows/ci-doctor.lock.yml @@ -5390,73 +5390,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5467,48 +5400,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5522,6 +5479,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/cli-consistency-checker.lock.yml b/.github/workflows/cli-consistency-checker.lock.yml index b5927d2d21..f4da281a90 100644 --- a/.github/workflows/cli-consistency-checker.lock.yml +++ b/.github/workflows/cli-consistency-checker.lock.yml @@ -4523,73 +4523,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4600,48 +4533,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4655,6 +4612,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/cli-version-checker.lock.yml b/.github/workflows/cli-version-checker.lock.yml index 8fa67b921a..94349836f8 100644 --- a/.github/workflows/cli-version-checker.lock.yml +++ b/.github/workflows/cli-version-checker.lock.yml @@ -5007,73 +5007,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5084,48 +5017,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5139,6 +5096,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/cloclo.lock.yml b/.github/workflows/cloclo.lock.yml index 76fd54d24d..965b5c2ce4 100644 --- a/.github/workflows/cloclo.lock.yml +++ b/.github/workflows/cloclo.lock.yml @@ -6691,73 +6691,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6768,48 +6701,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6823,6 +6780,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/close-old-discussions.lock.yml b/.github/workflows/close-old-discussions.lock.yml index 3cd54187cc..10424a950d 100644 --- a/.github/workflows/close-old-discussions.lock.yml +++ b/.github/workflows/close-old-discussions.lock.yml @@ -4621,73 +4621,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4698,48 +4631,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4753,6 +4710,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/commit-changes-analyzer.lock.yml b/.github/workflows/commit-changes-analyzer.lock.yml index 18ef8d9096..9724db0fd9 100644 --- a/.github/workflows/commit-changes-analyzer.lock.yml +++ b/.github/workflows/commit-changes-analyzer.lock.yml @@ -4938,73 +4938,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5015,48 +4948,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5070,6 +5027,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/copilot-agent-analysis.lock.yml b/.github/workflows/copilot-agent-analysis.lock.yml index b49ff6dc6e..074bb46a9a 100644 --- a/.github/workflows/copilot-agent-analysis.lock.yml +++ b/.github/workflows/copilot-agent-analysis.lock.yml @@ -5683,73 +5683,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5760,48 +5693,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5815,6 +5772,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/copilot-pr-merged-report.lock.yml b/.github/workflows/copilot-pr-merged-report.lock.yml index d538119ae5..135baee887 100644 --- a/.github/workflows/copilot-pr-merged-report.lock.yml +++ b/.github/workflows/copilot-pr-merged-report.lock.yml @@ -5975,73 +5975,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6052,48 +5985,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6107,6 +6064,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/copilot-pr-nlp-analysis.lock.yml b/.github/workflows/copilot-pr-nlp-analysis.lock.yml index 3adac4fccd..8ec7f201b2 100644 --- a/.github/workflows/copilot-pr-nlp-analysis.lock.yml +++ b/.github/workflows/copilot-pr-nlp-analysis.lock.yml @@ -6063,73 +6063,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6140,48 +6073,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6195,6 +6152,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/copilot-pr-prompt-analysis.lock.yml b/.github/workflows/copilot-pr-prompt-analysis.lock.yml index 23cb472a23..20b4a6c7db 100644 --- a/.github/workflows/copilot-pr-prompt-analysis.lock.yml +++ b/.github/workflows/copilot-pr-prompt-analysis.lock.yml @@ -5086,73 +5086,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5163,48 +5096,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5218,6 +5175,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/copilot-session-insights.lock.yml b/.github/workflows/copilot-session-insights.lock.yml index 97d23d0e7c..b6d94687bd 100644 --- a/.github/workflows/copilot-session-insights.lock.yml +++ b/.github/workflows/copilot-session-insights.lock.yml @@ -7093,73 +7093,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -7170,48 +7103,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -7225,6 +7182,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/craft.lock.yml b/.github/workflows/craft.lock.yml index 68764284b2..220d40db41 100644 --- a/.github/workflows/craft.lock.yml +++ b/.github/workflows/craft.lock.yml @@ -6295,73 +6295,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6372,48 +6305,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6427,6 +6384,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/daily-assign-issue-to-user.lock.yml b/.github/workflows/daily-assign-issue-to-user.lock.yml index 193286baa1..fdb27c18bb 100644 --- a/.github/workflows/daily-assign-issue-to-user.lock.yml +++ b/.github/workflows/daily-assign-issue-to-user.lock.yml @@ -4894,73 +4894,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4971,48 +4904,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5026,6 +4983,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/daily-code-metrics.lock.yml b/.github/workflows/daily-code-metrics.lock.yml index 05ca35a746..8d300bd0e0 100644 --- a/.github/workflows/daily-code-metrics.lock.yml +++ b/.github/workflows/daily-code-metrics.lock.yml @@ -6138,73 +6138,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6215,48 +6148,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6270,6 +6227,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/daily-copilot-token-report.lock.yml b/.github/workflows/daily-copilot-token-report.lock.yml index 5338c6dc7a..f8c7be3a8c 100644 --- a/.github/workflows/daily-copilot-token-report.lock.yml +++ b/.github/workflows/daily-copilot-token-report.lock.yml @@ -6232,73 +6232,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6309,48 +6242,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6364,6 +6321,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/daily-doc-updater.lock.yml b/.github/workflows/daily-doc-updater.lock.yml index 5f0bb7cc08..de1c5388d8 100644 --- a/.github/workflows/daily-doc-updater.lock.yml +++ b/.github/workflows/daily-doc-updater.lock.yml @@ -4734,73 +4734,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4811,48 +4744,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4866,6 +4823,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/daily-fact.lock.yml b/.github/workflows/daily-fact.lock.yml index 0330f34470..4fb956bce7 100644 --- a/.github/workflows/daily-fact.lock.yml +++ b/.github/workflows/daily-fact.lock.yml @@ -4989,73 +4989,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5066,48 +4999,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5121,6 +5078,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/daily-file-diet.lock.yml b/.github/workflows/daily-file-diet.lock.yml index 103c2b0a93..8a9847fd1d 100644 --- a/.github/workflows/daily-file-diet.lock.yml +++ b/.github/workflows/daily-file-diet.lock.yml @@ -4774,73 +4774,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4851,48 +4784,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4906,6 +4863,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/daily-firewall-report.lock.yml b/.github/workflows/daily-firewall-report.lock.yml index 5f1f36ac85..7ee641adbf 100644 --- a/.github/workflows/daily-firewall-report.lock.yml +++ b/.github/workflows/daily-firewall-report.lock.yml @@ -5517,73 +5517,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5594,48 +5527,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5649,6 +5606,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/daily-issues-report.lock.yml b/.github/workflows/daily-issues-report.lock.yml index 28d5e18902..d2fa663edb 100644 --- a/.github/workflows/daily-issues-report.lock.yml +++ b/.github/workflows/daily-issues-report.lock.yml @@ -6358,73 +6358,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6435,48 +6368,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6490,6 +6447,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/daily-malicious-code-scan.lock.yml b/.github/workflows/daily-malicious-code-scan.lock.yml index 057e20d315..eb51a86d78 100644 --- a/.github/workflows/daily-malicious-code-scan.lock.yml +++ b/.github/workflows/daily-malicious-code-scan.lock.yml @@ -4761,73 +4761,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4838,48 +4771,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4893,6 +4850,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/daily-multi-device-docs-tester.lock.yml b/.github/workflows/daily-multi-device-docs-tester.lock.yml index 5335fcbd01..cb980f1b80 100644 --- a/.github/workflows/daily-multi-device-docs-tester.lock.yml +++ b/.github/workflows/daily-multi-device-docs-tester.lock.yml @@ -4645,73 +4645,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4722,48 +4655,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4777,6 +4734,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/daily-news.lock.yml b/.github/workflows/daily-news.lock.yml index e42097e64c..7e7f208a79 100644 --- a/.github/workflows/daily-news.lock.yml +++ b/.github/workflows/daily-news.lock.yml @@ -5991,73 +5991,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6068,48 +6001,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6123,6 +6080,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/daily-performance-summary.lock.yml b/.github/workflows/daily-performance-summary.lock.yml index 5be2417b12..f98f3cd4e3 100644 --- a/.github/workflows/daily-performance-summary.lock.yml +++ b/.github/workflows/daily-performance-summary.lock.yml @@ -7598,73 +7598,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -7675,48 +7608,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -7730,6 +7687,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/daily-repo-chronicle.lock.yml b/.github/workflows/daily-repo-chronicle.lock.yml index 01e41f341e..2b8a695f8b 100644 --- a/.github/workflows/daily-repo-chronicle.lock.yml +++ b/.github/workflows/daily-repo-chronicle.lock.yml @@ -5665,73 +5665,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5742,48 +5675,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5797,6 +5754,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/daily-team-status.lock.yml b/.github/workflows/daily-team-status.lock.yml index 057d0f1032..24040c2f70 100644 --- a/.github/workflows/daily-team-status.lock.yml +++ b/.github/workflows/daily-team-status.lock.yml @@ -4289,73 +4289,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4366,48 +4299,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4421,6 +4378,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/daily-workflow-updater.lock.yml b/.github/workflows/daily-workflow-updater.lock.yml index a1c00222a7..2d3227be24 100644 --- a/.github/workflows/daily-workflow-updater.lock.yml +++ b/.github/workflows/daily-workflow-updater.lock.yml @@ -4453,73 +4453,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4530,48 +4463,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4585,6 +4542,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/deep-report.lock.yml b/.github/workflows/deep-report.lock.yml index 00a58475ee..97ed68ef8d 100644 --- a/.github/workflows/deep-report.lock.yml +++ b/.github/workflows/deep-report.lock.yml @@ -5234,73 +5234,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5311,48 +5244,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5366,6 +5323,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/dependabot-go-checker.lock.yml b/.github/workflows/dependabot-go-checker.lock.yml index 563ea4b52c..3b60359206 100644 --- a/.github/workflows/dependabot-go-checker.lock.yml +++ b/.github/workflows/dependabot-go-checker.lock.yml @@ -5056,73 +5056,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5133,48 +5066,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5188,6 +5145,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/dev-hawk.lock.yml b/.github/workflows/dev-hawk.lock.yml index 13369fc506..9d571654d5 100644 --- a/.github/workflows/dev-hawk.lock.yml +++ b/.github/workflows/dev-hawk.lock.yml @@ -5174,73 +5174,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5251,48 +5184,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5306,6 +5263,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/dev.lock.yml b/.github/workflows/dev.lock.yml index ceb9ad7e1b..eab34269a3 100644 --- a/.github/workflows/dev.lock.yml +++ b/.github/workflows/dev.lock.yml @@ -5154,73 +5154,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5231,48 +5164,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5286,6 +5243,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/developer-docs-consolidator.lock.yml b/.github/workflows/developer-docs-consolidator.lock.yml index c44ed211c6..df6f06dae7 100644 --- a/.github/workflows/developer-docs-consolidator.lock.yml +++ b/.github/workflows/developer-docs-consolidator.lock.yml @@ -5885,73 +5885,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5962,48 +5895,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6017,6 +5974,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/dictation-prompt.lock.yml b/.github/workflows/dictation-prompt.lock.yml index dcd42eeaf7..7b5820d3d2 100644 --- a/.github/workflows/dictation-prompt.lock.yml +++ b/.github/workflows/dictation-prompt.lock.yml @@ -4396,73 +4396,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4473,48 +4406,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4528,6 +4485,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/docs-noob-tester.lock.yml b/.github/workflows/docs-noob-tester.lock.yml index 802862b1cd..01785cba60 100644 --- a/.github/workflows/docs-noob-tester.lock.yml +++ b/.github/workflows/docs-noob-tester.lock.yml @@ -4535,73 +4535,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4612,48 +4545,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4667,6 +4624,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/duplicate-code-detector.lock.yml b/.github/workflows/duplicate-code-detector.lock.yml index 5b5d061d71..f37274f5ca 100644 --- a/.github/workflows/duplicate-code-detector.lock.yml +++ b/.github/workflows/duplicate-code-detector.lock.yml @@ -4606,73 +4606,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4683,48 +4616,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4738,6 +4695,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/example-permissions-warning.lock.yml b/.github/workflows/example-permissions-warning.lock.yml index 5b8d756859..6142ff5214 100644 --- a/.github/workflows/example-permissions-warning.lock.yml +++ b/.github/workflows/example-permissions-warning.lock.yml @@ -1528,73 +1528,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -1605,48 +1538,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -1660,6 +1617,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/example-workflow-analyzer.lock.yml b/.github/workflows/example-workflow-analyzer.lock.yml index 24f741a53d..54b3802aa9 100644 --- a/.github/workflows/example-workflow-analyzer.lock.yml +++ b/.github/workflows/example-workflow-analyzer.lock.yml @@ -4452,73 +4452,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4529,48 +4462,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4584,6 +4541,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/firewall-escape.lock.yml b/.github/workflows/firewall-escape.lock.yml index ec4f349fd3..37756f90c8 100644 --- a/.github/workflows/firewall-escape.lock.yml +++ b/.github/workflows/firewall-escape.lock.yml @@ -1948,73 +1948,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -2025,48 +1958,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -2080,6 +2037,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/firewall.lock.yml b/.github/workflows/firewall.lock.yml index 480675f4cb..daf4c9ba5f 100644 --- a/.github/workflows/firewall.lock.yml +++ b/.github/workflows/firewall.lock.yml @@ -1643,73 +1643,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -1720,48 +1653,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -1775,6 +1732,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/github-mcp-structural-analysis.lock.yml b/.github/workflows/github-mcp-structural-analysis.lock.yml index 83f5f7a289..bcd19a5352 100644 --- a/.github/workflows/github-mcp-structural-analysis.lock.yml +++ b/.github/workflows/github-mcp-structural-analysis.lock.yml @@ -5811,73 +5811,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5888,48 +5821,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5943,6 +5900,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/github-mcp-tools-report.lock.yml b/.github/workflows/github-mcp-tools-report.lock.yml index 71968d1325..08cb4d49b0 100644 --- a/.github/workflows/github-mcp-tools-report.lock.yml +++ b/.github/workflows/github-mcp-tools-report.lock.yml @@ -5588,73 +5588,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5665,48 +5598,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5720,6 +5677,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/glossary-maintainer.lock.yml b/.github/workflows/glossary-maintainer.lock.yml index 1748ceaab3..6cf438be93 100644 --- a/.github/workflows/glossary-maintainer.lock.yml +++ b/.github/workflows/glossary-maintainer.lock.yml @@ -5554,73 +5554,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5631,48 +5564,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5686,6 +5643,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/go-fan.lock.yml b/.github/workflows/go-fan.lock.yml index 0ea6199411..1140c81711 100644 --- a/.github/workflows/go-fan.lock.yml +++ b/.github/workflows/go-fan.lock.yml @@ -5160,73 +5160,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5237,48 +5170,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5292,6 +5249,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/go-logger.lock.yml b/.github/workflows/go-logger.lock.yml index bd2ac8236c..5194a689fa 100644 --- a/.github/workflows/go-logger.lock.yml +++ b/.github/workflows/go-logger.lock.yml @@ -4893,73 +4893,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4970,48 +4903,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5025,6 +4982,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/go-pattern-detector.lock.yml b/.github/workflows/go-pattern-detector.lock.yml index 52f3476255..62b9342f0b 100644 --- a/.github/workflows/go-pattern-detector.lock.yml +++ b/.github/workflows/go-pattern-detector.lock.yml @@ -4644,73 +4644,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4721,48 +4654,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4776,6 +4733,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/grumpy-reviewer.lock.yml b/.github/workflows/grumpy-reviewer.lock.yml index 2729fc1fad..efb35bacc9 100644 --- a/.github/workflows/grumpy-reviewer.lock.yml +++ b/.github/workflows/grumpy-reviewer.lock.yml @@ -6100,73 +6100,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6177,48 +6110,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6232,6 +6189,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/hourly-ci-cleaner.lock.yml b/.github/workflows/hourly-ci-cleaner.lock.yml index 6e9ae0fdd7..c7bc780522 100644 --- a/.github/workflows/hourly-ci-cleaner.lock.yml +++ b/.github/workflows/hourly-ci-cleaner.lock.yml @@ -4872,73 +4872,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4949,48 +4882,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5004,6 +4961,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/instructions-janitor.lock.yml b/.github/workflows/instructions-janitor.lock.yml index 2eee1e2c29..1bfc36369f 100644 --- a/.github/workflows/instructions-janitor.lock.yml +++ b/.github/workflows/instructions-janitor.lock.yml @@ -4658,73 +4658,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4735,48 +4668,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4790,6 +4747,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/issue-arborist.lock.yml b/.github/workflows/issue-arborist.lock.yml index 242f531608..53b511c00d 100644 --- a/.github/workflows/issue-arborist.lock.yml +++ b/.github/workflows/issue-arborist.lock.yml @@ -4615,73 +4615,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4692,48 +4625,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4747,6 +4704,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/issue-monster.lock.yml b/.github/workflows/issue-monster.lock.yml index bd8f476e22..1abf95d3b6 100644 --- a/.github/workflows/issue-monster.lock.yml +++ b/.github/workflows/issue-monster.lock.yml @@ -5333,73 +5333,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5410,48 +5343,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5465,6 +5422,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/issue-triage-agent.lock.yml b/.github/workflows/issue-triage-agent.lock.yml index adb18a5cb9..fa6527dbf4 100644 --- a/.github/workflows/issue-triage-agent.lock.yml +++ b/.github/workflows/issue-triage-agent.lock.yml @@ -4628,73 +4628,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4705,48 +4638,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4760,6 +4717,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/layout-spec-maintainer.lock.yml b/.github/workflows/layout-spec-maintainer.lock.yml index 31f2c1cb01..9d19db1e37 100644 --- a/.github/workflows/layout-spec-maintainer.lock.yml +++ b/.github/workflows/layout-spec-maintainer.lock.yml @@ -4687,73 +4687,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4764,48 +4697,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4819,6 +4776,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/lockfile-stats.lock.yml b/.github/workflows/lockfile-stats.lock.yml index cbe2701149..c501c26b9e 100644 --- a/.github/workflows/lockfile-stats.lock.yml +++ b/.github/workflows/lockfile-stats.lock.yml @@ -5171,73 +5171,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5248,48 +5181,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5303,6 +5260,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/mcp-inspector.lock.yml b/.github/workflows/mcp-inspector.lock.yml index 392f5dac82..1f86a697f4 100644 --- a/.github/workflows/mcp-inspector.lock.yml +++ b/.github/workflows/mcp-inspector.lock.yml @@ -5067,73 +5067,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5144,48 +5077,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5199,6 +5156,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/mergefest.lock.yml b/.github/workflows/mergefest.lock.yml index aa1a70bb54..d96df36654 100644 --- a/.github/workflows/mergefest.lock.yml +++ b/.github/workflows/mergefest.lock.yml @@ -5239,73 +5239,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5316,48 +5249,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5371,6 +5328,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/notion-issue-summary.lock.yml b/.github/workflows/notion-issue-summary.lock.yml index d3d0b37b72..90ca1e57af 100644 --- a/.github/workflows/notion-issue-summary.lock.yml +++ b/.github/workflows/notion-issue-summary.lock.yml @@ -4131,73 +4131,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4208,48 +4141,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4263,6 +4220,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/org-health-report.lock.yml b/.github/workflows/org-health-report.lock.yml index a80aaf6b2c..e58d8bbf88 100644 --- a/.github/workflows/org-health-report.lock.yml +++ b/.github/workflows/org-health-report.lock.yml @@ -5926,73 +5926,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6003,48 +5936,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6058,6 +6015,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/pdf-summary.lock.yml b/.github/workflows/pdf-summary.lock.yml index 7a7b8537f2..51a59bb006 100644 --- a/.github/workflows/pdf-summary.lock.yml +++ b/.github/workflows/pdf-summary.lock.yml @@ -6125,73 +6125,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6202,48 +6135,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6257,6 +6214,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/plan.lock.yml b/.github/workflows/plan.lock.yml index e5da0b5a50..fb02577257 100644 --- a/.github/workflows/plan.lock.yml +++ b/.github/workflows/plan.lock.yml @@ -5412,73 +5412,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5489,48 +5422,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5544,6 +5501,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/poem-bot.lock.yml b/.github/workflows/poem-bot.lock.yml index 582a316e60..cd71716438 100644 --- a/.github/workflows/poem-bot.lock.yml +++ b/.github/workflows/poem-bot.lock.yml @@ -7177,73 +7177,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -7254,48 +7187,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -7309,6 +7266,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/portfolio-analyst.lock.yml b/.github/workflows/portfolio-analyst.lock.yml index 4a07a4510b..7bafbdc4f2 100644 --- a/.github/workflows/portfolio-analyst.lock.yml +++ b/.github/workflows/portfolio-analyst.lock.yml @@ -5291,73 +5291,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5368,48 +5301,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5423,6 +5380,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/pr-nitpick-reviewer.lock.yml b/.github/workflows/pr-nitpick-reviewer.lock.yml index 67490ae88e..b243716332 100644 --- a/.github/workflows/pr-nitpick-reviewer.lock.yml +++ b/.github/workflows/pr-nitpick-reviewer.lock.yml @@ -6408,73 +6408,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6485,48 +6418,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6540,6 +6497,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/prompt-clustering-analysis.lock.yml b/.github/workflows/prompt-clustering-analysis.lock.yml index 5b9c4cab08..d7ea26869d 100644 --- a/.github/workflows/prompt-clustering-analysis.lock.yml +++ b/.github/workflows/prompt-clustering-analysis.lock.yml @@ -6448,73 +6448,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6525,48 +6458,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6580,6 +6537,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/python-data-charts.lock.yml b/.github/workflows/python-data-charts.lock.yml index ce0c667e62..3b66dbd02d 100644 --- a/.github/workflows/python-data-charts.lock.yml +++ b/.github/workflows/python-data-charts.lock.yml @@ -6299,73 +6299,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6376,48 +6309,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6431,6 +6388,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/q.lock.yml b/.github/workflows/q.lock.yml index 3dfdecd691..1bb7d0ad6c 100644 --- a/.github/workflows/q.lock.yml +++ b/.github/workflows/q.lock.yml @@ -6709,73 +6709,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6786,48 +6719,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6841,6 +6798,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/release.lock.yml b/.github/workflows/release.lock.yml index bc6b9c8c3d..8fd7927cb4 100644 --- a/.github/workflows/release.lock.yml +++ b/.github/workflows/release.lock.yml @@ -4589,73 +4589,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4666,48 +4599,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4721,6 +4678,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/repo-tree-map.lock.yml b/.github/workflows/repo-tree-map.lock.yml index 34ee9795b9..8184daf7f9 100644 --- a/.github/workflows/repo-tree-map.lock.yml +++ b/.github/workflows/repo-tree-map.lock.yml @@ -4470,73 +4470,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4547,48 +4480,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4602,6 +4559,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/repository-quality-improver.lock.yml b/.github/workflows/repository-quality-improver.lock.yml index 1661137ba8..c8b5cec918 100644 --- a/.github/workflows/repository-quality-improver.lock.yml +++ b/.github/workflows/repository-quality-improver.lock.yml @@ -5507,73 +5507,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5584,48 +5517,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5639,6 +5596,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/research.lock.yml b/.github/workflows/research.lock.yml index 67ffdfca2b..f1ed59b382 100644 --- a/.github/workflows/research.lock.yml +++ b/.github/workflows/research.lock.yml @@ -4384,73 +4384,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4461,48 +4394,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4516,6 +4473,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/safe-output-health.lock.yml b/.github/workflows/safe-output-health.lock.yml index f6bd9fb112..7871f67ec4 100644 --- a/.github/workflows/safe-output-health.lock.yml +++ b/.github/workflows/safe-output-health.lock.yml @@ -5470,73 +5470,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5547,48 +5480,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5602,6 +5559,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/schema-consistency-checker.lock.yml b/.github/workflows/schema-consistency-checker.lock.yml index 911c9e45c0..25c6cb506a 100644 --- a/.github/workflows/schema-consistency-checker.lock.yml +++ b/.github/workflows/schema-consistency-checker.lock.yml @@ -5116,73 +5116,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5193,48 +5126,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5248,6 +5205,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/scout.lock.yml b/.github/workflows/scout.lock.yml index a6b6a76a78..c5e258de78 100644 --- a/.github/workflows/scout.lock.yml +++ b/.github/workflows/scout.lock.yml @@ -6737,73 +6737,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6814,48 +6747,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6869,6 +6826,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/security-fix-pr.lock.yml b/.github/workflows/security-fix-pr.lock.yml index 59d4189fe8..9c12e9b922 100644 --- a/.github/workflows/security-fix-pr.lock.yml +++ b/.github/workflows/security-fix-pr.lock.yml @@ -4666,73 +4666,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4743,48 +4676,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4798,6 +4755,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/semantic-function-refactor.lock.yml b/.github/workflows/semantic-function-refactor.lock.yml index 7cb15b453f..6266f5bed0 100644 --- a/.github/workflows/semantic-function-refactor.lock.yml +++ b/.github/workflows/semantic-function-refactor.lock.yml @@ -5504,73 +5504,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5581,48 +5514,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5636,6 +5593,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/smoke-claude.lock.yml b/.github/workflows/smoke-claude.lock.yml index 218c881f4f..7a073a4901 100644 --- a/.github/workflows/smoke-claude.lock.yml +++ b/.github/workflows/smoke-claude.lock.yml @@ -6583,73 +6583,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6660,48 +6593,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6715,6 +6672,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/smoke-codex.lock.yml b/.github/workflows/smoke-codex.lock.yml index fda8167c86..64846d49ba 100644 --- a/.github/workflows/smoke-codex.lock.yml +++ b/.github/workflows/smoke-codex.lock.yml @@ -6172,73 +6172,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6249,48 +6182,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6304,6 +6261,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/smoke-copilot-no-firewall.lock.yml b/.github/workflows/smoke-copilot-no-firewall.lock.yml index 8d1a96475a..3ad95c47ce 100644 --- a/.github/workflows/smoke-copilot-no-firewall.lock.yml +++ b/.github/workflows/smoke-copilot-no-firewall.lock.yml @@ -7589,73 +7589,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -7666,48 +7599,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -7721,6 +7678,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/smoke-copilot-playwright.lock.yml b/.github/workflows/smoke-copilot-playwright.lock.yml index 3ebc9286a6..5b9d2cc17d 100644 --- a/.github/workflows/smoke-copilot-playwright.lock.yml +++ b/.github/workflows/smoke-copilot-playwright.lock.yml @@ -7569,73 +7569,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -7646,48 +7579,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -7701,6 +7658,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/smoke-copilot-safe-inputs.lock.yml b/.github/workflows/smoke-copilot-safe-inputs.lock.yml index 2e616db69a..3c67b843d0 100644 --- a/.github/workflows/smoke-copilot-safe-inputs.lock.yml +++ b/.github/workflows/smoke-copilot-safe-inputs.lock.yml @@ -7294,73 +7294,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -7371,48 +7304,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -7426,6 +7383,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/smoke-copilot.lock.yml b/.github/workflows/smoke-copilot.lock.yml index fe8c43e309..8f72510ccd 100644 --- a/.github/workflows/smoke-copilot.lock.yml +++ b/.github/workflows/smoke-copilot.lock.yml @@ -6108,73 +6108,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6185,48 +6118,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6240,6 +6197,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/smoke-detector.lock.yml b/.github/workflows/smoke-detector.lock.yml index 24a6c25b49..8c79d2546c 100644 --- a/.github/workflows/smoke-detector.lock.yml +++ b/.github/workflows/smoke-detector.lock.yml @@ -6328,73 +6328,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6405,48 +6338,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6460,6 +6417,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/smoke-srt-custom-config.lock.yml b/.github/workflows/smoke-srt-custom-config.lock.yml index b63a1ccb36..ffc3b875bc 100644 --- a/.github/workflows/smoke-srt-custom-config.lock.yml +++ b/.github/workflows/smoke-srt-custom-config.lock.yml @@ -1827,73 +1827,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -1904,48 +1837,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -1959,6 +1916,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/smoke-srt.lock.yml b/.github/workflows/smoke-srt.lock.yml index e6c1a34708..fdbbd9423c 100644 --- a/.github/workflows/smoke-srt.lock.yml +++ b/.github/workflows/smoke-srt.lock.yml @@ -4280,73 +4280,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4357,48 +4290,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4412,6 +4369,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/spec-kit-execute.lock.yml b/.github/workflows/spec-kit-execute.lock.yml index 3c525e35fb..c86dcae303 100644 --- a/.github/workflows/spec-kit-execute.lock.yml +++ b/.github/workflows/spec-kit-execute.lock.yml @@ -4998,73 +4998,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5075,48 +5008,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5130,6 +5087,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/spec-kit-executor.lock.yml b/.github/workflows/spec-kit-executor.lock.yml index 195b9676fc..5dceb81e6c 100644 --- a/.github/workflows/spec-kit-executor.lock.yml +++ b/.github/workflows/spec-kit-executor.lock.yml @@ -4688,73 +4688,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4765,48 +4698,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4820,6 +4777,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/speckit-dispatcher.lock.yml b/.github/workflows/speckit-dispatcher.lock.yml index 1df4ce20df..d93cac28d6 100644 --- a/.github/workflows/speckit-dispatcher.lock.yml +++ b/.github/workflows/speckit-dispatcher.lock.yml @@ -6620,73 +6620,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6697,48 +6630,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6752,6 +6709,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/stale-repo-identifier.lock.yml b/.github/workflows/stale-repo-identifier.lock.yml index 2ddbf05a5d..a7298b8bd6 100644 --- a/.github/workflows/stale-repo-identifier.lock.yml +++ b/.github/workflows/stale-repo-identifier.lock.yml @@ -6162,73 +6162,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6239,48 +6172,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6294,6 +6251,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/static-analysis-report.lock.yml b/.github/workflows/static-analysis-report.lock.yml index 348002c6e8..94429353f9 100644 --- a/.github/workflows/static-analysis-report.lock.yml +++ b/.github/workflows/static-analysis-report.lock.yml @@ -5209,73 +5209,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5286,48 +5219,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5341,6 +5298,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/super-linter.lock.yml b/.github/workflows/super-linter.lock.yml index c79e7f46f4..87238180e1 100644 --- a/.github/workflows/super-linter.lock.yml +++ b/.github/workflows/super-linter.lock.yml @@ -4685,73 +4685,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4762,48 +4695,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4817,6 +4774,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/technical-doc-writer.lock.yml b/.github/workflows/technical-doc-writer.lock.yml index 567814eed2..d3339fd0e6 100644 --- a/.github/workflows/technical-doc-writer.lock.yml +++ b/.github/workflows/technical-doc-writer.lock.yml @@ -5911,73 +5911,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5988,48 +5921,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6043,6 +6000,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/test-discussion-expires.lock.yml b/.github/workflows/test-discussion-expires.lock.yml index 44c19df519..f90fa75c68 100644 --- a/.github/workflows/test-discussion-expires.lock.yml +++ b/.github/workflows/test-discussion-expires.lock.yml @@ -4069,73 +4069,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4146,48 +4079,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4201,6 +4158,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/test-hide-older-comments.lock.yml b/.github/workflows/test-hide-older-comments.lock.yml index 4bc8629fb2..80f543662d 100644 --- a/.github/workflows/test-hide-older-comments.lock.yml +++ b/.github/workflows/test-hide-older-comments.lock.yml @@ -4843,73 +4843,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4920,48 +4853,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4975,6 +4932,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/test-python-safe-input.lock.yml b/.github/workflows/test-python-safe-input.lock.yml index 04368cfd9e..d48277ecbb 100644 --- a/.github/workflows/test-python-safe-input.lock.yml +++ b/.github/workflows/test-python-safe-input.lock.yml @@ -5689,73 +5689,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5766,48 +5699,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5821,6 +5778,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/tidy.lock.yml b/.github/workflows/tidy.lock.yml index 170cb1e6cb..cd81467913 100644 --- a/.github/workflows/tidy.lock.yml +++ b/.github/workflows/tidy.lock.yml @@ -4812,73 +4812,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4889,48 +4822,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4944,6 +4901,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/typist.lock.yml b/.github/workflows/typist.lock.yml index 4eac10f660..0484696129 100644 --- a/.github/workflows/typist.lock.yml +++ b/.github/workflows/typist.lock.yml @@ -5534,73 +5534,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5611,48 +5544,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5666,6 +5623,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/unbloat-docs.lock.yml b/.github/workflows/unbloat-docs.lock.yml index 6317e7f2d2..4ceee5917a 100644 --- a/.github/workflows/unbloat-docs.lock.yml +++ b/.github/workflows/unbloat-docs.lock.yml @@ -6446,73 +6446,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -6523,48 +6456,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -6578,6 +6535,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/video-analyzer.lock.yml b/.github/workflows/video-analyzer.lock.yml index 6f5dd81842..40f2917a17 100644 --- a/.github/workflows/video-analyzer.lock.yml +++ b/.github/workflows/video-analyzer.lock.yml @@ -4726,73 +4726,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -4803,48 +4736,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -4858,6 +4815,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/.github/workflows/weekly-issue-summary.lock.yml b/.github/workflows/weekly-issue-summary.lock.yml index f48c69d4b4..ed357cf264 100644 --- a/.github/workflows/weekly-issue-summary.lock.yml +++ b/.github/workflows/weekly-issue-summary.lock.yml @@ -5518,73 +5518,6 @@ jobs: lines.push(`Model: ${model}`); } lines.push(""); - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - const internalTools = ["fetch_copilot_cli_documentation"]; - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -5595,48 +5528,72 @@ jobs: } } } - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + lines.push("Conversation:"); + lines.push(""); + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (content.type === "text" && content.text) { + const text = content.text.trim(); + if (text && text.length > 0) { + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); + conversationLineCount++; + } + } else if (content.type === "tool_use") { const toolName = content.name; const input = content.input || {}; if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } const statusIcon = isError ? "✗" : "✓"; let displayName; if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + const maxCmdLength = 100; + const displayCmd = cmd.length > maxCmdLength ? cmd.substring(0, maxCmdLength) + "..." : cmd; + displayName = `bash: ${displayCmd}`; } else if (toolName.startsWith("mcp__")) { displayName = formatMcpName(toolName); } else { displayName = toolName; } - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); - } + lines.push(`Tool: [${statusIcon}] ${displayName}`); + conversationLineCount++; + lines.push(""); + conversationLineCount++; } } } } - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } const lastEntry = logEntries[logEntries.length - 1]; @@ -5650,6 +5607,27 @@ jobs: lines.push(` Duration: ${duration}`); } } + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/pkg/workflow/js/log_parser_shared.cjs b/pkg/workflow/js/log_parser_shared.cjs index e2e3c99ca8..1575f48dc0 100644 --- a/pkg/workflow/js/log_parser_shared.cjs +++ b/pkg/workflow/js/log_parser_shared.cjs @@ -962,7 +962,7 @@ function formatToolCallAsDetails(options) { * * The output includes: * - A compact header with model info - * - Tool/command summary list (status icon + name only) + * - Agent conversation with response text and tool executions * - Basic execution statistics * * @param {Array} logEntries - Array of log entries with type, message, etc. @@ -982,90 +982,7 @@ function generatePlainTextSummary(logEntries, options = {}) { } lines.push(""); - // Add Available Tools section from init entry - const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init"); - if (initEntry && initEntry.tools && Array.isArray(initEntry.tools) && initEntry.tools.length > 0) { - lines.push("Available Tools:"); - lines.push(""); - - // Categorize tools using the same logic as formatInitializationSummary - /** @type {{ [key: string]: string[] }} */ - const categories = { - Builtin: [], - "Safe Outputs": [], - "Safe Inputs": [], - "Git/GitHub": [], - Playwright: [], - Serena: [], - MCP: [], - "Custom Agents": [], - Other: [], - }; - - // Builtin tools that come with gh-aw / Copilot - const builtinTools = [ - "bash", - "write_bash", - "read_bash", - "stop_bash", - "list_bash", - "grep", - "glob", - "view", - "create", - "edit", - "store_memory", - "code_review", - "codeql_checker", - "report_progress", - "report_intent", - "gh-advisory-database", - ]; - - // Internal tools that are specific to Copilot CLI - const internalTools = ["fetch_copilot_cli_documentation"]; - - for (const tool of initEntry.tools) { - const toolLower = tool.toLowerCase(); - - if (builtinTools.includes(toolLower) || internalTools.includes(toolLower)) { - categories["Builtin"].push(tool); - } else if (tool.startsWith("safeoutputs-") || tool.startsWith("safe_outputs-")) { - // Extract the tool name without the prefix for cleaner display - const toolName = tool.replace(/^safeoutputs-|^safe_outputs-/, ""); - categories["Safe Outputs"].push(toolName); - } else if (tool.startsWith("safeinputs-") || tool.startsWith("safe_inputs-")) { - // Extract the tool name without the prefix for cleaner display - const toolName = tool.replace(/^safeinputs-|^safe_inputs-/, ""); - categories["Safe Inputs"].push(toolName); - } else if (tool.startsWith("mcp__github__")) { - categories["Git/GitHub"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__playwright__")) { - categories["Playwright"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__serena__")) { - categories["Serena"].push(formatMcpName(tool)); - } else if (tool.startsWith("mcp__") || ["ListMcpResourcesTool", "ReadMcpResourceTool"].includes(tool)) { - categories["MCP"].push(tool.startsWith("mcp__") ? formatMcpName(tool) : tool); - } else if (isLikelyCustomAgent(tool)) { - // Custom agents typically have hyphenated names (kebab-case) - categories["Custom Agents"].push(tool); - } else { - categories["Other"].push(tool); - } - } - - // Display categories with tools - for (const [category, tools] of Object.entries(categories)) { - if (tools.length > 0) { - const toolText = tools.length === 1 ? "tool" : "tools"; - lines.push(`${category}: ${tools.length} ${toolText}`); - lines.push(tools.join(", ")); - } - } - lines.push(""); - } - - // Collect tool usage summary + // Collect tool usage pairs for status lookup const toolUsePairs = new Map(); for (const entry of logEntries) { if (entry.type === "user" && entry.message?.content) { @@ -1077,61 +994,125 @@ function generatePlainTextSummary(logEntries, options = {}) { } } - // Count tools and gather summary - const toolCounts = { total: 0, success: 0, error: 0 }; - const toolSummary = []; + // Generate conversation flow with agent responses and tool executions + lines.push("Conversation:"); + lines.push(""); + + let conversationLineCount = 0; + const MAX_CONVERSATION_LINES = 50; // Limit conversation output + let conversationTruncated = false; for (const entry of logEntries) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + if (entry.type === "assistant" && entry.message?.content) { for (const content of entry.message.content) { - if (content.type === "tool_use") { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + + if (content.type === "text" && content.text) { + // Display agent response text + const text = content.text.trim(); + if (text && text.length > 0) { + // Truncate long responses to keep output manageable + const maxTextLength = 500; + let displayText = text; + if (displayText.length > maxTextLength) { + displayText = displayText.substring(0, maxTextLength) + "..."; + } + + // Split into lines and add Agent prefix + const textLines = displayText.split("\n"); + for (const line of textLines) { + if (conversationLineCount >= MAX_CONVERSATION_LINES) { + conversationTruncated = true; + break; + } + lines.push(`Agent: ${line}`); + conversationLineCount++; + } + lines.push(""); // Add blank line after agent response + conversationLineCount++; + } + } else if (content.type === "tool_use") { + // Display tool execution const toolName = content.name; const input = content.input || {}; - // Skip internal tools + // Skip internal tools (file operations) if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { continue; } - toolCounts.total++; const toolResult = toolUsePairs.get(content.id); const isError = toolResult?.is_error === true; - - if (isError) { - toolCounts.error++; - } else { - toolCounts.success++; - } - const statusIcon = isError ? "✗" : "✓"; - // Format tool name compactly + // Format tool execution in Copilot CLI style let displayName; + let resultPreview = ""; + if (toolName === "Bash") { - const cmd = formatBashCommand(input.command || "").slice(0, MAX_BASH_COMMAND_DISPLAY_LENGTH); - displayName = `bash: ${cmd}`; + const cmd = formatBashCommand(input.command || ""); + displayName = `$ ${cmd}`; + + // Show result preview if available + if (toolResult && toolResult.content) { + const resultText = typeof toolResult.content === "string" ? toolResult.content : String(toolResult.content); + const resultLines = resultText.split("\n").filter(l => l.trim()); + if (resultLines.length > 0) { + const previewLine = resultLines[0].substring(0, 80); + if (resultLines.length > 1) { + resultPreview = ` └ ${resultLines.length} lines...`; + } else if (previewLine) { + resultPreview = ` └ ${previewLine}`; + } + } + } } else if (toolName.startsWith("mcp__")) { - displayName = formatMcpName(toolName); + // Format MCP tool names like github-list_pull_requests + const formattedName = formatMcpName(toolName).replace("::", "-"); + displayName = formattedName; + + // Show result preview if available + if (toolResult && toolResult.content) { + const resultText = typeof toolResult.content === "string" ? toolResult.content : JSON.stringify(toolResult.content); + const truncated = resultText.length > 80 ? resultText.substring(0, 80) + "..." : resultText; + resultPreview = ` └ ${truncated}`; + } } else { displayName = toolName; + + // Show result preview if available + if (toolResult && toolResult.content) { + const resultText = typeof toolResult.content === "string" ? toolResult.content : String(toolResult.content); + const truncated = resultText.length > 80 ? resultText.substring(0, 80) + "..." : resultText; + resultPreview = ` └ ${truncated}`; + } } - // Limit to 20 tool summaries - if (toolSummary.length < 20) { - toolSummary.push(` [${statusIcon}] ${displayName}`); + lines.push(`${statusIcon} ${displayName}`); + conversationLineCount++; + + if (resultPreview) { + lines.push(resultPreview); + conversationLineCount++; } + + lines.push(""); // Add blank line after tool execution + conversationLineCount++; } } } } - // Tool summary section - if (toolSummary.length > 0) { - lines.push("Tools/Commands:"); - lines.push(...toolSummary); - if (toolCounts.total > 20) { - lines.push(` ... and ${toolCounts.total - 20} more`); - } + if (conversationTruncated) { + lines.push("... (conversation truncated)"); lines.push(""); } @@ -1147,6 +1128,31 @@ function generatePlainTextSummary(logEntries, options = {}) { lines.push(` Duration: ${duration}`); } } + + // Count tools for statistics + let toolCounts = { total: 0, success: 0, error: 0 }; + for (const entry of logEntries) { + if (entry.type === "assistant" && entry.message?.content) { + for (const content of entry.message.content) { + if (content.type === "tool_use") { + const toolName = content.name; + // Skip internal tools + if (["Read", "Write", "Edit", "MultiEdit", "LS", "Grep", "Glob", "TodoWrite"].includes(toolName)) { + continue; + } + toolCounts.total++; + const toolResult = toolUsePairs.get(content.id); + const isError = toolResult?.is_error === true; + if (isError) { + toolCounts.error++; + } else { + toolCounts.success++; + } + } + } + } + } + if (toolCounts.total > 0) { lines.push(` Tools: ${toolCounts.success}/${toolCounts.total} succeeded`); } diff --git a/pkg/workflow/js/log_parser_shared.test.cjs b/pkg/workflow/js/log_parser_shared.test.cjs index be45003ca3..98536195a9 100644 --- a/pkg/workflow/js/log_parser_shared.test.cjs +++ b/pkg/workflow/js/log_parser_shared.test.cjs @@ -1422,7 +1422,7 @@ describe("log_parser_shared.cjs", () => { expect(result).toContain("Duration: 1m"); }); - it("should include tool usage statistics", async () => { + it("should include tool usage in conversation", async () => { const { generatePlainTextSummary } = await import("./log_parser_shared.cjs"); const logEntries = [ @@ -1450,19 +1450,19 @@ describe("log_parser_shared.cjs", () => { const result = generatePlainTextSummary(logEntries, { parserName: "Agent" }); - expect(result).toContain("Tools/Commands:"); - expect(result).toContain("[✓] bash: echo test"); - expect(result).toContain("[✗] github::create_issue"); + expect(result).toContain("Conversation:"); + expect(result).toContain("✓ $ echo test"); + expect(result).toContain("✗ github-create_issue"); expect(result).toContain("Tools: 1/2 succeeded"); }); - it("should limit tool summaries to 20 items", async () => { + it("should limit conversation output", async () => { const { generatePlainTextSummary } = await import("./log_parser_shared.cjs"); - // Create 25 tool uses + // Create 60 tool uses (which will exceed MAX_CONVERSATION_LINES of 50) const toolUses = []; const toolResults = []; - for (let i = 0; i < 25; i++) { + for (let i = 0; i < 60; i++) { toolUses.push({ type: "tool_use", id: `${i}`, name: "Bash", input: { command: `cmd${i}` } }); toolResults.push({ type: "tool_result", tool_use_id: `${i}`, is_error: false }); } @@ -1476,7 +1476,7 @@ describe("log_parser_shared.cjs", () => { const result = generatePlainTextSummary(logEntries, { parserName: "Agent" }); - expect(result).toContain("... and 5 more"); + expect(result).toContain("... (conversation truncated)"); }); it("should include token usage and cost", async () => { @@ -1498,7 +1498,7 @@ describe("log_parser_shared.cjs", () => { expect(result).toContain("Cost: $0.0025"); }); - it("should skip internal tools in summary", async () => { + it("should skip internal tools in conversation", async () => { const { generatePlainTextSummary } = await import("./log_parser_shared.cjs"); const logEntries = [ @@ -1529,12 +1529,12 @@ describe("log_parser_shared.cjs", () => { const result = generatePlainTextSummary(logEntries, { parserName: "Agent" }); // Should only show Bash, not Read or Write - expect(result).toContain("bash: test"); + expect(result).toContain("✓ $ test"); expect(result).not.toContain("Read"); expect(result).not.toContain("Write"); }); - it("should include Available Tools section from init entry", async () => { + it("should include conversation section", async () => { const { generatePlainTextSummary } = await import("./log_parser_shared.cjs"); const logEntries = [ @@ -1561,20 +1561,11 @@ describe("log_parser_shared.cjs", () => { const result = generatePlainTextSummary(logEntries, { parserName: "Agent" }); - expect(result).toContain("Available Tools:"); - expect(result).toContain("Builtin: 4 tools"); - expect(result).toContain("bash, view, create, edit"); - expect(result).toContain("Git/GitHub: 2 tools"); - expect(result).toContain("github::search_issues, github::create_issue"); - expect(result).toContain("Playwright: 1 tool"); - expect(result).toContain("playwright::navigate"); - expect(result).toContain("Safe Outputs: 2 tools"); - expect(result).toContain("create_issue, add_comment"); - expect(result).toContain("Custom Agents: 2 tools"); - expect(result).toContain("create-agentic-workflow, debug-agentic-workflow"); + expect(result).toContain("Conversation:"); + expect(result).toContain("Statistics:"); }); - it("should handle empty tools list gracefully", async () => { + it("should handle empty conversation gracefully", async () => { const { generatePlainTextSummary } = await import("./log_parser_shared.cjs"); const logEntries = [ @@ -1584,8 +1575,9 @@ describe("log_parser_shared.cjs", () => { const result = generatePlainTextSummary(logEntries, { parserName: "Agent" }); - // Should not contain Available Tools section if no tools - expect(result).not.toContain("Available Tools:"); + // Should contain Conversation section but no content + expect(result).toContain("Conversation:"); + expect(result).toContain("Statistics:"); }); it("should work without init entry", async () => { @@ -1597,7 +1589,86 @@ describe("log_parser_shared.cjs", () => { // Should work without init entry expect(result).toContain("=== Agent Execution Summary ==="); - expect(result).not.toContain("Available Tools:"); + expect(result).toContain("Conversation:"); + }); + + it("should include agent response text in conversation", async () => { + const { generatePlainTextSummary } = await import("./log_parser_shared.cjs"); + + const logEntries = [ + { type: "system", subtype: "init", model: "test-model" }, + { + type: "assistant", + message: { + content: [ + { type: "text", text: "I'll help you with that task." }, + { type: "tool_use", id: "1", name: "Bash", input: { command: "echo hello" } }, + ], + }, + }, + { + type: "user", + message: { + content: [{ type: "tool_result", tool_use_id: "1", is_error: false, content: "hello" }], + }, + }, + { + type: "assistant", + message: { + content: [{ type: "text", text: "The command executed successfully!" }], + }, + }, + { type: "result", num_turns: 2 }, + ]; + + const result = generatePlainTextSummary(logEntries, { parserName: "Agent" }); + + expect(result).toContain("Conversation:"); + expect(result).toContain("Agent: I'll help you with that task."); + expect(result).toContain("✓ $ echo hello"); + expect(result).toContain("Agent: The command executed successfully!"); + }); + + it("should truncate long agent responses", async () => { + const { generatePlainTextSummary } = await import("./log_parser_shared.cjs"); + + const longText = "a".repeat(600); // Longer than MAX_TEXT_LENGTH of 500 + const logEntries = [ + { type: "system", subtype: "init" }, + { + type: "assistant", + message: { + content: [{ type: "text", text: longText }], + }, + }, + { type: "result", num_turns: 1 }, + ]; + + const result = generatePlainTextSummary(logEntries, { parserName: "Agent" }); + + expect(result).toContain("Agent: " + "a".repeat(500) + "..."); + expect(result).not.toContain("a".repeat(600)); + }); + + it("should handle multi-line agent responses", async () => { + const { generatePlainTextSummary } = await import("./log_parser_shared.cjs"); + + const logEntries = [ + { type: "system", subtype: "init" }, + { + type: "assistant", + message: { + content: [{ type: "text", text: "Line 1\nLine 2\nLine 3" }], + }, + }, + { type: "result", num_turns: 1 }, + ]; + + const result = generatePlainTextSummary(logEntries, { parserName: "Agent" }); + + expect(result).toContain("Agent: Line 1"); + expect(result).toContain("Agent: Line 2"); + expect(result).toContain("Agent: Line 3"); }); }); });