(context: ToolUseContext, phase: 'before' | 'after')
| 271 | } |
| 272 | |
| 273 | function buildPayload(context: ToolUseContext, phase: 'before' | 'after') { |
| 274 | const stdout = process.stdout as NodeJS.WriteStream |
| 275 | const ink = getInk(stdout) |
| 276 | const tmuxPane = captureTmuxPane() |
| 277 | return { |
| 278 | phase, |
| 279 | createdAt: new Date().toISOString(), |
| 280 | pid: process.pid, |
| 281 | cwd: process.cwd(), |
| 282 | stdout: { |
| 283 | isTTY: stdout.isTTY, |
| 284 | columns: stdout.columns, |
| 285 | rows: stdout.rows, |
| 286 | }, |
| 287 | appState: { |
| 288 | expandedView: context.getAppState?.().expandedView, |
| 289 | verbose: context.getAppState?.().verbose, |
| 290 | }, |
| 291 | ink: getInkSummary(stdout), |
| 292 | rendererStructuralProbe: buildRendererStructuralProbe(ink, tmuxPane), |
| 293 | tmuxPane, |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | function writePayload(path: string, payload: unknown): void { |
| 298 | writeFileSync(path, `${JSON.stringify(payload, null, 2)}\n`, 'utf8') |
no test coverage detected