Skip to main content

Module export

Module export 

Source
Expand description

Trace export (Task 12): metadata export of persisted synaps-request-trace/1 records, explicit redacted content export, and the recursive secret redaction they share.

  • Metadata export (synaps trace export <id> --metadata-only): reads the private trace JSONL, validates every line as a RequestTrace, selects the records whose turn_id or request_id equals the given (validated, bounded) TraceId, and writes them to a user-selected private file (0600, parent 0700), refusing symlinks and pre-existing targets. No network, no content — the records are structurally metadata-only.
  • Content export (--include-content --allow-content-export): fail-closed. It requires BOTH flags in the same invocation and an existing ephemeral capture bundle produced by /trace next content (see trace::controls). The bundle is re-redacted (defense in depth), written under its own clearly-labeled schema (synaps-trace-content-export/1, never synaps-request-trace/1), and the capture bundle is deleted (consumed). Expired bundles are deleted and refused.

Structs§

ContentExport
On-disk shape of the content export artifact. NOT a request trace.
MetadataExportStats
Result of a metadata export.

Enums§

ExportError
Typed export failure. Every variant is metadata-only (paths, counts).

Constants§

CONTENT_EXPORT_SCHEMA
Schema tag of the content-export artifact. Deliberately distinct from both the request-trace and capture schemas.

Functions§

export_content
Export the ephemeral capture bundle for id into a fresh private file. Fail-closed: requires allow_content_export, an existing unexpired bundle, and re-redacts before writing. Consumes (deletes) the bundle.
export_metadata
Export all records whose turn_id or request_id equals id from the trace JSONL at trace_log into a fresh private file at output.
redact_value
Recursively redact credential-bearing keys and obvious secret-shaped values in place. Returns the number of redactions applied. Applies to nested objects and arrays at any depth.
sweep_expired_captures
Delete any expired capture bundles in dir (bounded retention sweep).