Documentation
¶
Overview ¶
Package transcript is the operator's read projection over mast's sessions: list them, show one — its state, its pending interrupts, the edits and captures its approvals recorded — export its approval decisions, and look up a resume token. It reads the same ADK session store a daemon or a library embed writes through, so a session written by either reads identically here.
It is the read half. The writes — pause and abort markers, interrupt bookkeeping, token consumption, auto-resume attempts — are the daemon's and the root package's, and live under internal/ (#301). To pause or resume from Go, use mast.Pause, mast.ResumeSession and mast.ResumeByToken.
The record types are aliases of the store's own, so a value from mast.ListSessions or mast.Pause is the same type as one from here.
Index ¶
- Constants
- Variables
- func ValidReasons() []string
- type Detail
- type ExportMeta
- type ExportOptions
- type PauseHandle
- type PauseRecord
- type PauseSpec
- type PendingInput
- type Reason
- type Store
- func (s *Store) Decisions(ctx context.Context, userID, sessionID string) ([]approval.Decision, error)
- func (s *Store) ExportDecisions(ctx context.Context, w io.Writer, opts ExportOptions) (int, error)
- func (s *Store) FindToken(ctx context.Context, token string) (*PauseRecord, error)
- func (s *Store) Get(ctx context.Context, userID, sessionID string) (*Detail, error)
- func (s *Store) List(ctx context.Context, userID string) ([]Summary, error)
- type Summary
Constants ¶
const ( StatePaused = itr.StatePaused StateAborted = itr.StateAborted StateInterrupted = itr.StateInterrupted StateIdle = itr.StateIdle )
Session states, as Detail.State and Summary.State report them.
const ( AwaitingApproval = itr.AwaitingApproval AwaitingInput = itr.AwaitingInput )
What a session is waiting on, as Detail.Awaiting reports it.
const ( PlaneGate = itr.PlaneGate PlaneInterrupt = itr.PlaneInterrupt )
Pause planes, as recorded in PauseRecord.Plane.
const ( ReasonBudgetExhaustion = itr.ReasonBudgetExhaustion ReasonWatchdogAnomaly = itr.ReasonWatchdogAnomaly ReasonCostCoolDown = itr.ReasonCostCoolDown ReasonMaintenanceWindow = itr.ReasonMaintenanceWindow ReasonRateLimitBackoff = itr.ReasonRateLimitBackoff ReasonAmbiguity = itr.ReasonAmbiguity ReasonOperator = itr.ReasonOperator ReasonA2ATaskPending = itr.ReasonA2ATaskPending ReasonOther = itr.ReasonOther )
Pause reasons a PauseSpec may carry; ValidReasons lists them.
const ( RedactionNone = itr.RedactionNone RedactionApproverDigest = itr.RedactionApproverDigest )
Redaction modes for ExportOptions.
const DefaultTokenTTL = itr.DefaultTokenTTL
DefaultTokenTTL is how long a resume token lives when a PauseSpec names no TokenTTL.
Variables ¶
var ( ErrNotFound = itr.ErrNotFound ErrTokenNotFound = itr.ErrTokenNotFound ErrTokenExpired = itr.ErrTokenExpired ErrAlreadyResumed = itr.ErrAlreadyResumed )
Errors the read methods and mast's resume calls return; compare with errors.Is.
Functions ¶
func ValidReasons ¶ added in v0.2.0
func ValidReasons() []string
ValidReasons lists the pause reasons a PauseSpec may carry.
Types ¶
type ExportMeta ¶ added in v0.4.0
type ExportMeta = itr.ExportMeta
ExportMeta is the header line ExportDecisions writes first.
type ExportOptions ¶ added in v0.4.0
type ExportOptions = itr.ExportOptions
ExportOptions selects and redacts what ExportDecisions writes.
type PauseHandle ¶ added in v0.2.0
type PauseHandle = itr.PauseHandle
PauseHandle is what mast.Pause returns: the token and its expiry.
type PauseRecord ¶ added in v0.2.0
type PauseRecord = itr.PauseRecord
PauseRecord is the durable record behind a resume token.
type PendingInput ¶
type PendingInput = itr.PendingInput
PendingInput is an interrupt a session is waiting on.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store reads mast's sessions out of an ADK session service.
func NewStore ¶
func NewStore(svc adksession.Service, appName string) *Store
NewStore reads sessions for appName ("mast" for anything mast wrote) out of svc — the same service passed as mast.Config.Sessions or opened by the daemon's --session-db.
func (*Store) Decisions ¶ added in v0.4.0
func (s *Store) Decisions(ctx context.Context, userID, sessionID string) ([]approval.Decision, error)
Decisions returns a session's durable approval decisions, oldest first.
func (*Store) ExportDecisions ¶ added in v0.4.0
ExportDecisions writes the decisions opts selects as JSONL — a meta line, then one mast.decision/v1 record per line — and returns how many records it wrote.
func (*Store) FindToken ¶ added in v0.2.0
FindToken returns the pause record behind a resume token, consumed or not. ErrTokenNotFound when there is none.