entiresession

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package entiresession maps Entire checkpoint snapshots into shared session graphs, delegating native transcripts where a mapper exists.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(checkpoint *entirecheckpoint.Checkpoint) ([]Result, *Report, error)

Build maps every wrapped session in one checkpoint. Snapshot selection is a caller concern: Result exposes the stable identity and created_at needed to choose the latest snapshot before persistence.

func BuildWith

func BuildWith(checkpoint *entirecheckpoint.Checkpoint, profile traceprocessing.MappingProfile) ([]Result, *Report, error)

BuildWith maps with explicit product policy, including the delegated mappers.

Types

type Accounting

type Accounting struct {
	Total     int            `json:"total"`
	Mapped    int            `json:"mapped"`
	Evidence  int            `json:"envelope_evidence"`
	Discarded map[string]int `json:"discarded,omitempty"`
}

func (Accounting) Accounted

func (a Accounting) Accounted() int

func (Accounting) Balanced

func (a Accounting) Balanced() bool

func (Accounting) DiscardReasons

func (a Accounting) DiscardReasons() []string

type CompactAccounting

type CompactAccounting struct {
	Lines  Accounting `json:"lines"`
	Blocks Accounting `json:"blocks"`
}

type DelegateReport

type DelegateReport struct {
	SessionID string                        `json:"session_id"`
	Agent     string                        `json:"agent"`
	Claude    *claudesession.Report         `json:"claude,omitempty"`
	Codex     *codexsession.Report          `json:"codex,omitempty"`
	Cursor    *cursorsession.PortableReport `json:"cursor,omitempty"`
	// Tasks are the checkpoint's subagent transcripts this session claimed,
	// and whether each became a nested session.
	Tasks    []DelegatedTask `json:"tasks,omitempty"`
	Warnings []string        `json:"warnings,omitempty"`
}

type DelegatedTask

type DelegatedTask struct {
	Directory string `json:"directory"`
	Nested    bool   `json:"nested"`
}

type EnvelopeData

type EnvelopeData struct {
	StartedAtFallback *time.Time                 `json:"started_at_fallback,omitempty"`
	EndedAtFallback   *time.Time                 `json:"ended_at_fallback,omitempty"`
	GitBranchFill     *string                    `json:"git_branch_fill,omitempty"`
	Outcome           session.Outcome            `json:"outcome"`
	OutcomeEvidence   string                     `json:"outcome_evidence"`
	Attributes        []session.SessionAttribute `json:"session_attributes,omitempty"`
	// MetadataFiles are the session's files_touched entries, distinct and in
	// metadata order. They are repository-relative, but they are the working
	// tree's changes over the checkpoint window rather than this session's own
	// edits: Entire records what changed while the session was active, and in a
	// multi-session checkpoint it often hands every session the same list. No
	// FileTouch row can carry them (see FilesUnrepresentable below); the ingest
	// layer decides whether they become session-scoped evidence
	// (entireingest/README.md, "Metadata file lists").
	MetadataFiles []string `json:"metadata_files,omitempty"`
	// MetadataFilesShared is true when another session in the same checkpoint
	// reports the identical non-empty files_touched list. The list is then the
	// checkpoint's diff and names nobody's work in particular.
	MetadataFilesShared bool                 `json:"metadata_files_shared,omitempty"`
	FileTouches         []session.FileTouch  `json:"file_touches,omitempty"`
	TokenUsage          []session.TokenUsage `json:"token_usage,omitempty"`
	VendorIDs           []session.VendorID   `json:"vendor_ids,omitempty"`
	Report              EnvelopeReport       `json:"report"`
}

EnvelopeData is the standalone Entire-owned enrichment for a graph. The future ranked ingest can apply these rows to a richer graph without rebuilding or replacing its transcript-derived tree.

func Envelope

func Envelope(graph *session.Graph, snapshot *entirecheckpoint.SessionSnapshot, checkpointID string, createdAt time.Time) (*EnvelopeData, error)

Envelope computes the metadata layer without mutating graph. File evidence is compared with graph here so enrichment remains path-boundary additive.

func EnvelopeWith

func EnvelopeWith(graph *session.Graph, snapshot *entirecheckpoint.SessionSnapshot, checkpointID string, createdAt time.Time, profile traceprocessing.MappingProfile) (*EnvelopeData, error)

