sessionpg

package
v0.0.12-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 32 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sessionpg stores Sessions in PostgreSQL and decides nothing. WithSession runs a Session transaction: it locks the Session, runs the operation and prunes the journal. Inside a Session transaction, on its queries, the participants load the facts the sessions and items decisions read and apply what they decide: they lock the Session, allocate event sequence positions, event IDs, Item positions and output indexes, and write the public change journal, a Turn's execution journal and its counters, Items, Turn usage, Subagent bindings, child Turns and child Items, Artifact settlement, Environment state, input reservations and devices. SessionTx binds a Session to its caller's transaction for the sessions procedures. Store is the pooled adapter: it stores the sessions.Service use cases and serves the Session reads. Execution is the lease-bound adapter: it runs the sessions.ExecutionOperations transactions on the execution lease.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendChanges

func AppendChanges(ctx context.Context, q *sqlc.Queries, session pgtype.UUID, changes ...sessions.SessionChange) error

AppendChanges journals public changes in order. Each gets a new event ID and the Session's next sequence position, and commits with the caller's state. Text PostgreSQL cannot store is textvalue.ErrUnstorable.

func ApplyTurnEnd

func ApplyTurnEnd(ctx context.Context, q *sqlc.Queries, session, turn pgtype.UUID, end sessions.TurnEnd) error

ApplyTurnEnd writes what a Turn that ended settles, in the order sessions.TurnEnd lists: terminal activity, Artifacts, finished Items and then the public changes.

func LoadEnding

func LoadEnding(ctx context.Context, q *sqlc.Queries, session, turn pgtype.UUID) (sessions.Ending, error)

LoadEnding reads the facts sessions.EndTurn settles a Turn that ended with: its Items still in progress and the Session's public usage.

func LoadEnvironment

func LoadEnvironment(ctx context.Context, q *sqlc.Queries, tenant, environment string) (sessions.Environment, error)

LoadEnvironment reads, on q, the tenant's Environment of a Session that was not publicly deleted. A malformed tenant is sessions.ErrInvalidInput, and a malformed Environment ID a missing Environment, sessions.ErrNotFound. Other adapters read the Environment of their operation with it.

func LoadEnvironmentInput

func LoadEnvironmentInput(ctx context.Context, q *sqlc.Queries, session pgtype.UUID) (*sessions.EnvironmentInputState, error)

LoadEnvironmentInput reads the Session's latest Environment input reservation that no Turn has admitted or superseded, with the facts of its Environment, and nil when there is none. sessions.InputActivity projects it.

func LoadRequiredActions

func LoadRequiredActions(ctx context.Context, q *sqlc.Queries, session pgtype.UUID, turn sessions.Turn) ([]v1.FunctionCallAction, error)

LoadRequiredActions reads the required actions of the Session's Turn within the caller's snapshot, as sessions.LoadRequiredActions selects them.

func LoadUsage

func LoadUsage(ctx context.Context, q *sqlc.Queries, session pgtype.UUID) (json.RawMessage, error)

LoadUsage reads the Session's public usage: the sum of its root Turns once every one has ended with recorded usage, and null otherwise.

func LockSession

func LockSession(ctx context.Context, q *sqlc.Queries, tenant, session pgtype.UUID) (sessions.LockedSession, error)

LockSession locks the tenant's Session row, including a publicly deleted one, and returns what the lock shows. Every Session write takes this lock first, which orders input admission against completion and cancellation across service processes. A missing Session is sessions.ErrNotFound.

func PruneChanges

func PruneChanges(ctx context.Context, q *sqlc.Queries, session pgtype.UUID) error

PruneChanges drops the Session's journaled changes beyond the sessions retention bounds. Callers run it after the transaction's last change.

func ResourceLookup added in v0.0.10

func ResourceLookup(tenantID, id string) (sqlc.GetDeviceParams, error)

ResourceLookup parses a tenant and the internal identifier of one of its resources, such as a device, Session or Environment; a malformed one is sessions.ErrInvalidInput.

func TurnFromRow

func TurnFromRow(row sqlc.Turn) sessions.Turn

TurnFromRow maps a stored Turn.

func TurnLookup

func TurnLookup(tenantID, sessionID, turnID string) (sqlc.GetTurnParams, error)

TurnLookup parses the internal identifiers of a tenant's Turn; a malformed one is sessions.ErrInvalidInput.

func WithSession

