( args: string, _context: ToolUseContext, )
| 3 | import type { LocalCommandResult } from '../../types/command.js' |
| 4 | |
| 5 | export async function call( |
| 6 | args: string, |
| 7 | _context: ToolUseContext, |
| 8 | ): Promise<LocalCommandResult> { |
| 9 | const trace = getRenderTrace() |
| 10 | const cleanArgs = args.trim().toLowerCase() |
| 11 | |
| 12 | if (cleanArgs === 'full') { |
| 13 | trace.armFullCapture() |
| 14 | return { |
| 15 | type: 'text', |
| 16 | value: |
| 17 | 'Full capture armed for next 32 natural frames with row content and ANSI. ' + |
| 18 | 'No repaint triggered — corruption state is preserved. ' + |
| 19 | 'Privacy warning: traces may contain secrets. ' + |
| 20 | 'Type /render-trace to dump when ready.', |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | if (cleanArgs === 'status') { |
| 25 | const status = trace.status |
| 26 | const remaining = trace.framesUntilFullDisable |
| 27 | return { |
| 28 | type: 'text', |
| 29 | value: `Status: ${status} | Full frames remaining: ${remaining}`, |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | // Default: dump |
| 34 | try { |
| 35 | const path = trace.dumpSync() |
| 36 | return { type: 'text', value: `Render trace dumped to:\n${path}` } |
| 37 | } catch (err) { |
| 38 | const message = err instanceof Error ? err.message : String(err) |
| 39 | return { type: 'text', value: `Failed to dump trace: ${message}` } |
| 40 | } |
| 41 | } |
nothing calls this directly
no test coverage detected