sqlite

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const AgentExecutionSnapshotKeyBytes = 32

AgentExecutionSnapshotKeyBytes is the required AES-256 key length.

Variables

This section is empty.

Functions

func NewDB

func NewDB(path string) (*sql.DB, error)

NewDB opens a SQLite database with recommended pragmas for WAL mode, busy timeout, synchronous mode, and foreign keys.

Types

type AgentExecutionSnapshotCipher added in v0.2.0

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

AgentExecutionSnapshotCipher encrypts immutable execution snapshot bodies at rest. Snapshot bodies are sensitive (resolved prompts, Skill content, repository identities, endpoint metadata, policy configuration) and are never stored or returned in plaintext outside this seam.

func NewAgentExecutionSnapshotCipher added in v0.2.0

func NewAgentExecutionSnapshotCipher(key []byte) (*AgentExecutionSnapshotCipher, error)

NewAgentExecutionSnapshotCipher builds an AES-256-GCM snapshot cipher.

type Store

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

Store implements both store.ResultStore and store.SessionStore.

func NewStore

func NewStore(db *sql.DB, dbPath string) *Store

NewStore creates a new Store backed by the given SQLite database. The dbPath is the filesystem path to the database file (used for metrics and logging).

func OpenLockedStore added in v0.2.0

func OpenLockedStore(path string) (*Store, error)

OpenLockedStore acquires the process-lifetime filesystem lock adjacent to path before SQLite is opened. Production controller wiring must use this constructor so overlapping Pods or releases cannot initialize or write the same database even if Kubernetes ownership fencing is misconfigured.

func (*Store) AcquireChatTurn added in v0.2.0

func (s *Store) AcquireChatTurn(
	ctx context.Context,
	session *store.SessionRecord,
	turnID string,
	expiresAt time.Time,
) (bool, error)

AcquireChatTurn creates a chat Session when needed and reserves its current transcript revision for one turn. Expired reservations may be reclaimed, but Task locks and Gateway-owned Sessions are never taken over by chat.

func (*Store) AcquireLock

func (s *Store) AcquireLock(ctx context.Context, namespace, name, taskName, taskUID string) error

AcquireLock atomically sets a durable Task lock for a session. Returns store.ErrNotFound if the session does not exist, or an error if already locked.

func (*Store) AcquireLockUntil added in v0.2.0

func (s *Store) AcquireLockUntil(ctx context.Context, namespace, name, ownerName, ownerUID string, expiresAt time.Time) error

AcquireLockUntil atomically sets a crash-recoverable transient lock.

func (*Store) AcquireSessionMutationLease added in v0.2.0

func (s *Store) AcquireSessionMutationLease(ctx context.Context, request store.AcquireSessionMutationLeaseRequest) (*store.SessionControl, error)

AcquireSessionMutationLease acquires the next monotonic lease generation and mirrors ownership into the legacy session active_task field in the same transaction.

func (*Store) ActivateSessionTurnProjection added in v0.2.0

func (s *Store) ActivateSessionTurnProjection(ctx context.Context, request store.ActivateSessionTurnProjectionRequest) (*store.OutboxProjection, error)

ActivateSessionTurnProjection makes the deferred terminal projection claimable only after Kubernetes control finalization has committed.

func (*Store) AdmitGatewayEvent

func (s *Store) AdmitGatewayEvent(ctx context.Context, admission store.GatewayEventAdmission) (*store.GatewayEvent, bool, error)

AdmitGatewayEvent atomically deduplicates a normalized event and, for accepted events, creates/upserts the Session and appends one stable user message.

func (*Store) AppendExecutionEvent

func (s *Store) AppendExecutionEvent(ctx context.Context, event *store.ExecutionEvent) (*store.ExecutionEvent, error)

AppendExecutionEvent appends an execution event and allocates the next sequence number transactionally for its (namespace, stream_type, stream_id) stream.

func (*Store) AppendExecutionEventIfAbsent added in v0.2.0

func (s *Store) AppendExecutionEventIfAbsent(
	ctx context.Context,
	event *store.ExecutionEvent,
	dedupeKey string,
) (*store.ExecutionEvent, bool, error)

AppendExecutionEventIfAbsent atomically appends an execution event when its stream-scoped deduplication key is absent. A repeated key returns the existing event without allocating another sequence.

func (*Store) AppendExecutionEventWithPlanIfAbsent added in v0.2.0

func (s *Store) AppendExecutionEventWithPlanIfAbsent(
	ctx context.Context,
	event *store.ExecutionEvent,
	dedupeKey string,
	plan *store.PlanState,
) (*store.ExecutionEvent, bool, error)

AppendExecutionEventWithPlanIfAbsent atomically appends an execution event and updates its task plan projection. Duplicate event keys leave the current plan unchanged.

func (*Store) AppendMessages

func (s *Store) AppendMessages(ctx context.Context, namespace, name string, messages []store.SessionMessage) error

AppendMessages inserts messages into a session's logical transcript and updates session metadata. Stable message IDs make retries idempotent; even-numbered logical orders leave a gap for gateway terminal projections that arrive after later user messages were durably admitted.

func (*Store) AppendMessagesWithLock added in v0.2.0

func (s *Store) AppendMessagesWithLock(
	ctx context.Context,
	namespace, name, ownerName, ownerUID string,
	messages []store.SessionMessage,
) error

AppendMessagesWithLock requires the exact active lock owner through the whole transaction, preventing writes after lease expiry and takeover.

func (*Store) ApplyMemoryProposal

func (s *Store) ApplyMemoryProposal(ctx context.Context, apply store.MemoryProposalApply) (*store.Memory, error)

ApplyMemoryProposal applies an accepted memory proposal into durable memories.

func (*Store) ApplyScanTaskIngestion added in v0.2.0

func (s *Store) ApplyScanTaskIngestion(ctx context.Context, ingestion *store.ScanTaskIngestion, validate func(*store.ScanRun) error, apply func(store.SecurityStore, *store.ScanRun) error) (bool, error)

func (*Store) ArchiveMemoryProposal

func (s *Store) ArchiveMemoryProposal(ctx context.Context, namespace, id string) error

ArchiveMemoryProposal archives a proposal without applying it.

func (*Store) BindPatchProposalPublicationEvidence added in v0.2.0

func (s *Store) BindPatchProposalPublicationEvidence(ctx context.Context, proposal *store.PatchProposal) error

BindPatchProposalPublicationEvidence atomically finalizes a proposal with one immutable governed-publication tuple. Identical replay is a no-op; any differing replay conflicts and leaves the first tuple unchanged.

func (*Store) BindSessionCleanupIdentity added in v0.2.0

func (s *Store) BindSessionCleanupIdentity(ctx context.Context, namespace, sessionName, sessionUID string) error

BindSessionCleanupIdentity records the Kubernetes Session UID on the transcript row so deletion cannot confuse a pre-cutover replacement with the control record left by an older Session incarnation.

func (*Store) CancelWorkActions

func (s *Store) CancelWorkActions(ctx context.Context, namespace, monitorName, targetKind string, targetNumber int64, reason string) (int, error)

CancelWorkActions cancels non-terminal workflow actions for a target.

func (*Store) CheckTaskJobAuthority added in v0.2.0

func (s *Store) CheckTaskJobAuthority(ctx context.Context, identity store.TaskJobIdentity) error

func (*Store) ClaimNextGatewayDelivery

func (s *Store) ClaimNextGatewayDelivery(ctx context.Context, namespace, owner string, now time.Time, lease time.Duration) (*store.GatewayDelivery, error)

ClaimNextGatewayDelivery leases the oldest due outbox row.

func (*Store) ClaimNextGatewayEvent

func (s *Store) ClaimNextGatewayEvent(ctx context.Context, namespace, owner string, now time.Time, lease time.Duration) (*store.GatewayEvent, error)

ClaimNextGatewayEvent leases the oldest runnable event and reserves its Session.

func (*Store) ClaimOutboxProjectionRecords added in v0.2.0

func (s *Store) ClaimOutboxProjectionRecords(ctx context.Context, request store.ClaimOutboxProjectionsRequest) ([]store.OutboxProjection, error)

ClaimOutboxProjectionRecords claims due records after a Kubernetes control store has validated the controller epoch fence.

func (*Store) ClaimOutboxProjections added in v0.2.0

func (s *Store) ClaimOutboxProjections(ctx context.Context, request store.ClaimOutboxProjectionsRequest) ([]store.OutboxProjection, error)

ClaimOutboxProjections leases due pending records and expired delivering records in one transaction. Attempts and versions advance before records are returned.

func (*Store) CommitSessionRuntimeGeneration added in v0.2.0

