Skip to main content

Module debug_dump

Module debug_dump 

Source
Expand description

/debug support dump: rendered TUI lines plus session messages, written to {agent}/pi-debug.log.

Ports the observable shape of handleDebugCommand in the TypeScript modes/interactive/interactive-mode.ts: an ISO timestamp, terminal size, the fully rendered lines with their visible widths, and the agent messages as JSONL. Two additions over the reference, both required by the rewrite:

  • Redaction. The dump is written to the user’s disk and frequently shared for support, so credential-shaped substrings (bearer tokens, Authorization headers, sk- style keys, JSON api_key fields, and x-api-key headers) are masked before the file is written. Image data and ordinary text are preserved.
  • Atomic write. The file is written to a sibling temporary path and renamed into place, so a crash mid-write never leaves a half dump.

Structs§

DebugDumpInput
Input captured for a debug dump.

Functions§

redact_secrets
Mask credential-shaped substrings in text.
render_debug_dump
Render a debug dump to its full text form, with secrets redacted.
write_debug_dump
Render and atomically write a dump to the host debug log path.
write_debug_dump_atomically
Write content to path atomically (temp file + rename).
write_debug_dump_with
Render and atomically write a dump to the path resolved from agent_dir.