func WithSession(ctx context.Context, runner pgunit.Transactor, tenant, session pgtype.UUID, apply func(context.Context, *sqlc.Queries, sessions.LockedSession) error) error

WithSession runs one Session transaction on runner: it locks the tenant's Session, runs apply on the transaction's queries with what the lock shows, then prunes the Session's journal, and commits only when all of them succeed. apply applies the public view itself, with sessions.LockedSession.Public. It is the transaction runner of Session operations; other adapters lock the Session inside their own transaction with LockSession.

Types

type Execution

type Execution struct {
	// contains filtered or unexported fields
}

Execution is the Session storage of the execution owner. Every transaction runs on the connection that holds the execution lease, which the owner acquired and closes; losing or closing the lease fails the operation and never falls back to the pool.

func NewExecution

func NewExecution(lease *pgunit.Lease) *Execution

NewExecution builds the Session execution storage on a lease it borrows.

func (*Execution) ListEnvironmentConnections

func (e *Execution) ListEnvironmentConnections(ctx context.Context, after string) ([]sessions.EnvironmentKey, error)

func (*Execution) WithConnection

func (e *Execution) WithConnection(ctx context.Context, tenant, environment string, apply func(context.Context, sessions.ConnectionTx, sessions.LockedSession) error) error

WithConnection reads the Environment in the transaction before it locks the Environment's Session.

func (*Execution) WithDeviceBinding

func (e *Execution) WithDeviceBinding(ctx context.Context, tenant, session string, apply func(context.Context, sessions.DeviceBindingTx, sessions.LockedSession) error) error

func (*Execution) WithDueInputReservations added in v0.0.10

func (e *Execution) WithDueInputReservations(ctx context.Context, apply func(context.Context, sessions.InputTx, string) error) error

WithDueInputReservations locks each due reservation's Session with the scan itself, skipping Sessions another transaction holds, and prunes each Session's change journal after apply.

func (*Execution) WithFileWriteReservation

func (e *Execution) WithFileWriteReservation(ctx context.Context, tenant, environment string, apply func(context.Context, sessions.FileWriteReservationTx, sessions.Environment, sessions.LockedSession) error) error

WithFileWriteReservation reads the Environment in the transaction before it locks the Environment's Session.

func (*Execution) WithFileWriteSettlement

func (e *Execution) WithFileWriteSettlement(ctx context.Context, tenant, environment, write string, apply func(context.Context, sessions.FileWriteSettlementTx) error) error

WithFileWriteSettlement reads the write in the transaction before it locks the Session of the write's Environment, whether or not that Session was publicly deleted. A malformed ID is sessions.ErrInvalidInput and an unknown write sessions.ErrNotFound.

func (*Execution) WithFunctionTurn

func (e *Execution) WithFunctionTurn(ctx context.Context, tenant, session, turn string, apply func(context.Context, sessions.FunctionTx, sessions.Turn) error) error

func (*Execution) WithInitialization

func (e *Execution) WithInitialization(ctx context.Context, tenant, session string, apply func(context.Context, sessions.InitializationTx, sessions.LockedSession) error) error

func (*Execution) WithInputs added in v0.0.10

func (e *Execution) WithInputs(ctx context.Context, tenant, session string, apply func(context.Context, sessions.InputTx) error) error

func (*Execution) WithTurns added in v0.0.10

func (e *Execution) WithTurns(ctx context.Context, tenantID, sessionID string, apply func(context.Context, sessions.TurnTx) error) error

WithTurns runs apply in a Session transaction on the lease, including for a publicly deleted Session.

type SessionTx

type SessionTx struct {
	// contains filtered or unexported fields
}

SessionTx is one Session inside its caller's transaction. It implements the transaction interfaces of the sessions procedures by loading the facts they read and applying what they decide, and decides nothing itself.

The caller guarantees what the procedures assume: the queries are bound to the caller's open transaction, the tenant owns the Session, the transaction already holds the Session lock (LockSession), and the operation that owns the transaction supplies its authority, such as the execution lease. A SessionTx never begins or commits a transaction, never chooses a pool or the lease, and is not used after the transaction callback it was bound in returns.

func BindSession

func BindSession(q *sqlc.Queries, tenant, session pgtype.UUID) *SessionTx

BindSession binds the tenant's Session to the caller's transaction-bound queries.

func (*SessionTx) AdmitInputReservation added in v0.0.10

func (t *SessionTx) AdmitInputReservation(ctx context.Context, reservation string) (time.Time, error)

func (*SessionTx) AppendChanges

func (t *SessionTx) AppendChanges(ctx context.Context, changes ...sessions.SessionChange) error

func (*SessionTx) ApplyFunctionResult

func (t *SessionTx) ApplyFunctionResult(ctx context.Context, turn, call string) error

func (*SessionTx) ApplySubagentLifecycle

func (t *SessionTx) ApplySubagentLifecycle(ctx context.Context, subagent string, lifecycle sessions.SubagentLifecycle) error

func (*SessionTx) ApplyTurnEnd

func (t *SessionTx) ApplyTurnEnd(ctx context.Context, turn string, end sessions.TurnEnd) error

func (*SessionTx) ApplyTurnStatus added in v0.0.10

func (t *SessionTx) ApplyTurnStatus(ctx context.Context, turn string, change sessions.TurnStatusChange) (sessions.Turn, error)

func (*SessionTx) BeginArtifactCapture added in v0.0.10

func (t *SessionTx) BeginArtifactCapture(ctx context.Context, turn string) error

func (*SessionTx) BindDevice

func (t *SessionTx) BindDevice(ctx context.Context, device string) error

BindDevice binds the device to the Session; a Session bound to another device is sessions.ErrDeviceBindingConflict.

func (*SessionTx) CancelPendingInput

func (t *SessionTx) CancelPendingInput(ctx context.Context) error

func (*SessionTx) CountEvents

func (t *SessionTx) CountEvents(ctx context.Context, turn string, count int32, size int64) error

CountEvents adds entries to the Turn's journal counters.

func (*SessionTx) CreateFunctionCall

func (t *SessionTx) CreateFunctionCall(ctx context.Context, turn string, call sessions.FunctionCall) error

func (*SessionTx) CreateInputReservation added in v0.0.10

func (t *SessionTx) CreateInputReservation(ctx context.Context, key string, batch json.RawMessage, initial bool) (sessions.EnvironmentInputReservation, error)

func (*SessionTx) CreateTurn added in v0.0.10

func (t *SessionTx) CreateTurn(ctx context.Context) (sessions.Turn, error)

func (*SessionTx) CreateTurnInput added in v0.0.10

func (t *SessionTx) CreateTurnInput(ctx context.Context, turn, key string, position int32, input sessions.Input) (int64, error)

func (*SessionTx) ExpireEnvironment

func (t *SessionTx) ExpireEnvironment(ctx context.Context, environment string) error

ExpireEnvironment expires the Environment only while it is the Session's; another Environment is sessions.ErrNotFound and changes nothing.

func (*SessionTx) ExpireInputReservation added in v0.0.10

func (t *SessionTx) ExpireInputReservation(ctx context.Context, reservation string) error

func (*SessionTx) FailInputReservation added in v0.0.10

func (t *SessionTx) FailInputReservation(ctx context.Context, reservation, code string) error

func (*SessionTx) FailPendingInput

func (t *SessionTx) FailPendingInput(ctx context.Context) error

func (*SessionTx) FindInputReservation added in v0.0.10

func (t *SessionTx) FindInputReservation(ctx context.Context, key string, batch json.RawMessage) (*sessions.EnvironmentInputReservation, bool, error)

func (*SessionTx) FindResultTurn

func (t *SessionTx) FindResultTurn(ctx context.Context, turn string) (sessions.Turn, bool, error)

func (*SessionTx) HasFunctionCall

func (t *SessionTx) HasFunctionCall(ctx context.Context, call string) (bool, error)

func (*SessionTx) HasUnappliedInputs added in v0.0.10

func (t *SessionTx) HasUnappliedInputs(ctx context.Context, turn string, appliedThrough int64) (bool, error)

func (*SessionTx) InsertEnvironmentDevice

func (t *SessionTx) InsertEnvironmentDevice(ctx context.Context, device sessions.ExecutionDevice, credentialHash string) error

InsertEnvironmentDevice inserts the device only for the Session's own hosted Environment. The insert takes no row when the Environment already has a device, including one a concurrent transaction inserted first, or cannot take one: that is sessions.ErrDeviceBindingConflict.

func (*SessionTx) InsertEvent

func (t *SessionTx) InsertEvent(ctx context.Context, turn string, ordinal int32, event sessions.ExecutionEvent) error