func (s *Store) CommitSessionRuntimeGeneration(ctx context.Context, request store.CommitSessionRuntimeGenerationRequest) (*store.SessionControl, error)

CommitSessionRuntimeGeneration records the newest provider RuntimeSession generation proven live under the exact active Session lease.

func (*Store) CommitSessionTurn added in v0.2.0

func (s *Store) CommitSessionTurn(
	ctx context.Context,
	session *store.SessionRecord,
	turnID string,
	expectedMessageCount int,
	messages []store.SessionMessage,
	inputTokens, outputTokens int,
) error

CommitSessionTurn atomically appends one chat turn's messages and token usage. The reservation owner, lease, and observed message count fence the commit against concurrent or recovered turns.

func (*Store) CommitSessionTurnFinalization added in v0.2.0

func (s *Store) CommitSessionTurnFinalization(ctx context.Context, request store.CommitSessionTurnFinalizationRequest) (*store.SessionTurn, error)

CommitSessionTurnFinalization atomically persists optional transcript entries, the finalized turn receipt, and a deliberately deferred terminal projection. It never reads or mutates SQLite control-plane mirror tables.

func (*Store) CompareAndSwapBranchClaim added in v0.2.0

func (s *Store) CompareAndSwapBranchClaim(ctx context.Context, change store.BranchClaimCAS) (*store.BranchClaim, error)

CompareAndSwapBranchClaim atomically updates the exact generation, baseline, and availability observed by the caller.

func (*Store) CompareAndSwapControllerEpoch added in v0.2.0

func (s *Store) CompareAndSwapControllerEpoch(ctx context.Context, change store.ControllerEpochCAS) (*store.ControllerEpoch, error)

CompareAndSwapControllerEpoch creates or advances the controller epoch with exact version/epoch CAS semantics. A same-holder, same-digest retry of an already committed target epoch is idempotent.

func (*Store) CompleteOutboxProjection added in v0.2.0

func (s *Store) CompleteOutboxProjection(ctx context.Context, request store.CompleteOutboxProjectionRequest) (*store.OutboxProjection, error)

CompleteOutboxProjection completes, retries, or dead-letters the exact lease.

func (*Store) CompleteOutboxProjectionRecord added in v0.2.0

func (s *Store) CompleteOutboxProjectionRecord(ctx context.Context, request store.CompleteOutboxProjectionRequest) (*store.OutboxProjection, error)

CompleteOutboxProjectionRecord completes a claimed record after a Kubernetes control store has validated the controller epoch fence.

func (*Store) CompleteScanRunCancellation added in v0.2.0

func (s *Store) CompleteScanRunCancellation(ctx context.Context, run *store.ScanRun) error

CompleteScanRunCancellation releases active reservations only after cleanup. Late-Task cleanup preserves the result of an already terminal run.

func (*Store) CompleteScanTaskIngestion added in v0.2.0

func (s *Store) CompleteScanTaskIngestion(ctx context.Context, task store.ScanTaskIdentity) error

func (*Store) CompleteSessionCleanup added in v0.2.0

func (s *Store) CompleteSessionCleanup(ctx context.Context, request store.CompleteSessionCleanupRequest) error

CompleteSessionCleanup removes SQLite-owned turn/outbox/transcript state only after the caller has reclaimed the exact Kubernetes plan in the intent.

func (*Store) CountAgentExecutionSnapshotReferences added in v0.2.0

func (s *Store) CountAgentExecutionSnapshotReferences(
	ctx context.Context,
	key store.AgentExecutionSnapshotKey,
) (store.AgentExecutionSnapshotReferenceCounts, error)

CountAgentExecutionSnapshotReferences implements store.AgentExecutionSnapshotLifecycleStore. All counts are read by one SQL statement so the result is one consistent SQLite snapshot.

func (*Store) CountImplementationJobs

func (s *Store) CountImplementationJobs(ctx context.Context, filter store.ImplementationJobFilter) (int, error)

CountImplementationJobs counts jobs matching durable workflow filters without materializing historical rows. When ExcludeWorkActionStatuses is set, jobs with a linked work action in one of those statuses are excluded; jobs without a linked/found action remain counted, matching controller capacity semantics.

func (*Store) CountUnsettledOutboxProjections added in v0.2.0

func (s *Store) CountUnsettledOutboxProjections(ctx context.Context) (int64, error)

CountUnsettledOutboxProjections reports Pending or Delivering projections without claiming them. It is used only by the planned-upgrade drain barrier.

func (*Store) CreateActionRecord

func (s *Store) CreateActionRecord(ctx context.Context, record *store.ActionRecord) error

CreateActionRecord inserts a durable action record.

func (*Store) CreateBranchClaim added in v0.2.0

func (s *Store) CreateBranchClaim(ctx context.Context, claim *store.BranchClaim, fence store.ControllerEpochFence) (*store.BranchClaim, error)

CreateBranchClaim creates a canonical repository+full-ref ownership record. The same immutable identity and digest is idempotent; any mismatch conflicts.

func (*Store) CreateBranchClaimWithResult added in v0.2.0

func (s *Store) CreateBranchClaimWithResult(ctx context.Context, claim *store.BranchClaim, fence store.ControllerEpochFence) (*store.BranchClaim, bool, error)

CreateBranchClaimWithResult creates or idempotently returns a claim and reports true only when this transaction inserted the row.

func (*Store) CreateCommandEvent

func (s *Store) CreateCommandEvent(ctx context.Context, event *store.CommandEvent) error

CreateCommandEvent inserts a maintainer command event.

func (*Store) CreateDroppedFinding

func (s *Store) CreateDroppedFinding(ctx context.Context, dropped *store.DroppedFinding) error

CreateDroppedFinding records a rejected finding diagnostic.

func (*Store) CreateGatewayDelivery

func (s *Store) CreateGatewayDelivery(ctx context.Context, delivery *store.GatewayDelivery) (*store.GatewayDelivery, bool, error)

CreateGatewayDelivery idempotently inserts one outbox row.

func (*Store) CreateGitHubMutationRecord

func (s *Store) CreateGitHubMutationRecord(ctx context.Context, record *store.GitHubMutationRecord) error

CreateGitHubMutationRecord inserts an immutable GitHub mutation audit record.

func (*Store) CreateHarnessV1Attempt added in v0.2.0

func (s *Store) CreateHarnessV1Attempt(
	ctx context.Context,
	attempt *store.HarnessV1Attempt,
	fence store.ControllerEpochFence,
) error

CreateHarnessV1Attempt implements store.HarnessV1AttemptStore.

func (*Store) CreateImplementationJob

func (s *Store) CreateImplementationJob(ctx context.Context, job *store.ImplementationJob) error

CreateImplementationJob inserts an implementation job.

func (*Store) CreateMemory

func (s *Store) CreateMemory(ctx context.Context, memory *store.Memory) error

CreateMemory inserts a durable memory record.

func (*Store) CreateMemoryProposal

func (s *Store) CreateMemoryProposal(ctx context.Context, proposal *store.MemoryProposal) error

CreateMemoryProposal inserts a governance proposal.

func (*Store) CreateMonitorEvent

func (s *Store) CreateMonitorEvent(ctx context.Context, event *store.MonitorEvent) error

CreateMonitorEvent inserts an audit event.

func (*Store) CreateMonitorRun

func (s *Store) CreateMonitorRun(ctx context.Context, run *store.MonitorRun) error

CreateMonitorRun inserts a new monitor run.

func (*Store) CreatePatchProposal

func (s *Store) CreatePatchProposal(ctx context.Context, proposal *store.PatchProposal) error

CreatePatchProposal inserts a new patch proposal.

func (*Store) CreatePromptAttempt added in v0.2.0

func (s *Store) CreatePromptAttempt(ctx context.Context, attempt *store.PromptAttempt, fence store.ControllerEpochFence) (*store.PromptAttempt, error)

CreatePromptAttempt inserts a canonical prompt attempt. Repeating the exact immutable request, binding, and snapshot digests returns the committed row; reusing the identity for different immutable input conflicts.

func (*Store) CreatePublication added in v0.2.0

func (s *Store) CreatePublication(ctx context.Context, publication *store.Publication, fence store.ControllerEpochFence) (*store.Publication, error)

CreatePublication persists immutable clean-room publication intent in Preparing.

func (*Store) CreateRepairJob

func (s *Store) CreateRepairJob(ctx context.Context, job *store.RepairJob) error

CreateRepairJob inserts a repair job.

func (*Store) CreateReviewPublishRecord

func (s *Store) CreateReviewPublishRecord(ctx context.Context, record *store.ReviewPublishRecord) error

CreateReviewPublishRecord inserts a review publish attempt/outcome record.