func (*EnvelopeData) Apply

func (e *EnvelopeData) Apply(graph *session.Graph)

Apply fills only missing session fields, sets checkpoint-proven committed outcome, and appends rows not already present. It never removes transcript rows and is idempotent on one in-memory graph.

type EnvelopeReport

type EnvelopeReport struct {
	AttributesAdded          int `json:"attributes_added"`
	VendorIDsAdded           int `json:"vendor_ids_added"`
	AggregateUsageAdded      int `json:"aggregate_usage_added"`
	AggregateUsageAttributed int `json:"aggregate_usage_attributed"`
	AggregateUsageRejected   int `json:"aggregate_usage_rejected"`
	FilesConsidered          int `json:"files_considered"`
	FilesAlreadyCovered      int `json:"files_already_covered"`
	FilesUnrepresentable     int `json:"files_unrepresentable"`
	FilesShared              int `json:"files_shared"`
	HashChecked              int `json:"hash_checked"`
	HashMismatches           int `json:"hash_mismatches"`
	// contains filtered or unexported fields
}

func (EnvelopeReport) MarshalJSON

func (r EnvelopeReport) MarshalJSON() ([]byte, error)

MarshalJSON keeps local report fields unchanged while hosted reports include the rejected-aggregate counter even when zero.

type FidelityRank

type FidelityRank int
const (
	FidelityDelegated    FidelityRank = 2
	FidelityCompact      FidelityRank = 3
	FidelityMetadataOnly FidelityRank = 4
)

type Report

type Report struct {
	Sessions        int               `json:"sessions"`
	FailedSnapshots int               `json:"failed_snapshots"`
	Rows            Rows              `json:"rows"`
	Compact         CompactAccounting `json:"compact"`
	Metadata        Accounting        `json:"metadata"`
	Envelope        EnvelopeReport    `json:"envelope"`
	Delegated       []DelegateReport  `json:"delegated,omitempty"`
	// Tasks accounts for the checkpoint's subagent directories (tasks.go).
	Tasks    *Accounting            `json:"tasks,omitempty"`
	Shape    entirecheckpoint.Shape `json:"shape"`
	Findings []string               `json:"findings,omitempty"`
}

Report accounts for all Entire-owned source records and carries delegated mapper reports without rewriting them.

func (*Report) Balanced

func (r *Report) Balanced() bool

type Result

type Result struct {
	Graph     *session.Graph `json:"graph"`
	SessionID string         `json:"session_id"`
	// Vendor is the wrapped agent's canonical slug, never "entire" unless the
	// checkpoint named no agent at all. The ingest layer stores it as the
	// session's vendor, so how Entire spells an agent stays in this package.
	Vendor           string    `json:"vendor,omitempty"`
	CheckpointID     string    `json:"checkpoint_id"`
	CreatedAt        time.Time `json:"created_at"`
	CheckpointsCount int       `json:"checkpoints_count,omitempty"`
	// SourceBlobHash is the hash of the transcript the snapshot was mapped
	// from, computed from its bytes (sourceBlobHash), empty when it has none.
	SourceBlobHash string       `json:"source_blob_hash,omitempty"`
	Fidelity       FidelityRank `json:"fidelity_rank"`
	Warnings       []string     `json:"warnings,omitempty"`
	Error          string       `json:"error,omitempty"`
	Err            error        `json:"-"`
	// Envelope is the Entire-owned metadata layer, already applied to Graph. A
	// lower-fidelity arrival cannot replace a tree an upload owns, and this is
	// what it contributes instead (entireingest/README.md, "Coexistence with
	// uploads"). Not serialized: it is a view of rows the graph above already
	// carries.
	Envelope *EnvelopeData `json:"-"`
}

type Rows

type Rows struct {
	Sessions          int `json:"sessions"`
	UserInputs        int `json:"user_inputs"`
	ModelInvocations  int `json:"model_invocations"`
	AssistantMessages int `json:"assistant_messages"`
	ToolUses          int `json:"tool_uses"`
	ToolResults       int `json:"tool_results"`
	FileTouches       int `json:"file_touches"`
	Attributes        int `json:"session_attributes"`
	TokenUsage        int `json:"token_usage"`
	VendorIDs         int `json:"vendor_ids"`
}

Jump to

Keyboard shortcuts

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