InsertEvent records event at the Turn's journal position ordinal.

func (*SessionTx) InsertEvents

func (t *SessionTx) InsertEvents(ctx context.Context, turn string, first int32, events []sessions.ExecutionEvent) error

InsertEvents records events at the Turn's journal positions from first. The database stamps each entry.

func (*SessionTx) LoadActiveTurn

func (t *SessionTx) LoadActiveTurn(ctx context.Context) (sessions.Turn, bool, error)

func (*SessionTx) LoadArchive added in v0.0.10

func (t *SessionTx) LoadArchive(ctx context.Context) (sessions.ManagedArchive, error)

LoadArchive reads the resource disposal of the Session's hosted Environment, as GetManagedSessionArchive does.

func (*SessionTx) LoadBoundDevice

func (t *SessionTx) LoadBoundDevice(ctx context.Context) (bool, error)

func (*SessionTx) LoadChildItem

func (t *SessionTx) LoadChildItem(ctx context.Context, subagent, item string, candidate json.RawMessage) (sessions.StoredChildItem, bool, error)

func (*SessionTx) LoadChildTurn

func (t *SessionTx) LoadChildTurn(ctx context.Context, subagent, id string) (sessions.ChildTurn, bool, error)

func (*SessionTx) LoadComputeSuspension

func (t *SessionTx) LoadComputeSuspension(ctx context.Context) (bool, error)

func (*SessionTx) LoadDevice

func (t *SessionTx) LoadDevice(ctx context.Context, device string) (bool, error)

func (*SessionTx) LoadEnding

func (t *SessionTx) LoadEnding(ctx context.Context, turn string) (sessions.Ending, error)

func (*SessionTx) LoadEnvironment

func (t *SessionTx) LoadEnvironment(ctx context.Context) (sessions.Environment, error)

func (*SessionTx) LoadEnvironmentInput

func (t *SessionTx) LoadEnvironmentInput(ctx context.Context) (*sessions.EnvironmentInputState, error)

func (*SessionTx) LoadEventSources

func (t *SessionTx) LoadEventSources(ctx context.Context, turn string, first int32) ([]sessions.Source, error)

LoadEventSources reads the Turn's journal entries from first, in order.

func (*SessionTx) LoadFunctionCall

func (t *SessionTx) LoadFunctionCall(ctx context.Context, turn, call string) (sessions.FunctionCall, bool, error)

func (*SessionTx) LoadInputBatch added in v0.0.10

func (t *SessionTx) LoadInputBatch(ctx context.Context, key string, batch json.RawMessage) ([]sessions.InputReceipt, bool, error)

func (*SessionTx) LoadInputGate added in v0.0.10

func (t *SessionTx) LoadInputGate(ctx context.Context, key string, batch json.RawMessage) (sessions.InputGate, error)

func (*SessionTx) LoadInputReservation added in v0.0.10

func (t *SessionTx) LoadInputReservation(ctx context.Context, reservation string) (sessions.EnvironmentInputReservation, error)

func (*SessionTx) LoadInputSource

func (t *SessionTx) LoadInputSource(ctx context.Context, sequence int64) (sessions.Source, error)

LoadInputSource reads the Session's admitted input at sequence.

func (*SessionTx) LoadItem

func (t *SessionTx) LoadItem(ctx context.Context, turnID string, update items.Update) (items.Stored, error)

LoadItem reads what the Session holds for update's Item: the stored Item and, when update asks for them, whether the Turn has another assistant message and the result the application saved for the call.

func (*SessionTx) LoadJournalTurn

func (t *SessionTx) LoadJournalTurn(ctx context.Context, turn string) (sessions.JournalTurn, bool, error)

LoadJournalTurn reads the tenant's Turn in the Session.

func (*SessionTx) LoadNativeSubagent

func (t *SessionTx) LoadNativeSubagent(ctx context.Context, native string) (sessions.NativeSubagent, bool, error)

func (*SessionTx) LoadPendingFileWrite

func (t *SessionTx) LoadPendingFileWrite(ctx context.Context) (bool, error)

func (*SessionTx) LoadPendingFunctionCalls

func (t *SessionTx) LoadPendingFunctionCalls(ctx context.Context, turn string) ([]sessions.FunctionCall, error)

func (*SessionTx) LoadPublicSubagent

func (t *SessionTx) LoadPublicSubagent(ctx context.Context, id string) (v1.Subagent, error)

func (*SessionTx) LoadRootAgent

func (t *SessionTx) LoadRootAgent(ctx context.Context) (string, error)

func (*SessionTx) LoadTurn

func (t *SessionTx) LoadTurn(ctx context.Context, turn string) (sessions.Turn, error)

func (*SessionTx) LoadUsage

func (t *SessionTx) LoadUsage(ctx context.Context) (json.RawMessage, error)

func (*SessionTx) MatchEvents

func (t *SessionTx) MatchEvents(ctx context.Context, turn string, first int32, events []sessions.ExecutionEvent) (bool, error)

MatchEvents compares the Turn's journal entries from first with events.

func (*SessionTx) MatchFunctionCall

func (t *SessionTx) MatchFunctionCall(ctx context.Context, turn string, call sessions.FunctionCall) (sessions.FunctionCallMatch, error)

func (*SessionTx) MatchFunctionResult

func (t *SessionTx) MatchFunctionResult(ctx context.Context, turn, call string, result json.RawMessage) (sessions.FunctionResultMatch, error)

func (*SessionTx) PublishSubagent

func (t *SessionTx) PublishSubagent(ctx context.Context, subagent string, name, instructions *string) error

func (*SessionTx) PutChildItem

func (t *SessionTx) PutChildItem(ctx context.Context, item sessions.ChildItem) error

PutChildItem stores a Subagent Item; a new output Item takes its Turn's next output index.

func (*SessionTx) PutChildTurn

func (t *SessionTx) PutChildTurn(ctx context.Context, turn sessions.ChildTurn) error

func (*SessionTx) PutItem

func (t *SessionTx) PutItem(ctx context.Context, turnID string, created time.Time, change items.Change) (*int32, error)

PutItem stores a decided Item change. A new Item takes the Session's next position and, when it is output, the Turn's next output index; an update keeps both, and its first terminal status records when it settled. PutItem returns the Item's output index, nil when it has none, and textvalue.ErrUnstorable for text PostgreSQL cannot store.

func (*SessionTx) PutSubagentEffect

func (t *SessionTx) PutSubagentEffect(ctx context.Context, effect string, payload json.RawMessage) (bool, error)

func (*SessionTx) PutSubagentIdentity

func (t *SessionTx) PutSubagentIdentity(ctx context.Context, identity sessions.SubagentIdentity) (string, error)

PutSubagentIdentity allocates the Subagent ID of a new binding.

func (*SessionTx) PutTurnUsage

func (t *SessionTx) PutTurnUsage(ctx context.Context, turnID string, usage v1.TokenUsage) error

PutTurnUsage replaces a root Turn's recorded usage with a measurement.

func (*SessionTx) RecordEnvironmentFailure

func (t *SessionTx) RecordEnvironmentFailure(ctx context.Context, environment, reason string, detail *sessions.ProvisioningFailureDetail) (time.Time, error)

RecordEnvironmentFailure fails the Environment only while it is the Session's and still live; otherwise it changes nothing and returns pgx.ErrNoRows.

func (*SessionTx) RecordInputAudit added in v0.0.10

func (t *SessionTx) RecordInputAudit(ctx context.Context) error

func (*SessionTx) RecordTerminalActivity

func (t *SessionTx) RecordTerminalActivity(ctx context.Context) error

RecordTerminalActivity marks the Session's running managed compute active at the database's commit clock.

func (*SessionTx) RememberNativeSession added in v0.0.10

func (t *SessionTx) RememberNativeSession(ctx context.Context, native string) error

func (*SessionTx) RequestTurnCancel

func (t *SessionTx) RequestTurnCancel(ctx context.Context, turn string) error

func (*SessionTx) SubmitFunctionResult

func (t *SessionTx) SubmitFunctionResult(ctx context.Context, turn, call string, result json.RawMessage) error

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is the pooled Session adapter: the storage of the Session use cases and the Session reads. cipher opens the Session data frozen at creation and signs installation authorizations; it is nil on a service without a credential key.

func New

func New(units *pgunit.Pool, cipher *credentialcrypto.Cipher) *Store

New builds the pooled Session adapter on units, opening frozen Session data and signing installation authorizations with cipher.

func (*Store) ArchivedCancellationReceipt added in v0.0.10

func (s *Store) ArchivedCancellationReceipt(ctx context.Context, device, credentialHash string, runIDs []string) (runtimedevice.ArchivedCancellationReceipt, error)

ArchivedCancellationReceipt is a read-only exception for the exact already authenticated delivery. The ordinary credential view remains revoked; this cannot authorize bootstrap, reconnect, dispatch, workspace access or renewal. A marker records that archive caused the first revocation; timestamps alone cannot distinguish an earlier ordinary cancel/revoke followed by archive.

func (*Store) AuditSessionOperation added in v0.0.10

func (s *Store) AuditSessionOperation(ctx context.Context, tenantID, sessionID, action string) error

func (*Store) AuthenticateEnvironmentExecutor

func (s *Store) AuthenticateEnvironmentExecutor(ctx context.Context, environment, digest string) (string, error)

func (*Store) CreateDevice

func (s *Store) CreateDevice(ctx context.Context, tenant string, registration sessions.DeviceRegistration) (sessions.ExecutionDevice, error)

func (*Store) DeleteSessionArtifact

func (s *Store) DeleteSessionArtifact(ctx context.Context, tenantID, sessionID, artifactID string) error

func (*Store) ExecutorProjectExists

func (s *Store) ExecutorProjectExists(ctx context.Context, scope identity.ProjectScope) (bool, error)

func (*Store) FindCreation added in v0.0.10

func (s *Store) FindCreation(ctx context.Context, tenantID, key string) (sessions.CreationRecord, error)

func (*Store) FingerprintProviderKey added in v0.0.10

func (s *Store) FingerprintProviderKey(secret string) (string, error)

func (*Store) GetDeviceCredential

func (s *Store) GetDeviceCredential(ctx context.Context, device string) (runtimedevice.Credential, bool, error)

GetDeviceCredential reads a device's credential for the Runtime gateway. A malformed or unknown device has no credential. The standalone service assigns no product WorkspaceID.

func (*Store) GetEnvironment

func (s *Store) GetEnvironment(ctx context.Context, tenant, environment string) (sessions.Environment, error)

func (*Store) GetEnvironmentInputReservation added in v0.0.10

func (s *Store) GetEnvironmentInputReservation(ctx context.Context, tenantID, sessionID, reservationID string) (sessions.EnvironmentInputReservation, error)

func (*Store) GetManagedSessionArchive added in v0.0.10

func (s *Store) GetManagedSessionArchive(ctx context.Context, tenantID, sessionID string) (sessions.ManagedArchive, error)

func (*Store) GetSession added in v0.0.10

func (s *Store) GetSession(ctx context.Context, tenantID, sessionID string) (sessions.Session, error)

func (*Store) GetSessionArtifact

func (s *Store) GetSessionArtifact(ctx context.Context, tenantID, sessionID, artifactID string) (sessions.Artifact, error)

func (*Store) GetSessionDevice

func (s *Store) GetSessionDevice(ctx context.Context, tenant, session string) (sessions.ExecutionDevice, error)

func (*Store) GetSessionEnvironment

func (s *Store) GetSessionEnvironment(ctx context.Context, tenant, session string) (sessions.Environment, error)

func (*Store) GetSessionExecutionBinding added in v0.0.10

func (s *Store) GetSessionExecutionBinding(ctx context.Context, tenant, session string) (sessions.ExecutionBinding, error)

func (*Store) GetSessionExecutionConfiguration added in v0.0.10

func (s *Store) GetSessionExecutionConfiguration(ctx context.Context, tenantID, sessionID string) (v1.SessionExecutionConfiguration, error)

func (*Store) GetSessionRuntimeDevice

func (s *Store) GetSessionRuntimeDevice(ctx context.Context, tenant, session string) (sessions.ExecutionDevice, error)

func (*Store) GetSubagent

func (s *Store) GetSubagent(ctx context.Context, tenantID, sessionID, subagentID string) (v1.Subagent, error)

func (*Store) GetSubagentTurn

func (s *Store) GetSubagentTurn(ctx context.Context, tenantID, sessionID, subagentID, turnID string) (v1.Turn, error)

func (*Store) GetTurn added in v0.0.10

func (s *Store) GetTurn(ctx context.Context, tenant, session, turn string) (sessions.Turn, error)

func (*Store) GetTurnDiagnosticsSnapshot added in v0.0.10

func (s *Store) GetTurnDiagnosticsSnapshot(ctx context.Context, tenantID, sessionID, turnID string) (sessions.TurnDiagnosticsSnapshot, error)