func (*Store) CreateReviewRecord

func (s *Store) CreateReviewRecord(ctx context.Context, record *store.ReviewRecord) error

CreateReviewRecord inserts an immutable review record.

func (*Store) CreateRuntimeSession

func (s *Store) CreateRuntimeSession(ctx context.Context, session *harness.RuntimeSession) error

CreateRuntimeSession persists a new backend-neutral RuntimeSession.

func (*Store) CreateScanRun

func (s *Store) CreateScanRun(ctx context.Context, run *store.ScanRun) error

CreateScanRun inserts a new scan run.

func (*Store) CreateSession

func (s *Store) CreateSession(ctx context.Context, session *store.SessionRecord) error

CreateSession inserts a new session record.

func (*Store) CreateSessionControl added in v0.2.0

func (s *Store) CreateSessionControl(ctx context.Context, control *store.SessionControl, fence store.ControllerEpochFence) (*store.SessionControl, error)

CreateSessionControl attaches an immutable SessionUID and fenced control metadata to an existing transcript session.

func (*Store) CreateSessionTurn added in v0.2.0

func (s *Store) CreateSessionTurn(ctx context.Context, request store.CreateSessionTurnRequest) (*store.SessionTurn, error)

CreateSessionTurn opens a durable turn only under its exact active lease.

func (*Store) CreateSessionTurnRecord added in v0.2.0

func (s *Store) CreateSessionTurnRecord(ctx context.Context, request store.CreateSessionTurnRecordRequest) (*store.SessionTurn, error)

CreateSessionTurnRecord persists only the SQLite-owned open turn after the Kubernetes store has validated SessionControl and PromptAttempt fences.

func (*Store) CreateWorkAction

func (s *Store) CreateWorkAction(ctx context.Context, action *store.WorkAction) error

CreateWorkAction inserts a durable workflow action.

func (*Store) DeferGatewayEventProjection

func (s *Store) DeferGatewayEventProjection(
	ctx context.Context,
	namespace, id string,
	nextAttemptAt time.Time,
) error

DeferGatewayEventProjection rotates a nonterminal TaskCreated event behind other due projection work.

func (*Store) DeleteAgentExecutionSnapshot added in v0.2.0

func (s *Store) DeleteAgentExecutionSnapshot(ctx context.Context, key store.AgentExecutionSnapshotKey) error

DeleteAgentExecutionSnapshot implements store.AgentExecutionSnapshotLifecycleStore. It deliberately does not alter the Task-scoped broad deletion method above or perform lifecycle policy.

func (*Store) DeleteAgentExecutionSnapshots added in v0.2.0

func (s *Store) DeleteAgentExecutionSnapshots(ctx context.Context, taskUID string) error

DeleteAgentExecutionSnapshots implements store.AgentExecutionSnapshotStore.

func (*Store) DeleteArtifacts

func (s *Store) DeleteArtifacts(ctx context.Context, namespace, taskName string) error

DeleteArtifacts removes all artifacts for a task.

func (*Store) DeleteExecutionEvents

func (s *Store) DeleteExecutionEvents(ctx context.Context, namespace, streamType, streamID string) error

DeleteExecutionEvents removes all execution events for one stream.

func (*Store) DeleteGatewayTaskCleanupReceipt added in v0.2.0

func (s *Store) DeleteGatewayTaskCleanupReceipt(ctx context.Context, namespace, taskName, taskUID string) error

DeleteGatewayTaskCleanupReceipt is idempotent and never deletes another incarnation that reused the Task name.

func (*Store) DeleteMemory

func (s *Store) DeleteMemory(ctx context.Context, namespace, id string) error

DeleteMemory soft-deletes a memory by ID within a namespace.

func (*Store) DeleteParentMessages

func (s *Store) DeleteParentMessages(ctx context.Context, namespace, parentTask string) error

DeleteParentMessages deletes all messages for children of a parent task.

func (*Store) DeletePlan

func (s *Store) DeletePlan(ctx context.Context, namespace, taskName string) error

DeletePlan removes the autonomous plan state for a task.

func (*Store) DeleteRepositoryMonitor

func (s *Store) DeleteRepositoryMonitor(ctx context.Context, namespace, name string) error

DeleteRepositoryMonitor deletes normalized monitor metadata.

func (*Store) DeleteResult

func (s *Store) DeleteResult(ctx context.Context, namespace, taskName string) error

DeleteResult removes a task result.

func (*Store) DeleteRuntimeSession

func (s *Store) DeleteRuntimeSession(ctx context.Context, namespace string, id harness.RuntimeSessionID) error

DeleteRuntimeSession physically prunes a RuntimeSession after it reaches Deleted.

func (*Store) DeleteSession

func (s *Store) DeleteSession(ctx context.Context, namespace, name string) error

DeleteSession removes a quiescent session, its settled durable turn state, its messages (via CASCADE), and its session-scoped execution event read model. Open turns, active mutation leases, reconciliation-blocked controls, and undelivered projections keep the session durable for recovery.

func (*Store) DeleteTaskJobRevocations added in v0.2.0

func (s *Store) DeleteTaskJobRevocations(ctx context.Context, namespace, taskName, taskUID string) error

DeleteTaskJobRevocations is the finalizer-only reclamation step. A fresh namespace generation replaces the removed Task generation, so in-flight authorization cannot reuse its old generation after reclamation or name reuse.

func (*Store) DeleteTaskMessages

func (s *Store) DeleteTaskMessages(ctx context.Context, namespace, taskName string) error

DeleteTaskMessages deletes all messages involving a task (sent or received).

func (*Store) EnqueueOutboxProjection added in v0.2.0

func (s *Store) EnqueueOutboxProjection(ctx context.Context, projection *store.OutboxProjection, fence store.ControllerEpochFence) (*store.OutboxProjection, error)

EnqueueOutboxProjection inserts a restart-safe projection record. Reusing an ID with byte-identical payload and metadata is idempotent; any mismatch conflicts.

func (*Store) EnqueueOutboxProjectionRecord added in v0.2.0

func (s *Store) EnqueueOutboxProjectionRecord(ctx context.Context, projection *store.OutboxProjection, fence store.ControllerEpochFence) (*store.OutboxProjection, error)

EnqueueOutboxProjectionRecord persists an outbox record after a Kubernetes control store has validated the controller epoch fence.

func (*Store) ExpireGatewayEvent

func (s *Store) ExpireGatewayEvent(
	ctx context.Context,
	namespace, id, owner, reason string,
	now time.Time,
) error

ExpireGatewayEvent terminally expires stale work, appends one visible error, and releases the Session.

func (*Store) ExpireGatewayEventWithDelivery

func (s *Store) ExpireGatewayEventWithDelivery(
	ctx context.Context,
	projection store.GatewayExpiryProjection,
) (*store.GatewayDelivery, bool, error)

ExpireGatewayEventWithDelivery atomically expires stale work and creates the corresponding adapter outbox record.

func (*Store) FinalizeSessionTurn added in v0.2.0

func (s *Store) FinalizeSessionTurn(ctx context.Context, request store.FinalizeSessionTurnRequest) (*store.SessionTurn, error)

FinalizeSessionTurn is the atomic cross-store completion barrier. It optionally appends the canonical user/terminal transcript entries, snapshots the publication receipt, advances or blocks branch/session baselines, releases only the matching lease, and enqueues the terminal projection before commit.

func (*Store) FreezeGatewayEventTaskRuntimeAllowedTools added in v0.2.0

func (s *Store) FreezeGatewayEventTaskRuntimeAllowedTools(
	ctx context.Context,
	namespace, id, owner string,
	allowedTools []string,
	now time.Time,
) (*store.GatewayEvent, error)

FreezeGatewayEventTaskRuntimeAllowedTools records the external runtime policy that will be written to the deterministic Task. The first value wins so crash recovery never rebuilds the Task from mutable live policy.

func (*Store) GetActionRecord

func (s *Store) GetActionRecord(ctx context.Context, namespace, id string) (*store.ActionRecord, error)

GetActionRecord fetches an action record by ID.

func (*Store) GetAgentExecutionSnapshot added in v0.2.0

func (s *Store) GetAgentExecutionSnapshot(ctx context.Context, key store.AgentExecutionSnapshotKey) (*store.AgentExecutionSnapshot, error)

GetAgentExecutionSnapshot implements store.AgentExecutionSnapshotStore.

func (*Store) GetArtifact

func (s *Store) GetArtifact(ctx context.Context, namespace, taskName, filename string) ([]byte, string, error)

GetArtifact retrieves artifact data and content type. Returns store.ErrNotFound if not found.

func (*Store) GetBranchClaim added in v0.2.0

