backfill

package
v0.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TranscriptUploadOptions added in v0.16.0

type TranscriptUploadOptions struct {
	// ProjectDir is one Claude Code project directory
	// (~/.claude/projects/<flattened-cwd>) holding <session>.jsonl
	// files and per-session subagents/ directories.
	ProjectDir string

	// SessionIDs filters which sessions upload; empty means every
	// .jsonl in the directory.
	SessionIDs []string

	// IngestURL is the tapes-ingest base URL.
	IngestURL string

	// HarnessID tags the session envelope; Claude Code transcripts are
	// "claude".
	HarnessID string

	Verbose bool
	Logf    func(format string, args ...any)
}

TranscriptUploadOptions configures a harness-transcript upload run.

type TranscriptUploadResult added in v0.16.0

type TranscriptUploadResult struct {
	Sessions int      `json:"sessions"`
	Files    int      `json:"files"`
	Uploaded int      `json:"uploaded"`
	Deduped  int      `json:"deduped"`
	Failed   int      `json:"failed"`
	Failures []string `json:"failures,omitempty"`
}

TranscriptUploadResult summarizes an upload run.

func UploadTranscripts added in v0.16.0

func UploadTranscripts(ctx context.Context, opts TranscriptUploadOptions) (*TranscriptUploadResult, error)

UploadTranscripts pushes harness transcripts (main + subagents) into the tapes raw layer via POST /v1/ingest/transcript. Idempotent: the server dedups by content version, so re-running uploads nothing for unchanged files and a new version for grown ones.

type WireTraceOptions added in v0.16.0

type WireTraceOptions struct {
	// CapturesDir is the paperd wire-trace root holding turn-* bundles
	// (request.json + response.sse + meta.json per turn).
	CapturesDir string

	// IngestURL is the base URL of a tapes-ingest server, e.g.
	// "http://127.0.0.1:8090". The backfill POSTs one envelope per
	// captured turn to {IngestURL}/v1/ingest.
	IngestURL string

	// SessionIDs filters replay to bundles whose captured
	// X-Tapes-Harness-Session-Id matches; empty replays everything.
	SessionIDs []string

	// DryRun parses and reduces every bundle but skips the POST.
	DryRun bool

	// Verbose logs each turn's outcome to Logf.
	Verbose bool

	// Logf receives progress output; defaults to a no-op.
	Logf func(format string, args ...any)
}

WireTraceOptions configures a wire-trace → ingest backfill run.

type WireTraceResult added in v0.16.0

type WireTraceResult struct {
	Scanned  int      `json:"scanned"`
	Posted   int      `json:"posted"`
	RawOnly  int      `json:"raw_only"`
	Skipped  int      `json:"skipped"`
	Failed   int      `json:"failed"`
	Failures []string `json:"failures,omitempty"`
}

WireTraceResult summarizes a wire-trace backfill run.

func WireTrace added in v0.16.0

func WireTrace(ctx context.Context, opts WireTraceOptions) (*WireTraceResult, error)

WireTrace replays paperd wire-trace capture bundles through a tapes-ingest server, reconstructing the envelope tapes-extproc would have dispatched live: verbatim request bytes, response reduced with the same shared capture reducer, meta rebuilt from the bundle, and the session block recovered from the captured X-Tapes-* headers.

The whole flow is idempotent end to end: the raw layer dedupes on (org, request_id) — the turn directory name, stable across re-runs — and node inserts are content-addressed ON CONFLICT DO NOTHING, so turns that already landed via live capture reproduce their existing nodes byte for byte and only gain the previously-missing raw row.

Only provider chat-completion calls are replayed (…/v1/messages); auxiliary traffic in the trace (count_tokens, tapes API reads) is skipped.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL