Documentation
¶
Overview ¶
Package store provides shared persistence types, validation, and helper primitives.
Index ¶
- Constants
- Variables
- func AppendLimit(query string, args []any, limit int) (string, []any)
- func AppendWhere(query string, where []string) string
- func Apply(ctx context.Context, db *sql.DB, stream MigrationStream) error
- func BuildAndQuery(prefix string, suffix string, input ...Clause) (string, []any)
- func BuildClauses(input ...Clause) ([]string, []any)
- func BuildWhereQuery(prefix string, suffix string, input ...Clause) (string, []any)
- func Checkpoint(ctx context.Context, db *sql.DB) error
- func CheckpointPassive(ctx context.Context, db *sql.DB) error
- func ContextWithMutationCommitFence(ctx context.Context, fence MutationCommitFence) context.Context
- func EncodeNetworkUsageCursor(query NetworkUsageQuery, position NetworkUsageCursorPosition) (string, error)
- func EncodeSessionPermissionPolicy(policy SessionPermissionPolicy) (string, error)
- func EncodeSessionSpawnBudget(budget SessionSpawnBudget) (string, error)
- func ExecuteWrite(ctx context.Context, db *sql.DB, fn func(context.Context, *WriteTx) error) error
- func FormatNullableTimestamp(value time.Time) string
- func FormatTimestamp(value time.Time) string
- func IsSQLiteBusy(err error) bool
- func LocalDay(value time.Time) string
- func LocalDayStart(value time.Time, daysBack int) time.Time
- func NetworkDirectRoomIdentity(workspaceID string, channel string, sessionA string, sessionB string) (string, string, string, error)
- func NewID(prefix string) (string, error)
- func NormalizeNetworkConversationListLimit(limit int) int
- func NormalizeNetworkConversationSort(sort string) string
- func NormalizeNetworkDirectRoomSessions(sessionA string, sessionB string) (string, string, error)
- func NormalizeNetworkFanoutPolicy(policy string) string
- func NormalizeNetworkMessageLimit(limit int) int
- func NormalizeNetworkPeerIDs(values []string, field string) ([]string, error)
- func NormalizeNetworkUsageQuery(query NetworkUsageQuery) (NetworkUsageQuery, *NetworkUsageCursorPosition, error)
- func NormalizeSQLiteIdentifier(value string) (string, error)
- func NormalizeSessionType(value string) string
- func NullFloat64(value sql.NullFloat64) *float64
- func NullInt64(value sql.NullInt64) *int64
- func NullString(value sql.NullString) *string
- func NullableFloat64(value *float64) any
- func NullableInt64(value *int64) any
- func NullableString(value string) any
- func NullableStringPointer(value *string) any
- func OpenSQLiteDatabase(ctx context.Context, path string, ...) (*sql.DB, error)
- func OpenSQLiteDatabaseWithPragmas(ctx context.Context, path string, pragmas []string, ...) (*sql.DB, error)
- func ParseNullableTimestamp(value string) (*time.Time, error)
- func ParseTimestamp(value string) (time.Time, error)
- func RefuseLegacyDatabaseAtPath(ctx context.Context, path string, stream MigrationStream) (err error)
- func RequireCurrent(ctx context.Context, db *sql.DB, stream MigrationStream) error
- func SQLNullString(value string) sql.NullString
- func SQLNullStringPointer(value *string) sql.NullString
- func SessionActivityIdleSeconds(meta *SessionActivityMeta, now time.Time) int64
- func SessionAdvertisedCommandsEqual(left SessionAdvertisedCommand, right SessionAdvertisedCommand) bool
- func SessionDBFile(sessionDir string) string
- func SessionMetaFile(sessionDir string) string
- func SessionRuntimeFailurePointer(value string) *string
- func SessionRuntimeFailureValue(value *string) string
- func SqliteFilePath(path string) string
- func UpsertLoopOutputBlob(ctx context.Context, exec LoopOutputBlobExecutor, outputRef string, ...) error
- func ValidFailureKind(kind FailureKind) bool
- func ValidFailureReasonCode(code FailureReasonCode) bool
- func ValidPendingInteractionKind(kind string) bool
- func ValidPendingInteractionStatus(status string) bool
- func ValidStopReason(r StopReason) bool
- func ValidateChildSessionToolSubset(parent SessionPermissionPolicy, child SessionPermissionPolicy) error
- func ValidateJavaScriptSafeInteger(field string, value int64) error
- func ValidateNetworkChannelFanoutConfiguration(policy string, coordinatorPeerID string) error
- func ValidateNetworkFanoutPolicy(policy string) error
- func ValidateNetworkSubscriptionMode(mode string) error
- func ValidateSessionLineage(sessionID string, lineage *SessionLineage) error
- func ValidateSessionRuntime(status SessionRuntimeStatus, transition SessionRuntimeTransition, ...) error
- func ValidateSessionRuntimeRecovery(status SessionRuntimeStatus, generation int64, ...) error
- func ValidateSessionRuntimeSelection(selection *SessionRuntimeSelection, revision int64) error
- func ValidateSessionRuntimeSelectionState(state *SessionRuntimeSelectionState) error
- func WithMigrationLogger(ctx context.Context, logger *slog.Logger) context.Context
- func WriteSessionMeta(path string, meta SessionMeta) error
- type AcceptNetworkMessageRequest
- type AcceptNetworkMessageResult
- type Clause
- func Int64Clause(column string, op string, value int64) Clause
- func NotStringClause(column string, value string) Clause
- func OpaqueStringClause(column string, value string) Clause
- func ReadScopeClause(column string, scope ReadScope) Clause
- func ReadScopeCoalescedClause(columns []string, scope ReadScope) Clause
- func StringClause(column string, value string) Clause
- func StringCompareClause(column string, op string, value string) Clause
- func TimeClause(column string, op string, value time.Time) Clause
- type CommittedNetworkNotification
- type ConversationRewindReader
- type ConversationRewindRequest
- type ConversationRewindResult
- type ConversationRewindState
- type ConversationRewindTarget
- type ConversationRewinder
- type DeadEntity
- type DeadEntityKey
- type DeadEntityKind
- type DeadEntityStore
- type EventArchiveFilter
- type EventArchiveRequest
- type EventArchiveResult
- type EventArchiver
- type EventCloser
- type EventCorrelation
- type EventHourWeekdayBucket
- type EventMetadata
- type EventMetadataReadCloser
- type EventMetadataReader
- type EventQuery
- type EventReadCloser
- type EventReader
- type EventRecorder
- type EventSummary
- type EventSummaryBatchWriter
- type EventSummaryContentState
- type EventSummaryQuery
- type EventSummaryStore
- type EventWriter
- type FailureKind
- type FailureReasonCode
- type HookDispatchCounts
- type HookRunQuery
- type LongestSessionSample
- type LoopOutputBlobExecutor
- type MarketplaceCatalogEntry
- type MarketplaceCatalogReplacement
- type MarketplaceCatalogRepository
- type MarketplaceCatalogState
- type MigrationBootstrap
- type MigrationStepper
- type MigrationStream
- type MutationCommitFence
- type NetworkAcceptanceStore
- type NetworkAuditEntry
- type NetworkAuditQuery
- type NetworkAuditStore
- type NetworkAvailability
- type NetworkAvailabilityStore
- type NetworkBudgetUsage
- type NetworkCausationStore
- type NetworkChannelEntry
- type NetworkChannelKindCount
- type NetworkChannelPatch
- type NetworkChannelProjection
- type NetworkChannelProjectionQuery
- type NetworkChannelProjectionStore
- type NetworkChannelQuery
- type NetworkChannelRef
- type NetworkChannelStore
- type NetworkConversationMessage
- type NetworkConversationMessageQuery
- type NetworkConversationRef
- type NetworkConversationStore
- type NetworkConversationWriteResult
- type NetworkDirectRoomEntry
- type NetworkDirectRoomPage
- type NetworkDirectRoomQuery
- type NetworkDirectRoomSummary
- type NetworkInboxStore
- type NetworkMessageDisposition
- type NetworkMessageEntry
- type NetworkMessageQuery
- type NetworkMessageStore
- type NetworkPreferenceStore
- type NetworkRecentQuery
- type NetworkRecentStore
- type NetworkRecentSummary
- type NetworkSubscriptionEntry
- type NetworkSubscriptionQuery
- type NetworkSubscriptionRef
- type NetworkTaskStatusProjection
- type NetworkTaskStatusProjectionPayload
- type NetworkTaskStatusProjectionQuery
- type NetworkTaskStatusPublication
- type NetworkTaskThreadOrigin
- type NetworkTaskThreadOriginQuery
- type NetworkThreadPage
- type NetworkThreadParticipant
- type NetworkThreadQuery
- type NetworkThreadSessionTokenStats
- type NetworkThreadSessionTokenStatsQuery
- type NetworkThreadSessionTokenStatsUpdate
- type NetworkThreadSummary
- type NetworkUsageCursorPosition
- type NetworkUsageQuery
- type NetworkUsageReport
- type NetworkUsageStore
- type NetworkUsageSummary
- type NetworkWakeAdmissionInput
- type NetworkWakeOutcome
- type NetworkWakeQueueStore
- type NetworkWakeUsageDetail
- type NetworkWorkEntry
- type ObservabilityRetentionSweepResult
- type OnboardingStatus
- type OnboardingStore
- type OverviewDayQuery
- type OverviewSinceQuery
- type OverviewWorkspaceQuery
- type PendingInteraction
- type PendingInteractionCreate
- type PendingInteractionPayload
- type PendingInteractionTransition
- type PermissionLogEntry
- type PermissionLogQuery
- type ReadScope
- type ReconcileResult
- type SQLiteCorruptionError
- type SessionActivityMeta
- type SessionAdvertisedCommand
- type SessionAdvertisedCommandInput
- type SessionAdvertisedCommandState
- type SessionAgentMetrics
- type SessionAgentMetricsQuery
- type SessionAgentMetricsReader
- type SessionArchiveFilter
- type SessionArchiveStore
- type SessionAttach
- type SessionAttachRequest
- type SessionAttention
- type SessionAttentionCommit
- type SessionAttentionStore
- type SessionAttentionSummary
- type SessionCatalog
- type SessionCatalogAttentionRank
- type SessionCatalogOwnerReader
- type SessionCatalogPage
- type SessionCatalogPageQuery
- type SessionCatalogPager
- type SessionCatalogPosition
- type SessionCreationIdentity
- type SessionCreationIdentityStore
- type SessionCreationOptions
- type SessionCreationProfile
- func (p SessionCreationProfile) CanonicalJSON() ([]byte, error)
- func (p SessionCreationProfile) CreationDigest(opts SessionCreationOptions) (string, error)
- func (p SessionCreationProfile) PolicySpecDigest() (string, error)
- func (p SessionCreationProfile) Ref() (string, error)
- func (p SessionCreationProfile) Validate() error
- type SessionCreationProfileStore
- type SessionCreationRegistration
- type SessionCreationStore
- type SessionDBOwner
- type SessionEvent
- type SessionEventMetadataOpener
- type SessionExecutionLocationState
- type SessionFailure
- type SessionInfo
- type SessionInputAttachment
- type SessionInputQueueEntry
- type SessionInputQueueInsert
- type SessionInputQueueStore
- type SessionInputQueueSummary
- type SessionInputRuntime
- type SessionLedgerRecord
- type SessionLineage
- type SessionListQuery
- type SessionLivenessMeta
- type SessionMeta
- func (m *SessionMeta) AdvertisedCommandsValue() []SessionAdvertisedCommand
- func (m SessionMeta) CWDValue() string
- func (m SessionMeta) EffectivePermissionsValue() string
- func (m SessionMeta) EffectiveProviderAuthModeValue() string
- func (m SessionMeta) NetworkOwnerKeySnapshot() string
- func (m SessionMeta) NetworkSpecSnapshot() participation.Spec
- func (m *SessionMeta) SetAdvertisedCommands(commands []SessionAdvertisedCommand)
- func (m *SessionMeta) SetCWD(cwd string)
- func (m *SessionMeta) SetEffectivePermissions(permissions string)
- func (m *SessionMeta) SetEffectiveProviderAuthMode(mode string)
- func (m *SessionMeta) SetWorktreeID(worktreeID string)
- func (m SessionMeta) Validate() error
- func (m SessionMeta) WorktreeIDValue() string
- type SessionNetworkState
- type SessionPermissionPolicy
- type SessionPromptAdmission
- type SessionPromptAdmissionRequest
- type SessionPromptAdmissionResult
- type SessionPromptAdmissionStore
- type SessionProviderExecutionState
- type SessionRuntimeRecovery
- type SessionRuntimeSelection
- func CloneSessionRuntimeSelection(selection *SessionRuntimeSelection) *SessionRuntimeSelection
- func NormalizeSessionRuntimeSelection(selection *SessionRuntimeSelection) *SessionRuntimeSelection
- func SessionRuntimeSelectionStateValues(state *SessionRuntimeSelectionState) (*SessionRuntimeSelection, int64)
- type SessionRuntimeSelectionState
- type SessionRuntimeStatus
- type SessionRuntimeTransition
- type SessionSandboxMeta
- type SessionSoulSnapshotUpdate
- type SessionSpawnBudget
- type SessionStateUpdate
- type SessionTranscriptEpochStore
- type SessionTranscriptEpochUpdate
- type SkillExposureOwnerScope
- type SkillExposureRecord
- type SkillExposureRepository
- type StopReason
- type StreamStatus
- type TaskClosedDay
- type TaskDesignationRollup
- type TaskDesignationRollupQuery
- type TaskRunOutcomeDay
- type TokenStats
- type TokenStatsCostSummary
- type TokenStatsQuery
- type TokenStatsUpdate
- type TokenUsage
- type TokenUsageAgentTotal
- type TokenUsageCostGroup
- type TokenUsageDailyUpdate
- type TokenUsageDay
- type TokenUsageProfileTotal
- type TurnHistory
- type WakeReservation
- type WakeSkip
- type WorkspaceAttentionSummary
- type WriteTx
- func (tx *WriteTx) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (tx *WriteTx) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
- func (tx *WriteTx) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (tx *WriteTx) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
Constants ¶
const ( // NetworkSurfaceThread stores a public thread conversation container. NetworkSurfaceThread = "thread" // NetworkSurfaceDirect stores a two-party direct-room conversation container. NetworkSurfaceDirect = "direct" // NetworkFanoutPolicyCapabilityMatch activates peers by declared capability. NetworkFanoutPolicyCapabilityMatch = "capability_match" // NetworkFanoutPolicyCoordinator activates the configured channel coordinator. NetworkFanoutPolicyCoordinator = "coordinator" // NetworkFanoutPolicyAllMembers activates every eligible local channel member. NetworkFanoutPolicyAllMembers = "all_members" // NetworkSubscriptionModeMute suppresses unmentioned matching traffic. NetworkSubscriptionModeMute = "mute" // NetworkSubscriptionModeFull preserves full prompt injection. NetworkSubscriptionModeFull = "full" // NetworkKindGreet stores a presence announcement. NetworkKindGreet = "greet" // NetworkKindWhois stores a peer identity request or response. NetworkKindWhois = "whois" // NetworkKindSay stores a text conversation message. NetworkKindSay = "say" // NetworkKindCapability stores a capability transfer message. NetworkKindCapability = "capability" // NetworkKindReceipt stores an admission receipt message. NetworkKindReceipt = "receipt" // NetworkKindTrace stores a work lifecycle trace message. NetworkKindTrace = "trace" // NetworkWorkStateSubmitted is the initial work state. NetworkWorkStateSubmitted = "submitted" // NetworkWorkStateWorking marks active work. NetworkWorkStateWorking = "working" // NetworkWorkStateNeedsInput marks blocked work awaiting input. NetworkWorkStateNeedsInput = "needs_input" // NetworkWorkStateCompleted marks successful terminal work. NetworkWorkStateCompleted = "completed" // NetworkWorkStateFailed marks failed terminal work. NetworkWorkStateFailed = "failed" // NetworkWorkStateCanceled marks canceled terminal work. NetworkWorkStateCanceled = "canceled" )
const ( NetworkConversationSortRecentActivity = "recent_activity" NetworkConversationSortCreated = "created" NetworkConversationSortAlphabetical = "alphabetical" NetworkConversationListDefaultLimit = 50 NetworkConversationListMaxLimit = 200 NetworkMessageDefaultLimit = 120 NetworkMessageMaxLimit = 200 )
const ( PendingInteractionKindPermission = "permission" PendingInteractionKindClarify = "clarify" PendingInteractionStatusPending = "pending" PendingInteractionStatusOrphaned = "orphaned" PendingInteractionStatusResolved = "resolved" PendingInteractionStatusTimedOut = "timed_out" PendingInteractionStatusCanceled = "canceled" PendingInteractionTitleMaxBytes = 200 PendingInteractionPayloadMaxBytes = 4096 PendingInteractionResolutionMaxBytes = 240 PendingInteractionChoiceMaxBytes = 120 )
const ( PendingInteractionOutcomeApplied = "applied" PendingInteractionOutcomeAnswered = "answered" PendingInteractionOutcomeResolvedAfterRestart = "resolved-after-restart" PendingInteractionOutcomeAlreadyResolved = "already-resolved" PendingInteractionOutcomeQueueFull = "queue-full" )
const ( SessionCreationSandboxNone = "none" SessionCreationSandboxRef = "ref" )
const ( SessionInputAttachmentKindImage = attachmentspkg.KindImage SessionInputAttachmentKindFile = attachmentspkg.KindFile )
const ( // SessionInputQueueModeQueue stores operator input to run after the active turn ends. SessionInputQueueModeQueue = "queue" // SessionInputQueueModeSteer stores operator guidance that replaces the active turn. SessionInputQueueModeSteer = "steer" // SessionInputQueueModeInterrupt stores replacement input after an explicit interrupt. SessionInputQueueModeInterrupt = "interrupt" )
const ( // SessionInputDeliveryNone reports commands that do not submit replacement input. SessionInputDeliveryNone = "none" // SessionInputDeliveryDirect streams input immediately on an idle session. SessionInputDeliveryDirect = "direct" // SessionInputDeliveryAfterTurn dispatches input after the active turn settles. SessionInputDeliveryAfterTurn = "after_turn" // SessionInputDeliveryInterruptThenPrompt interrupts the target turn before dispatch. SessionInputDeliveryInterruptThenPrompt = "interrupt_then_prompt" )
const ( SessionInputQueueStatusQueued = "queued" SessionInputQueueStatusDispatching = "dispatching" SessionInputQueueStatusSent = "sent" SessionInputQueueStatusFailed = "failed" SessionInputQueueStatusCanceled = "canceled" )
const ( // SessionStallStateDetected marks a session whose ACP activity timed out // while the subprocess still appeared alive during recovery. SessionStallStateDetected = "stalled" // SessionStallReasonActivityTimeout reports that no ACP activity was observed // within the configured supervision window. SessionStallReasonActivityTimeout = "activity_timeout" // SessionStallReasonPromptDeadlineExceeded reports that the prompt-level // supervision deadline elapsed before completion. SessionStallReasonPromptDeadlineExceeded = "prompt_deadline_exceeded" // SessionStallReasonProcessUnhealthy reports that subprocess health checks // failed while a prompt was still active. SessionStallReasonProcessUnhealthy = "process_unhealthy" )
const ( SessionPromptOperationPrompt = "prompt" SessionPromptOperationSteer = "steer" SessionPromptAdmissionReserved = "reserved" SessionPromptAdmissionDispatchCommitted = "dispatch_committed" SessionPromptAdmissionCompleted = "completed" SessionPromptAdmissionIndeterminate = "indeterminate" )
const ( SessionPromptResultStatusAccepted = "accepted" SessionPromptResultStatusQueued = "queued" SessionPromptResultStatusSteering = "steering" SessionPromptResultStatusInterrupting = "interrupting" SessionPromptResultStatusCanceled = "canceled" )
const ( // SessionDatabaseName is the filename for per-session event storage. SessionDatabaseName = "events.db" // GlobalDatabaseName is the filename for the global CompozyOS index database. GlobalDatabaseName = "compozy.db" // SessionMetaName is the filename for quick session metadata lookups. SessionMetaName = "meta.json" )
const ( TokenCostStatusActual = "actual" TokenCostStatusEstimated = "estimated" TokenCostStatusIncluded = "included" TokenCostStatusUnknown = "unknown" TokenCostSourceAgentReported = "agent_reported" TokenCostSourceCatalogConfig = "catalog_config" TokenCostSourceModelsDev = "models_dev" TokenCostSourceBuiltin = "builtin" TokenCostSourceNone = "none" )
const ( NetworkDispositionDeliver = "deliver" NetworkDispositionIgnore = "ignore" )
const ( NetworkWakeTriggerNone = "" NetworkWakeTriggerDirect = "direct" NetworkWakeTriggerMention = "mention" )
const ( NetworkWakeSkipNotLive = "not_live" NetworkWakeSkipNotEligible = "not_eligible" NetworkWakeSkipNotAddressed = "not_addressed" NetworkWakeSkipDuplicate = "duplicate" NetworkWakeSkipDepthExceeded = "depth_exceeded" NetworkWakeSkipCoalesced = "coalesced" NetworkWakeSkipInFlight = "in_flight" NetworkWakeSkipBudgetExhausted = "budget_exhausted" NetworkWakeSkipNetworkDisabled = "network_disabled" )
const ( NetworkWakeStateSucceeded = "succeeded" NetworkWakeStateFailed = "failed" NetworkWakeStateCanceled = "canceled" NetworkWakeStateDeadlineExceeded = "deadline_exceeded" )
const ( NetworkWakeUsageActual = "actual" )
const ( NetworkWakeUsageReserved = "reserved" DefaultNetworkUsageLimit = 50 MaxNetworkUsageLimit = 200 MaxJavaScriptSafeInteger int64 = 9_007_199_254_740_991 )
const DefaultProfileID = "00000000000000000000000000"
DefaultProfileID is the permanent zero-ULID owner seeded by migration 00082.
const (
// DefaultSQLiteBusyTimeoutMS is the shared SQLite busy timeout in milliseconds.
DefaultSQLiteBusyTimeoutMS = defaultBusyTimeoutMS
)
const SessionCreationProfileVersion = 4
Variables ¶
var ( // ErrLegacyDatabase reports a database created by the removed migration runner. ErrLegacyDatabase = errors.New("store: database was created by the removed pre-goose migration runner") // ErrSchemaBehind reports a database older than the running binary. ErrSchemaBehind = errors.New("store: database schema is behind this binary") // ErrSchemaAhead reports a database newer than the running binary. ErrSchemaAhead = errors.New("store: database schema is ahead of this binary") // ErrMigrationConnectionCapacity reports a pool too small for a non-transactional migration. ErrMigrationConnectionCapacity = errors.New("store: migration database connection capacity is insufficient") )
var ( // ErrNetworkConversationNotFound reports a missing network conversation container. ErrNetworkConversationNotFound = errors.New("store: network conversation not found") // ErrNetworkDirectRoomCollision reports a direct_id bound to another peer pair. ErrNetworkDirectRoomCollision = errors.New("store: network direct room collision") // ErrNetworkWorkContainerMismatch reports a work_id used outside its bound container. ErrNetworkWorkContainerMismatch = errors.New("store: network work container mismatch") // ErrNetworkWorkClosed reports a non-duplicate message for terminal work. ErrNetworkWorkClosed = errors.New("store: network work closed") // ErrNetworkCursorInvalid reports a malformed or query-mismatched network list cursor. ErrNetworkCursorInvalid = errors.New("store: network cursor invalid") // ErrNetworkChannelExists reports an attempted create for an existing workspace channel. ErrNetworkChannelExists = errors.New("store: network channel already exists") // ErrNetworkChannelNotFound reports a message written without channel authority. ErrNetworkChannelNotFound = errors.New("store: network channel not found") )
var ( ErrPendingInteractionNotFound = errors.New("store: pending interaction not found") ErrPendingInteractionAlreadyResolved = errors.New("store: pending interaction already resolved") ErrPendingInteractionConflict = errors.New("store: pending interaction conflict") ErrPendingInteractionStatusInvalid = errors.New("store: pending interaction status is invalid") )
var ( // ErrSessionArchived reports an attempt to reactivate an archived session. ErrSessionArchived = errors.New("store: session is archived") // ErrSessionArchiveRequiresStopped reports an archive attempt for a live session. ErrSessionArchiveRequiresStopped = errors.New("store: session must be stopped before archiving") )
var ( // ErrSessionInputQueueFull reports that accepting an entry would exceed the configured capacity. ErrSessionInputQueueFull = errors.New("store: session input queue full") // ErrSessionInputQueueEntryNotFound reports that a queued input entry does not exist for a session. ErrSessionInputQueueEntryNotFound = errors.New("store: session input queue entry not found") // ErrSessionInputQueueEntryNotQueued reports that a pending input has already left the mutable queue state. ErrSessionInputQueueEntryNotQueued = errors.New("store: session input queue entry is not queued") // ErrSessionInputMutationConflict reports reuse of a mutation identity with different input. ErrSessionInputMutationConflict = errors.New("store: session input mutation identity conflict") // ErrSessionInputSteerTextOnly reports that steer input cannot include attachments. ErrSessionInputSteerTextOnly = errors.New("store: steer input cannot include attachments") )
var ( ErrSessionPromptAdmissionInProgress = errors.New("store: session prompt admission is in progress") ErrSessionPromptIdempotencyConflict = errors.New("store: session prompt idempotency conflict") ErrSessionPromptMessageConflict = errors.New("store: session prompt message identity conflict") ErrSessionPromptDispatchIndeterminate = errors.New( "store: session prompt dispatch is indeterminate", ) )
var ( // ErrClosed reports that a session database no longer accepts writes. ErrClosed = errors.New("store: session database closed") // ErrDrainTimeout reports that shutdown timed out before queued writes drained. ErrDrainTimeout = errors.New("store: writer drain timeout") // ErrSessionWorkspaceMismatch reports an attempt to reassign a durable session identity. ErrSessionWorkspaceMismatch = errors.New("store: session workspace owner does not match") )
var ( ErrConversationRewindTargetNotFound = errors.New("store: conversation rewind target not found") ErrConversationRewindTargetInvalid = errors.New("store: conversation rewind target is invalid") ErrConversationRewindFenceConflict = errors.New("store: conversation rewind fence conflict") ErrConversationRewindIdempotencyConflict = errors.New("store: conversation rewind idempotency conflict") )
var ( ErrNetworkUsageQueryInvalid = errors.New("network_usage_query_invalid") ErrNetworkUsageLimitInvalid = errors.New("network_usage_limit_invalid") ErrNetworkUsageCursorInvalid = errors.New("network_usage_cursor_invalid") ErrNetworkUsageUnsafeInteger = errors.New("network_usage_unsafe_integer") )
var ( // ErrSessionNotFound reports that a persisted session row does not exist. ErrSessionNotFound = errors.New("store: session not found") // ErrSessionAttachLocked reports that another holder owns a live attach lease. ErrSessionAttachLocked = errors.New("store: session attach locked") // ErrSessionNotAttachable reports that a session is not eligible for attach/resume. ErrSessionNotAttachable = errors.New("store: session not attachable") // ErrSessionParticipationMismatch rejects a same-ID refresh with different immutable Network participation. ErrSessionParticipationMismatch = errors.New("store: session participation mismatch") )
var ErrInvalidDeadEntity = errors.New("store: invalid dead entity")
var ErrReadScopeInvalid = errors.New("store: read scope is invalid")
var ErrSQLiteCorrupt = errors.New("store: sqlite database is corrupt")
var ( // ErrSessionCreationIdentityMismatch rejects adoption of a same-ID session with different creation truth. ErrSessionCreationIdentityMismatch = errors.New("store: session creation identity mismatch") )
var ( // ErrSessionMetadataSchemaBehind reports metadata that predates the runtime binding contract. ErrSessionMetadataSchemaBehind = errors.New("store: session metadata schema is behind this binary") )
Functions ¶
func AppendLimit ¶
AppendLimit appends a LIMIT clause when the limit is positive.
func AppendWhere ¶
AppendWhere appends a WHERE block when any clauses are present.
func BuildAndQuery ¶
BuildAndQuery composes validated clauses after an existing WHERE boundary.
func BuildClauses ¶
BuildClauses compacts optional clauses into WHERE fragments and args.
func BuildWhereQuery ¶
BuildWhereQuery composes validated clauses after a new WHERE boundary.
func Checkpoint ¶
Checkpoint truncates the WAL for an open SQLite database.
func CheckpointPassive ¶
CheckpointPassive runs a non-truncating SQLite WAL checkpoint.
func ContextWithMutationCommitFence ¶
func ContextWithMutationCommitFence(ctx context.Context, fence MutationCommitFence) context.Context
ContextWithMutationCommitFence carries a commit-time authorization check through service layers.
func EncodeNetworkUsageCursor ¶
func EncodeNetworkUsageCursor( query NetworkUsageQuery, position NetworkUsageCursorPosition, ) (string, error)
EncodeNetworkUsageCursor binds one keyset position to the normalized filter set.
func EncodeSessionPermissionPolicy ¶
func EncodeSessionPermissionPolicy(policy SessionPermissionPolicy) (string, error)
EncodeSessionPermissionPolicy marshals normalized permission policy metadata.
func EncodeSessionSpawnBudget ¶
func EncodeSessionSpawnBudget(budget SessionSpawnBudget) (string, error)
EncodeSessionSpawnBudget marshals budget metadata for the global session catalog.
func ExecuteWrite ¶
ExecuteWrite runs fn inside a BEGIN IMMEDIATE transaction with bounded SQLITE_BUSY retries.
func FormatNullableTimestamp ¶
FormatNullableTimestamp renders zero timestamps as empty strings for optional columns.
func FormatTimestamp ¶
FormatTimestamp renders a timestamp in the canonical SQLite text layout.
func IsSQLiteBusy ¶
IsSQLiteBusy reports whether err is a SQLite BUSY or LOCKED condition.
func LocalDay ¶
LocalDay formats one instant as the daemon-local calendar day bucket used by the daily usage rollup and the SQLite 'localtime' overview aggregates.
func LocalDayStart ¶
LocalDayStart returns daemon-local midnight daysBack days before value's day.
func NetworkDirectRoomIdentity ¶
func NetworkDirectRoomIdentity( workspaceID string, channel string, sessionA string, sessionB string, ) (string, string, string, error)
NetworkDirectRoomIdentity derives the stable direct-room id for one ordered session pair.
func NormalizeNetworkConversationListLimit ¶
NormalizeNetworkConversationListLimit applies the bounded catalog contract.
func NormalizeNetworkConversationSort ¶
NormalizeNetworkConversationSort applies the default recent-activity order.
func NormalizeNetworkDirectRoomSessions ¶
NormalizeNetworkDirectRoomSessions validates and orders a two-party room pair.
func NormalizeNetworkFanoutPolicy ¶
NormalizeNetworkFanoutPolicy applies the default channel activation policy.
func NormalizeNetworkMessageLimit ¶
NormalizeNetworkMessageLimit applies the bounded message-history contract.
func NormalizeNetworkPeerIDs ¶
NormalizeNetworkPeerIDs trims, validates, deduplicates, and sorts peer ids.
func NormalizeNetworkUsageQuery ¶
func NormalizeNetworkUsageQuery( query NetworkUsageQuery, ) (NetworkUsageQuery, *NetworkUsageCursorPosition, error)
NormalizeNetworkUsageQuery validates filters, applies defaults, and decodes the cursor.
func NormalizeSQLiteIdentifier ¶
NormalizeSQLiteIdentifier validates a SQLite identifier for use in helper queries.
func NormalizeSessionType ¶
NormalizeSessionType applies the default session type when empty.
func NullFloat64 ¶
func NullFloat64(value sql.NullFloat64) *float64
NullFloat64 converts sql.NullFloat64 into a pointer.
func NullString ¶
func NullString(value sql.NullString) *string
NullString converts sql.NullString into a trimmed string pointer.
func NullableFloat64 ¶
NullableFloat64 maps nil pointers to SQL NULL.
func NullableInt64 ¶
NullableInt64 maps nil pointers to SQL NULL.
func NullableString ¶
NullableString maps blank strings to SQL NULL.
func NullableStringPointer ¶
NullableStringPointer maps nil or blank string pointers to SQL NULL.
func OpenSQLiteDatabase ¶
func OpenSQLiteDatabase( ctx context.Context, path string, initialize func(context.Context, *sql.DB) error, ) (*sql.DB, error)
OpenSQLiteDatabase opens a SQLite database and applies shared configuration.
func OpenSQLiteDatabaseWithPragmas ¶
func OpenSQLiteDatabaseWithPragmas( ctx context.Context, path string, pragmas []string, initialize func(context.Context, *sql.DB) error, ) (*sql.DB, error)
OpenSQLiteDatabaseWithPragmas opens a SQLite database with additional driver-level pragmas.
func ParseNullableTimestamp ¶
ParseNullableTimestamp parses optional canonical timestamps.
func ParseTimestamp ¶
ParseTimestamp parses the canonical SQLite text timestamp.
func RefuseLegacyDatabaseAtPath ¶
func RefuseLegacyDatabaseAtPath(ctx context.Context, path string, stream MigrationStream) (err error)
RefuseLegacyDatabaseAtPath checks legacy markers through a read-only handle before a writable SQLite connection can mutate the database header.
func RequireCurrent ¶
RequireCurrent validates that a migration stream is exactly at the embedded head without creating tables or applying migrations.
func SQLNullString ¶
func SQLNullString(value string) sql.NullString
SQLNullString maps an optional string to a canonical trimmed sql.NullString.
func SQLNullStringPointer ¶
func SQLNullStringPointer(value *string) sql.NullString
SQLNullStringPointer maps a nil or blank string pointer to an invalid sql.NullString.
func SessionActivityIdleSeconds ¶
func SessionActivityIdleSeconds(meta *SessionActivityMeta, now time.Time) int64
SessionActivityIdleSeconds reports the age of the last recorded runtime activity relative to now.
func SessionAdvertisedCommandsEqual ¶
func SessionAdvertisedCommandsEqual(left SessionAdvertisedCommand, right SessionAdvertisedCommand) bool
SessionAdvertisedCommandsEqual compares two typed command values.
func SessionDBFile ¶
SessionDBFile returns the canonical events database path for a session directory.
func SessionMetaFile ¶
SessionMetaFile returns the canonical metadata file path for a session directory.
func SessionRuntimeFailurePointer ¶
SessionRuntimeFailurePointer normalizes an optional persisted runtime diagnostic.
func SessionRuntimeFailureValue ¶
SessionRuntimeFailureValue returns the normalized runtime diagnostic value.
func SqliteFilePath ¶
SqliteFilePath normalizes a filesystem path for use as a file:// URL Path in a SQLite DSN. url.URL requires an absolute path starting with "/" to produce the three-slash form "file:///...". On Windows, filepath.IsAbs returns true for drive-letter paths (e.g. "C:\..."), but filepath.ToSlash yields "C:/..." which url.URL serializes as "file://C:/..." — the SQLite URI parser then interprets "C:" as the network authority rather than a drive letter (failing with "invalid uri authority: C:"). Prepend "/" only for absolute paths that lack one; relative paths are left unchanged so callers that pass relative paths are unaffected. Exported so sibling packages (e.g. internal/store/sessiondb) build SQLite DSNs through the same canonical normalization instead of duplicating the logic.
func UpsertLoopOutputBlob ¶
func UpsertLoopOutputBlob( ctx context.Context, exec LoopOutputBlobExecutor, outputRef string, payload []byte, at time.Time, ) error
UpsertLoopOutputBlob persists a content-addressed loop output and refreshes its usage timestamp.
func ValidFailureKind ¶
func ValidFailureKind(kind FailureKind) bool
ValidFailureKind reports whether kind is a supported failure enum member.
func ValidFailureReasonCode ¶
func ValidFailureReasonCode(code FailureReasonCode) bool
ValidFailureReasonCode reports whether code is a supported failure reason.
func ValidPendingInteractionKind ¶
ValidPendingInteractionKind reports whether kind belongs to the durable vocabulary.
func ValidPendingInteractionStatus ¶
ValidPendingInteractionStatus reports whether status belongs to the durable vocabulary.
func ValidStopReason ¶
func ValidStopReason(r StopReason) bool
ValidStopReason reports whether r is a supported stop reason enum member.
func ValidateChildSessionToolSubset ¶
func ValidateChildSessionToolSubset(parent SessionPermissionPolicy, child SessionPermissionPolicy) error
ValidateChildSessionToolSubset ensures child concrete tool atoms cannot exceed the parent.
func ValidateJavaScriptSafeInteger ¶
ValidateJavaScriptSafeInteger rejects counters that cannot round-trip through JSON numbers.
func ValidateNetworkChannelFanoutConfiguration ¶
ValidateNetworkChannelFanoutConfiguration checks policy and coordinator coupling.
func ValidateNetworkFanoutPolicy ¶
ValidateNetworkFanoutPolicy checks one channel activation policy value.
func ValidateNetworkSubscriptionMode ¶
ValidateNetworkSubscriptionMode checks one delivery preference mode.
func ValidateSessionLineage ¶
func ValidateSessionLineage(sessionID string, lineage *SessionLineage) error
ValidateSessionLineage ensures lineage is structurally usable by spawn policy enforcement.
func ValidateSessionRuntime ¶
func ValidateSessionRuntime(status SessionRuntimeStatus, transition SessionRuntimeTransition, failure string) error
ValidateSessionRuntime validates one durable runtime binding projection.
func ValidateSessionRuntimeRecovery ¶
func ValidateSessionRuntimeRecovery( status SessionRuntimeStatus, generation int64, recovery *SessionRuntimeRecovery, ) error
ValidateSessionRuntimeRecovery validates one durable recovery projection.
func ValidateSessionRuntimeSelection ¶
func ValidateSessionRuntimeSelection(selection *SessionRuntimeSelection, revision int64) error
ValidateSessionRuntimeSelection ensures a persisted preference and revision are well formed.
func ValidateSessionRuntimeSelectionState ¶
func ValidateSessionRuntimeSelectionState(state *SessionRuntimeSelectionState) error
ValidateSessionRuntimeSelectionState ensures persisted selection state is well formed.
func WithMigrationLogger ¶
WithMigrationLogger overrides migration observability for operations using ctx.
func WriteSessionMeta ¶
func WriteSessionMeta(path string, meta SessionMeta) error
WriteSessionMeta writes the metadata file atomically via temp file and rename.
Types ¶
type AcceptNetworkMessageRequest ¶
type AcceptNetworkMessageRequest struct {
Message NetworkConversationMessage
Dispositions []NetworkMessageDisposition
Admissions []NetworkWakeAdmissionInput
}
AcceptNetworkMessageRequest is the complete input to the atomic acceptance boundary.
type AcceptNetworkMessageResult ¶
type AcceptNetworkMessageResult struct {
AcceptanceSeq int64
AvailabilityEpoch int64
Duplicate bool
Conversation NetworkConversationWriteResult
Dispositions []NetworkMessageDisposition
Admitted []WakeReservation
Skipped []WakeSkip
Notify []CommittedNetworkNotification
}
AcceptNetworkMessageResult reports the exact durable acceptance outcome.
type Clause ¶
type Clause struct {
// contains filtered or unexported fields
}
Clause represents an optional SQL filter clause plus its bound argument.
func Int64Clause ¶
Int64Clause builds a numeric comparison clause when the value is positive.
func NotStringClause ¶
NotStringClause builds an inequality clause when the value is non-empty.
func OpaqueStringClause ¶
OpaqueStringClause builds an equality clause without rewriting the value.
func ReadScopeClause ¶
ReadScopeClause builds the SQL predicate for a validated scope. Invalid input produces an always-false predicate as a second fail-closed guard.
func ReadScopeCoalescedClause ¶
ReadScopeCoalescedClause builds a scoped owner predicate across nullable, ordered owner columns.
func StringClause ¶
StringClause builds an equality clause when the value is non-empty.
func StringCompareClause ¶
StringCompareClause builds a validated string comparison when the value is non-empty.
type CommittedNetworkNotification ¶
type CommittedNetworkNotification struct {
WorkspaceID string
RecipientSessionID string
TaskRunID string
AcceptanceSeq int64
ReadyAt time.Time
}
CommittedNetworkNotification is safe to dispatch only after acceptance commits.
type ConversationRewindReader ¶
type ConversationRewindReader interface {
ConversationRewindTarget(context.Context, string) (ConversationRewindTarget, error)
ConversationRewindState(context.Context) (ConversationRewindState, bool, error)
ConversationRewindReceipt(context.Context, string, string) (ConversationRewindResult, bool, error)
}
type ConversationRewindRequest ¶
type ConversationRewindRequest struct {
MessageID string
IdempotencyKey string
RequestHash string
ExpectedGeneration int64
ExpectedMaxSequence int64
TranscriptEpoch int64
BaselineJSON string
}
func (ConversationRewindRequest) Validate ¶
func (r ConversationRewindRequest) Validate() error
type ConversationRewindState ¶
type ConversationRewinder ¶
type ConversationRewinder interface {
ConversationRewindReader
RewindConversation(context.Context, ConversationRewindRequest) (ConversationRewindResult, error)
}
type DeadEntity ¶
type DeadEntity struct {
DeadEntityKey
ProfileName string
ProfileColor string
ProfileIcon string
ProfileEmoji string
ProfileArchived bool
Reason string
MarkedAt time.Time
}
DeadEntity is one durable confirmed-dead external runtime.
func (DeadEntity) Normalize ¶
func (e DeadEntity) Normalize() DeadEntity
Normalize returns the canonical durable row.
func (DeadEntity) Validate ¶
func (e DeadEntity) Validate() error
Validate ensures the durable row is complete and bounded.
type DeadEntityKey ¶
type DeadEntityKey struct {
ProfileID string
WorkspaceID string
Kind DeadEntityKind
EntityID string
}
DeadEntityKey identifies one profile- and workspace-scoped external runtime.
func (DeadEntityKey) Normalize ¶
func (k DeadEntityKey) Normalize() DeadEntityKey
Normalize returns the canonical dead-entity key.
func (DeadEntityKey) Validate ¶
func (k DeadEntityKey) Validate() error
Validate ensures the key is profile- and workspace-scoped and uses a closed kind.
type DeadEntityKind ¶
type DeadEntityKind string
DeadEntityKind identifies one workspace-scoped external runtime family.
const ( DeadEntityKindExtension DeadEntityKind = "extension" DeadEntityKindBridge DeadEntityKind = "bridge" DeadEntityKindMCPSidecar DeadEntityKind = "mcp_sidecar" DeadEntityKindLoopTarget DeadEntityKind = "loop_target" )
type DeadEntityStore ¶
type DeadEntityStore interface {
MarkDeadEntity(ctx context.Context, entity DeadEntity) error
ClearDeadEntity(ctx context.Context, key DeadEntityKey) error
FindDeadEntity(
ctx context.Context,
key DeadEntityKey,
) (DeadEntity, bool, error)
ListDeadEntities(ctx context.Context, readScope ReadScope, workspaceID string) ([]DeadEntity, error)
}
DeadEntityStore manages workspace-scoped confirmed-dead external runtimes.
type EventArchiveFilter ¶
type EventArchiveFilter string
EventArchiveFilter selects rows by their non-destructive archive state.
const ( // EventArchiveAll keeps archived and unarchived rows visible for history queries. EventArchiveAll EventArchiveFilter = "" // EventArchiveUnarchived selects rows eligible for transcript replay. EventArchiveUnarchived EventArchiveFilter = "unarchived" // EventArchiveArchived selects rows retained only for forensic history. EventArchiveArchived EventArchiveFilter = "archived" )
func (EventArchiveFilter) Validate ¶
func (f EventArchiveFilter) Validate() error
Validate rejects unsupported archive filters.
type EventArchiveRequest ¶
EventArchiveRequest identifies one closed event sequence range to archive.
func (EventArchiveRequest) Validate ¶
func (r EventArchiveRequest) Validate() error
Validate ensures an archive request names one positive ordered range.
type EventArchiveResult ¶
EventArchiveResult reports the idempotent mutation applied to one range.
type EventArchiver ¶
type EventArchiver interface {
ArchiveEvents(ctx context.Context, request EventArchiveRequest) (EventArchiveResult, error)
}
EventArchiver marks closed replay spans without deleting their forensic rows.
type EventCloser ¶
EventCloser releases a session event-store handle.
type EventCorrelation ¶
type EventCorrelation struct {
WorktreeID string `json:"worktree_id,omitempty"`
TaskID string `json:"task_id,omitempty"`
RunID string `json:"run_id,omitempty"`
WorkflowID string `json:"workflow_id,omitempty"`
ClaimTokenHash string `json:"claim_token_hash,omitempty"`
LeaseUntil *time.Time `json:"lease_until,omitempty"`
CoordinatorSessionID string `json:"coordinator_session_id,omitempty"`
SchedulerReason string `json:"scheduler_reason,omitempty"`
HookEvent string `json:"hook_event,omitempty"`
HookName string `json:"hook_name,omitempty"`
ActorKind string `json:"actor_kind,omitempty"`
ActorID string `json:"actor_id,omitempty"`
ReleaseReason string `json:"release_reason,omitempty"`
}
EventCorrelation carries the canonical cross-surface correlation keys for session and observability events.
func (EventCorrelation) IsZero ¶
func (c EventCorrelation) IsZero() bool
IsZero reports whether the correlation payload carries any fields.
func (EventCorrelation) Normalize ¶
func (c EventCorrelation) Normalize() EventCorrelation
Normalize trims string fields and canonicalizes timestamps.
type EventHourWeekdayBucket ¶
EventHourWeekdayBucket is one hour-by-weekday event count; weekday 0 is Sunday.
type EventMetadata ¶
type EventMetadata struct {
ID string
SessionID string
Sequence int64
TurnID string
Type string
AgentName string
Timestamp time.Time
}
EventMetadata is the content-excluded projection of a durable session event.
type EventMetadataReadCloser ¶
type EventMetadataReadCloser interface {
EventMetadataReader
EventCloser
}
EventMetadataReadCloser owns a read-only metadata handle for one session.
type EventMetadataReader ¶
type EventMetadataReader interface {
MaxEventSequence(ctx context.Context) (int64, error)
QueryEventMetadata(ctx context.Context, query EventQuery) ([]EventMetadata, error)
}
EventMetadataReader reads the sequence and projection needed by replay cursors.
type EventQuery ¶
type EventQuery struct {
Type string
AgentName string
TurnID string
Since time.Time
Limit int
AfterSequence int64
BeforeSequence int64
Archive EventArchiveFilter
}
EventQuery filters per-session events while preserving follow-friendly ordering.
func (EventQuery) Validate ¶
func (q EventQuery) Validate() error
Validate ensures the query is internally consistent.
type EventReadCloser ¶
type EventReadCloser interface {
EventReader
EventCloser
}
EventReadCloser is the complete contract exposed by read-only event stores.
type EventReader ¶
type EventReader interface {
Query(ctx context.Context, query EventQuery) ([]SessionEvent, error)
History(ctx context.Context, query EventQuery) ([]TurnHistory, error)
ListTokenUsage(ctx context.Context) ([]TokenUsage, error)
}
EventReader reads durable session events and turn history.
type EventRecorder ¶
type EventRecorder interface {
EventReadCloser
EventWriter
}
EventRecorder is the complete mutable per-session event-store contract.
type EventSummary ¶
type EventSummary struct {
ID string
ProfileID string
ProfileName string
ProfileColor string
ProfileIcon string
ProfileEmoji string
ProfileArchived bool
SessionID string
WorkspaceID string
Sequence int64
Type string
AgentName string
Provider string
Outcome string
*EventSummaryContentState
EventCorrelation
ParentSessionID string
RootSessionID string
SpawnDepth int
Summary string
Timestamp time.Time
}
func (EventSummary) ContentValue ¶
func (s EventSummary) ContentValue() json.RawMessage
ContentValue returns an isolated copy of the event payload.
func (*EventSummary) SetContent ¶
func (s *EventSummary) SetContent(content json.RawMessage)
SetContent replaces the event payload with an isolated copy.
func (EventSummary) Validate ¶
func (s EventSummary) Validate() error
Validate ensures the summary contains the required identifying fields.
type EventSummaryBatchWriter ¶
type EventSummaryBatchWriter interface {
WriteEventSummaries(ctx context.Context, summaries []EventSummary) error
}
EventSummaryBatchWriter persists related summaries atomically.
type EventSummaryContentState ¶
type EventSummaryContentState struct {
Content json.RawMessage
}
EventSummaryContentState keeps the optional payload compact while preserving EventSummary's value-oriented Content field for readers.
type EventSummaryQuery ¶
type EventSummaryQuery struct {
ReadScope ReadScope
SessionID string
WorkspaceID string
WorktreeID string
AgentName string
Type string
TaskID string
RunID string
ActorKind string
ActorID string
Provider string
Outcome string
Component string
ErrorOnly bool
AfterSequence int64
Since time.Time
Limit int
}
EventSummaryQuery filters event summaries through one explicit profile or the AllProfiles aggregate.
func (EventSummaryQuery) Validate ¶
func (q EventSummaryQuery) Validate() error
Validate rejects an implicit profile lens before checking query bounds.
type EventSummaryStore ¶
type EventSummaryStore interface {
WriteEventSummary(ctx context.Context, summary EventSummary) error
ListEventSummaries(ctx context.Context, query EventSummaryQuery) ([]EventSummary, error)
}
EventSummaryStore manages persisted observability event summaries.
type EventWriter ¶
type EventWriter interface {
Record(ctx context.Context, event SessionEvent) error
RecordTokenUsage(ctx context.Context, usage TokenUsage) error
}
EventWriter appends session events and token usage.
type FailureKind ¶
type FailureKind string
FailureKind classifies ACP/session lifecycle failures at the source and keeps them transport-stable across storage, API, SSE, and CLI surfaces.
const ( FailureStartup FailureKind = "startup_failure" FailureHandshake FailureKind = "handshake_failure" FailureLoad FailureKind = "load_session_failure" FailureProtocol FailureKind = "protocol_failure" FailurePrompt FailureKind = "prompt_failure" FailureCanceled FailureKind = "cancellation" FailurePermission FailureKind = "permission_failure" FailureProviderAuth FailureKind = "provider_auth_failure" FailureProcess FailureKind = "process_exit" FailureTransport FailureKind = "transport_failure" FailureTimeout FailureKind = "timeout" FailureUnknown FailureKind = "unknown_failure" )
type FailureReasonCode ¶
type FailureReasonCode string
FailureReasonCode identifies a stable machine-readable cause within a failure kind.
const (
FailureReasonPromptStreamIncomplete FailureReasonCode = "prompt_stream_incomplete"
)
type HookDispatchCounts ¶
HookDispatchCounts summarizes hook dispatch completions inside a window.
type HookRunQuery ¶
type HookRunQuery struct {
SessionID string
Event string
Outcome hookspkg.HookRunOutcome
Since time.Time
Limit int
}
HookRunQuery filters persisted per-session hook run records.
func (HookRunQuery) Validate ¶
func (q HookRunQuery) Validate() error
Validate ensures the query uses sane bounds.
type LongestSessionSample ¶
type LongestSessionSample struct {
SessionID string
AgentName string
StartedAt time.Time
RuntimeSeconds int64
}
LongestSessionSample is the longest-running user session inside a window.
type LoopOutputBlobExecutor ¶
type LoopOutputBlobExecutor interface {
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}
LoopOutputBlobExecutor is the SQL surface required to persist one loop output blob.
type MarketplaceCatalogEntry ¶
type MarketplaceCatalogEntry struct {
Kind string
EntryID string
Name string
Description string
Version string
PublishedAt string
UpdatedAt string
DigestSHA256 string
Tier string
InstallSlug string
PayloadJSON string
FetchedAt string
}
MarketplaceCatalogEntry is the storage-boundary projection for one curated entry.
type MarketplaceCatalogReplacement ¶
type MarketplaceCatalogReplacement struct {
Kind string
ManifestVersion int64
GeneratedAt string
FetchedAt string
Entries []MarketplaceCatalogEntry
}
MarketplaceCatalogReplacement is one validated, atomic per-kind projection.
type MarketplaceCatalogRepository ¶
type MarketplaceCatalogRepository interface {
ReplaceMarketplaceCatalog(context.Context, MarketplaceCatalogReplacement) error
MarkMarketplaceCatalogStale(context.Context, string, string) error
ListMarketplaceCatalogEntries(context.Context, string, int64) ([]MarketplaceCatalogEntry, error)
GetMarketplaceCatalogEntry(context.Context, string, string) (MarketplaceCatalogEntry, error)
GetMarketplaceExtensionByInstallSlug(context.Context, string, string) (MarketplaceCatalogEntry, error)
ListMarketplaceSkillsByInstallSlugs(context.Context, []string) ([]MarketplaceCatalogEntry, error)
GetMarketplaceCatalogState(context.Context, string) (MarketplaceCatalogState, error)
}
MarketplaceCatalogRepository owns the global SQLite projection and its transactions.
type MarketplaceCatalogState ¶
type MarketplaceCatalogState struct {
Kind string
ManifestVersion int64
GeneratedAt string
FetchedAt string
Stale bool
LastError string
EntryCount int64
}
MarketplaceCatalogState is the storage-boundary freshness record for one kind.
type MigrationBootstrap ¶
type MigrationBootstrap struct {
FS fs.FS
MigrationDir string
SchemaSource string
SeedSource string
// Initialize writes instance-specific state after schema and seed SQL and
// before migration versions are recorded, all in the same transaction.
Initialize func(context.Context, *sql.Tx) error
}
MigrationBootstrap describes the declarative schema for a migration head.
type MigrationStepper ¶
type MigrationStepper struct {
// contains filtered or unexported fields
}
MigrationStepper applies a validated migration stream to explicit version boundaries without rebuilding its migration plan between steps.
func NewMigrationStepper ¶
func NewMigrationStepper( ctx context.Context, db *sql.DB, stream MigrationStream, ) (*MigrationStepper, error)
NewMigrationStepper validates the stream and prepares one reusable provider. It does not apply the stream's declarative bootstrap; callers explicitly step through the ordered SQL migrations.
type MigrationStream ¶
type MigrationStream struct {
Name string
FS fs.FS
Dir string
VersionTable string
LegacyTables []string
Bootstrap *MigrationBootstrap
}
MigrationStream describes one independently versioned embedded schema.
type MutationCommitFence ¶
MutationCommitFence revalidates an authenticated mutation at its commit boundary.
type NetworkAcceptanceStore ¶
type NetworkAcceptanceStore interface {
AcceptNetworkMessage(
ctx context.Context,
req *AcceptNetworkMessageRequest,
) (AcceptNetworkMessageResult, error)
}
NetworkAcceptanceStore owns atomic message acceptance and wake accounting.
type NetworkAuditEntry ¶
type NetworkAuditEntry struct {
ID string
ProfileID string
ProfileName string
ProfileColor string
ProfileIcon string
ProfileEmoji string
ProfileArchived bool
SessionID string
Direction string
Kind string
WorkspaceID string
Channel string
Surface string
ThreadID string
DirectID string
WorkID string
PeerFrom string
PeerTo string
MessageID string
Reason string
Size int
Timestamp time.Time
}
func (NetworkAuditEntry) Validate ¶
func (e NetworkAuditEntry) Validate() error
Validate ensures the network audit entry is complete and internally consistent.
type NetworkAuditQuery ¶
type NetworkAuditQuery struct {
ReadScope ReadScope
SessionID string
WorkspaceID string
// Global explicitly allows daemon-admin aggregate callers to scan audit rows
// across workspaces. Workspace-scoped API surfaces must leave this false.
Global bool
Direction string
Kind string
Channel string
Surface string
ThreadID string
DirectID string
WorkID string
MessageID string
Since time.Time
Limit int
}
NetworkAuditQuery filters network audit lookups through one explicit profile or the AllProfiles aggregate.
func (NetworkAuditQuery) Validate ¶
func (q NetworkAuditQuery) Validate() error
Validate rejects an implicit profile lens before checking query bounds.
type NetworkAuditStore ¶
type NetworkAuditStore interface {
WriteNetworkAudit(ctx context.Context, entry NetworkAuditEntry) error
ListNetworkAudit(ctx context.Context, query NetworkAuditQuery) ([]NetworkAuditEntry, error)
}
NetworkAuditStore manages network message audit entries.
type NetworkAvailability ¶
NetworkAvailability is the persisted admission kill-switch state.
type NetworkAvailabilityStore ¶
type NetworkAvailabilityStore interface {
GetNetworkAvailability(ctx context.Context) (NetworkAvailability, error)
SetNetworkAvailability(
ctx context.Context,
enabled bool,
updatedBy string,
) (NetworkAvailability, error)
}
NetworkAvailabilityStore serializes availability changes with network admission writes.
type NetworkBudgetUsage ¶
type NetworkBudgetUsage struct {
OwnerKey string
WakesUsed int
WallTimeUsed time.Duration
InputTokensUsed int64
OutputTokensUsed int64
ExhaustedReason string
UpdatedAt time.Time
}
NetworkBudgetUsage reports the durable consumption counters for one participation owner.
type NetworkCausationStore ¶
type NetworkCausationStore interface {
ResolveNetworkCausation(
ctx context.Context,
workspaceID string,
causationID string,
) (rootID string, depth int, found bool, err error)
}
NetworkCausationStore resolves durable wake ancestry for bounded reply chains.
type NetworkChannelEntry ¶
type NetworkChannelEntry struct {
ProfileID string
ProfileName string
ProfileColor string
ProfileIcon string
ProfileEmoji string
ProfileArchived bool
Channel string
WorkspaceID string
Purpose string
FanoutPolicy string
CoordinatorPeerID string
CreatedBy string
CreatedAt time.Time
UpdatedAt time.Time
}
NetworkChannelEntry stores durable channel metadata for the operator-facing network workspace.
func (NetworkChannelEntry) Validate ¶
func (e NetworkChannelEntry) Validate() error
Validate ensures the persisted channel metadata is complete.
type NetworkChannelKindCount ¶
NetworkChannelKindCount is one materialized public-message kind total.
type NetworkChannelPatch ¶
type NetworkChannelPatch struct {
Purpose *string
FanoutPolicy *string
CoordinatorPeerID *string
UpdatedAt time.Time
}
NetworkChannelPatch describes a partial channel metadata update. Nil fields are left unchanged.
func (NetworkChannelPatch) Apply ¶
func (p NetworkChannelPatch) Apply(entry NetworkChannelEntry) NetworkChannelEntry
Apply returns the entry that would result from applying the patch.
func (NetworkChannelPatch) HasChanges ¶
func (p NetworkChannelPatch) HasChanges() bool
HasChanges reports whether the patch includes at least one mutable field.
type NetworkChannelProjection ¶
type NetworkChannelProjection struct {
WorkspaceID string
Channel string
MessageCount int
PresenceCount int
HistoricalParticipantCount int
LastActivityAt *time.Time
LastActivitySequence int64
LastPresenceAt *time.Time
LastPresenceSequence int64
LastMessageSequence int64
LastMessagePreview string
}
NetworkChannelProjection is the bounded read model for one channel's persisted timeline activity.
func (NetworkChannelProjection) Validate ¶
func (p NetworkChannelProjection) Validate() error
Validate ensures the projection remains workspace-qualified and additive.
type NetworkChannelProjectionQuery ¶
NetworkChannelProjectionQuery scopes bounded projection reads.
func (NetworkChannelProjectionQuery) Validate ¶
func (q NetworkChannelProjectionQuery) Validate() error
Validate ensures projection reads cannot cross a workspace.
type NetworkChannelProjectionStore ¶
type NetworkChannelProjectionStore interface {
ListNetworkChannelProjections(
ctx context.Context,
query NetworkChannelProjectionQuery,
) ([]NetworkChannelProjection, error)
ListNetworkChannelKindCounts(
ctx context.Context,
ref NetworkChannelRef,
) ([]NetworkChannelKindCount, error)
}
NetworkChannelProjectionStore reads materialized channel timeline totals.
type NetworkChannelQuery ¶
NetworkChannelQuery filters persisted network channel metadata through one explicit profile or the AllProfiles aggregate.
func (NetworkChannelQuery) Validate ¶
func (q NetworkChannelQuery) Validate() error
Validate rejects an implicit profile lens before checking query bounds.
type NetworkChannelRef ¶
NetworkChannelRef identifies one workspace-qualified network channel.
func (NetworkChannelRef) Validate ¶
func (r NetworkChannelRef) Validate() error
Validate ensures the channel reference is workspace-qualified.
type NetworkChannelStore ¶
type NetworkChannelStore interface {
CreateNetworkChannel(ctx context.Context, entry NetworkChannelEntry) error
WriteNetworkChannel(ctx context.Context, entry NetworkChannelEntry) error
GetNetworkChannel(ctx context.Context, readScope ReadScope, ref NetworkChannelRef) (NetworkChannelEntry, error)
ListNetworkChannels(ctx context.Context, query NetworkChannelQuery) ([]NetworkChannelEntry, error)
PatchNetworkChannel(
ctx context.Context,
readScope ReadScope,
ref NetworkChannelRef,
patch NetworkChannelPatch,
) error
DeleteNetworkChannel(ctx context.Context, ref NetworkChannelRef) error
}
NetworkChannelStore manages durable network channel metadata.
type NetworkConversationMessage ¶
type NetworkConversationMessage struct {
Sequence int64
ProfileID string
ProfileName string
ProfileColor string
ProfileIcon string
ProfileEmoji string
ProfileArchived bool
MessageID string
SessionID string
WorkspaceID string
Channel string
Surface string
ThreadID string
DirectID string
Direction string
PeerFrom string
PeerTo string
Kind string
WorkID string
ReplyTo string
TraceID string
CausationID string
Intent string
Text string
PreviewText string
Mentions []string
ExtJSON json.RawMessage
Body json.RawMessage
SizeBytes int64
Timestamp time.Time
}
NetworkConversationMessage is one persisted network conversation or presence message.
func (NetworkConversationMessage) Validate ¶
func (e NetworkConversationMessage) Validate() error
Validate ensures the persisted network message is complete and internally consistent.
type NetworkConversationMessageQuery ¶
type NetworkConversationMessageQuery struct {
ReadScope ReadScope
BeforeMessageID string
AfterMessageID string
Kind string
WorkID string
Limit int
}
NetworkConversationMessageQuery filters conversation message lookups through one explicit profile or the AllProfiles aggregate.
func (NetworkConversationMessageQuery) Validate ¶
func (q NetworkConversationMessageQuery) Validate() error
Validate ensures the query uses sane bounds and one cursor direction.
type NetworkConversationRef ¶
type NetworkConversationRef struct {
WorkspaceID string
Channel string
Surface string
ThreadID string
DirectID string
}
NetworkConversationRef identifies one persisted network conversation container.
func (NetworkConversationRef) ContainerID ¶
func (r NetworkConversationRef) ContainerID() string
ContainerID returns the thread or direct-room id selected by the surface.
func (NetworkConversationRef) Validate ¶
func (r NetworkConversationRef) Validate() error
Validate ensures the reference identifies exactly one supported container.
type NetworkConversationStore ¶
type NetworkConversationStore interface {
ResolveDirectRoom(ctx context.Context, entry NetworkDirectRoomEntry) (NetworkDirectRoomSummary, error)
WriteConversationMessage(
ctx context.Context,
entry NetworkConversationMessage,
) (NetworkConversationWriteResult, error)
ListThreads(ctx context.Context, ref NetworkChannelRef, query NetworkThreadQuery) (NetworkThreadPage, error)
GetThread(
ctx context.Context,
readScope ReadScope,
ref NetworkChannelRef,
threadID string,
) (NetworkThreadSummary, error)
ListDirectRooms(
ctx context.Context,
ref NetworkChannelRef,
query NetworkDirectRoomQuery,
) (NetworkDirectRoomPage, error)
GetDirectRoom(
ctx context.Context,
readScope ReadScope,
ref NetworkChannelRef,
directID string,
) (NetworkDirectRoomSummary, error)
ListConversationMessages(
ctx context.Context,
ref NetworkConversationRef,
query NetworkConversationMessageQuery,
) ([]NetworkConversationMessage, error)
GetWork(ctx context.Context, readScope ReadScope, workspaceID string, workID string) (NetworkWorkEntry, error)
}
NetworkConversationStore manages durable conversation containers and work rows.
type NetworkConversationWriteResult ¶
type NetworkConversationWriteResult struct {
MessageID string
Duplicate bool
ConversationOpened bool
WorkOpened bool
WorkTransitioned bool
WorkState string
LastActivityAt time.Time
}
NetworkConversationWriteResult reports the transactional write outcome.
type NetworkDirectRoomEntry ¶
type NetworkDirectRoomEntry struct {
ProfileID string
WorkspaceID string
Channel string
DirectID string
SessionA string
SessionB string
OpenedAt time.Time
LastActivityAt time.Time
}
NetworkDirectRoomEntry is the write DTO for a direct-room row.
func (NetworkDirectRoomEntry) Validate ¶
func (e NetworkDirectRoomEntry) Validate() error
Validate ensures direct-room membership is stable and ordered.
type NetworkDirectRoomPage ¶
type NetworkDirectRoomPage struct {
Directs []NetworkDirectRoomSummary
NextCursor string
HasMore bool
Total int
Limit int
}
NetworkDirectRoomPage is one bounded, counted page of direct-room summaries.
type NetworkDirectRoomQuery ¶
type NetworkDirectRoomQuery struct {
ReadScope ReadScope
Search string
SessionID string
Sort string
HasWork *bool
Limit int
After string
}
NetworkDirectRoomQuery filters and orders direct-room summary lookups through one explicit profile or the AllProfiles aggregate.
func (NetworkDirectRoomQuery) Normalize ¶
func (q NetworkDirectRoomQuery) Normalize() NetworkDirectRoomQuery
Normalize applies canonical whitespace, sort, and server-owned bounds.
func (NetworkDirectRoomQuery) Validate ¶
func (q NetworkDirectRoomQuery) Validate() error
Validate ensures the query uses a supported order and sane bounds.
type NetworkDirectRoomSummary ¶
type NetworkDirectRoomSummary struct {
ProfileID string
ProfileName string
ProfileColor string
ProfileIcon string
ProfileEmoji string
ProfileArchived bool
WorkspaceID string
Channel string
DirectID string
SessionA string
SessionB string
OpenedAt time.Time
OpenedSequence int64
LastActivityAt time.Time
LastActivitySequence int64
MessageCount int
OpenWorkCount int
LastMessagePreview string
}
NetworkDirectRoomSummary is the list/detail projection for a direct room.
func (NetworkDirectRoomSummary) Validate ¶
func (s NetworkDirectRoomSummary) Validate() error
Validate ensures the direct-room summary is internally consistent.
type NetworkInboxStore ¶
type NetworkInboxStore interface {
ListNetworkInbox(
ctx context.Context,
workspaceID string,
sessionID string,
channel string,
limit int,
) ([]NetworkMessageEntry, error)
}
NetworkInboxStore reads immutable delivered dispositions by durable session identity.
type NetworkMessageDisposition ¶
NetworkMessageDisposition is one immutable pre-message recipient decision.
func (NetworkMessageDisposition) Validate ¶
func (d NetworkMessageDisposition) Validate() error
Validate ensures the decision is bound to one durable session identity.
type NetworkMessageEntry ¶
type NetworkMessageEntry = NetworkConversationMessage
NetworkMessageEntry is the persisted network timeline row used by existing store interfaces.
type NetworkMessageQuery ¶
type NetworkMessageQuery struct {
ReadScope ReadScope
SessionID string
WorkspaceID string
Channel string
PeerID string
PeerFrom string
PeerTo string
Kind string
Direction string
MessageID string
BeforeMessageID string
AfterMessageID string
DirectedOnly bool
PublicOnly bool
IncludePresence bool
Since time.Time
Limit int
}
NetworkMessageQuery filters persisted network timeline lookups through one explicit profile or the AllProfiles aggregate.
func (NetworkMessageQuery) Validate ¶
func (q NetworkMessageQuery) Validate() error
Validate ensures the query uses sane bounds.
type NetworkMessageStore ¶
type NetworkMessageStore interface {
WriteNetworkMessage(ctx context.Context, entry NetworkMessageEntry) error
ListNetworkMessages(ctx context.Context, query NetworkMessageQuery) ([]NetworkMessageEntry, error)
}
NetworkMessageStore manages persisted network timeline messages.
type NetworkPreferenceStore ¶
type NetworkPreferenceStore interface {
PutNetworkSubscription(ctx context.Context, entry NetworkSubscriptionEntry) error
PutNetworkSubscriptionWithChannel(
ctx context.Context,
channel NetworkChannelEntry,
entry NetworkSubscriptionEntry,
) error
ListNetworkSubscriptions(ctx context.Context, query NetworkSubscriptionQuery) ([]NetworkSubscriptionEntry, error)
DeleteNetworkSubscription(ctx context.Context, ref NetworkSubscriptionRef) error
PutNetworkTaskThreadOrigin(ctx context.Context, origin NetworkTaskThreadOrigin) error
ListNetworkTaskThreadOrigins(
ctx context.Context,
query NetworkTaskThreadOriginQuery,
) ([]NetworkTaskThreadOrigin, error)
PutTaskDesignationRollup(ctx context.Context, rollup TaskDesignationRollup) error
ListTaskDesignationRollups(ctx context.Context, query TaskDesignationRollupQuery) ([]TaskDesignationRollup, error)
}
NetworkPreferenceStore manages network delivery preferences and network-task links.
type NetworkRecentQuery ¶
NetworkRecentQuery limits the cross-channel recent-conversation projection through one explicit profile or the AllProfiles aggregate.
func (NetworkRecentQuery) Validate ¶
func (q NetworkRecentQuery) Validate() error
Validate ensures recents never cross workspace boundaries.
type NetworkRecentStore ¶
type NetworkRecentStore interface {
ListNetworkRecents(ctx context.Context, query NetworkRecentQuery) ([]NetworkRecentSummary, error)
}
NetworkRecentStore reads cross-channel recent conversation summaries.
type NetworkRecentSummary ¶
type NetworkRecentSummary struct {
ProfileID string
ProfileName string
ProfileColor string
ProfileIcon string
ProfileEmoji string
ProfileArchived bool
WorkspaceID string
Channel string
Surface string
ContainerID string
LastActivityAt time.Time
LastActivitySequence int64
LastMessagePreview string
Title string
ParticipantCount int
SessionA string
SessionB string
}
NetworkRecentSummary is one cross-channel thread or direct-room list item.
type NetworkSubscriptionEntry ¶
type NetworkSubscriptionEntry struct {
WorkspaceID string
Channel string
ThreadID string
SessionID string
Mode string
CreatedAt time.Time
UpdatedAt time.Time
}
NetworkSubscriptionEntry stores one session delivery preference.
func (NetworkSubscriptionEntry) Validate ¶
func (e NetworkSubscriptionEntry) Validate() error
Validate ensures one subscription row is usable by zero-token routing.
type NetworkSubscriptionQuery ¶
type NetworkSubscriptionQuery struct {
WorkspaceID string
Channel string
ThreadID string
SessionID string
ExactThread bool
Limit int
}
NetworkSubscriptionQuery filters session delivery preferences.
func (NetworkSubscriptionQuery) Validate ¶
func (q NetworkSubscriptionQuery) Validate() error
Validate ensures subscription reads remain workspace-scoped.
type NetworkSubscriptionRef ¶
type NetworkSubscriptionRef struct {
WorkspaceID string
Channel string
ThreadID string
SessionID string
}
NetworkSubscriptionRef identifies one session's channel or thread delivery mode.
func (NetworkSubscriptionRef) Validate ¶
func (r NetworkSubscriptionRef) Validate() error
Validate ensures the subscription target is workspace-qualified.
type NetworkTaskStatusProjection ¶
type NetworkTaskStatusProjection struct {
NetworkTaskStatusPublication
RecipientSessionID string
}
NetworkTaskStatusProjection is one recipient-scoped durable projection.
type NetworkTaskStatusProjectionPayload ¶
type NetworkTaskStatusProjectionPayload struct {
EventID string `json:"event_id"`
EventType string `json:"event_type"`
TaskID string `json:"task_id"`
RunID string `json:"run_id,omitempty"`
TaskStatus string `json:"task_status"`
RunStatus string `json:"run_status,omitempty"`
NetworkParticipation participation.Spec `json:"network_participation"`
ConversationAvailable bool `json:"conversation_available"`
ConversationAvailability string `json:"conversation_availability"`
ProjectedAt string `json:"projected_at"`
}
NetworkTaskStatusProjectionPayload is the immutable transition snapshot stored for one event and its exact recipients.
type NetworkTaskStatusProjectionQuery ¶
type NetworkTaskStatusProjectionQuery struct {
WorkspaceID string
RecipientSessionID string
TaskID string
Limit int
}
NetworkTaskStatusProjectionQuery filters durable recipient projections.
func (NetworkTaskStatusProjectionQuery) Validate ¶
func (q NetworkTaskStatusProjectionQuery) Validate() error
Validate keeps projection reads workspace-scoped and bounded.
type NetworkTaskStatusPublication ¶
type NetworkTaskStatusPublication struct {
EventID string
EventType string
TaskID string
RunID string
WorkspaceID string
Channel string
ThreadID string
ProjectionJSON json.RawMessage
ProjectedAt time.Time
}
NetworkTaskStatusPublication is one typed task transition bound to its Network origin thread.
func (NetworkTaskStatusPublication) Validate ¶
func (p NetworkTaskStatusPublication) Validate() error
Validate ensures a publication is thread-scoped and contains typed JSON.
type NetworkTaskThreadOrigin ¶
type NetworkTaskThreadOrigin struct {
TaskID string
WorkspaceID string
Channel string
ThreadID string
OriginMessageID string
Digest string
SourceMessageIDs []string
CreatedAt time.Time
UpdatedAt time.Time
}
func (NetworkTaskThreadOrigin) Validate ¶
func (o NetworkTaskThreadOrigin) Validate() error
Validate ensures the origin is thread-scoped and compact.
type NetworkTaskThreadOriginQuery ¶
type NetworkTaskThreadOriginQuery struct {
TaskID string
WorkspaceID string
Channel string
ThreadID string
Limit int
}
NetworkTaskThreadOriginQuery filters promoted task origin links.
func (NetworkTaskThreadOriginQuery) Validate ¶
func (q NetworkTaskThreadOriginQuery) Validate() error
Validate ensures origin reads are either task-specific or thread-specific.
type NetworkThreadPage ¶
type NetworkThreadPage struct {
Threads []NetworkThreadSummary
NextCursor string
HasMore bool
Total int
Limit int
}
NetworkThreadPage is one bounded, counted page of public-thread summaries.
type NetworkThreadParticipant ¶
type NetworkThreadParticipant struct {
WorkspaceID string
Channel string
ThreadID string
SessionID string
FirstMessageID string
FirstSeenAt time.Time
LastSeenAt time.Time
}
NetworkThreadParticipant is one session recorded as present in a public thread.
func (NetworkThreadParticipant) Validate ¶
func (p NetworkThreadParticipant) Validate() error
Validate ensures the participant belongs to one concrete public thread.
type NetworkThreadQuery ¶
type NetworkThreadQuery struct {
ReadScope ReadScope
Search string
SessionID string
Sort string
HasWork *bool
Limit int
After string
}
NetworkThreadQuery filters and orders public-thread summary lookups through one explicit profile or the AllProfiles aggregate.
func (NetworkThreadQuery) Normalize ¶
func (q NetworkThreadQuery) Normalize() NetworkThreadQuery
Normalize applies canonical whitespace, sort, and server-owned bounds.
func (NetworkThreadQuery) Validate ¶
func (q NetworkThreadQuery) Validate() error
Validate ensures the query uses a supported order and sane bounds.
type NetworkThreadSessionTokenStats ¶
type NetworkThreadSessionTokenStats struct {
WorkspaceID string
Channel string
ThreadID string
SessionID string
DeliveredCount int64
PromptSizeBytes int64
EstimatedPromptTokens int64
FirstDeliveredAt time.Time
LastDeliveredAt time.Time
UpdatedAt time.Time
}
NetworkThreadSessionTokenStats aggregates delivered prompt cost by thread session.
type NetworkThreadSessionTokenStatsQuery ¶
type NetworkThreadSessionTokenStatsQuery struct {
WorkspaceID string
Channel string
ThreadID string
SessionID string
Limit int
}
NetworkThreadSessionTokenStatsQuery filters thread/session prompt-cost aggregates.
func (NetworkThreadSessionTokenStatsQuery) Validate ¶
func (q NetworkThreadSessionTokenStatsQuery) Validate() error
Validate ensures aggregate reads cannot cross workspace/thread boundaries.
type NetworkThreadSessionTokenStatsUpdate ¶
type NetworkThreadSessionTokenStatsUpdate struct {
WorkspaceID string
Channel string
ThreadID string
SessionID string
DeliveredCount int64
PromptSizeBytes int64
EstimatedPromptTokens int64
DeliveredAt time.Time
UpdatedAt time.Time
}
NetworkThreadSessionTokenStatsUpdate increments one thread/session prompt-cost row.
func (NetworkThreadSessionTokenStatsUpdate) Validate ¶
func (u NetworkThreadSessionTokenStatsUpdate) Validate() error
Validate ensures the prompt-cost update is scoped and additive.
type NetworkThreadSummary ¶
type NetworkThreadSummary struct {
ProfileID string
ProfileName string
ProfileColor string
ProfileIcon string
ProfileEmoji string
ProfileArchived bool
WorkspaceID string
Channel string
ThreadID string
RootMessageID string
Title string
OpenedByPeerID string
OpenedSessionID string
OpenedAt time.Time
OpenedSequence int64
LastActivityAt time.Time
LastActivitySequence int64
MessageCount int
ParticipantCount int
OpenWorkCount int
DeliveredCount int64
PromptSizeBytes int64
EstimatedPromptTokens int64
LastMessagePreview string
}
NetworkThreadSummary is the list/detail projection for a public thread.
func (NetworkThreadSummary) Validate ¶
func (s NetworkThreadSummary) Validate() error
Validate ensures the public-thread summary is internally consistent.
type NetworkUsageCursorPosition ¶
type NetworkUsageCursorPosition struct {
ReservedAt time.Time `json:"reserved_at"`
WakeID string `json:"wake_id"`
}
NetworkUsageCursorPosition is the stable descending keyset position of one page.
type NetworkUsageQuery ¶
type NetworkUsageQuery struct {
WorkspaceID string
Owner *participation.OwnerRef
Channel string
RunID string
Cursor string
Limit int
LimitSet bool
}
NetworkUsageQuery scopes wake accounting to one authenticated workspace.
type NetworkUsageReport ¶
type NetworkUsageReport struct {
Details []NetworkWakeUsageDetail
Total NetworkUsageSummary
Budget *NetworkBudgetUsage
NextCursor string
}
NetworkUsageReport pairs a bounded page with full-filter totals and budget truth.
type NetworkUsageStore ¶
type NetworkUsageStore interface {
GetNetworkUsage(ctx context.Context, query NetworkUsageQuery) (NetworkUsageReport, error)
}
NetworkUsageStore reads truthful wake-ledger detail and aggregates.
type NetworkUsageSummary ¶
type NetworkUsageSummary struct {
WakeCount int
ReservedWakeCount int
ActualWakeCount int
ChargedWallTime time.Duration
InputTokens int64
OutputTokens int64
}
NetworkUsageSummary aggregates the complete filtered ledger scope.
type NetworkWakeAdmissionInput ¶
type NetworkWakeAdmissionInput struct {
WorkspaceID string
RecipientSessionID string
OwnerKey string
Spec participation.Spec
Trigger string
Eligible bool
Addressed bool
RootID string
Depth int
WakeID string
TaskRunID string
}
NetworkWakeAdmissionInput carries policy resolved before the acceptance transaction.
func (NetworkWakeAdmissionInput) Validate ¶
func (i NetworkWakeAdmissionInput) Validate() error
Validate ensures an admission candidate is immutable and fully identified.
type NetworkWakeOutcome ¶
type NetworkWakeOutcome struct {
State string
ActualWallTime time.Duration
ActualInputTokens int64
ActualOutputTokens int64
UsageState string
Reason string
}
NetworkWakeOutcome is the terminal truth applied by the wake runner.
func (NetworkWakeOutcome) Validate ¶
func (o NetworkWakeOutcome) Validate() error
Validate rejects non-terminal or internally contradictory settlement facts.
type NetworkWakeQueueStore ¶
type NetworkWakeQueueStore interface {
ListQueuedNetworkWakes(ctx context.Context, limit int) ([]CommittedNetworkNotification, error)
LoadNetworkWake(
ctx context.Context,
workspaceID string,
wakeID string,
) (WakeReservation, []NetworkMessageEntry, error)
}
NetworkWakeQueueStore reads committed wake work for daemon execution.
type NetworkWakeUsageDetail ¶
type NetworkWakeUsageDetail struct {
WakeID string
TaskRunID string
OwnerKey string
WorkspaceID string
Channel string
RootID string
Depth int
State string
UsageState string
ChargedWallTime time.Duration
InputTokens int64
OutputTokens int64
ReservedAt time.Time
SettledAt *time.Time
Reason string
}
NetworkWakeUsageDetail is the charged usage truth for one admitted wake.
type NetworkWorkEntry ¶
type NetworkWorkEntry struct {
WorkID string
ProfileID string
ProfileName string
ProfileColor string
ProfileIcon string
ProfileEmoji string
ProfileArchived bool
WorkspaceID string
Channel string
Surface string
ThreadID string
DirectID string
OpenedBySessionID string
TargetSessionID string
State string
OpenedAt time.Time
LastActivityAt time.Time
TerminalAt *time.Time
}
NetworkWorkEntry stores lifecycle metadata for work inside one conversation.
func (NetworkWorkEntry) Validate ¶
func (e NetworkWorkEntry) Validate() error
Validate ensures a work row is bound to exactly one conversation container.
type ObservabilityRetentionSweepResult ¶
type ObservabilityRetentionSweepResult struct {
CutoffAt time.Time
DeletedEventSummaries int64
DeletedTokenStats int64
DeletedTokenUsageDaily int64
DeletedPermissionLogs int64
}
ObservabilityRetentionSweepResult reports how many global observability rows were deleted by one retention sweep.
type OnboardingStatus ¶
OnboardingStatus describes the global first-run onboarding completion state.
type OnboardingStore ¶
type OnboardingStore interface {
GetOnboardingStatus(ctx context.Context) (OnboardingStatus, error)
CompleteOnboarding(ctx context.Context, completedAt string) (OnboardingStatus, error)
ResetOnboarding(ctx context.Context) (OnboardingStatus, error)
}
OnboardingStore manages the domain lifecycle for first-run onboarding.
type OverviewDayQuery ¶
OverviewDayQuery bounds one daily-rollup aggregate by day bucket, optional workspace, and an explicit profile or AllProfiles lens.
func (OverviewDayQuery) Validate ¶
func (q OverviewDayQuery) Validate() error
Validate rejects an implicit profile lens before checking the day bucket.
type OverviewSinceQuery ¶
OverviewSinceQuery bounds one overview aggregate by timestamp, optional workspace, and an explicit profile or AllProfiles lens.
func (OverviewSinceQuery) Validate ¶
func (q OverviewSinceQuery) Validate() error
Validate rejects an implicit profile lens before checking the lower bound.
type OverviewWorkspaceQuery ¶
OverviewWorkspaceQuery scopes one workspace-optional overview projection by profile.
func (OverviewWorkspaceQuery) Validate ¶
func (q OverviewWorkspaceQuery) Validate() error
Validate rejects an implicit profile lens before the projection runs.
type PendingInteraction ¶
type PendingInteraction struct {
InteractionID string
SessionID string
Kind string
ProviderRequestID string
TurnID string
Title string
Payload PendingInteractionPayload
Status string
CreatedAt time.Time
ResolvedAt *time.Time
Resolution string
ResolvedBy string
}
PendingInteraction is one restart-durable operator decision request.
func SanitizePendingInteraction ¶
func SanitizePendingInteraction(interaction PendingInteraction) PendingInteraction
SanitizePendingInteraction applies the public redaction and size boundary to a canonical record.
type PendingInteractionCreate ¶
type PendingInteractionCreate struct {
InteractionID string
SessionID string
Kind string
ProviderRequestID string
TurnID string
Title string
Payload PendingInteractionPayload
CreatedAt time.Time
}
PendingInteractionCreate records one new pending provider request.
func (PendingInteractionCreate) Normalize ¶
func (r PendingInteractionCreate) Normalize() PendingInteractionCreate
Normalize redacts and bounds content before it can reach persistence.
func (PendingInteractionCreate) Validate ¶
func (r PendingInteractionCreate) Validate() error
Validate rejects incomplete identities and payloads that cannot fit the public contract.
type PendingInteractionPayload ¶
type PendingInteractionPayload struct {
Choices []string `json:"choices,omitempty"`
Decisions []string `json:"decisions,omitempty"`
}
PendingInteractionPayload is the allowlisted display-only interaction body.
type PendingInteractionTransition ¶
type PendingInteractionTransition struct {
InteractionID string
Status string
Resolution string
ResolvedBy string
At time.Time
OrphanInput *SessionInputQueueInsert
}
PendingInteractionTransition moves one pending record to another lifecycle status.
func (PendingInteractionTransition) Normalize ¶
func (r PendingInteractionTransition) Normalize() PendingInteractionTransition
Normalize applies the same secret and size boundary used by every read surface.
func (PendingInteractionTransition) Validate ¶
func (r PendingInteractionTransition) Validate() error
Validate ensures terminal transitions are explicit and attributable.
type PermissionLogEntry ¶
type PermissionLogEntry struct {
ID string
SessionID string
AgentName string
Action string
Resource string
Decision string
PolicyUsed string
Timestamp time.Time
}
PermissionLogEntry is an audit log entry for a daemon permission decision.
func (PermissionLogEntry) Validate ¶
func (e PermissionLogEntry) Validate() error
Validate ensures the permission audit entry is complete.
type PermissionLogQuery ¶
type PermissionLogQuery struct {
SessionID string
AgentName string
Decision string
Since time.Time
Limit int
}
PermissionLogQuery filters permission audit queries.
func (PermissionLogQuery) Validate ¶
func (q PermissionLogQuery) Validate() error
Validate ensures the query uses sane bounds.
type ReadScope ¶
ReadScope selects exactly one profile or the explicit labeled aggregate.
type ReconcileResult ¶
type SQLiteCorruptionError ¶
SQLiteCorruptionError reports corruption without attempting to mutate or replace the database family. Recovery belongs to a stopped composition root that can preserve every related database and companion file together.
func (*SQLiteCorruptionError) Error ¶
func (e *SQLiteCorruptionError) Error() string
func (*SQLiteCorruptionError) Is ¶
func (e *SQLiteCorruptionError) Is(target error) bool
func (*SQLiteCorruptionError) Unwrap ¶
func (e *SQLiteCorruptionError) Unwrap() error
type SessionActivityMeta ¶
type SessionActivityMeta struct {
TurnID string `json:"turn_id,omitempty"`
TurnSource string `json:"turn_source,omitempty"`
TurnStartedAt *time.Time `json:"turn_started_at,omitempty"`
LastActivityAt *time.Time `json:"last_activity_at,omitempty"`
LastActivityKind string `json:"last_activity_kind,omitempty"`
LastActivityDetail string `json:"last_activity_detail,omitempty"`
CurrentTool string `json:"current_tool,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
LastProgressAt *time.Time `json:"last_progress_at,omitempty"`
IterationCurrent int `json:"iteration_current,omitempty"`
IterationMax int `json:"iteration_max,omitempty"`
IdleSeconds int64 `json:"idle_seconds,omitempty"`
}
SessionActivityMeta is the persisted prompt/runtime activity snapshot for one ACP-backed session.
func CloneSessionActivityMeta ¶
func CloneSessionActivityMeta(meta *SessionActivityMeta) *SessionActivityMeta
CloneSessionActivityMeta returns a deep copy of the runtime activity payload.
func (*SessionActivityMeta) Validate ¶
func (m *SessionActivityMeta) Validate() error
Validate ensures the activity payload remains internally consistent.
type SessionAdvertisedCommand ¶
type SessionAdvertisedCommand struct {
Name string `json:"name"`
Description string `json:"description"`
Input *SessionAdvertisedCommandInput `json:"input,omitempty"`
}
SessionAdvertisedCommand is one ACP command in the latest replacement set for a session.
func CloneSessionAdvertisedCommands ¶
func CloneSessionAdvertisedCommands(commands []SessionAdvertisedCommand) []SessionAdvertisedCommand
CloneSessionAdvertisedCommands returns an ownership-safe copy of a command replacement set.
func (SessionAdvertisedCommand) Validate ¶
func (c SessionAdvertisedCommand) Validate() error
Validate enforces the durable advertised-command projection contract.
type SessionAdvertisedCommandInput ¶
type SessionAdvertisedCommandInput struct {
Hint string `json:"hint"`
}
SessionAdvertisedCommandInput describes the optional unstructured command argument.
type SessionAdvertisedCommandState ¶
type SessionAdvertisedCommandState struct {
AdvertisedCommands []SessionAdvertisedCommand `json:"advertised_commands,omitempty"`
}
SessionAdvertisedCommandState keeps the optional command catalog compact inside SessionMeta. Embedding preserves the flat session metadata JSON contract.
type SessionAgentMetrics ¶
type SessionAgentMetrics struct {
AgentName string
Total int
Active int
Failed int
RuntimeSeconds int64
LastActivityAt time.Time
}
SessionAgentMetrics contains exact visible-session aggregates for one agent.
type SessionAgentMetricsQuery ¶
type SessionAgentMetricsQuery struct {
ReadScope ReadScope
WorkspaceID string
ExcludeIDs []string
ExcludeSessionTypes []string
ExcludeSpawnRoles []string
}
SessionAgentMetricsQuery describes one workspace-scoped grouped catalog read through one explicit profile or the AllProfiles aggregate. Active runtime session IDs are excluded before the session manager overlays their current snapshots.
func (SessionAgentMetricsQuery) Validate ¶
func (q SessionAgentMetricsQuery) Validate() error
Validate ensures grouped metrics cannot cross workspace boundaries.
type SessionAgentMetricsReader ¶
type SessionAgentMetricsReader interface {
AggregateSessionsByAgent(
ctx context.Context,
query SessionAgentMetricsQuery,
) ([]SessionAgentMetrics, error)
}
SessionAgentMetricsReader exposes one grouped durable-catalog read for agent projections.
type SessionArchiveFilter ¶
type SessionArchiveFilter string
SessionArchiveFilter controls whether archived rows participate in a catalog read.
const ( SessionArchiveExclude SessionArchiveFilter = "exclude" SessionArchiveOnly SessionArchiveFilter = "only" SessionArchiveInclude SessionArchiveFilter = "include" )
func (SessionArchiveFilter) Validate ¶
func (f SessionArchiveFilter) Validate() error
Validate reports whether the archive filter is supported. An empty filter leaves internal catalog reads unfiltered.
type SessionArchiveStore ¶
type SessionArchiveStore interface {
SessionArchivedAt(ctx context.Context, workspaceID string, sessionID string) (*time.Time, error)
SetSessionArchived(
ctx context.Context,
workspaceID string,
sessionID string,
archived bool,
) (SessionInfo, error)
}
SessionArchiveStore owns the workspace-scoped archive metadata for sessions.
type SessionAttach ¶
type SessionAttach struct {
SessionID string
AttachedTo string
AttachExpiresAt time.Time
AttachedAt time.Time
}
SessionAttach records one acquired attach lock.
type SessionAttachRequest ¶
type SessionAttachRequest struct {
SessionID string
AttachedTo string
Now time.Time
TTL time.Duration
}
SessionAttachRequest identifies one explicit attach lock acquisition.
func (SessionAttachRequest) Normalize ¶
func (r SessionAttachRequest) Normalize() SessionAttachRequest
Normalize trims the attach request and applies UTC timestamps.
func (SessionAttachRequest) Validate ¶
func (r SessionAttachRequest) Validate() error
Validate ensures the attach request carries the fields needed for a CAS lock.
type SessionAttention ¶
type SessionAttention struct {
PendingPermissionCount int
PendingClarifyCount int
AttentionRevision int64
LastSettledRevision int64
LastSeenRevision int64
LastSeenAt *time.Time
AttentionChangedAt *time.Time
}
SessionAttention is the catalog-owned attention projection for one session.
func CloneSessionAttention ¶
func CloneSessionAttention(attention *SessionAttention) *SessionAttention
CloneSessionAttention returns an isolated copy of an optional attention projection.
func (SessionAttention) Unseen ¶
func (a SessionAttention) Unseen() bool
Unseen reports whether the latest settled turn has not been observed.
type SessionAttentionCommit ¶
type SessionAttentionCommit struct {
Before SessionAttention
After SessionAttention
Interaction *PendingInteraction
Outcome string
}
SessionAttentionCommit reports one committed canonical attention mutation.
type SessionAttentionStore ¶
type SessionAttentionStore interface {
GetSessionAttention(ctx context.Context, sessionID string) (SessionAttention, error)
CreatePendingInteraction(ctx context.Context, req PendingInteractionCreate) (SessionAttentionCommit, error)
TransitionPendingInteraction(
ctx context.Context,
req PendingInteractionTransition,
) (SessionAttentionCommit, error)
ListPendingInteractions(ctx context.Context, sessionID string, statuses []string) ([]PendingInteraction, error)
MarkSessionSettled(ctx context.Context, sessionID string, seen bool, at time.Time) (SessionAttentionCommit, error)
MarkSessionSeen(ctx context.Context, sessionID string, at time.Time) (SessionAttentionCommit, error)
}
SessionAttentionStore owns canonical pending interactions and revision fences.
type SessionAttentionSummary ¶
type SessionAttentionSummary struct {
NeedsYou int
Finished int
ByWorkspace []WorkspaceAttentionSummary
}
SessionAttentionSummary is the exact operator-wide attention aggregate.
type SessionCatalog ¶
type SessionCatalog interface {
RegisterSession(ctx context.Context, session SessionInfo) error
UpdateSessionState(ctx context.Context, update SessionStateUpdate) error
DeleteSession(ctx context.Context, sessionID string) error
ListSessions(ctx context.Context, query SessionListQuery) ([]SessionInfo, error)
AttachSession(ctx context.Context, req SessionAttachRequest) (SessionAttach, error)
ReconcileSessions(ctx context.Context, sessions []SessionInfo) (ReconcileResult, error)
}
SessionCatalog manages global session index records.
type SessionCatalogAttentionRank ¶
type SessionCatalogAttentionRank int
SessionCatalogAttentionRank is the stable attention-class component of a catalog cursor.
const ( SessionCatalogAttentionRankNeedsYou SessionCatalogAttentionRank = iota SessionCatalogAttentionRankFinished SessionCatalogAttentionRankNone )
type SessionCatalogOwnerReader ¶
type SessionCatalogOwnerReader interface {
ListSessions(ctx context.Context, query SessionListQuery) ([]SessionInfo, error)
}
SessionCatalogOwnerReader is the narrow durable-catalog read required for immutable owner authorization.
type SessionCatalogPage ¶
type SessionCatalogPage struct {
Sessions []SessionInfo
Total int
}
SessionCatalogPage is one bounded durable-catalog result. Total is counted before the keyset anchor and excludes IDs owned by the active overlay.
type SessionCatalogPageQuery ¶
type SessionCatalogPageQuery struct {
ReadScope ReadScope
WorkspaceID string
WorktreeID string
State string
SessionType string
AgentName string
ParentSessionID string
RootSessionID string
Search string
Resumable bool
Archive SessionArchiveFilter
Sort string
Limit int
After *SessionCatalogPosition
ExcludeIDs []string
ExcludeSessionTypes []string
ExcludeSpawnRoles []string
}
SessionCatalogPageQuery describes one bounded durable-catalog read through one explicit profile or the AllProfiles aggregate. Cursor decoding and active-session overlay belong to the session manager.
func (SessionCatalogPageQuery) Validate ¶
func (q SessionCatalogPageQuery) Validate() error
Validate ensures the durable query is bounded and its anchor is usable.
type SessionCatalogPager ¶
type SessionCatalogPager interface {
PageSessions(ctx context.Context, query SessionCatalogPageQuery) (SessionCatalogPage, error)
}
SessionCatalogPager exposes the bounded catalog read used by public session lists.
type SessionCatalogPosition ¶
type SessionCatalogPosition struct {
AttentionRank SessionCatalogAttentionRank `json:"attention_rank"`
PrimaryAt time.Time `json:"primary_at"`
SecondaryAt time.Time `json:"secondary_at"`
CreatedAt time.Time `json:"created_at"`
ID string `json:"id"`
}
SessionCatalogPosition is the stable keyset anchor used by bounded catalog reads.
func (SessionCatalogPosition) Validate ¶
func (p SessionCatalogPosition) Validate() error
Validate ensures the keyset anchor is complete.
type SessionCreationIdentity ¶
type SessionCreationIdentity struct {
CreationProfileRef string
PolicySpecDigest string
CreationDigest string
}
SessionCreationIdentity is the immutable idempotency witness for one created session.
func (SessionCreationIdentity) Validate ¶
func (i SessionCreationIdentity) Validate() error
Validate requires the complete non-secret creation identity triple.
type SessionCreationIdentityStore ¶
type SessionCreationIdentityStore interface {
RegisterSessionWithCreationIdentity(
context.Context,
SessionInfo,
SessionCreationIdentity,
) (SessionCreationRegistration, error)
GetSessionCreationIdentity(context.Context, string) (SessionCreationIdentity, error)
}
SessionCreationIdentityStore persists the immutable per-session witness.
type SessionCreationOptions ¶
type SessionCreationOptions struct {
SessionID string `json:"session_id"`
Name string `json:"name,omitempty"`
NetworkOwnerKey string `json:"network_owner_key"`
NetworkParticipation participation.Spec `json:"network_participation"`
SessionType string `json:"session_type"`
}
SessionCreationOptions are deterministic per-session options excluded from the stable policy digest but included in the creation digest.
type SessionCreationProfile ¶
type SessionCreationProfile struct {
Version int `json:"version"`
AgentName string `json:"agent_name"`
Provider string `json:"provider"`
Model string `json:"model,omitempty"`
ReasoningEffort string `json:"reasoning_effort,omitempty"`
Speed speedpkg.Speed `json:"speed"`
ProfileID string `json:"profile_id"`
WorkspaceID string `json:"workspace_id"`
CWD string `json:"cwd"`
WorktreeRef string `json:"worktree_ref,omitempty"`
SandboxMode string `json:"sandbox_mode"`
SandboxRef string `json:"sandbox_ref,omitempty"`
Permissions string `json:"permissions"`
AllowedTools []string `json:"allowed_tools,omitempty"`
AgentTools []string `json:"agent_tools,omitempty"`
AgentToolsets []string `json:"agent_toolsets,omitempty"`
DeniedTools []string `json:"denied_tools,omitempty"`
RuntimeMode string `json:"runtime_mode,omitempty"`
PromptOverlay string `json:"prompt_overlay,omitempty"`
ContractOverlay string `json:"contract_overlay,omitempty"`
}
SessionCreationProfile is the immutable, secret-free runtime policy used to create or reseed a session. New fields require a profile version bump.
func NormalizeSessionCreationProfile ¶
func NormalizeSessionCreationProfile(profile SessionCreationProfile) SessionCreationProfile
NormalizeSessionCreationProfile produces the only canonical digest input.
func (SessionCreationProfile) CanonicalJSON ¶
func (p SessionCreationProfile) CanonicalJSON() ([]byte, error)
CanonicalJSON returns the stable serialized profile used by persistence and hashing.
func (SessionCreationProfile) CreationDigest ¶
func (p SessionCreationProfile) CreationDigest(opts SessionCreationOptions) (string, error)
CreationDigest binds a stable policy to one preallocated session identity.
func (SessionCreationProfile) PolicySpecDigest ¶
func (p SessionCreationProfile) PolicySpecDigest() (string, error)
PolicySpecDigest hashes stable effective policy/profile/contract inputs.
func (SessionCreationProfile) Ref ¶
func (p SessionCreationProfile) Ref() (string, error)
Ref returns the content-addressed immutable profile reference.
func (SessionCreationProfile) Validate ¶
func (p SessionCreationProfile) Validate() error
Validate enforces the complete immutable profile contract.
type SessionCreationProfileStore ¶
type SessionCreationProfileStore interface {
PutSessionCreationProfile(context.Context, SessionCreationProfile) (string, error)
GetSessionCreationProfile(context.Context, string) (SessionCreationProfile, error)
}
SessionCreationProfileStore persists and loads content-addressed profiles.
type SessionCreationRegistration ¶
type SessionCreationRegistration struct {
SessionID string
Created bool
Identity SessionCreationIdentity
}
SessionCreationRegistration reports whether an atomic registration created or matched a row.
type SessionCreationStore ¶
type SessionCreationStore interface {
SessionCreationIdentityStore
SessionCreationProfileStore
}
SessionCreationStore is the complete durable idempotent-creation catalog.
type SessionDBOwner ¶
SessionDBOwner is the immutable identity authorized to access one events.db.
func LookupSessionDBOwner ¶
func LookupSessionDBOwner( ctx context.Context, catalog SessionCatalogOwnerReader, sessionID string, ) (SessionDBOwner, error)
LookupSessionDBOwner resolves one session's immutable database owner from the durable catalog. It rejects missing and conflicting catalog rows.
func (SessionDBOwner) Normalize ¶
func (o SessionDBOwner) Normalize() (SessionDBOwner, error)
Normalize validates and canonicalizes a session database owner.
type SessionEvent ¶
type SessionEvent struct {
ID string
SessionID string
Sequence int64
TurnID string
Type string
AgentName string
Content string
Archived bool
Timestamp time.Time
}
SessionEvent is a persisted event row for a single Compozy session.
func (SessionEvent) Validate ¶
func (e SessionEvent) Validate() error
Validate ensures the event has the required fields for persistence.
type SessionEventMetadataOpener ¶
type SessionEventMetadataOpener func( ctx context.Context, owner SessionDBOwner, ) (EventMetadataReadCloser, error)
SessionEventMetadataOpener opens the metadata reader for one known session.
type SessionExecutionLocationState ¶
type SessionExecutionLocationState struct {
WorktreeID string `json:"worktree_id,omitempty"`
CWD string `json:"cwd,omitempty"`
}
SessionExecutionLocationState keeps the optional execution location compact inside SessionMeta. Embedding preserves the flat session metadata JSON contract.
type SessionFailure ¶
type SessionFailure struct {
Kind FailureKind `json:"kind"`
ReasonCode FailureReasonCode `json:"reason_code,omitempty"`
Summary string `json:"summary,omitempty"`
CrashBundlePath string `json:"crash_bundle_path,omitempty"`
}
SessionFailure is the durable, redacted diagnostic summary attached to a session terminal state and projected through public read paths.
func CloneSessionFailure ¶
func CloneSessionFailure(failure *SessionFailure) *SessionFailure
CloneSessionFailure returns a deep copy of a session failure pointer.
func (SessionFailure) IsZero ¶
func (f SessionFailure) IsZero() bool
IsZero reports whether the failure carries no diagnostic fields.
func (SessionFailure) Normalize ¶
func (f SessionFailure) Normalize() SessionFailure
Normalize returns a trimmed copy of f.
func (SessionFailure) Validate ¶
func (f SessionFailure) Validate() error
Validate checks that non-empty failure records use known kinds.
type SessionInfo ¶
type SessionInfo struct {
ID string
ProfileID string
Name string
AgentName string
Provider string
Model string
ReasoningEffort string
Speed speedpkg.Speed
SpeedResolution *speedpkg.Resolution
RuntimeStatus SessionRuntimeStatus
RuntimeTransition SessionRuntimeTransition
RuntimeFailure string
RuntimeGeneration int64
RuntimeRecovery *SessionRuntimeRecovery
SelectedRuntime *SessionRuntimeSelection
RuntimeSelectionRevision int64
WorkspaceID string
WorktreeID string
*SessionNetworkState
SessionType string
Lineage *SessionLineage
State string
ACPSessionID *string
StopReason StopReason
StopDetail string
Failure *SessionFailure
Liveness *SessionLivenessMeta
Sandbox *SessionSandboxMeta
SoulSnapshotID string
SoulDigest string
ParentSoulDigest string
AttachedTo string
AttachExpiresAt *time.Time
TranscriptEpoch int64
Attention *SessionAttention
ArchivedAt *time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
SessionInfo is the canonical session index row stored in the global database.
func (*SessionInfo) AttentionSnapshot ¶
func (s *SessionInfo) AttentionSnapshot() SessionAttention
AttentionSnapshot returns an isolated zero-safe attention projection.
func (SessionInfo) NetworkSpecSnapshot ¶
func (s SessionInfo) NetworkSpecSnapshot() participation.Spec
NetworkSpecSnapshot returns the immutable snapshot, defaulting uninitialized in-memory sessions to Local.
func (*SessionInfo) SetNetworkSpec ¶
func (s *SessionInfo) SetNetworkSpec(spec participation.Spec)
SetNetworkSpec replaces the immutable participation snapshot.
func (SessionInfo) Validate ¶
func (s SessionInfo) Validate() error
Validate ensures the session record contains the required fields.
type SessionInputAttachment ¶
type SessionInputAttachment struct {
ID string `json:"id"`
Name string `json:"name"`
MIMEType string `json:"mime_type"`
Bytes int64 `json:"bytes"`
SHA256 string `json:"sha256"`
Kind string `json:"kind"`
Width int `json:"width"`
Height int `json:"height"`
}
SessionInputAttachment is the storage-native attachment snapshot on queued input and prompt admissions.
func (SessionInputAttachment) Normalize ¶
func (a SessionInputAttachment) Normalize() SessionInputAttachment
Normalize returns trimmed attachment identity fields.
type SessionInputQueueEntry ¶
type SessionInputQueueEntry struct {
ID string
SessionID string
PromptAdmissionID string
MessageID string
IdempotencyKey string
TurnID string
TargetTurnID string
EventID string
Status string
Mode string
Delivery string
Text string
Runtime SessionInputRuntime
SkillInvocations []commandpkg.Invocation
Attachments []SessionInputAttachment
SessionGeneration int64
TaskRunID string
RunGeneration *int64
LoopRunID string
OwnerKind string
OwnerEpoch *int64
BindingEpoch *int64
PromptID string
PromptKind string
OperationUsageBaseTokens *int64
PromptAttempt int
Dispatchable bool
DispatchTokenHash string
AttemptCount int
EnqueuedAt time.Time
ActivatedAt *time.Time
DispatchStartedAt *time.Time
SentAt *time.Time
FailedAt *time.Time
FailureSummary string
CanceledAt *time.Time
FenceKind string
FenceDisposition string
FenceReasonCode string
FencedAt *time.Time
TerminalEventStartSeq *int64
TerminalEventEndSeq *int64
TerminalKind string
TerminalStopReason string
TerminalDisposition string
TerminalReasonCode string
TerminalTokensReported bool
TerminalTokensUsed *int64
TerminalAt *time.Time
UpdatedAt time.Time
}
SessionInputQueueEntry is one persisted busy-input item.
type SessionInputQueueInsert ¶
type SessionInputQueueInsert struct {
ID string
SessionID string
PromptAdmissionID string
MessageID string
IdempotencyKey string
TurnID string
TargetTurnID string
EventID string
Mode string
Delivery string
Text string
Runtime SessionInputRuntime
SkillInvocations []commandpkg.Invocation
Attachments []SessionInputAttachment
SessionGeneration int64
TaskRunID string
RunGeneration *int64
QueueCap int
Now time.Time
}
SessionInputQueueInsert captures the atomic insert request for busy input.
func (SessionInputQueueInsert) Normalize ¶
func (r SessionInputQueueInsert) Normalize() SessionInputQueueInsert
Normalize trims scalar and attachment fields, clones slices, and normalizes the request clock to UTC.
func (SessionInputQueueInsert) Validate ¶
func (r SessionInputQueueInsert) Validate() error
Validate ensures the insert request can be persisted.
type SessionInputQueueStore ¶
type SessionInputQueueStore interface {
EnqueueSessionInput(
ctx context.Context,
req SessionInputQueueInsert,
) (SessionInputQueueEntry, int, error)
EnqueueInterruptSessionInput(
ctx context.Context,
req SessionInputQueueInsert,
) (SessionInputQueueEntry, int, error)
StageSessionSteer(
ctx context.Context,
req SessionInputQueueInsert,
) (SessionInputQueueEntry, error)
ListPendingSessionInputs(ctx context.Context, sessionID string) ([]SessionInputQueueEntry, error)
ReplaceSessionInput(
ctx context.Context,
sessionID string,
entryID string,
replacement SessionInputQueueInsert,
) (SessionInputQueueEntry, bool, error)
PromoteSessionInputToSteer(
ctx context.Context,
sessionID string,
entryID string,
replacement SessionInputQueueInsert,
) (SessionInputQueueEntry, bool, error)
ClaimNextSessionInput(
ctx context.Context,
sessionID string,
now time.Time,
) (SessionInputQueueEntry, bool, error)
PeekNextSessionInput(
ctx context.Context,
sessionID string,
) (SessionInputQueueEntry, bool, error)
GetSessionInputQueueEntry(
ctx context.Context,
sessionID string,
entryID string,
) (SessionInputQueueEntry, error)
MarkSessionInputSent(
ctx context.Context,
sessionID string,
entryID string,
now time.Time,
) error
ReleaseSessionInput(ctx context.Context, sessionID string, entryID string, now time.Time) error
MarkSessionInputFailed(
ctx context.Context,
sessionID string,
entryID string,
summary string,
now time.Time,
) error
CancelSessionInput(
ctx context.Context,
sessionID string,
entryID string,
now time.Time,
) (SessionInputQueueEntry, error)
CancelPendingSessionInputs(
ctx context.Context,
sessionID string,
generation int64,
now time.Time,
) (int, error)
AdvanceSessionInputGeneration(ctx context.Context, sessionID string, now time.Time) (int64, error)
CurrentSessionInputGeneration(ctx context.Context, sessionID string) (int64, error)
SessionInputQueueSummary(ctx context.Context, sessionID string) (SessionInputQueueSummary, error)
}
SessionInputQueueStore persists operator busy-input entries.
type SessionInputQueueSummary ¶
type SessionInputQueueSummary struct {
SessionID string
Generation int64
PendingActive int
PendingQueued int
PendingSteer int
PendingLeased int
}
SessionInputQueueSummary captures the current generation and pending entries for recap/status reads.
type SessionInputRuntime ¶
type SessionInputRuntime struct {
Provider string
Model string
ReasoningEffort string
Speed string
}
SessionInputRuntime is the immutable runtime selection captured when busy input is admitted. It intentionally uses storage-native fields so queued work remains independent from the live session binding and selector state.
func (SessionInputRuntime) Normalize ¶
func (r SessionInputRuntime) Normalize() SessionInputRuntime
Normalize returns the canonical persisted runtime selection.
type SessionLedgerRecord ¶
type SessionLedgerRecord struct {
SessionID string
WorkspaceID string
AgentName string
SessionType string
EventsDBPath string
Lineage *SessionLineage
StartedAt time.Time
EndedAt time.Time
}
SessionLedgerRecord carries the durable session evidence needed to materialize a forensic session ledger after the live event store has been closed.
type SessionLineage ¶
type SessionLineage struct {
ParentSessionID string `json:"parent_session_id,omitempty"`
RootSessionID string `json:"root_session_id,omitempty"`
SpawnDepth int `json:"spawn_depth"`
SpawnRole string `json:"spawn_role,omitempty"`
TTLExpiresAt *time.Time `json:"ttl_expires_at,omitempty"`
AutoStopOnParent bool `json:"auto_stop_on_parent"`
NotifyCreator bool `json:"notify_creator"`
SpawnBudget SessionSpawnBudget `json:"spawn_budget"`
PermissionPolicy SessionPermissionPolicy `json:"permission_policy"`
}
SessionLineage is the persisted parent/root metadata used for safe spawned sessions.
func CloneSessionLineage ¶
func CloneSessionLineage(lineage *SessionLineage) *SessionLineage
CloneSessionLineage returns a deep copy of lineage metadata.
func NormalizeSessionLineage ¶
func NormalizeSessionLineage(sessionID string, lineage *SessionLineage) *SessionLineage
NormalizeSessionLineage returns lineage with trimmed identifiers and a root record for first-class manual sessions when no lineage was supplied.
type SessionListQuery ¶
type SessionListQuery struct {
ReadScope ReadScope
ID string
State string
AgentName string
WorkspaceID string
WorktreeID string
SessionType string
ParentSessionID string
RootSessionID string
SpawnRole string
Resumable bool
Archive SessionArchiveFilter
Sort string
Limit int
}
SessionListQuery filters session index queries through one explicit profile or the AllProfiles aggregate.
func (SessionListQuery) Validate ¶
func (q SessionListQuery) Validate() error
Validate rejects an implicit profile lens before checking query bounds.
type SessionLivenessMeta ¶
type SessionLivenessMeta struct {
SubprocessPID int `json:"subprocess_pid,omitempty"`
SubprocessStartedAt *time.Time `json:"subprocess_started_at,omitempty"`
LastUpdateAt *time.Time `json:"last_update_at,omitempty"`
StallState string `json:"stall_state,omitempty"`
StallReason string `json:"stall_reason,omitempty"`
Activity *SessionActivityMeta `json:"activity,omitempty"`
}
SessionLivenessMeta is the persisted runtime supervision state for one ACP-backed session.
func CloneSessionLivenessMeta ¶
func CloneSessionLivenessMeta(meta *SessionLivenessMeta) *SessionLivenessMeta
CloneSessionLivenessMeta returns a deep copy of the liveness payload.
func (*SessionLivenessMeta) Validate ¶
func (m *SessionLivenessMeta) Validate() error
Validate ensures the liveness payload remains internally consistent.
type SessionMeta ¶
type SessionMeta struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
AgentName string `json:"agent_name"`
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
ReasoningEffort string `json:"reasoning_effort,omitempty"`
Speed speedpkg.Speed `json:"speed,omitempty"`
SpeedResolution *speedpkg.Resolution `json:"speed_resolution,omitempty"`
RuntimeStatus SessionRuntimeStatus `json:"runtime_status"`
RuntimeTransition SessionRuntimeTransition `json:"runtime_transition,omitempty"`
RuntimeFailure *string `json:"runtime_failure,omitempty"`
RuntimeGeneration int64 `json:"runtime_generation,omitempty"`
RuntimeRecovery *SessionRuntimeRecovery `json:"runtime_recovery,omitempty"`
RuntimeSelection *SessionRuntimeSelectionState `json:"runtime_selection,omitempty"`
*SessionProviderExecutionState
ProfileID string `json:"profile_id"`
WorkspaceID string `json:"workspace_id,omitempty"`
*SessionExecutionLocationState
NetworkParticipation *participation.Spec `json:"network_participation"`
SessionType string `json:"session_type,omitempty"`
Lineage *SessionLineage `json:"lineage,omitempty"`
State string `json:"state"`
StopReason *StopReason `json:"stop_reason,omitempty"`
StopDetail string `json:"stop_detail,omitempty"`
Failure *SessionFailure `json:"failure,omitempty"`
ACPSessionID *string `json:"acp_session_id,omitempty"`
Liveness *SessionLivenessMeta `json:"liveness,omitempty"`
Sandbox *SessionSandboxMeta `json:"sandbox,omitempty"`
CreationProfile *SessionCreationProfile `json:"creation_profile,omitempty"`
CreationOptions *SessionCreationOptions `json:"creation_options,omitempty"`
CreationProfileRef string `json:"creation_profile_ref,omitempty"`
PolicySpecDigest string `json:"policy_spec_digest,omitempty"`
CreationDigest string `json:"creation_digest,omitempty"`
*SessionAdvertisedCommandState
SoulSnapshotID string `json:"soul_snapshot_id,omitempty"`
SoulDigest string `json:"soul_digest,omitempty"`
ParentSoulDigest string `json:"parent_soul_digest,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
SessionMeta is the atomically-written session metadata document.
func ReadSessionMeta ¶
func ReadSessionMeta(path string) (SessionMeta, error)
ReadSessionMeta loads a session metadata document from disk.
func (*SessionMeta) AdvertisedCommandsValue ¶
func (m *SessionMeta) AdvertisedCommandsValue() []SessionAdvertisedCommand
AdvertisedCommandsValue returns the optional advertised command catalog.
func (SessionMeta) CWDValue ¶
func (m SessionMeta) CWDValue() string
CWDValue returns the optional execution directory without exposing nil embedding details.
func (SessionMeta) EffectivePermissionsValue ¶
func (m SessionMeta) EffectivePermissionsValue() string
EffectivePermissionsValue returns the persisted permission mode.
func (SessionMeta) EffectiveProviderAuthModeValue ¶
func (m SessionMeta) EffectiveProviderAuthModeValue() string
EffectiveProviderAuthModeValue returns the persisted provider authentication owner.
func (SessionMeta) NetworkOwnerKeySnapshot ¶
func (m SessionMeta) NetworkOwnerKeySnapshot() string
NetworkOwnerKeySnapshot returns the immutable budget owner stored in creation metadata.
func (SessionMeta) NetworkSpecSnapshot ¶
func (m SessionMeta) NetworkSpecSnapshot() participation.Spec
NetworkSpecSnapshot returns the immutable participation snapshot stored in metadata.
func (*SessionMeta) SetAdvertisedCommands ¶
func (m *SessionMeta) SetAdvertisedCommands(commands []SessionAdvertisedCommand)
SetAdvertisedCommands stores an ownership-safe advertised command catalog.
func (*SessionMeta) SetCWD ¶
func (m *SessionMeta) SetCWD(cwd string)
SetCWD updates the optional execution directory with value semantics.
func (*SessionMeta) SetEffectivePermissions ¶
func (m *SessionMeta) SetEffectivePermissions(permissions string)
SetEffectivePermissions updates the optional persisted permission mode.
func (*SessionMeta) SetEffectiveProviderAuthMode ¶
func (m *SessionMeta) SetEffectiveProviderAuthMode(mode string)
SetEffectiveProviderAuthMode updates the optional provider authentication owner.
func (*SessionMeta) SetWorktreeID ¶
func (m *SessionMeta) SetWorktreeID(worktreeID string)
SetWorktreeID updates the optional worktree binding with value semantics.
func (SessionMeta) Validate ¶
func (m SessionMeta) Validate() error
Validate ensures the metadata file remains aligned with the session index schema.
func (SessionMeta) WorktreeIDValue ¶
func (m SessionMeta) WorktreeIDValue() string
WorktreeIDValue returns the optional worktree binding without exposing nil embedding details.
type SessionNetworkState ¶
type SessionNetworkState struct {
NetworkSpec participation.Spec
}
SessionNetworkState keeps immutable participation off the hot SessionInfo value.
type SessionPermissionPolicy ¶
type SessionPermissionPolicy struct {
Tools []string `json:"tools"`
Skills []string `json:"skills"`
MCPServers []string `json:"mcp_servers"`
WorkspacePaths []string `json:"workspace_paths"`
NetworkChannels []string `json:"network_channels"`
SandboxProfiles []string `json:"sandbox_profiles"`
}
SessionPermissionPolicy captures concrete permission atoms available to a session.
func DecodeSessionPermissionPolicy ¶
func DecodeSessionPermissionPolicy(raw string) (SessionPermissionPolicy, error)
DecodeSessionPermissionPolicy unmarshals permission policy metadata from the global session catalog.
func NormalizeSessionPermissionPolicy ¶
func NormalizeSessionPermissionPolicy(policy SessionPermissionPolicy) SessionPermissionPolicy
NormalizeSessionPermissionPolicy returns a policy with stable, trimmed atom lists.
type SessionPromptAdmission ¶
type SessionPromptAdmission struct {
ID string
WorkspaceID string
SessionID string
MessageID string
IdempotencyKey string
Operation string
FingerprintVersion string
RequestFingerprint string
State string
Mode string
AuthoredText string
Runtime SessionInputRuntime
SkillInvocations []commandpkg.Invocation
Attachments []SessionInputAttachment
TurnID string
EventID string
Result *SessionPromptAdmissionResult
IndeterminateReason string
CreatedAt time.Time
DispatchCommittedAt *time.Time
CompletedAt *time.Time
UpdatedAt time.Time
}
SessionPromptAdmission is the durable command receipt for one external prompt or steer request.
type SessionPromptAdmissionRequest ¶
type SessionPromptAdmissionRequest struct {
ID string
WorkspaceID string
SessionID string
MessageID string
IdempotencyKey string
Operation string
FingerprintVersion string
RequestFingerprint string
Mode string
AuthoredText string
Runtime SessionInputRuntime
SkillInvocations []commandpkg.Invocation
Attachments []SessionInputAttachment
TurnID string
EventID string
Now time.Time
}
SessionPromptAdmissionRequest carries immutable command identity and request material.
func (SessionPromptAdmissionRequest) Normalize ¶
func (r SessionPromptAdmissionRequest) Normalize() SessionPromptAdmissionRequest
Normalize trims scalar and attachment fields, clones slices, and normalizes the request clock to UTC.
func (SessionPromptAdmissionRequest) Validate ¶
func (r SessionPromptAdmissionRequest) Validate() error
Validate ensures an admission has complete, stable identity before persistence.
type SessionPromptAdmissionResult ¶
type SessionPromptAdmissionResult struct {
Status string `json:"status"`
Mode string `json:"mode,omitempty"`
QueueEntryID string `json:"queue_entry_id,omitempty"`
QueuePosition int `json:"queue_position,omitempty"`
QueueGeneration int64 `json:"queue_generation,omitempty"`
Delivery string `json:"delivery,omitempty"`
PreviousTurnID string `json:"previous_turn_id,omitempty"`
NewTurnID string `json:"new_turn_id,omitempty"`
CanceledQueuedEntries int `json:"canceled_queued_entries,omitempty"`
Goal json.RawMessage `json:"goal,omitempty"`
}
SessionPromptAdmissionResult is the durable non-streaming result replayed for one admitted command.
type SessionPromptAdmissionStore ¶
type SessionPromptAdmissionStore interface {
ReplaySessionPromptAdmission(
ctx context.Context,
request SessionPromptAdmissionRequest,
) (SessionPromptAdmission, bool, error)
ClaimSessionPromptAdmission(
ctx context.Context,
request SessionPromptAdmissionRequest,
) (SessionPromptAdmission, bool, error)
CommitSessionPromptDispatch(
ctx context.Context,
workspaceID string,
sessionID string,
idempotencyKey string,
now time.Time,
) error
CompleteSessionPromptAdmission(
ctx context.Context,
workspaceID string,
sessionID string,
idempotencyKey string,
result SessionPromptAdmissionResult,
now time.Time,
) (SessionPromptAdmission, error)
MarkSessionPromptAdmissionIndeterminate(
ctx context.Context,
workspaceID string,
sessionID string,
idempotencyKey string,
reason string,
now time.Time,
) error
EnqueueAdmittedSessionInput(
ctx context.Context,
request SessionPromptAdmissionRequest,
queueInput SessionInputQueueInsert,
) (SessionPromptAdmission, SessionInputQueueEntry, int, bool, error)
StageAdmittedSessionSteer(
ctx context.Context,
request SessionPromptAdmissionRequest,
queueInput SessionInputQueueInsert,
) (SessionPromptAdmission, SessionInputQueueEntry, bool, error)
}
SessionPromptAdmissionStore persists command receipts and their queue-linked admission decisions.
type SessionProviderExecutionState ¶
type SessionProviderExecutionState struct {
EffectivePermissions string `json:"effective_permissions,omitempty"`
EffectiveProviderAuthMode string `json:"effective_provider_auth_mode,omitempty"`
}
SessionProviderExecutionState keeps resolved provider execution settings compact inside SessionMeta. Embedding preserves the flat session metadata JSON contract.
type SessionRuntimeRecovery ¶
type SessionRuntimeRecovery struct {
Attempt int `json:"attempt"`
MaxAttempts int `json:"max_attempts"`
Generation int64 `json:"generation"`
StartedAt time.Time `json:"started_at"`
LastAttemptAt time.Time `json:"last_attempt_at"`
NextAttemptAt *time.Time `json:"next_attempt_at,omitempty"`
LastError string `json:"last_error,omitempty"`
}
SessionRuntimeRecovery is the durable projection of an automatic runtime recovery attempt.
func CloneSessionRuntimeRecovery ¶
func CloneSessionRuntimeRecovery(recovery *SessionRuntimeRecovery) *SessionRuntimeRecovery
CloneSessionRuntimeRecovery returns an ownership-safe recovery projection.
type SessionRuntimeSelection ¶
type SessionRuntimeSelection struct {
Provider string `json:"provider"`
Model string `json:"model,omitempty"`
ReasoningEffort string `json:"reasoning_effort,omitempty"`
Speed speedpkg.Speed `json:"speed,omitempty"`
}
SessionRuntimeSelection is the durable runtime preference for future prompts.
func CloneSessionRuntimeSelection ¶
func CloneSessionRuntimeSelection(selection *SessionRuntimeSelection) *SessionRuntimeSelection
CloneSessionRuntimeSelection returns an independent canonical selection.
func NormalizeSessionRuntimeSelection ¶
func NormalizeSessionRuntimeSelection(selection *SessionRuntimeSelection) *SessionRuntimeSelection
NormalizeSessionRuntimeSelection returns an independent canonical selection.
func SessionRuntimeSelectionStateValues ¶
func SessionRuntimeSelectionStateValues( state *SessionRuntimeSelectionState, ) (*SessionRuntimeSelection, int64)
SessionRuntimeSelectionStateValues returns independent values from persisted selection state.
type SessionRuntimeSelectionState ¶
type SessionRuntimeSelectionState struct {
Selected *SessionRuntimeSelection `json:"selected,omitempty"`
Revision int64 `json:"revision"`
}
SessionRuntimeSelectionState keeps a selected runtime and its revision together.
func NewSessionRuntimeSelectionState ¶
func NewSessionRuntimeSelectionState( selection *SessionRuntimeSelection, revision int64, ) *SessionRuntimeSelectionState
NewSessionRuntimeSelectionState returns canonical persisted selection state.
type SessionRuntimeStatus ¶
type SessionRuntimeStatus string
SessionRuntimeStatus is the persisted lifecycle of a logical session's ACP binding.
const ( SessionRuntimeUnbound SessionRuntimeStatus = "unbound" SessionRuntimeBinding SessionRuntimeStatus = "binding" SessionRuntimeReady SessionRuntimeStatus = "ready" SessionRuntimeReconfiguring SessionRuntimeStatus = "reconfiguring" SessionRuntimeRecovering SessionRuntimeStatus = "recovering" SessionRuntimeFailed SessionRuntimeStatus = "failed" )
type SessionRuntimeTransition ¶
type SessionRuntimeTransition string
SessionRuntimeTransition identifies the most recent successful binding strategy.
const ( SessionRuntimeTransitionNone SessionRuntimeTransition = "" SessionRuntimeTransitionInitialBind SessionRuntimeTransition = "initial_bind" SessionRuntimeTransitionLiveConfiguration SessionRuntimeTransition = "live_configuration" SessionRuntimeTransitionProcessReplacement SessionRuntimeTransition = "process_replacement" SessionRuntimeTransitionAutomaticRecovery SessionRuntimeTransition = "automatic_recovery" )
type SessionSandboxMeta ¶
type SessionSandboxMeta struct {
SandboxID string `json:"sandbox_id,omitempty"`
Backend string `json:"backend"`
Profile string `json:"profile,omitempty"`
State string `json:"state,omitempty"`
InstanceID string `json:"instance_id,omitempty"`
RuntimeRootDir string `json:"runtime_root_dir,omitempty"`
RuntimeAdditionalDirs []string `json:"runtime_additional_dirs,omitempty"`
ProviderState json.RawMessage `json:"provider_state,omitempty"`
SSHAccessExpiresAt *time.Time `json:"ssh_access_expires_at,omitempty"`
LastSyncAt *time.Time `json:"last_sync_at,omitempty"`
LastSyncError string `json:"last_sync_error,omitempty"`
}
SessionSandboxMeta is the persisted runtime sandbox state for a session.
type SessionSoulSnapshotUpdate ¶
type SessionSoulSnapshotUpdate struct {
ID string
SoulSnapshotID string
SoulDigest string
ParentSoulDigest string
UpdatedAt time.Time
}
SessionSoulSnapshotUpdate updates the Soul provenance attached to a session.
func (SessionSoulSnapshotUpdate) Validate ¶
func (u SessionSoulSnapshotUpdate) Validate() error
Validate ensures session Soul provenance is internally consistent.
type SessionSpawnBudget ¶
type SessionSpawnBudget struct {
MaxChildren int `json:"max_children"`
MaxDepth int `json:"max_depth"`
TTLSeconds int64 `json:"ttl_seconds"`
MaxActivePerWorkspace int `json:"max_active_per_workspace,omitempty"`
}
SessionSpawnBudget captures durable spawn limits attached to a session.
func DecodeSessionSpawnBudget ¶
func DecodeSessionSpawnBudget(raw string) (SessionSpawnBudget, error)
DecodeSessionSpawnBudget unmarshals budget metadata from the global session catalog.
type SessionStateUpdate ¶
type SessionStateUpdate struct {
ID string
State string
ACPSessionID *string
RuntimeSet bool
Provider string
Model string
ReasoningEffort string
Speed speedpkg.Speed
SpeedResolution *speedpkg.Resolution
RuntimeStatus SessionRuntimeStatus
RuntimeTransition SessionRuntimeTransition
RuntimeFailure string
RuntimeGeneration int64
RuntimeRecovery *SessionRuntimeRecovery
SelectedRuntimeSet bool
SelectedRuntime *SessionRuntimeSelection
RuntimeSelectionRevision int64
StopReasonSet bool
StopReason *string
StopDetail string
FailureSet bool
Failure *SessionFailure
AttentionTransition bool
Liveness *SessionLivenessMeta
Sandbox *SessionSandboxMeta
UpdatedAt time.Time
}
SessionStateUpdate updates only the stateful fields of an indexed session.
func (SessionStateUpdate) Validate ¶
func (u SessionStateUpdate) Validate() error
Validate ensures the update contains the required fields.
type SessionTranscriptEpochStore ¶
type SessionTranscriptEpochStore interface {
SessionTranscriptEpoch(ctx context.Context, sessionID string) (int64, error)
EnsureSessionTranscriptEpoch(ctx context.Context, update SessionTranscriptEpochUpdate) (int64, error)
}
SessionTranscriptEpochStore manages destructive transcript reset epochs.
type SessionTranscriptEpochUpdate ¶
SessionTranscriptEpochUpdate advances a session transcript epoch after destructive transcript resets.
func (SessionTranscriptEpochUpdate) Validate ¶
func (u SessionTranscriptEpochUpdate) Validate() error
Validate ensures the epoch update targets a known session and positive epoch.
type SkillExposureOwnerScope ¶
type SkillExposureOwnerScope string
SkillExposureOwnerScope identifies the shared owner of one provider-root link.
const ( SkillExposureOwnerUser SkillExposureOwnerScope = "user" SkillExposureOwnerWorkspace SkillExposureOwnerScope = "workspace" )
type SkillExposureRecord ¶
type SkillExposureRecord struct {
ID int64
SkillName string
CanonicalDir string
TargetSlug string
LinkPath string
LinkTarget string
OwnerScope SkillExposureOwnerScope
WorkspaceID string
CreatedAt time.Time
UpdatedAt time.Time
}
SkillExposureRecord is the durable ownership proof for one created skill link.
type SkillExposureRepository ¶
type SkillExposureRepository interface {
CreateSkillExposure(context.Context, SkillExposureRecord) (SkillExposureRecord, error)
GetSkillExposureByOwnerTarget(
context.Context,
string,
SkillExposureOwnerScope,
string,
string,
) (SkillExposureRecord, error)
ListSkillExposuresByOwner(
context.Context,
string,
SkillExposureOwnerScope,
string,
) ([]SkillExposureRecord, error)
ListSkillExposuresByCanonicalDir(context.Context, string) ([]SkillExposureRecord, error)
DeleteSkillExposure(context.Context, int64) error
}
SkillExposureRepository persists exposure ownership independently from link health.
type StopReason ¶
type StopReason string
const ( StopCompleted StopReason = "completed" StopUserCanceled StopReason = "user_canceled" StopMaxIterations StopReason = "max_iterations" StopLoopDetected StopReason = "loop_detected" StopTimeout StopReason = "timeout" StopBudgetExceeded StopReason = "budget_exceeded" StopError StopReason = "error" StopAgentCrashed StopReason = "agent_crashed" StopHookStopped StopReason = "hook_stopped" StopShutdown StopReason = "shutdown" )
type StreamStatus ¶
StreamStatus describes the applied state of one migration stream.
func Status ¶
func Status(ctx context.Context, db *sql.DB, stream MigrationStream) (StreamStatus, error)
Status returns stream state without creating or mutating a version table.
type TaskClosedDay ¶
TaskClosedDay is one daemon-local day of completed-task closures.
type TaskDesignationRollup ¶
type TaskDesignationRollup struct {
DesignationGroupID string
TaskID string
SummaryJSON json.RawMessage
CreatedAt time.Time
}
TaskDesignationRollup stores the terminal summary for a designated run group.
func (TaskDesignationRollup) Validate ¶
func (r TaskDesignationRollup) Validate() error
Validate ensures the rollup can be retrieved by task and group.
type TaskDesignationRollupQuery ¶
TaskDesignationRollupQuery filters designation rollup reads.
func (TaskDesignationRollupQuery) Validate ¶
func (q TaskDesignationRollupQuery) Validate() error
Validate ensures rollup reads cannot become unbounded.
type TaskRunOutcomeDay ¶
TaskRunOutcomeDay is one daemon-local day of terminal worker-run outcomes.
type TokenStats ¶
type TokenStats struct {
ID string
SessionID string
AgentName string
InputTokens *int64
OutputTokens *int64
TotalTokens *int64
TotalCost *float64
CostCurrency *string
CostStatus string
CostSource string
TurnCount int64
UpdatedAt time.Time
}
TokenStats is the aggregated usage record for a session in the global database.
type TokenStatsCostSummary ¶
type TokenStatsCostSummary struct {
TotalCost *float64
Currency *string
Status string
Source string
}
TokenStatsCostSummary is the compatible cost projection across token-stat rows.
func AggregateTokenStatsCost ¶
func AggregateTokenStatsCost(stats []TokenStats) TokenStatsCostSummary
AggregateTokenStatsCost sums only rows with identical truthful provenance and currency.
type TokenStatsQuery ¶
TokenStatsQuery filters token aggregation lookups.
func (TokenStatsQuery) Validate ¶
func (q TokenStatsQuery) Validate() error
Validate ensures the query uses sane bounds.
type TokenStatsUpdate ¶
type TokenStatsUpdate struct {
SessionID string
AgentName string
InputTokens *int64
OutputTokens *int64
TotalTokens *int64
CostAmount *float64
CostCurrency *string
CostStatus string
CostSource string
Turns int64
UpdatedAt time.Time
}
TokenStatsUpdate adds one or more turns of usage into a session aggregate.
func (TokenStatsUpdate) Validate ¶
func (u TokenStatsUpdate) Validate() error
Validate ensures the aggregate update contains the required identifying fields.
type TokenUsage ¶
type TokenUsage struct {
TurnID string
InputTokens *int64
OutputTokens *int64
TotalTokens *int64
ThoughtTokens *int64
CacheReadTokens *int64
CacheWriteTokens *int64
ContextUsed *int64
ContextSize *int64
CostAmount *float64
CostCurrency *string
Timestamp time.Time
}
TokenUsage captures per-turn usage data reported by an ACP provider.
func (TokenUsage) Validate ¶
func (u TokenUsage) Validate() error
Validate ensures the usage payload has the required fields.
type TokenUsageAgentTotal ¶
TokenUsageAgentTotal is one agent's summed token usage inside a rollup window.
type TokenUsageCostGroup ¶
type TokenUsageCostGroup struct {
CostStatus string
CostSource string
CostCurrency string
TotalCost float64
RowsWithoutCost int64
RowsTotal int64
}
TokenUsageCostGroup is one provenance-uniform cost bucket inside a rollup window.
type TokenUsageDailyUpdate ¶
type TokenUsageDailyUpdate struct {
Day string
ProfileID string
WorkspaceID string
AgentName string
InputTokens *int64
OutputTokens *int64
TotalTokens *int64
CostAmount *float64
CostCurrency *string
CostStatus string
CostSource string
Turns int64
UpdatedAt time.Time
}
TokenUsageDailyUpdate merges one turn of token usage into the daily rollup.
func (TokenUsageDailyUpdate) Validate ¶
func (u TokenUsageDailyUpdate) Validate() error
Validate ensures the rollup update carries a canonical day bucket, non-negative token deltas, and a valid cost shape.
type TokenUsageDay ¶
TokenUsageDay is one daemon-local day of summed token usage.
type TokenUsageProfileTotal ¶
type TokenUsageProfileTotal struct {
ProfileID string
ProfileName string
Color string
Icon string
Emoji string
Archived bool
TotalTokens int64
}
TokenUsageProfileTotal is one owner-labeled profile bucket inside a usage window.
type TurnHistory ¶
type TurnHistory struct {
TurnID string
Events []SessionEvent
}
TurnHistory groups ordered events by their turn identifier.
type WakeReservation ¶
type WakeReservation struct {
WakeID string
TaskRunID string
WorkspaceID string
OwnerKey string
EnvelopeIDs []string
ReservedWallTime string
CoalesceUntil time.Time
}
WakeReservation is durable admission evidence paired one-to-one with a task run.
type WorkspaceAttentionSummary ¶
WorkspaceAttentionSummary is one exact workspace aggregate.
type WriteTx ¶
type WriteTx struct {
// contains filtered or unexported fields
}
WriteTx is the single-connection transaction handle passed to ExecuteWrite callbacks.
func (*WriteTx) ExecContext ¶
ExecContext executes a statement inside the active write transaction.
func (*WriteTx) PrepareContext ¶
PrepareContext prepares a statement inside the active write transaction.
func (*WriteTx) QueryContext ¶
QueryContext executes a query inside the active write transaction.
Source Files
¶
- dead_entity_store.go
- event_store.go
- event_summary_content.go
- event_summary_store.go
- failure.go
- id.go
- loop_output_blob.go
- marketplace_catalog.go
- meta.go
- migrate.go
- migrate_logging.go
- migration_bootstrap.go
- migration_database.go
- migration_manifest.go
- migration_plan.go
- migration_plan_fs.go
- migration_refusal.go
- migration_sql_parser.go
- migration_status.go
- migration_stepper.go
- mutation_fence.go
- network_audit_store.go
- network_channel_projection.go
- network_channel_store.go
- network_claim_token.go
- network_constants.go
- network_conversation_store.go
- network_conversation_summaries.go
- network_delivery_store.go
- network_direct_identity.go
- network_errors.go
- network_message_store.go
- network_preference_store.go
- network_queries.go
- network_validation.go
- onboarding_store.go
- profile_identity.go
- read_scope.go
- session_advertised_command.go
- session_attention.go
- session_catalog.go
- session_catalog_agent_metrics.go
- session_catalog_owner.go
- session_catalog_page.go
- session_creation_identity.go
- session_creation_profile.go
- session_db_owner.go
- session_input_attachment.go
- session_input_queue.go
- session_lineage.go
- session_liveness.go
- session_meta_types.go
- session_permission_policy.go
- session_prompt_admission.go
- session_runtime.go
- session_runtime_recovery.go
- session_runtime_selection.go
- session_spawn_budget.go
- session_store_errors.go
- session_type.go
- skill_exposure.go
- sql_clause.go
- sql_null.go
- sqlite.go
- sqlite_checkpoint.go
- sqlite_cleanup.go
- sqlite_config.go
- sqlite_corruption.go
- sqlite_header.go
- sqlite_identifier.go
- sqlite_probe.go
- store.go
- store_paths.go
- timestamp.go
- token_stats_cost.go
- types_conversation_rewind.go
- types_dead_entity.go
- types_event.go
- types_event_summary.go
- types_network_admission.go
- types_network_audit.go
- types_network_availability.go
- types_network_channel.go
- types_network_conversation.go
- types_network_direct.go
- types_network_subscription.go
- types_network_task_origin.go
- types_network_task_status.go
- types_network_usage.go
- types_observability_retention.go
- types_observe_overview.go
- types_permission_log.go
- types_reconcile.go
- types_session.go
- types_session_network.go
- types_task_designation_rollup.go
- types_token_stats.go
- validation.go
- write.go
Directories
¶
| Path | Synopsis |
|---|---|
|
schema
Package schema embeds the global database schema and migration directory.
|
Package schema embeds the global database schema and migration directory. |
|
schema
Package schema embeds the session database schema and migration directory.
|
Package schema embeds the session database schema and migration directory. |
|
Package workspacedb owns per-workspace SQLite database lifecycle helpers.
|
Package workspacedb owns per-workspace SQLite database lifecycle helpers. |
|
schema
Package schema embeds the workspace database schema and migration directory.
|
Package schema embeds the workspace database schema and migration directory. |