func (s *Store) GetBranchClaim(ctx context.Context, id string) (*store.BranchClaim, error)

GetBranchClaim returns one branch claim.

func (*Store) GetCommandEvent

func (s *Store) GetCommandEvent(ctx context.Context, namespace, id string) (*store.CommandEvent, error)

GetCommandEvent fetches a command event by ID.

func (*Store) GetControllerEpoch added in v0.2.0

func (s *Store) GetControllerEpoch(ctx context.Context, name string) (*store.ControllerEpoch, error)

GetControllerEpoch returns the current durable controller epoch.

func (*Store) GetExternalEffect added in v0.2.0

func (s *Store) GetExternalEffect(ctx context.Context, id string) (*store.ExternalEffect, error)

GetExternalEffect returns one durable external-effect record.

func (*Store) GetExternalEffectByIdentity added in v0.2.0

func (s *Store) GetExternalEffectByIdentity(ctx context.Context, identity store.ExternalEffectIdentity) (*store.ExternalEffect, error)

GetExternalEffectByIdentity resolves one exact durable external-effect identity and rejects any impossible identity mismatch.

func (*Store) GetFinding

func (s *Store) GetFinding(ctx context.Context, namespace, id string) (*store.Finding, error)

GetFinding returns a finding by ID.

func (*Store) GetFindingCounts

func (s *Store) GetFindingCounts(ctx context.Context, namespace, repositoryScan string) (store.FindingCounts, error)

GetFindingCounts returns current open finding counts by severity.

func (*Store) GetGatewayDelivery

func (s *Store) GetGatewayDelivery(ctx context.Context, namespace, id string) (*store.GatewayDelivery, error)

GetGatewayDelivery returns one delivery by stable ID.

func (*Store) GetGatewayEvent

func (s *Store) GetGatewayEvent(ctx context.Context, namespace, id string) (*store.GatewayEvent, error)

GetGatewayEvent returns one event by stable Orka event ID.

func (*Store) GetGatewayEventDuplicate

func (s *Store) GetGatewayEventDuplicate(
	ctx context.Context, candidate *store.GatewayEvent, now time.Time,
) (*store.GatewayEvent, error)

GetGatewayEventDuplicate resolves a durable duplicate before mutable readiness checks.

func (*Store) GetGatewayEventForTask

func (s *Store) GetGatewayEventForTask(ctx context.Context, namespace, taskName, taskUID string) (*store.GatewayEvent, error)

GetGatewayEventForTask resolves durable gateway ownership for one linked Task identity.

func (*Store) GetGatewayQueueStats

func (s *Store) GetGatewayQueueStats(ctx context.Context, namespace string) (store.GatewayQueueStats, error)

GetGatewayQueueStats returns exact queue depth and oldest-age inputs without identity labels.

func (*Store) GetGatewayTaskCleanupReceipt added in v0.2.0

func (s *Store) GetGatewayTaskCleanupReceipt(ctx context.Context, namespace, taskName, taskUID string) (*store.GatewayTaskCleanupReceipt, error)

GetGatewayTaskCleanupReceipt does not consult bounded deduplication history or current Gateway/Binding objects. The original Task UID remains authoritative when their names, or an external event ID, are reused.

func (*Store) GetGitHubMutationRecord

func (s *Store) GetGitHubMutationRecord(ctx context.Context, namespace, id string) (*store.GitHubMutationRecord, error)

GetGitHubMutationRecord fetches one mutation record.

func (*Store) GetHarnessV1Attempt added in v0.2.0

func (s *Store) GetHarnessV1Attempt(ctx context.Context, key store.HarnessV1AttemptKey) (*store.HarnessV1Attempt, error)

GetHarnessV1Attempt implements store.HarnessV1AttemptStore.

func (*Store) GetImplementationJob

func (s *Store) GetImplementationJob(ctx context.Context, namespace, id string) (*store.ImplementationJob, error)

GetImplementationJob fetches one implementation job.

func (*Store) GetLatestExecutionEventSeq

func (s *Store) GetLatestExecutionEventSeq(ctx context.Context, namespace, streamType, streamID string) (int64, error)

GetLatestExecutionEventSeq returns the latest sequence for a stream or zero when empty.

func (*Store) GetLatestThreatModel

func (s *Store) GetLatestThreatModel(ctx context.Context, namespace, repositoryScan string) (*store.ThreatModel, error)

GetLatestThreatModel returns the current threat model for a repository.

func (*Store) GetMemory

func (s *Store) GetMemory(ctx context.Context, namespace, id string) (*store.Memory, error)

GetMemory fetches a memory by ID within a namespace.

func (*Store) GetMemoryProposal

func (s *Store) GetMemoryProposal(ctx context.Context, namespace, id string) (*store.MemoryProposal, error)

GetMemoryProposal fetches a proposal by ID within a namespace.

func (*Store) GetMessages

func (s *Store) GetMessages(ctx context.Context, namespace, taskName, parentTask string, markRead bool) ([]store.Message, error)

GetMessages returns unread messages for a task, including broadcasts to siblings. parentTask scopes both direct and broadcast delivery to one coordinator family. If markRead is true, messages are marked as read atomically.

func (*Store) GetMonitorItem

func (s *Store) GetMonitorItem(ctx context.Context, namespace, monitorName, kind, itemKey string) (*store.MonitorItem, error)

GetMonitorItem fetches one monitor item by its durable key.

func (*Store) GetMonitorRun

func (s *Store) GetMonitorRun(ctx context.Context, namespace, id string) (*store.MonitorRun, error)

GetMonitorRun fetches a monitor run by ID.

func (*Store) GetOutboxProjection added in v0.2.0

func (s *Store) GetOutboxProjection(ctx context.Context, id string) (*store.OutboxProjection, error)

GetOutboxProjection returns one outbox record.

func (*Store) GetPlan

func (s *Store) GetPlan(ctx context.Context, namespace, taskName string) (*store.PlanState, error)

GetPlan retrieves the autonomous plan state for a task.

func (*Store) GetPromptAttempt added in v0.2.0

func (s *Store) GetPromptAttempt(ctx context.Context, id string) (*store.PromptAttempt, error)

GetPromptAttempt returns one durable prompt attempt.

func (*Store) GetPromptResultReceipt added in v0.2.0

func (s *Store) GetPromptResultReceipt(ctx context.Context, attemptID string) (*store.PromptResultReceipt, error)

GetPromptResultReceipt returns the immutable receipt for one PromptAttempt.

func (*Store) GetPublication added in v0.2.0

func (s *Store) GetPublication(ctx context.Context, id string) (*store.Publication, error)

GetPublication returns a publication and its exact receipts.

func (*Store) GetRepairJob

func (s *Store) GetRepairJob(ctx context.Context, namespace, id string) (*store.RepairJob, error)

GetRepairJob fetches a repair job by ID.

func (*Store) GetRepositoryMonitor

func (s *Store) GetRepositoryMonitor(ctx context.Context, namespace, name string) (*store.RepositoryMonitorRecord, error)

GetRepositoryMonitor fetches normalized monitor metadata.

func (*Store) GetResult

func (s *Store) GetResult(ctx context.Context, namespace, taskName string) ([]byte, error)

GetResult retrieves a task result. Returns store.ErrNotFound if no result exists.

func (*Store) GetReviewPublishRecord

func (s *Store) GetReviewPublishRecord(ctx context.Context, namespace, id string) (*store.ReviewPublishRecord, error)

GetReviewPublishRecord fetches a review publish record by ID.

func (*Store) GetReviewRecord

func (s *Store) GetReviewRecord(ctx context.Context, namespace, id string) (*store.ReviewRecord, error)

GetReviewRecord fetches a review record by ID.

func (*Store) GetReviewSlice

func (s *Store) GetReviewSlice(ctx context.Context, namespace, repositoryScan, id string) (*store.ReviewSlice, error)

GetReviewSlice returns one review slice.

func (*Store) GetRuntimeSession

func (s *Store) GetRuntimeSession(ctx context.Context, namespace string, id harness.RuntimeSessionID) (*harness.RuntimeSession, error)

GetRuntimeSession loads a RuntimeSession by namespace and canonical ID.

func (*Store) GetScanRun

func (s *Store) GetScanRun(ctx context.Context, namespace, id string) (*store.ScanRun, error)

GetScanRun fetches a scan run by ID.

func (*Store) GetScanTaskIngestion added in v0.2.0

func (s *Store) GetScanTaskIngestion(ctx context.Context, task store.ScanTaskIdentity) (*store.ScanTaskIngestion, error)

func (*Store) GetSession

func (s *Store) GetSession(ctx context.Context, namespace, name string) (*store.SessionRecord, error)

GetSession loads a session with all its messages.

