| 55 | } |
| 56 | |
| 57 | function toolInputFull(name, input) { |
| 58 | if (!input) return ''; |
| 59 | switch (name) { |
| 60 | case 'Bash': return input.command || ''; |
| 61 | case 'Read': return input.file_path || ''; |
| 62 | case 'Write': return `${input.file_path || ''}\n${'─'.repeat(30)}\n${trunc(input.content, 800)}`; |
| 63 | case 'Edit': { |
| 64 | let s = (input.file_path || '') + '\n'; |
| 65 | if (input.old_string !== undefined) s += `- ${trunc(input.old_string, 300)}\n+ ${trunc(input.new_string, 300)}`; |
| 66 | return s; |
| 67 | } |
| 68 | case 'Glob': return `pattern: ${input.pattern}${input.path ? '\npath: ' + input.path : ''}`; |
| 69 | case 'Grep': return `pattern: ${input.pattern}${input.path ? '\npath: ' + input.path : ''}`; |
| 70 | case 'WebFetch': return `${input.url}\n${input.prompt || ''}`; |
| 71 | case 'WebSearch': return input.query || ''; |
| 72 | case 'Task': return `[${input.subagent_type || 'agent'}] ${input.description || ''}\n${trunc(input.prompt, 300)}`; |
| 73 | case 'Skill': { |
| 74 | const tags = []; |
| 75 | if (input.name) tags.push(`name: ${input.name}`); |
| 76 | if (input.skill) tags.push(`skill: ${input.skill}`); |
| 77 | if (input.skill_name) tags.push(`skill_name: ${input.skill_name}`); |
| 78 | if (input.id) tags.push(`id: ${input.id}`); |
| 79 | let argsSummary = ''; |
| 80 | if (typeof input.args === 'string') argsSummary = `args: <hidden ${input.args.length} chars>`; |
| 81 | else if (input.args && typeof input.args === 'object') argsSummary = `args keys: ${Object.keys(input.args).join(', ')}`; |
| 82 | else if (input.args !== undefined) argsSummary = `args: <${typeof input.args}>`; |
| 83 | return [tags.join('\n'), argsSummary].filter(Boolean).join('\n') || 'Skill input hidden'; |
| 84 | } |
| 85 | default: return JSON.stringify(input, null, 2); |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | // ---- Markdown ---- |
| 90 | export function renderMd(text) { |