Documentation
¶
Overview ¶
Package session owns Peen's durable transport-neutral session transcript.
Index ¶
- Constants
- Variables
- type AgentRunEventInput
- type AgentRunEventPage
- type AgentRunPage
- type AppendJobOutputInput
- type CompactionInput
- type CompactionPage
- type CreateJobInput
- type CreateModelCallInput
- type CreateModelRunInput
- type CreateSessionNoticeInput
- type EventInput
- type EventPage
- type FinalizeAgentRunInput
- type FinalizeJobInput
- type FinalizeModelCallInput
- type FinalizeModelRunInput
- type FinalizeTurnInput
- type History
- type JobOutputPage
- type JobPage
- type JobSignalRequestPage
- type Lease
- type ListAgentRunEventsOptions
- type ListAgentRunsOptions
- type ListCompactionsOptions
- type ListEventsOptions
- type ListJobOutputOptions
- type ListJobSignalRequestsOptions
- type ListJobsOptions
- type ListMessagesOptions
- type ListModelCallsOptions
- type ListModelRunsOptions
- type ListSessionNoticesOptions
- type ListTurnsOptions
- type MessageInput
- type MessagePage
- type ModelCallPage
- type ModelRunPage
- type NoticePage
- type OpenSessionOptions
- type OpenSessionResult
- type Options
- type PageOrder
- type RecordJobSignalInput
- type RecordModelCallRetriesInput
- type StartAgentRunInput
- type StartTurnInput
- type Store
- func (s *Store) AcquireTurn(ctx context.Context, sessionID uuid.UUID, input StartTurnInput) (Lease, error)
- func (s *Store) AppendAgentRunEvent(ctx context.Context, sessionID uuid.UUID, agentRunID uuid.UUID, ...) (*models.AgentRunEvent, error)
- func (s *Store) AppendCheckpoint(ctx context.Context, lease Lease, messages []MessageInput, events []EventInput) error
- func (s *Store) AppendJobOutput(ctx context.Context, sessionID uuid.UUID, jobID uuid.UUID, ...) (*models.JobOutputLine, error)
- func (s *Store) Cancel(ctx context.Context, sessionID uuid.UUID) (bool, error)
- func (s *Store) CompletedHistory(ctx context.Context, sessionID uuid.UUID) (*History, error)
- func (s *Store) CreateAgentRun(ctx context.Context, sessionID uuid.UUID, input StartAgentRunInput) (*models.AgentRun, error)
- func (s *Store) CreateCompaction(ctx context.Context, sessionID uuid.UUID, input CompactionInput) (*models.Compaction, error)
- func (s *Store) CreateJob(ctx context.Context, sessionID uuid.UUID, input CreateJobInput) (*models.Job, error)
- func (s *Store) CreateModelCall(ctx context.Context, sessionID uuid.UUID, modelRunID uuid.UUID, ...) (*models.ModelCall, error)
- func (s *Store) CreateModelRun(ctx context.Context, sessionID uuid.UUID, input CreateModelRunInput) (*models.ModelRun, error)
- func (s *Store) CreateOrResume(ctx context.Context, requestedSessionID *uuid.UUID, options OpenSessionOptions) (*OpenSessionResult, error)
- func (s *Store) CreateSessionNotice(ctx context.Context, sessionID uuid.UUID, input CreateSessionNoticeInput) (*models.SessionNotice, error)
- func (s *Store) DrainSessionNotices(ctx context.Context, sessionID uuid.UUID) ([]*models.SessionNotice, error)
- func (s *Store) FinalizeAgentRun(ctx context.Context, sessionID uuid.UUID, agentRunID uuid.UUID, ...) (*models.AgentRun, error)
- func (s *Store) FinalizeJob(ctx context.Context, sessionID uuid.UUID, jobID uuid.UUID, ...) (*models.Job, error)
- func (s *Store) FinalizeModelCall(ctx context.Context, sessionID uuid.UUID, modelRunID uuid.UUID, ...) (*models.ModelCall, error)
- func (s *Store) FinalizeModelRun(ctx context.Context, sessionID uuid.UUID, modelRunID uuid.UUID, ...) (*models.ModelRun, error)
- func (s *Store) FinalizeTurn(ctx context.Context, lease Lease, input FinalizeTurnInput) error
- func (s *Store) Get(ctx context.Context, sessionID uuid.UUID) (*models.Session, error)
- func (s *Store) GetAgentRun(ctx context.Context, sessionID uuid.UUID, agentRunID uuid.UUID) (*models.AgentRun, error)
- func (s *Store) GetCompaction(ctx context.Context, sessionID uuid.UUID, compactionID uuid.UUID) (*models.Compaction, error)
- func (s *Store) GetContextSnapshot(ctx context.Context, sessionID uuid.UUID, hash string) (*models.ContextSnapshot, error)
- func (s *Store) GetJob(ctx context.Context, sessionID uuid.UUID, jobID uuid.UUID) (*models.Job, error)
- func (s *Store) GetModelRun(ctx context.Context, sessionID uuid.UUID, modelRunID uuid.UUID) (*models.ModelRun, error)
- func (s *Store) GetPromptSnapshot(ctx context.Context, sessionID uuid.UUID, hash string) (*models.PromptSnapshot, error)
- func (s *Store) IsActive(sessionID uuid.UUID) bool
- func (s *Store) LatestCompaction(ctx context.Context, sessionID uuid.UUID) (*models.Compaction, error)
- func (s *Store) ListAgentRunEvents(ctx context.Context, sessionID uuid.UUID, agentRunID uuid.UUID, ...) (*AgentRunEventPage, error)
- func (s *Store) ListAgentRuns(ctx context.Context, sessionID uuid.UUID, options ListAgentRunsOptions) (*AgentRunPage, error)
- func (s *Store) ListCompactions(ctx context.Context, sessionID uuid.UUID, options ListCompactionsOptions) (*CompactionPage, error)
- func (s *Store) ListEvents(ctx context.Context, sessionID uuid.UUID, options ListEventsOptions) (*EventPage, error)
- func (s *Store) ListJobOutput(ctx context.Context, sessionID uuid.UUID, jobID uuid.UUID, ...) (*JobOutputPage, error)
- func (s *Store) ListJobSignalRequests(ctx context.Context, sessionID uuid.UUID, jobID uuid.UUID, ...) (*JobSignalRequestPage, error)
- func (s *Store) ListJobs(ctx context.Context, sessionID uuid.UUID, options ListJobsOptions) (*JobPage, error)
- func (s *Store) ListMessages(ctx context.Context, sessionID uuid.UUID, options ListMessagesOptions) (*MessagePage, error)
- func (s *Store) ListModelCalls(ctx context.Context, sessionID uuid.UUID, modelRunID uuid.UUID, ...) (*ModelCallPage, error)
- func (s *Store) ListModelRuns(ctx context.Context, sessionID uuid.UUID, options ListModelRunsOptions) (*ModelRunPage, error)
- func (s *Store) ListSessionNotices(ctx context.Context, sessionID uuid.UUID, options ListSessionNoticesOptions) (*NoticePage, error)
- func (s *Store) ListTurns(ctx context.Context, sessionID uuid.UUID, options ListTurnsOptions) (*TurnPage, error)
- func (s *Store) OpenWorkspace(ctx context.Context, workspace string, options OpenSessionOptions) (*OpenSessionResult, error)
- func (s *Store) RecordJobSignal(ctx context.Context, sessionID uuid.UUID, jobID uuid.UUID, ...) (*models.JobSignalRequest, error)
- func (s *Store) RecordModelCallRetries(ctx context.Context, sessionID uuid.UUID, modelRunID uuid.UUID, ...) error
- func (s *Store) RecoverInterrupted(ctx context.Context) (int, error)
- func (s *Store) RecoverInterruptedAgentRuns(ctx context.Context) (int, error)
- func (s *Store) RecoverInterruptedJobs(ctx context.Context) (int, error)
- func (s *Store) RecoverInterruptedModelRuns(ctx context.Context) (int, error)
- func (s *Store) RegisterCancellation(lease Lease, cancel context.CancelFunc)
- func (s *Store) ReleaseTurn(lease Lease)
- func (s *Store) RequestAgentRunCancellation(ctx context.Context, sessionID uuid.UUID, agentRunID uuid.UUID) (*models.AgentRun, bool, error)
- func (s *Store) SaveContextSnapshot(ctx context.Context, snapshot *models.ContextSnapshot) error
- func (s *Store) SavePromptSnapshot(ctx context.Context, snapshot *models.PromptSnapshot) error
- type TurnPage
Constants ¶
const ( // DefaultPageLimit is the API default for transcript pagination. DefaultPageLimit = 50 // MaximumPageLimit bounds one transcript page at the storage boundary. MaximumPageLimit = 200 )
Variables ¶
var ( // ErrSessionBusy reports a concurrent turn attempt for one session. ErrSessionBusy = commerr.ErrLockHeld // ErrInvalidPage reports invalid transcript pagination arguments. ErrInvalidPage = commerr.ErrValidationFailed )
Functions ¶
This section is empty.
Types ¶
type AgentRunEventInput ¶ added in v0.4.0
type AgentRunEventInput struct {
ID uuid.UUID
EventType string
PayloadJSON string
CreatedAt time.Time
}
AgentRunEventInput is one immutable child-agent event.
type AgentRunEventPage ¶ added in v0.4.0
type AgentRunEventPage struct {
Run *models.AgentRun
Items []*models.AgentRunEvent
NextCursor int64
HasMore bool
}
AgentRunEventPage is one complete ordered child-event window.
type AgentRunPage ¶ added in v0.4.0
AgentRunPage is one complete child-run page.
type AppendJobOutputInput ¶ added in v0.4.0
type AppendJobOutputInput struct {
ID uuid.UUID
Stream models.JobOutputStream
Content string
CreatedAt time.Time
}
AppendJobOutputInput is one immutable line in the combined process stream.
type CompactionInput ¶
type CompactionInput struct {
ID uuid.UUID
FromMessageID uuid.UUID
ToMessageID uuid.UUID
FromSequence int64
ToSequence int64
DirectFromSequence int64
DirectToSequence int64
Summary string
SourceMessageCount int64
InputTokenCount int64
SummaryTokenCount int64
ModelID string
PromptHash string
SupersedesCompactionID *uuid.UUID
}
CompactionInput stores one immutable replacement summary.
type CompactionPage ¶ added in v0.4.0
type CompactionPage struct {
Items []*models.Compaction
Limit int
Offset int
HasMore bool
}
CompactionPage is one complete session-local compaction page.
type CreateJobInput ¶ added in v0.4.0
type CreateJobInput struct {
ID uuid.UUID
TurnID uuid.UUID
ToolCallID string
PID int64
Purpose string
Command string
Directory string
StartedAt time.Time
}
CreateJobInput records a supervised process before its output is observed.
type CreateModelCallInput ¶ added in v0.4.0
type CreateModelCallInput struct {
ID uuid.UUID
Round int64
RequestMessagesJSON string
RequestToolsJSON string
StartedAt time.Time
}
CreateModelCallInput describes one outbound provider round before bytes leave Peen.
type CreateModelRunInput ¶ added in v0.4.0
type CreateModelRunInput struct {
ID uuid.UUID
TurnID uuid.UUID
AgentRunID *uuid.UUID
Stage models.ModelRunStage
ModelReference string
ConnectionName string
RequestedModelID string
RequestSettingsJSON string
StartedAt time.Time
}
CreateModelRunInput describes one logical provider invocation before its first outbound round starts.
type CreateSessionNoticeInput ¶ added in v0.4.0
type CreateSessionNoticeInput struct {
ID uuid.UUID
Type string
Source string
Summary string
DataJSON string
Delivery models.NoticeDelivery
CreatedAt time.Time
}
CreateSessionNoticeInput describes an external or worker report before it is delivered to a model.
type EventInput ¶
type EventInput struct {
ID uuid.UUID
RequestID uuid.UUID
EventType string
PayloadJSON string
ParentToolCallID string
}
EventInput describes one exact internal or protocol event.
type FinalizeAgentRunInput ¶ added in v0.4.0
type FinalizeAgentRunInput struct {
State models.AgentRunState
ResponseText string
ResponseThinking string
ResponseMessagesJSON string
FinishReason string
PromptTokenCount int64
CompletionTokenCount int64
FailureClassification string
FailureDetail string
}
FinalizeAgentRunInput describes the durable terminal outcome of a child.
type FinalizeJobInput ¶ added in v0.4.0
FinalizeJobInput stores a job's terminal outcome exactly once.
type FinalizeModelCallInput ¶ added in v0.4.0
type FinalizeModelCallInput struct {
State models.ModelCallState
ResponseMessageJSON string
ResponseUsageJSON string
RetryAttemptsJSON string
RetryAttemptCount int64
PromptTokens int64
CompletionTokens int64
TotalTokens int64
ReasoningTokens int64
CacheReadTokens int64
CacheWriteTokens int64
CacheWriteLongTTLTokens int64
WastedPromptTokens int64
WastedCompletionTokens int64
WastedTotalTokens int64
TotalAttempts int64
ResponseModelID string
FinishReason string
ResponseCostAmount string
RetryCostAmount string
BilledCostAmount string
CostKnown bool
FailureClassification string
FailureDetail string
}
FinalizeModelCallInput records the complete result of one provider round.
type FinalizeModelRunInput ¶ added in v0.4.0
type FinalizeModelRunInput struct {
State models.ModelRunState
ResponseModelID string
ResponseText string
ResponseThinking string
ResponseMessagesJSON string
ResponseInjectionsJSON string
ResponseUsageJSON string
ResponseCostAmount string
RetryCostAmount string
BilledCostAmount string
CostKnown bool
FinishReason string
FailureClassification string
FailureDetail string
}
FinalizeModelRunInput stores every non-secret result of one logical model invocation, including aggregate usage across its provider rounds.
type FinalizeTurnInput ¶
type FinalizeTurnInput struct {
State models.TurnState
FailureClassification string
ContextSnapshotHash *string
PromptSnapshotHash *string
Messages []MessageInput
Events []EventInput
}
FinalizeTurnInput describes terminal turn state and durable references.
type History ¶
type History struct {
Compaction *models.Compaction
Messages []*models.Message
}
History is the active compaction followed by its uncovered completed tail.
type JobOutputPage ¶ added in v0.4.0
type JobOutputPage struct {
Job *models.Job
Items []*models.JobOutputLine
NextCursor int64
HasMore bool
}
JobOutputPage is one complete ordered output replay page.
type JobSignalRequestPage ¶ added in v0.4.0
type JobSignalRequestPage struct {
Job *models.Job
Items []*models.JobSignalRequest
Limit int
Offset int
HasMore bool
}
JobSignalRequestPage is one complete signal-request history page.
type ListAgentRunEventsOptions ¶ added in v0.4.0
ListAgentRunEventsOptions controls one replay window. Cursor is the next sequence number the caller has not seen yet, beginning at zero.
type ListAgentRunsOptions ¶ added in v0.4.0
type ListAgentRunsOptions struct {
Limit int
Offset int
State *models.AgentRunState
}
ListAgentRunsOptions controls a bounded child-run page.
type ListCompactionsOptions ¶ added in v0.4.0
ListCompactionsOptions controls a bounded page of compaction records.
type ListEventsOptions ¶ added in v0.4.0
ListEventsOptions controls a bounded page of durable protocol events.
type ListJobOutputOptions ¶ added in v0.4.0
type ListJobOutputOptions struct {
Cursor int64
Limit int
Stream *models.JobOutputStream
}
ListJobOutputOptions controls one ordered process-output replay window.
type ListJobSignalRequestsOptions ¶ added in v0.4.0
ListJobSignalRequestsOptions controls a bounded signal-request history page.
type ListJobsOptions ¶ added in v0.4.0
ListJobsOptions controls a bounded session-local process-job page.
type ListMessagesOptions ¶
ListMessagesOptions controls a bounded session-local message page.
type ListModelCallsOptions ¶ added in v0.4.0
ListModelCallsOptions controls one ordered provider-round page.
type ListModelRunsOptions ¶ added in v0.4.0
type ListModelRunsOptions struct {
Limit int
Offset int
Stage *models.ModelRunStage
State *models.ModelRunState
}
ListModelRunsOptions controls a bounded session-local model-run page.
type ListSessionNoticesOptions ¶ added in v0.4.0
ListSessionNoticesOptions controls a bounded page of notice history.
type ListTurnsOptions ¶ added in v0.4.0
ListTurnsOptions controls a bounded page of durable session turns.
type MessageInput ¶
type MessageInput struct {
ID uuid.UUID
Workspace string
Role models.MessageRole
Content string
ModelID string
Thinking string
ToolCallsJSON string
ToolCallID string
IsError bool
Incomplete bool
}
MessageInput describes a durable transcript record.
type MessagePage ¶
MessagePage is one complete limit-offset transcript page.
type ModelCallPage ¶ added in v0.4.0
type ModelCallPage struct {
Run *models.ModelRun
Items []*models.ModelCall
Limit int
Offset int
HasMore bool
}
ModelCallPage is one complete provider-round page for a model run.
type ModelRunPage ¶ added in v0.4.0
ModelRunPage is one complete model-run page.
type NoticePage ¶ added in v0.5.0
type NoticePage struct {
Items []*models.SessionNotice
Limit int
Offset int
HasMore bool
}
NoticePage is one complete session-local notice page.
type OpenSessionOptions ¶
OpenSessionOptions supplies immutable session attribution on creation.
type OpenSessionResult ¶
OpenSessionResult is a resolved session and whether this call created it.
type Options ¶
type Options struct {
Clock func() time.Time
NewID func() uuid.UUID
// MaxStoredMessageBytes bounds one message row of any role. An assistant
// or tool message has no caller-facing size limit, so without this a
// single tool result could grow the transcript without bound. Zero takes
// the package default.
MaxStoredMessageBytes int
}
Options supplies deterministic seams for the transport-neutral store.
type RecordJobSignalInput ¶ added in v0.4.0
type RecordJobSignalInput struct {
ID uuid.UUID
Signal models.JobSignal
Accepted bool
RequestedAt time.Time
}
RecordJobSignalInput records one accepted or no-op request to stop a job.
type RecordModelCallRetriesInput ¶ added in v0.4.0
RecordModelCallRetriesInput persists every retry that Elelem reports while a provider round remains active.
type StartAgentRunInput ¶ added in v0.4.0
type StartAgentRunInput struct {
ID uuid.UUID
ParentTurnID uuid.UUID
ParentAgentRunID *uuid.UUID
ParentToolCallID string
RequestID uuid.UUID
Name string
Definition models.AgentRunDefinition
Depth int64
Workspace string
ModelReference string
ModelID string
Task string
Instructions string
AllowedToolsJSON string
SystemPrompt string
StartedAt time.Time
}
StartAgentRunInput describes the immutable child-agent launch record.
type StartTurnInput ¶
type StartTurnInput struct {
RequestID uuid.UUID
Workspace string
Messages []MessageInput
Events []EventInput
}
StartTurnInput describes the durable beginning of an agent turn.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists sessions and protects each active session turn in-process.
func (*Store) AcquireTurn ¶
func (s *Store) AcquireTurn( ctx context.Context, sessionID uuid.UUID, input StartTurnInput, ) (Lease, error)
AcquireTurn starts one durable turn and records its initial transcript data.
func (*Store) AppendAgentRunEvent ¶ added in v0.4.0
func (s *Store) AppendAgentRunEvent( ctx context.Context, sessionID uuid.UUID, agentRunID uuid.UUID, input AgentRunEventInput, ) (*models.AgentRunEvent, error)
AppendAgentRunEvent records a child event before it reaches a live client.
func (*Store) AppendCheckpoint ¶
func (s *Store) AppendCheckpoint( ctx context.Context, lease Lease, messages []MessageInput, events []EventInput, ) error
AppendCheckpoint records visible messages and events without ending a turn.
func (*Store) AppendJobOutput ¶ added in v0.4.0
func (s *Store) AppendJobOutput( ctx context.Context, sessionID uuid.UUID, jobID uuid.UUID, input AppendJobOutputInput, ) (*models.JobOutputLine, error)
AppendJobOutput stores one process line in sequence before any live reader can see it. stdout and stderr share the same sequence so replay preserves observed ordering across both streams.
func (*Store) CompletedHistory ¶
CompletedHistory returns the current summary and the raw completed tail.
func (*Store) CreateAgentRun ¶ added in v0.4.0
func (s *Store) CreateAgentRun( ctx context.Context, sessionID uuid.UUID, input StartAgentRunInput, ) (*models.AgentRun, error)
CreateAgentRun records a child before any provider work or visible stream event can begin.
func (*Store) CreateCompaction ¶
func (s *Store) CreateCompaction( ctx context.Context, sessionID uuid.UUID, input CompactionInput, ) (*models.Compaction, error)
CreateCompaction stores an immutable completed-history replacement summary.
func (*Store) CreateJob ¶ added in v0.4.0
func (s *Store) CreateJob( ctx context.Context, sessionID uuid.UUID, input CreateJobInput, ) (*models.Job, error)
CreateJob records a supervised process before its output reaches memory or any connected client.
func (*Store) CreateModelCall ¶ added in v0.4.0
func (s *Store) CreateModelCall( ctx context.Context, sessionID uuid.UUID, modelRunID uuid.UUID, input CreateModelCallInput, ) (*models.ModelCall, error)
CreateModelCall writes one exact outbound provider request before Elelem gives its driver permission to execute it.
func (*Store) CreateModelRun ¶ added in v0.4.0
func (s *Store) CreateModelRun( ctx context.Context, sessionID uuid.UUID, input CreateModelRunInput, ) (*models.ModelRun, error)
CreateModelRun records a logical model invocation before any provider work begins. No live event is permitted to outrun this row.
func (*Store) CreateOrResume ¶
func (s *Store) CreateOrResume( ctx context.Context, requestedSessionID *uuid.UUID, options OpenSessionOptions, ) (*OpenSessionResult, error)
CreateOrResume creates a session or resumes its requested durable ID.
func (*Store) CreateSessionNotice ¶ added in v0.4.0
func (s *Store) CreateSessionNotice( ctx context.Context, sessionID uuid.UUID, input CreateSessionNoticeInput, ) (*models.SessionNotice, error)
CreateSessionNotice writes a notice before it reaches an in-process bus or a model. It is the durable source of the session's outside event history.
func (*Store) DrainSessionNotices ¶ added in v0.4.0
func (s *Store) DrainSessionNotices( ctx context.Context, sessionID uuid.UUID, ) ([]*models.SessionNotice, error)
DrainSessionNotices marks every pending notice delivered and returns the exact immutable records for the next model context.
func (*Store) FinalizeAgentRun ¶ added in v0.4.0
func (s *Store) FinalizeAgentRun( ctx context.Context, sessionID uuid.UUID, agentRunID uuid.UUID, input FinalizeAgentRunInput, ) (*models.AgentRun, error)
FinalizeAgentRun writes the terminal response or failure exactly once.
func (*Store) FinalizeJob ¶ added in v0.4.0
func (s *Store) FinalizeJob( ctx context.Context, sessionID uuid.UUID, jobID uuid.UUID, input FinalizeJobInput, ) (*models.Job, error)
FinalizeJob records a terminal process result exactly once.
func (*Store) FinalizeModelCall ¶ added in v0.4.0
func (s *Store) FinalizeModelCall( ctx context.Context, sessionID uuid.UUID, modelRunID uuid.UUID, modelCallID uuid.UUID, input FinalizeModelCallInput, ) (*models.ModelCall, error)
FinalizeModelCall writes one provider round's output and accounting exactly once. The request snapshot is immutable from CreateModelCall.
func (*Store) FinalizeModelRun ¶ added in v0.4.0
func (s *Store) FinalizeModelRun( ctx context.Context, sessionID uuid.UUID, modelRunID uuid.UUID, input FinalizeModelRunInput, ) (*models.ModelRun, error)
FinalizeModelRun writes the logical invocation outcome after every round has either finished or been marked terminal.
func (*Store) FinalizeTurn ¶
FinalizeTurn atomically writes terminal transcript data and state.
func (*Store) GetAgentRun ¶ added in v0.4.0
func (s *Store) GetAgentRun( ctx context.Context, sessionID uuid.UUID, agentRunID uuid.UUID, ) (*models.AgentRun, error)
GetAgentRun returns one session-scoped durable child run.
func (*Store) GetCompaction ¶ added in v0.4.0
func (s *Store) GetCompaction( ctx context.Context, sessionID uuid.UUID, compactionID uuid.UUID, ) (*models.Compaction, error)
GetCompaction returns one immutable compaction record owned by a session.
func (*Store) GetContextSnapshot ¶ added in v0.4.0
func (s *Store) GetContextSnapshot( ctx context.Context, sessionID uuid.UUID, hash string, ) (*models.ContextSnapshot, error)
GetContextSnapshot returns a snapshot only when this session references it.
func (*Store) GetJob ¶ added in v0.4.0
func (s *Store) GetJob( ctx context.Context, sessionID uuid.UUID, jobID uuid.UUID, ) (*models.Job, error)
GetJob reads a single durable process job scoped to its session.
func (*Store) GetModelRun ¶ added in v0.4.0
func (s *Store) GetModelRun( ctx context.Context, sessionID uuid.UUID, modelRunID uuid.UUID, ) (*models.ModelRun, error)
GetModelRun returns one session-scoped logical model invocation.
func (*Store) GetPromptSnapshot ¶ added in v0.4.0
func (s *Store) GetPromptSnapshot( ctx context.Context, sessionID uuid.UUID, hash string, ) (*models.PromptSnapshot, error)
GetPromptSnapshot returns a snapshot only when this session references it.
func (*Store) LatestCompaction ¶
func (s *Store) LatestCompaction( ctx context.Context, sessionID uuid.UUID, ) (*models.Compaction, error)
LatestCompaction returns the current chain head, not a superseded row.
func (*Store) ListAgentRunEvents ¶ added in v0.4.0
func (s *Store) ListAgentRunEvents( ctx context.Context, sessionID uuid.UUID, agentRunID uuid.UUID, options ListAgentRunEventsOptions, ) (*AgentRunEventPage, error)
ListAgentRunEvents returns ordered durable replay data for one child run.
func (*Store) ListAgentRuns ¶ added in v0.4.0
func (s *Store) ListAgentRuns( ctx context.Context, sessionID uuid.UUID, options ListAgentRunsOptions, ) (*AgentRunPage, error)
ListAgentRuns returns a stable newest-first session-scoped child-run page.
func (*Store) ListCompactions ¶ added in v0.4.0
func (s *Store) ListCompactions( ctx context.Context, sessionID uuid.UUID, options ListCompactionsOptions, ) (*CompactionPage, error)
ListCompactions returns a stable newest-first page of durable summaries.
func (*Store) ListEvents ¶ added in v0.4.0
func (s *Store) ListEvents( ctx context.Context, sessionID uuid.UUID, options ListEventsOptions, ) (*EventPage, error)
ListEvents returns a stable bounded page of durable protocol events.
func (*Store) ListJobOutput ¶ added in v0.4.0
func (s *Store) ListJobOutput( ctx context.Context, sessionID uuid.UUID, jobID uuid.UUID, options ListJobOutputOptions, ) (*JobOutputPage, error)
ListJobOutput replays the one persisted combined process stream.
func (*Store) ListJobSignalRequests ¶ added in v0.4.0
func (s *Store) ListJobSignalRequests( ctx context.Context, sessionID uuid.UUID, jobID uuid.UUID, options ListJobSignalRequestsOptions, ) (*JobSignalRequestPage, error)
ListJobSignalRequests returns every durable request to signal one job.
func (*Store) ListJobs ¶ added in v0.4.0
func (s *Store) ListJobs( ctx context.Context, sessionID uuid.UUID, options ListJobsOptions, ) (*JobPage, error)
ListJobs returns a stable newest-first session-local process-job page.
func (*Store) ListMessages ¶
func (s *Store) ListMessages( ctx context.Context, sessionID uuid.UUID, options ListMessagesOptions, ) (*MessagePage, error)
ListMessages returns a stable bounded page of one session's transcript.
func (*Store) ListModelCalls ¶ added in v0.4.0
func (s *Store) ListModelCalls( ctx context.Context, sessionID uuid.UUID, modelRunID uuid.UUID, options ListModelCallsOptions, ) (*ModelCallPage, error)
ListModelCalls returns the ordered provider rounds for one durable model invocation, including each exact request and retry trail.
func (*Store) ListModelRuns ¶ added in v0.4.0
func (s *Store) ListModelRuns( ctx context.Context, sessionID uuid.UUID, options ListModelRunsOptions, ) (*ModelRunPage, error)
ListModelRuns returns a stable newest-first session-local model run page.
func (*Store) ListSessionNotices ¶ added in v0.4.0
func (s *Store) ListSessionNotices( ctx context.Context, sessionID uuid.UUID, options ListSessionNoticesOptions, ) (*NoticePage, error)
ListSessionNotices returns all notice history, pending and delivered, in durable sequence order.
func (*Store) ListTurns ¶ added in v0.4.0
func (s *Store) ListTurns( ctx context.Context, sessionID uuid.UUID, options ListTurnsOptions, ) (*TurnPage, error)
ListTurns returns a stable newest-first page of durable session turns.
func (*Store) OpenWorkspace ¶ added in v0.7.0
func (s *Store) OpenWorkspace( ctx context.Context, workspace string, options OpenSessionOptions, ) (*OpenSessionResult, error)
OpenWorkspace returns the one durable session belonging to workspace.
func (*Store) RecordJobSignal ¶ added in v0.4.0
func (s *Store) RecordJobSignal( ctx context.Context, sessionID uuid.UUID, jobID uuid.UUID, input RecordJobSignalInput, ) (*models.JobSignalRequest, error)
RecordJobSignal stores every accepted and no-op signal request.
func (*Store) RecordModelCallRetries ¶ added in v0.4.0
func (s *Store) RecordModelCallRetries( ctx context.Context, sessionID uuid.UUID, modelRunID uuid.UUID, modelCallID uuid.UUID, input RecordModelCallRetriesInput, ) error
RecordModelCallRetries checkpoints failed attempts while the provider round remains in progress, preserving them even if the process exits mid-backoff.
func (*Store) RecoverInterrupted ¶
RecoverInterrupted marks active turns and their messages incomplete.
func (*Store) RecoverInterruptedAgentRuns ¶ added in v0.4.0
RecoverInterruptedAgentRuns marks stale child runs terminal during startup.
func (*Store) RecoverInterruptedJobs ¶ added in v0.4.0
RecoverInterruptedJobs marks process rows left running by a prior process terminal. The original child process cannot be safely reattached.
func (*Store) RecoverInterruptedModelRuns ¶ added in v0.4.0
RecoverInterruptedModelRuns marks durable work left running by a prior Peen process terminal. No provider connection can be safely resumed in place.
func (*Store) RegisterCancellation ¶
func (s *Store) RegisterCancellation(lease Lease, cancel context.CancelFunc)
RegisterCancellation associates cancellation with one exact active lease.
func (*Store) ReleaseTurn ¶
ReleaseTurn removes a lease only when it is still the registered turn.
func (*Store) RequestAgentRunCancellation ¶ added in v0.4.0
func (s *Store) RequestAgentRunCancellation( ctx context.Context, sessionID uuid.UUID, agentRunID uuid.UUID, ) (*models.AgentRun, bool, error)
RequestAgentRunCancellation records cancellation before signalling an active in-process child. It is idempotent for terminal and already-requested rows.
func (*Store) SaveContextSnapshot ¶
SaveContextSnapshot stores an immutable resolved harness context.
func (*Store) SavePromptSnapshot ¶
SavePromptSnapshot stores an immutable effective prompt.