func (*Store) GetSessionCleanupCompletion added in v0.2.0

func (s *Store) GetSessionCleanupCompletion(ctx context.Context, namespace, sessionName string) (*store.SessionCleanupCompletion, error)

GetSessionCleanupCompletion returns the durable deletion tombstone retained after the Session row and intent have been atomically removed.

func (*Store) GetSessionCleanupIdentity added in v0.2.0

func (s *Store) GetSessionCleanupIdentity(ctx context.Context, namespace, sessionName string) (string, error)

GetSessionCleanupIdentity returns the Kubernetes Session UID already bound to a transcript row, including a bind-before-control crash residue.

func (*Store) GetSessionCleanupIntent added in v0.2.0

func (s *Store) GetSessionCleanupIntent(ctx context.Context, namespace, sessionName string) (*store.SessionCleanupIntent, error)

GetSessionCleanupIntent returns the durable cross-store cleanup plan.

func (*Store) GetSessionControl added in v0.2.0

func (s *Store) GetSessionControl(ctx context.Context, namespace, sessionName string) (*store.SessionControl, error)

GetSessionControl returns control state for an existing transcript session.

func (*Store) GetSessionLineage added in v0.2.0

func (s *Store) GetSessionLineage(ctx context.Context, namespace, sessionName string) (*store.SessionLineage, error)

GetSessionLineage implements store.SessionLineageStore.

func (*Store) GetSessionTurn added in v0.2.0

func (s *Store) GetSessionTurn(ctx context.Context, id string) (*store.SessionTurn, error)

GetSessionTurn returns a durable session turn.

func (*Store) GetSessionTurnCleanupReceipt added in v0.2.0

func (s *Store) GetSessionTurnCleanupReceipt(ctx context.Context, namespace, sessionName, promptAttemptID string) (*store.SessionTurnCleanupReceipt, error)

GetSessionTurnCleanupReceipt reads evidence only after the exact Session cleanup transaction committed. It never revives an ordinary turn or outbox row.

func (*Store) GetSessionType

func (s *Store) GetSessionType(ctx context.Context, namespace, name string) (string, error)

GetSessionType returns the stored Session type without loading transcript messages.

func (*Store) GetWorkAction

func (s *Store) GetWorkAction(ctx context.Context, namespace, id string) (*store.WorkAction, error)

GetWorkAction fetches one workflow action by ID.

func (*Store) HasGatewayTaskTombstone

func (s *Store) HasGatewayTaskTombstone(ctx context.Context, namespace, taskName, taskUID string) (bool, error)

HasGatewayTaskTombstone reports whether retention compacted the exact linked Task identity.

func (*Store) HasSessionCleanupFenceForUID added in v0.2.0

func (s *Store) HasSessionCleanupFenceForUID(ctx context.Context, sessionUID string) (bool, error)

HasSessionCleanupFenceForUID reports whether a Session UID belongs to a pending or completed deletion and may not acquire new Kubernetes authority.

func (*Store) HasSessionCleanupIntent added in v0.2.0

func (s *Store) HasSessionCleanupIntent(ctx context.Context, namespace, sessionName string) (bool, error)

HasSessionCleanupIntent reports whether new work must be refused for a Session whose deletion has crossed the durable intent boundary.

func (*Store) HealthCheck

func (s *Store) HealthCheck(ctx context.Context) error

HealthCheck verifies the database is reachable by executing a simple query.

func (*Store) IsLocked

func (s *Store) IsLocked(ctx context.Context, namespace, name, currentTask, currentTaskUID string) (bool, error)

IsLocked returns true if the session is locked by another Task incarnation.

func (*Store) LinkUsagePullRequest added in v0.2.0

func (s *Store) LinkUsagePullRequest(ctx context.Context, link store.UsagePRLink) error

func (*Store) ListActionRecords

func (s *Store) ListActionRecords(ctx context.Context, filter store.ActionRecordFilter) ([]store.ActionRecord, string, error)

ListActionRecords lists action records ordered newest first.

func (*Store) ListActiveScanRuns added in v0.2.0

func (s *Store) ListActiveScanRuns(ctx context.Context, namespace, repositoryScan string) ([]store.ScanRun, error)

ListActiveScanRuns reads reservations without walking completed scan history.

func (*Store) ListAgentExecutionSnapshotMetadataBefore added in v0.2.0

func (s *Store) ListAgentExecutionSnapshotMetadataBefore(
	ctx context.Context,
	cutoff time.Time,
) ([]store.AgentExecutionSnapshotMetadata, error)

ListAgentExecutionSnapshotMetadataBefore implements store.AgentExecutionSnapshotLifecycleStore. The cutoff is strict so a retention pass can use one stable timestamp without collecting records created exactly at that boundary.

func (*Store) ListArtifacts

func (s *Store) ListArtifacts(ctx context.Context, namespace, taskName string) ([]store.ArtifactMetadata, error)

ListArtifacts returns metadata for all artifacts belonging to a task.

func (*Store) ListCommandEvents

func (s *Store) ListCommandEvents(ctx context.Context, filter store.CommandEventFilter) ([]store.CommandEvent, string, error)

ListCommandEvents lists command intake events.

func (*Store) ListDroppedFindings

func (s *Store) ListDroppedFindings(ctx context.Context, filter store.DroppedFindingFilter) ([]store.DroppedFinding, string, error)

ListDroppedFindings lists rejected finding diagnostics.

func (*Store) ListExecutionEvents

func (s *Store) ListExecutionEvents(ctx context.Context, filter store.ExecutionEventFilter) ([]store.ExecutionEvent, error)

ListExecutionEvents returns execution events matching filter in stream sequence order.

func (*Store) ListFindings

func (s *Store) ListFindings(ctx context.Context, filter store.FindingFilter) ([]store.Finding, string, error)

ListFindings lists findings for a repository scan with optional filtering.

func (*Store) ListGatewayDeliveries

func (s *Store) ListGatewayDeliveries(ctx context.Context, filter store.GatewayDeliveryFilter) ([]store.GatewayDelivery, error)

ListGatewayDeliveries lists newest-first delivery records.

func (*Store) ListGatewayEvents

func (s *Store) ListGatewayEvents(ctx context.Context, filter store.GatewayEventFilter) ([]store.GatewayEvent, error)

ListGatewayEvents lists newest-first normalized ingress records.

func (*Store) ListGatewaySessionCleanupCandidates added in v0.2.0

func (s *Store) ListGatewaySessionCleanupCandidates(ctx context.Context, filter store.GatewaySessionCleanupFilter) (store.GatewaySessionCleanupPage, error)

ListGatewaySessionCleanupCandidates also finds Sessions whose event records were compacted in an earlier maintenance pass. Runtime retirement must not depend on the continued presence of that bounded event history.

func (*Store) ListGatewayTaskCleanupReceipts added in v0.2.0

func (s *Store) ListGatewayTaskCleanupReceipts(ctx context.Context, filter store.GatewayTaskCleanupReceiptFilter) ([]store.GatewayTaskCleanupReceipt, error)

ListGatewayTaskCleanupReceipts uses the primary key as an exclusive cursor so receipts retained for live Tasks cannot starve later entries.

func (*Store) ListGitHubMutationRecords

func (s *Store) ListGitHubMutationRecords(ctx context.Context, filter store.GitHubMutationRecordFilter) ([]store.GitHubMutationRecord, string, error)

ListGitHubMutationRecords lists mutation records ordered newest first.

func (*Store) ListHarnessV1AttemptsByTask added in v0.2.0

func (s *Store) ListHarnessV1AttemptsByTask(ctx context.Context, namespace, taskUID string) ([]store.HarnessV1Attempt, error)

ListHarnessV1AttemptsByTask implements store.HarnessV1AttemptStore.

func (*Store) ListImplementationJobs

func (s *Store) ListImplementationJobs(ctx context.Context, filter store.ImplementationJobFilter) ([]store.ImplementationJob, string, error)

ListImplementationJobs lists implementation jobs ordered by update time.

func (*Store) ListMemories

func (s *Store) ListMemories(ctx context.Context, filter store.MemoryFilter) ([]store.Memory, error)

ListMemories lists memories matching the filter ordered for compact recall/governance.

func (*Store) ListMemoryProposals

func (s *Store) ListMemoryProposals(ctx context.Context, filter store.MemoryProposalFilter) ([]store.MemoryProposal, error)

ListMemoryProposals lists proposals for governance review.

func (*Store) ListMonitorEvents

func (s *Store) ListMonitorEvents(ctx context.Context, filter store.MonitorEventFilter) ([]store.MonitorEvent, string, error)

ListMonitorEvents lists audit events ordered newest first.