func (*Store) ListAdminRuntimeTargets added in v0.0.10

func (s *Store) ListAdminRuntimeTargets(ctx context.Context, tenantIDs []string, after string, limit int, ascending bool) (sessions.AdminRuntimeTargetPage, error)

func (*Store) ListEnrolledRuntimeBindings

func (s *Store) ListEnrolledRuntimeBindings(ctx context.Context) ([]sessions.EnrolledRuntimeBinding, error)

func (*Store) ListEnvironmentInitializations

func (s *Store) ListEnvironmentInitializations(ctx context.Context, after string) ([]sessions.EnvironmentInitialization, error)

func (*Store) ListEnvironmentInputWork added in v0.0.10

func (s *Store) ListEnvironmentInputWork(ctx context.Context, after string, connectedDevices []string) ([]sessions.EnvironmentInputWork, error)

func (*Store) ListExecutionDevices added in v0.0.10

func (s *Store) ListExecutionDevices(ctx context.Context, tenant string) ([]sessions.ExecutionDevice, error)

func (*Store) ListExecutionWork added in v0.0.10

func (s *Store) ListExecutionWork(ctx context.Context, after string, statuses, connectedDevices []string) ([]sessions.ExecutionWork, error)

func (*Store) ListItems

func (s *Store) ListItems(ctx context.Context, tenantID, sessionID, cursor string, limit int, ascending bool) (sessions.ItemPage, error)

func (*Store) ListSessionArtifacts

func (s *Store) ListSessionArtifacts(ctx context.Context, tenantID, sessionID, environmentID, cursor string, limit int, ascending bool) (sessions.ArtifactPage, error)

func (*Store) ListSessionEvents added in v0.0.10

func (s *Store) ListSessionEvents(ctx context.Context, tenantID, sessionID string, after int64) ([]sessions.SessionChange, error)

func (*Store) ListSessions added in v0.0.10

func (s *Store) ListSessions(ctx context.Context, tenantID, cursor string, limit int, ascending bool, agentID *string) (sessions.Page, error)

func (*Store) ListSubagentItems

func (s *Store) ListSubagentItems(ctx context.Context, tenantID, sessionID, subagentID, cursor string, limit int, ascending bool) (v1.ItemList, error)

func (*Store) ListSubagentTurnItems

func (s *Store) ListSubagentTurnItems(ctx context.Context, tenantID, sessionID, subagentID, turnID, cursor string, limit int, ascending bool) (v1.ItemList, error)

func (*Store) ListSubagentTurns

func (s *Store) ListSubagentTurns(ctx context.Context, tenantID, sessionID, subagentID, cursor string, limit int, ascending bool) (v1.TurnList, error)

func (*Store) ListSubagents

func (s *Store) ListSubagents(ctx context.Context, tenantID, sessionID, cursor string, limit int, ascending bool) (v1.SubagentList, error)

func (*Store) ListTurnInputs added in v0.0.10

func (s *Store) ListTurnInputs(ctx context.Context, tenant, session, turn string, after int64, limit int) ([]sessions.TurnInput, error)

func (*Store) ListTurns added in v0.0.10

func (s *Store) ListTurns(ctx context.Context, tenant, session, cursor string, limit int, ascending bool) (sessions.TurnPage, error)

func (*Store) LoadExecutorCredentialRestriction

func (s *Store) LoadExecutorCredentialRestriction(ctx context.Context, principal identity.Principal, key string) (string, error)

func (*Store) LoadProjectArchived

func (s *Store) LoadProjectArchived(ctx context.Context, tenant string) (bool, error)

func (*Store) MeasuredSessionUsage added in v0.0.10

func (s *Store) MeasuredSessionUsage(ctx context.Context, tenantID, sessionID string) (json.RawMessage, error)

func (*Store) ProjectExecutorCredentialState

func (s *Store) ProjectExecutorCredentialState(ctx context.Context, project identity.Principal, environment string) (sessions.ExecutorCredentialState, error)

func (*Store) ReadAdminSummary added in v0.0.10

func (s *Store) ReadAdminSummary(ctx context.Context, tenantID string, filter sessions.AdminSummaryFilter, visit func(sessions.Session, *string) error) (sessions.AdminAssetCounts, error)

func (*Store) ReadEnvironmentSetup