func (*Store) ListMonitorItems

func (s *Store) ListMonitorItems(ctx context.Context, filter store.MonitorItemFilter) ([]store.MonitorItem, string, error)

ListMonitorItems lists current monitor items.

func (*Store) ListMonitorRuns

func (s *Store) ListMonitorRuns(ctx context.Context, filter store.MonitorRunFilter) ([]store.MonitorRun, string, error)

ListMonitorRuns lists monitor runs ordered newest first unless OldestFirst is set.

func (*Store) ListPatchProposals

func (s *Store) ListPatchProposals(ctx context.Context, namespace, findingID string) ([]store.PatchProposal, error)

ListPatchProposals lists patch proposals for a finding, newest first.

func (*Store) ListRepairJobs

func (s *Store) ListRepairJobs(ctx context.Context, filter store.RepairJobFilter) ([]store.RepairJob, string, error)

ListRepairJobs lists repair jobs ordered by update time.

func (*Store) ListReviewPublishRecords

func (s *Store) ListReviewPublishRecords(ctx context.Context, filter store.ReviewPublishRecordFilter) ([]store.ReviewPublishRecord, string, error)

ListReviewPublishRecords lists review publish records ordered newest first.

func (*Store) ListReviewRecords

func (s *Store) ListReviewRecords(ctx context.Context, filter store.ReviewRecordFilter) ([]store.ReviewRecord, string, error)

ListReviewRecords lists review records ordered newest first.

func (*Store) ListReviewSlices

func (s *Store) ListReviewSlices(ctx context.Context, filter store.ReviewSliceFilter) ([]store.ReviewSlice, string, error)

ListReviewSlices lists review slices for a repository scan.

func (*Store) ListScanRuns

func (s *Store) ListScanRuns(ctx context.Context, namespace, repositoryScan string, limit int, cursor string) ([]store.ScanRun, string, error)

ListScanRuns lists scan runs in admission order, newest first. Caller clocks and late Task timestamps must not change which run owns the current pipeline.

func (*Store) ListScanRunsPendingCancellation added in v0.2.0

func (s *Store) ListScanRunsPendingCancellation(ctx context.Context, namespace, repositoryScan string) ([]store.ScanRun, error)

ListScanRunsPendingCancellation includes terminal runs whose late Tasks still need cleanup without walking completed scan history.

func (*Store) ListSessionCleanupIntents added in v0.2.0

func (s *Store) ListSessionCleanupIntents(ctx context.Context) ([]store.SessionCleanupIntent, error)

ListSessionCleanupIntents returns every pending durable cleanup plan in deterministic order for controller-startup recovery.

func (*Store) ListSessionCleanupTurns added in v0.2.0

func (s *Store) ListSessionCleanupTurns(ctx context.Context, intent store.SessionCleanupIntent) ([]store.SessionTurn, error)

ListSessionCleanupTurns returns finalized metadata only under the exact durable deletion intent. It never returns user prompts or transcript content.

func (*Store) ListSessionExecutionEvents

func (s *Store) ListSessionExecutionEvents(ctx context.Context, filter store.SessionExecutionEventFilter) ([]store.SessionExecutionEvent, int64, error)

ListSessionExecutionEvents returns task-derived events for one session with a deterministic session cursor.

func (*Store) ListSessions

func (s *Store) ListSessions(ctx context.Context, namespace string) ([]store.SessionMetadata, error)

ListSessions returns metadata for all sessions in a namespace.

func (*Store) ListSessionsPage added in v0.2.0

func (s *Store) ListSessionsPage(ctx context.Context, namespace, afterName string, limit int, excludeType string) ([]store.SessionMetadata, bool, error)

ListSessionsPage pushes the name cursor, type filter, ordering, and LIMIT into SQL so a continuation request reads only its own page.

func (s *Store) ListUsagePullRequestLinks(ctx context.Context, namespace, monitorUID string, before time.Time, limit int) ([]store.UsagePRLink, error)

func (*Store) ListWorkActions

func (s *Store) ListWorkActions(ctx context.Context, filter store.WorkActionFilter) ([]store.WorkAction, string, error)

ListWorkActions lists workflow actions ordered by update time.

func (*Store) LoadTranscript

func (s *Store) LoadTranscript(ctx context.Context, namespace, name string, maxMessages int) ([]store.SessionMessage, error)

LoadTranscript retrieves messages in logical conversation order.

func (*Store) LoadTranscriptThrough

func (s *Store) LoadTranscriptThrough(
	ctx context.Context,
	namespace, name, throughMessageID string,
	maxMessages int,
) ([]store.SessionMessage, error)

LoadTranscriptThrough retrieves logical history through one stable message ID.

func (*Store) LoadUsage added in v0.2.0

func (s *Store) LoadUsage(ctx context.Context, filter store.UsageFilter) (store.UsageData, error)

func (*Store) MaintainGatewayRecords

func (s *Store) MaintainGatewayRecords(ctx context.Context, namespace string, now, terminalCutoff time.Time) (store.GatewayMaintenanceResult, error)

MaintainGatewayRecords expires pending deliveries, compacts terminal event identities into bounded tombstones, and prunes their transcript messages. Transcripts without ACP records are reclaimed atomically with a cleanup completion. Sessions with ACP identity or records remain for coordinated runtime and Kubernetes cleanup. Event expiry stays in the gateway service so it can atomically create a visible error delivery.

func (*Store) MarkExpiredGatewayEventDeadLettered

func (s *Store) MarkExpiredGatewayEventDeadLettered(
	ctx context.Context, namespace, id, reason string, now time.Time,
) error

MarkExpiredGatewayEventDeadLettered releases an unrecoverable legacy expiry from repair ordering without fabricating immutable delivery identity.

func (*Store) MarkFindingDuplicate added in v0.2.0

func (s *Store) MarkFindingDuplicate(ctx context.Context, namespace, id, canonicalID string) error

MarkFindingDuplicate keeps an old finding addressable while removing it from canonical lists and counts.

func (*Store) MarkGatewayDeliveryDelivered

func (s *Store) MarkGatewayDeliveryDelivered(ctx context.Context, namespace, id, owner, providerMessageID string, now time.Time) error

MarkGatewayDeliveryDelivered records one successful provider send.

func (*Store) MarkGatewayDeliveryTerminal

func (s *Store) MarkGatewayDeliveryTerminal(ctx context.Context, namespace, id, owner string, state store.GatewayDeliveryState, reason string, now time.Time) error

MarkGatewayDeliveryTerminal records a permanent, dead-lettered, or expired result.

func (*Store) MarkGatewayEventTaskCreated

func (s *Store) MarkGatewayEventTaskCreated(ctx context.Context, namespace, id, taskName, taskUID, owner string, now time.Time) error

MarkGatewayEventTaskCreated links a claimed event to its deterministic Task.

func (*Store) NeedLeaderElection added in v0.2.0

func (s *Store) NeedLeaderElection() bool

NeedLeaderElection keeps SQLite-backed background mutation behind the controller-runtime leader gate. The filesystem lock remains held for the whole process lifetime, including standby/startup, and is the final defense against overlapping writers.

func (*Store) PersistAgentExecutionSnapshot added in v0.2.0

func (s *Store) PersistAgentExecutionSnapshot(ctx context.Context, snapshot store.AgentExecutionSnapshot) error

PersistAgentExecutionSnapshot implements store.AgentExecutionSnapshotStore.

func (*Store) PreparePromptAttemptReclamation added in v0.2.0

func (s *Store) PreparePromptAttemptReclamation(ctx context.Context, request store.ReclaimPromptAttemptsRequest) error

PreparePromptAttemptReclamation proves and durably records the complete task-scoped retention barrier without deleting PromptAttempts.

func (*Store) PrepareSessionCleanup added in v0.2.0

func (s *Store) PrepareSessionCleanup(ctx context.Context, intent store.SessionCleanupIntent) (*store.SessionCleanupIntent, error)

PrepareSessionCleanup atomically re-proves SQLite quiescence and records the exact Kubernetes cleanup plan before any authoritative object is deleted.

func (*Store) ProjectGatewayTerminal

func (s *Store) ProjectGatewayTerminal(ctx context.Context, projection store.GatewayTerminalProjection) (*store.GatewayDelivery, bool, error)

ProjectGatewayTerminal atomically appends one terminal message, creates one outbox row, completes the event, and releases the Session for the next queued event.

func (*Store) ProjectSessionLineage added in v0.2.0

func (s *Store) ProjectSessionLineage(ctx context.Context, lineage store.SessionLineage) (*store.SessionLineage, error)

ProjectSessionLineage implements store.SessionLineageStore. Kubernetes has already established the authoritative lineage and mutation Lease before this idempotent payload projection runs. A conflicting row is an integrity failure to repair explicitly, never a SQLite decision about Session owner.

func (*Store) PruneUsage added in v0.2.0

func (s *Store) PruneUsage(ctx context.Context, before time.Time) error

PruneUsage expires whole, inactive work cohorts. It never trims the early attempts from a retained request. Cumulative counter baselines remain until the counter itself expires, so retention cannot turn an old total into new usage.

func (*Store) ReclaimBranchClaim added in v0.2.0

func (s *Store) ReclaimBranchClaim(ctx context.Context, request store.ReclaimBranchClaimRequest) error

ReclaimBranchClaim deletes only the exact available Task-owned claim. A missing claim or one whose immutable owner/request identity was replaced is already reclaimed from the caller's perspective; every other mismatch is a conflict so stale recovery cannot delete a live claim.

func (*Store) ReclaimHarnessV1Attempts added in v0.2.0

func (s *Store) ReclaimHarnessV1Attempts(
	ctx context.Context,
	request store.ReclaimHarnessV1AttemptsRequest,
) (int, error)

ReclaimHarnessV1Attempts implements store.HarnessV1AttemptStore. Attempt removal is fenced by the current controller epoch and re-proves every terminal and Session/outbox barrier in one SQLite transaction.

func (*Store) ReclaimPromptAttempts added in v0.2.0

func (s *Store) ReclaimPromptAttempts(ctx context.Context, request store.ReclaimPromptAttemptsRequest) (int, error)

ReclaimPromptAttempts is the SQLite compatibility implementation of the task-scoped retention contract. Marker creation and deletion are committed in one transaction for direct callers; controller callers may prepare first so artifact retirement happens between durable authorization and deletion.

func (*Store) ReconcileSessionControl added in v0.2.0

func (s *Store) ReconcileSessionControl(ctx context.Context, request store.ReconcileSessionControlRequest) (*store.SessionControl, error)

ReconcileSessionControl atomically establishes an independently observed branch baseline and returns a reconciliation-blocked Session and BranchClaim to Available using exact session/claim version and generation fences.

func (*Store) RecordUsage added in v0.2.0

func (s *Store) RecordUsage(ctx context.Context, observation store.UsageObservation) error

func (*Store) RecordUsagePullRequest added in v0.2.0

func (s *Store) RecordUsagePullRequest(ctx context.Context, pr store.UsagePullRequest) error

func (*Store) RecoverPromptAttemptPreSubmission added in v0.2.0

func (s *Store) RecoverPromptAttemptPreSubmission(ctx context.Context, recovery store.PromptAttemptPreSubmissionRecovery) (*store.PromptAttempt, error)

RecoverPromptAttemptPreSubmission returns a pre-acceptance attempt to Reserved without inventing a new attempt or replaying an accepted prompt.

func (*Store) RegisterUsageTask added in v0.2.0

func (s *Store) RegisterUsageTask(ctx context.Context, task store.UsageTask) error

func (*Store) RegisterUsageWork added in v0.2.0

func (s *Store) RegisterUsageWork(ctx context.Context, work store.UsageWorkRequest) error

func (*Store) ReleaseChatTurn added in v0.2.0

func (s *Store) ReleaseChatTurn(
	ctx context.Context,
	namespace, name, turnID string,
	deleteEmptyCreatedSession bool,
) error

ReleaseChatTurn clears a reservation only when it is still owned by turnID. If this reservation created the Session, failed turns remove that row only while it is still empty and otherwise untouched. Bound Kubernetes identities must remain for coordinated cleanup.

func (*Store) ReleaseLock

func (s *Store) ReleaseLock(ctx context.Context, namespace, name, taskName, taskUID string) error

ReleaseLock clears the lock only for the exact Task incarnation.

func (*Store) ReleaseSessionMutationLease added in v0.2.0

func (s *Store) ReleaseSessionMutationLease(ctx context.Context, request store.ReleaseSessionMutationLeaseRequest) (*store.SessionControl, error)

ReleaseSessionMutationLease atomically aborts an exact pre-prompt lease in the legacy SQLite-authoritative store.

func (*Store) RenewGatewayEventClaim

func (s *Store) RenewGatewayEventClaim(
	ctx context.Context,
	namespace, id, owner string,
	now time.Time,
	lease time.Duration,
) (*store.GatewayEvent, error)

RenewGatewayEventClaim proves ownership immediately before a consequential Task create.

func (*Store) RequestScanRunCancellation added in v0.2.0

func (s *Store) RequestScanRunCancellation(ctx context.Context, run *store.ScanRun, reason string) error

RequestScanRunCancellation freezes ordinary progress before Task deletion. Each new request fences older cleanup attempts so they cannot erase a retry.

func (*Store) ReserveExternalEffect added in v0.2.0

func (s *Store) ReserveExternalEffect(ctx context.Context, request store.ReserveExternalEffectRequest) (*store.ExternalEffect, error)

ReserveExternalEffect creates or returns a durable same-digest effect identity.

func (*Store) ResolveFindingIfCurrent added in v0.2.0

func (s *Store) ResolveFindingIfCurrent(ctx context.Context, namespace, id, scanRunID string, prNumber int) (bool, error)

ResolveFindingIfCurrent resolves only the pr_open occurrence and PR selected by the caller.

func (*Store) ResumeSessionTurnFinalization added in v0.2.0

func (s *Store) ResumeSessionTurnFinalization(ctx context.Context, request store.ResumeSessionTurnFinalizationRequest) (*store.SessionTurn, error)

ResumeSessionTurnFinalization is a compatibility no-op for the legacy SQLite-authoritative store because its transcript, control, lease, and outbox finalization commit in one transaction. It still validates the current epoch and exact persisted finalization identity so recovery cannot accept a different turn or digest.

func (*Store) RetryGatewayDelivery

func (s *Store) RetryGatewayDelivery(ctx context.Context, namespace, id string, now, expiresAt time.Time) (*store.GatewayDelivery, error)

RetryGatewayDelivery manually requeues one dead-lettered or failed delivery.

func (*Store) RetryGatewayEvent

func (s *Store) RetryGatewayEvent(ctx context.Context, namespace, id, owner, reason string, nextAttemptAt time.Time) error

RetryGatewayEvent returns a failed dispatch to the FIFO queue and releases its reservation.

func (*Store) ReviewMemoryProposal

func (s *Store) ReviewMemoryProposal(ctx context.Context, review store.MemoryProposalReview) error

ReviewMemoryProposal records a reviewer decision. It never applies the proposal automatically.

func (*Store) RevokeTaskJob added in v0.2.0

func (s *Store) RevokeTaskJob(ctx context.Context, identity store.TaskJobIdentity) error

func (*Store) SaveArtifact

func (s *Store) SaveArtifact(ctx context.Context, namespace, taskName, filename, contentType string, data []byte) error

SaveArtifact inserts or replaces a task artifact. Returns an error if data exceeds 10MB.

func (*Store) SavePlan

func (s *Store) SavePlan(ctx context.Context, namespace, taskName string, plan *store.PlanState) error

SavePlan upserts an autonomous plan state.

func (*Store) SavePromptResultReceipt added in v0.2.0

func (s *Store) SavePromptResultReceipt(ctx context.Context, receipt store.PromptResultReceipt) error

SavePromptResultReceipt inserts one immutable attempt-bound result receipt.

func (*Store) SaveResult

func (s *Store) SaveResult(ctx context.Context, namespace, taskName string, data []byte) error

SaveResult inserts or replaces a task result.

func (*Store) SaveThreatModel

func (s *Store) SaveThreatModel(ctx context.Context, model *store.ThreatModel) error

SaveThreatModel stores the current threat model, replacing any older copies for the repository. When Version is zero, the revision number is incremented from the latest stored model.

func (*Store) ScheduleGatewayDeliveryRetry

func (s *Store) ScheduleGatewayDeliveryRetry(ctx context.Context, namespace, id, owner, reason string, nextAttemptAt time.Time) error

ScheduleGatewayDeliveryRetry records a retryable adapter result.

func (*Store) SearchTranscript

func (s *Store) SearchTranscript(ctx context.Context, filter store.TranscriptSearchFilter) ([]store.TranscriptSearchResult, error)

SearchTranscript searches transcript content and returns compact snippets.

func (*Store) SendMessage

func (s *Store) SendMessage(ctx context.Context, msg *store.Message) error

SendMessage stores a new inter-agent message.

func (*Store) SetAgentExecutionSnapshotCipher added in v0.2.0

func (s *Store) SetAgentExecutionSnapshotCipher(snapshotCipher *AgentExecutionSnapshotCipher) error