func (s *Store) ReadEnvironmentSetup(ctx context.Context, tenant, session string) (environmentconfig.Setup, error)

ReadEnvironmentSetup opens the setup the Session froze at creation. Frozen data that does not open, decode or validate is corrupt stored data, never the caller's input, so it is an internal error.

func (*Store) ReadInitialEnvironmentFile

func (s *Store) ReadInitialEnvironmentFile(ctx context.Context, tenant, session string, position int) (environmentconfig.InitialFileMetadata, []byte, error)

ReadInitialEnvironmentFile opens the initial file the Session froze at position. A file that does not open or match its recorded size is corrupt stored data, so it is an internal error.

func (*Store) ReadSessionArtifact

func (s *Store) ReadSessionArtifact(ctx context.Context, tenantID, sessionID, artifactID string, consume func(sessions.Artifact, io.Reader) error) error

ReadSessionArtifact keeps an admitted snapshot available across concurrent deletion.

func (*Store) RevokeDevice

func (s *Store) RevokeDevice(ctx context.Context, tenant, device string) error

func (*Store) SessionEventCursor added in v0.0.10

func (s *Store) SessionEventCursor(ctx context.Context, tenantID, sessionID string) (int64, error)

func (*Store) SessionModelExecution added in v0.0.10

func (s *Store) SessionModelExecution(ctx context.Context, tenant, session string) (*v1.ModelProviderInput, error)

func (*Store) SessionStreamSnapshot added in v0.0.10

func (s *Store) SessionStreamSnapshot(ctx context.Context, tenantID, sessionID string) (sessions.Session, int64, error)

func (*Store) SignInstallation

func (s *Store) SignInstallation(_ context.Context, payload string) (string, error)

func (*Store) TouchAuthenticatedDevice

func (s *Store) TouchAuthenticatedDevice(ctx context.Context, device, credentialHash string, kinds []runtimedevice.SupportedAgentKind) (bool, error)

func (*Store) TouchDevice

func (s *Store) TouchDevice(ctx context.Context, device string) (bool, error)

func (*Store) UpdateSessionMetadata added in v0.0.10

func (s *Store) UpdateSessionMetadata(ctx context.Context, tenantID, sessionID string, encoded []byte) (sessions.Session, error)

func (*Store) VerifyInstallation

func (s *Store) VerifyInstallation(_ context.Context, payload, signature string) error

func (*Store) WithArtifactStaging

func (s *Store) WithArtifactStaging(ctx context.Context, key sessions.ArtifactStagingKey, stage func(context.Context, sessions.ArtifactStagingTx) error) error

WithArtifactStaging runs the staging in one pooled transaction, not on the execution lease: the transfer can outlast a lease transaction, and staged Artifacts stay private until the lease-bound completion publishes or discards them. Large objects the staging created are removed with the rolled-back transaction.

func (*Store) WithCreation added in v0.0.10

func (s *Store) WithCreation(ctx context.Context, tenantID string, apply func(context.Context, sessions.CreationTx) error) error

func (*Store) WithEnrollment

func (s *Store) WithEnrollment(ctx context.Context, environment, credentialHash string, apply func(context.Context, sessions.EnrollmentTx, sessions.Environment, sessions.LockedSession) error) error

WithEnrollment authenticates the credential and reads the Environment on the pool before it knows which Session to lock; the enrollment transaction rechecks that authority under the Session lock.

func (*Store) WithEnvironmentExecutorCredentials

func (s *Store) WithEnvironmentExecutorCredentials(ctx context.Context, tenant, environment string, apply func(context.Context, sessions.EnvironmentExecutorCredentialTx, sessions.LockedSession) error) error

WithEnvironmentExecutorCredentials reads the Environment on the pool before it knows which Session to lock.

func (*Store) WithExecutorCredentials

func (s *Store) WithExecutorCredentials(ctx context.Context, tenant string, apply func(context.Context, sessions.ExecutorCredentialTx) error) error

func (*Store) WithInputs added in v0.0.10

func (s *Store) WithInputs(ctx context.Context, tenant, session string, apply func(context.Context, sessions.InputTx) error) error

func (*Store) WithSessionDeletion added in v0.0.10

func (s *Store) WithSessionDeletion(ctx context.Context, tenantID, sessionID string, apply func(context.Context, sessions.LockedSession, sessions.SessionDeletionTx) error) error

Jump to

Keyboard shortcuts

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