SetAgentExecutionSnapshotCipher installs the required at-rest encryption cipher after proving that it can authenticate every retained snapshot. Callers must configure the cipher before snapshot readers or writers start. This rejects key rotation while any snapshot encrypted by the previous key remains, preventing one database from silently accumulating mixed-key rows.

func (*Store) SetMemoryDisabled

func (s *Store) SetMemoryDisabled(ctx context.Context, namespace, id string, disabled bool) error

SetMemoryDisabled toggles memory recall without deleting the provenance record.

func (*Store) SetPublicationPRIntent added in v0.2.0

func (s *Store) SetPublicationPRIntent(ctx context.Context, request store.SetPublicationPRIntentRequest) (*store.Publication, error)

SetPublicationPRIntent persists the exact PR tuple after independent remote verification has fixed the current head and before the first forge call.

func (*Store) SetPublicationPRReceipt added in v0.2.0

func (s *Store) SetPublicationPRReceipt(ctx context.Context, request store.SetPublicationPRReceiptRequest) (*store.Publication, error)

SetPublicationPRReceipt commits the exact forge result before the Publication leaves Verifying.

func (*Store) Start

func (s *Store) Start(ctx context.Context) error

Start runs background maintenance and blocks until ctx is cancelled, then closes the database without issuing any final writes. It satisfies the controller-runtime manager.Runnable interface.

func (*Store) SyncControllerEpochMirror added in v0.2.0

func (s *Store) SyncControllerEpochMirror(ctx context.Context, authoritative store.ControllerEpoch) error

SyncControllerEpochMirror records the exact Kubernetes-authoritative epoch used to fence SQLite payload mutations. It may move a stale mirror forward after a crash between authoritative acquisition and mirror persistence, but never rewinds or replaces conflicting evidence at the same epoch.

func (*Store) TransitionExternalEffect added in v0.2.0

func (s *Store) TransitionExternalEffect(ctx context.Context, transition store.ExternalEffectTransition) (*store.ExternalEffect, error)

TransitionExternalEffect applies an exact version/state/epoch CAS. Terminal same-response retries are idempotent; request-digest mismatch always conflicts.

func (*Store) TransitionHarnessV1Attempt added in v0.2.0

func (s *Store) TransitionHarnessV1Attempt(ctx context.Context, transition store.HarnessV1AttemptTransition) (*store.HarnessV1Attempt, error)

TransitionHarnessV1Attempt implements store.HarnessV1AttemptStore.

func (*Store) TransitionPromptAttemptDelivery added in v0.2.0

func (s *Store) TransitionPromptAttemptDelivery(ctx context.Context, transition store.PromptAttemptDeliveryTransition) (*store.PromptAttempt, error)

TransitionPromptAttemptDelivery applies an exact delivery-state CAS.

func (*Store) TransitionPromptAttemptExecution added in v0.2.0

func (s *Store) TransitionPromptAttemptExecution(ctx context.Context, transition store.PromptAttemptExecutionTransition) (*store.PromptAttempt, error)

TransitionPromptAttemptExecution applies an exact version/state/epoch CAS.

func (*Store) TransitionPublication added in v0.2.0

func (s *Store) TransitionPublication(ctx context.Context, transition store.PublicationTransition) (*store.Publication, error)

TransitionPublication applies a fenced generation/version/state CAS and validates that the persisted receipt exactly matches immutable intent.

func (*Store) TransitionRuntimeSession

func (s *Store) TransitionRuntimeSession(
	ctx context.Context,
	transition harness.RuntimeSessionTransition,
) (*harness.RuntimeSession, error)

TransitionRuntimeSession validates and persists an optimistic RuntimeSession state transition.

func (*Store) UpdateActionRecord

func (s *Store) UpdateActionRecord(ctx context.Context, record *store.ActionRecord) error

UpdateActionRecord replaces result fields when sensitive content must be redacted.

func (*Store) UpdateCommandEvent

func (s *Store) UpdateCommandEvent(ctx context.Context, event *store.CommandEvent) error

UpdateCommandEvent updates command processing state.

func (*Store) UpdateFindingState

func (s *Store) UpdateFindingState(ctx context.Context, namespace, id, state string) error

UpdateFindingState updates the user-visible finding state.

func (*Store) UpdateGitHubMutationRecord

func (s *Store) UpdateGitHubMutationRecord(ctx context.Context, record *store.GitHubMutationRecord) error

UpdateGitHubMutationRecord updates the durable outcome of one mutation attempt.

func (*Store) UpdateImplementationJob

func (s *Store) UpdateImplementationJob(ctx context.Context, job *store.ImplementationJob) error

UpdateImplementationJob updates implementation job state.

func (*Store) UpdateMemory

func (s *Store) UpdateMemory(ctx context.Context, memory *store.Memory) error

UpdateMemory updates mutable memory fields.

func (*Store) UpdateMonitorRun

func (s *Store) UpdateMonitorRun(ctx context.Context, run *store.MonitorRun) error

UpdateMonitorRun updates a monitor run.

func (*Store) UpdatePatchProposal

func (s *Store) UpdatePatchProposal(ctx context.Context, proposal *store.PatchProposal) error

UpdatePatchProposal updates an existing patch proposal.

func (*Store) UpdateRepairJob

func (s *Store) UpdateRepairJob(ctx context.Context, job *store.RepairJob) error

UpdateRepairJob updates repair job state.

func (*Store) UpdateReviewPublishRecord

func (s *Store) UpdateReviewPublishRecord(ctx context.Context, record *store.ReviewPublishRecord) error

UpdateReviewPublishRecord updates a review publish attempt/outcome record.

func (*Store) UpdateReviewSliceStatus

func (s *Store) UpdateReviewSliceStatus(ctx context.Context, namespace, repositoryScan, id, lastScanRunID, status string) error

UpdateReviewSliceStatus updates slice status and review timestamp.

func (*Store) UpdateScanRun

func (s *Store) UpdateScanRun(ctx context.Context, run *store.ScanRun) error

UpdateScanRun updates progress without rebinding a run or reactivating an old run after a newer run has been admitted, even when that newer run is terminal.

func (*Store) UpdateTokenCounts

func (s *Store) UpdateTokenCounts(ctx context.Context, namespace, name string, inputTokens, outputTokens int) error

UpdateTokenCounts atomically increments the token counters for a session.

func (*Store) UpdateTokenCountsWithLock added in v0.2.0

func (s *Store) UpdateTokenCountsWithLock(
	ctx context.Context,
	namespace, name, ownerName, ownerUID string,
	inputTokens, outputTokens int,
) error

UpdateTokenCountsWithLock requires the exact active transient lock owner.

func (*Store) UpdateWorkAction

func (s *Store) UpdateWorkAction(ctx context.Context, action *store.WorkAction) error

UpdateWorkAction updates durable workflow action state.

func (*Store) UpsertFinding

func (s *Store) UpsertFinding(ctx context.Context, finding *store.Finding) error

UpsertFinding inserts or updates a finding keyed by repository fingerprint.

func (*Store) UpsertMonitorItem

func (s *Store) UpsertMonitorItem(ctx context.Context, item *store.MonitorItem) error

UpsertMonitorItem inserts or updates the latest state for one monitor item.

func (*Store) UpsertObservedFinding added in v0.2.0

func (s *Store) UpsertObservedFinding(ctx context.Context, finding *store.Finding) error

UpsertObservedFinding inserts or updates a finding from a current scan observation, which may explicitly reopen a remediated finding.

func (*Store) UpsertRepositoryMonitor

func (s *Store) UpsertRepositoryMonitor(ctx context.Context, monitor *store.RepositoryMonitorRecord) error

UpsertRepositoryMonitor inserts or updates normalized monitor metadata.

func (*Store) UpsertReviewSlice

func (s *Store) UpsertReviewSlice(ctx context.Context, slice *store.ReviewSlice) error

UpsertReviewSlice inserts or updates a deterministic review slice.

func (*Store) WithAuthorizedTaskDataTransaction added in v0.2.0

func (s *Store) WithAuthorizedTaskDataTransaction(ctx context.Context, namespace, taskName string, authorize, access func(context.Context) error) (accessErr error)

WithAuthorizedTaskDataTransaction fences authorization using a durable cleanup generation. Kubernetes latency does not reserve a SQLite connection or writer. Only cleanup, rather than unrelated writes, invalidates the proof.

func (*Store) WithTaskDataTransaction added in v0.2.0

func (s *Store) WithTaskDataTransaction(ctx context.Context, mutate func(context.Context) error) error

WithTaskDataTransaction serializes a database-only callback with cleanup. Network authorization belongs in WithAuthorizedTaskDataTransaction.

Jump to

Keyboard shortcuts

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