globaldb

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 66 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrationStream

func MigrationStream() store.MigrationStream

MigrationStream returns the embedded global database migration stream.

Types

type AppMetadataRepo

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

func (*AppMetadataRepo) CompleteOnboarding

func (g *AppMetadataRepo) CompleteOnboarding(ctx context.Context, completedAt string) (store.OnboardingStatus, error)

CompleteOnboarding stores the first completion timestamp and preserves it on repeat calls.

func (*AppMetadataRepo) DeleteAppMetadata

func (g *AppMetadataRepo) DeleteAppMetadata(ctx context.Context, key string) error

DeleteAppMetadata removes the value stored under key. Missing keys are a no-op.

func (*AppMetadataRepo) GetAppMetadata

func (g *AppMetadataRepo) GetAppMetadata(ctx context.Context, key string) (string, bool, error)

GetAppMetadata returns the value stored under key and whether the key exists.

func (*AppMetadataRepo) GetOnboardingStatus

func (g *AppMetadataRepo) GetOnboardingStatus(ctx context.Context) (store.OnboardingStatus, error)

GetOnboardingStatus returns the domain status backed by app metadata.

func (*AppMetadataRepo) ResetOnboarding

func (g *AppMetadataRepo) ResetOnboarding(ctx context.Context) (store.OnboardingStatus, error)

ResetOnboarding clears first-run completion so onboarding is shown again.

func (*AppMetadataRepo) SetAppMetadata

func (g *AppMetadataRepo) SetAppMetadata(ctx context.Context, key string, value string) error

SetAppMetadata upserts the value stored under key.

type ApprovalGrantRepo

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

func (*ApprovalGrantRepo) ListApprovalGrants

func (g *ApprovalGrantRepo) ListApprovalGrants(
	ctx context.Context,
	readScope store.ReadScope,
	workspaceID string,
) (grants []toolspkg.ApprovalGrant, err error)

ListApprovalGrants returns one workspace's grants under the requested profile scope in stable creation order. Aggregate reads include profile owner labels.

func (*ApprovalGrantRepo) LookupApprovalGrant

func (g *ApprovalGrantRepo) LookupApprovalGrant(
	ctx context.Context,
	key toolspkg.ApprovalGrantKey,
) (toolspkg.ApprovalGrant, bool, error)

LookupApprovalGrant returns and touches the most-specific remembered decision.

func (*ApprovalGrantRepo) PutApprovalGrant

func (g *ApprovalGrantRepo) PutApprovalGrant(
	ctx context.Context,
	grant toolspkg.ApprovalGrant,
) (toolspkg.ApprovalGrant, error)

PutApprovalGrant creates or replaces one exact durable decision.

func (*ApprovalGrantRepo) RevokeApprovalGrant

func (g *ApprovalGrantRepo) RevokeApprovalGrant(ctx context.Context, profileID, workspaceID, id string) error

RevokeApprovalGrant removes one profile/workspace-scoped remembered decision.

type ApprovalPendingRepo

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

func (*ApprovalPendingRepo) CompleteApprovalExecution

func (g *ApprovalPendingRepo) CompleteApprovalExecution(
	ctx context.Context,
	approvalID string,
	status toolspkg.ApprovalExecutionStatus,
	result json.RawMessage,
	errorPayload json.RawMessage,
	executedAt time.Time,
) (toolspkg.ApprovalStatus, error)

func (*ApprovalPendingRepo) CreateApproval

func (g *ApprovalPendingRepo) CreateApproval(
	ctx context.Context,
	approvalID string,
	request toolspkg.ApprovalRequest,
	requestedAt time.Time,
) (toolspkg.ApprovalStatus, error)

func (*ApprovalPendingRepo) ExpireApprovals

func (g *ApprovalPendingRepo) ExpireApprovals(
	ctx context.Context,
	now time.Time,
) ([]toolspkg.ApprovalStatus, error)

func (*ApprovalPendingRepo) GetApproval

func (g *ApprovalPendingRepo) GetApproval(
	ctx context.Context,
	approvalID string,
) (toolspkg.ApprovalStatus, error)

func (*ApprovalPendingRepo) ListPendingApprovals

func (g *ApprovalPendingRepo) ListPendingApprovals(
	ctx context.Context,
) ([]toolspkg.ApprovalStatus, error)

func (*ApprovalPendingRepo) RecoverDispatchingApprovals

func (g *ApprovalPendingRepo) RecoverDispatchingApprovals(
	ctx context.Context,
	now time.Time,
) ([]toolspkg.ApprovalStatus, error)

func (*ApprovalPendingRepo) ResolveApproval

func (g *ApprovalPendingRepo) ResolveApproval(
	ctx context.Context,
	approvalID string,
	outcome toolspkg.ApprovalOutcome,
	resolvedAt time.Time,
) (toolspkg.ApprovalStatus, error)

type AttentionRepo

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

func (*AttentionRepo) IsAttentionWorkspaceMuted

func (r *AttentionRepo) IsAttentionWorkspaceMuted(
	ctx context.Context,
	profileID string,
	workspaceID string,
) (bool, error)

IsAttentionWorkspaceMuted reports whether one profile muted one workspace.

func (*AttentionRepo) ListAttentionWorkspaceMutes

func (r *AttentionRepo) ListAttentionWorkspaceMutes(ctx context.Context, profileID string) ([]string, error)

ListAttentionWorkspaceMutes returns the muted workspace registrations for one profile.

func (*AttentionRepo) ReplaceAttentionWorkspaceMutes

func (r *AttentionRepo) ReplaceAttentionWorkspaceMutes(
	ctx context.Context,
	profileID string,
	workspaceIDs []string,
) (err error)

ReplaceAttentionWorkspaceMutes atomically replaces one profile's mute set.

type AutomationRepo

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

func (*AutomationRepo) ClaimScheduledRun

func (g *AutomationRepo) ClaimScheduledRun(
	ctx context.Context,
	claim automation.SchedulerClaim,
) (result automation.SchedulerClaimResult, err error)

ClaimScheduledRun advances one durable cursor and creates a run reservation before scheduler dispatch begins.

func (*AutomationRepo) CountRuns

func (g *AutomationRepo) CountRuns(ctx context.Context, query automation.RunQuery) (int64, error)

CountRuns returns the number of automation runs matching the supplied filters.

func (*AutomationRepo) CreateJob

func (g *AutomationRepo) CreateJob(ctx context.Context, value automation.Job) (automation.Job, error)

CreateJob stores a new automation job definition.

func (*AutomationRepo) CreateRun

func (g *AutomationRepo) CreateRun(ctx context.Context, run automation.Run) (automation.Run, error)

CreateRun stores a new automation run history row.

func (*AutomationRepo) CreateSuggestion

func (g *AutomationRepo) CreateSuggestion(
	ctx context.Context,
	suggestion automation.Suggestion,
	pendingCap int,
) (created automation.Suggestion, err error)

func (*AutomationRepo) CreateTrigger

func (g *AutomationRepo) CreateTrigger(ctx context.Context, value automation.Trigger) (automation.Trigger, error)

CreateTrigger stores a new automation trigger definition.

func (*AutomationRepo) DeleteJob

func (g *AutomationRepo) DeleteJob(ctx context.Context, id string) error

DeleteJob removes an automation job definition.

func (*AutomationRepo) DeleteJobEnabledOverlay

func (g *AutomationRepo) DeleteJobEnabledOverlay(ctx context.Context, jobID string) error

DeleteJobEnabledOverlay clears a persisted job enabled overlay if it exists.

func (*AutomationRepo) DeleteRun

func (g *AutomationRepo) DeleteRun(ctx context.Context, id string) error

DeleteRun removes an automation run history row.

func (*AutomationRepo) DeleteSchedulerState

func (g *AutomationRepo) DeleteSchedulerState(ctx context.Context, jobID string) error

DeleteSchedulerState removes a durable scheduler cursor if it exists.

func (*AutomationRepo) DeleteTrigger

func (g *AutomationRepo) DeleteTrigger(ctx context.Context, id string) (err error)

DeleteTrigger removes an automation trigger definition.

func (*AutomationRepo) DeleteTriggerEnabledOverlay

func (g *AutomationRepo) DeleteTriggerEnabledOverlay(ctx context.Context, triggerID string) error

DeleteTriggerEnabledOverlay clears a persisted trigger enabled overlay if it exists.

func (*AutomationRepo) GetJob

func (g *AutomationRepo) GetJob(ctx context.Context, id string) (automation.Job, error)

GetJob loads one persisted automation job definition by primary key.

func (*AutomationRepo) GetJobEnabledOverlay

func (g *AutomationRepo) GetJobEnabledOverlay(ctx context.Context, jobID string) (automation.JobEnabledOverlay, error)

GetJobEnabledOverlay loads one persisted job enabled overlay by job id.

func (*AutomationRepo) GetRun

func (g *AutomationRepo) GetRun(ctx context.Context, id string) (automation.Run, error)

GetRun loads one persisted automation run by primary key.

func (*AutomationRepo) GetSchedulerState

func (g *AutomationRepo) GetSchedulerState(ctx context.Context, jobID string) (automation.SchedulerState, error)

GetSchedulerState loads one durable automation scheduler cursor by job id.

func (*AutomationRepo) GetSuggestion

func (g *AutomationRepo) GetSuggestion(
	ctx context.Context,
	profileID string,
	workspaceID string,
	id string,
) (automation.Suggestion, error)

func (*AutomationRepo) GetTrigger

func (g *AutomationRepo) GetTrigger(ctx context.Context, id string) (automation.Trigger, error)

GetTrigger loads one persisted automation trigger definition by primary key.

func (*AutomationRepo) GetTriggerByWebhookID

func (g *AutomationRepo) GetTriggerByWebhookID(ctx context.Context, webhookID string) (automation.Trigger, error)

GetTriggerByWebhookID loads a webhook trigger using its stable webhook identifier.

func (*AutomationRepo) GetTriggerEnabledOverlay

func (g *AutomationRepo) GetTriggerEnabledOverlay(
	ctx context.Context,
	triggerID string,
) (automation.TriggerEnabledOverlay, error)

GetTriggerEnabledOverlay loads one persisted trigger enabled overlay by trigger id.

func (*AutomationRepo) LatestRunsByOwner

func (g *AutomationRepo) LatestRunsByOwner(
	ctx context.Context, owner automation.RunOwnerKind, ids []string,
) (map[string]automation.Run, error)

func (*AutomationRepo) ListAcceptedSuggestions

func (g *AutomationRepo) ListAcceptedSuggestions(ctx context.Context) ([]automation.Suggestion, error)

func (*AutomationRepo) ListJobDefinitions

func (g *AutomationRepo) ListJobDefinitions(
	ctx context.Context,
	source automation.JobSource,
) (jobs []automation.Job, err error)

ListJobDefinitions returns complete persisted definitions for internal reconciliation.

func (*AutomationRepo) ListJobEnabledOverlays

func (g *AutomationRepo) ListJobEnabledOverlays(
	ctx context.Context,
) (overlays []automation.JobEnabledOverlay, err error)

ListJobEnabledOverlays returns all persisted job enabled overlays.

func (*AutomationRepo) ListJobs

func (g *AutomationRepo) ListJobs(
	ctx context.Context,
	query automation.JobListQuery,
) (page automation.JobListPage, err error)

ListJobs returns one stable page of effective persisted automation jobs.

func (*AutomationRepo) ListRuns

func (g *AutomationRepo) ListRuns(
	ctx context.Context,
	query automation.RunQuery,
) (runs []automation.Run, err error)

ListRuns returns filtered automation run history rows.

func (*AutomationRepo) ListSchedulerStates

func (g *AutomationRepo) ListSchedulerStates(ctx context.Context) ([]automation.SchedulerState, error)

ListSchedulerStates returns every durable automation scheduler cursor.

func (*AutomationRepo) ListSuggestions

func (g *AutomationRepo) ListSuggestions(
	ctx context.Context,
	readScope store.ReadScope,
	workspaceID string,
	status automation.SuggestionStatus,
) ([]automation.Suggestion, error)

func (*AutomationRepo) ListSuggestionsAggregate

func (g *AutomationRepo) ListSuggestionsAggregate(
	ctx context.Context,
	scope store.ReadScope,
	status automation.SuggestionStatus,
) ([]automation.Suggestion, error)

func (*AutomationRepo) ListTriggerDefinitions

func (g *AutomationRepo) ListTriggerDefinitions(
	ctx context.Context,
	source automation.JobSource,
) (triggers []automation.Trigger, err error)

ListTriggerDefinitions returns complete persisted definitions for internal reconciliation.

func (*AutomationRepo) ListTriggerEnabledOverlays

func (g *AutomationRepo) ListTriggerEnabledOverlays(
	ctx context.Context,
) (overlays []automation.TriggerEnabledOverlay, err error)

ListTriggerEnabledOverlays returns all persisted trigger enabled overlays.

func (*AutomationRepo) ListTriggers

func (g *AutomationRepo) ListTriggers(
	ctx context.Context,
	query automation.TriggerListQuery,
) (page automation.TriggerListPage, err error)

ListTriggers returns one stable page of effective persisted automation triggers.

func (*AutomationRepo) RecordRunDeliveryError

func (g *AutomationRepo) RecordRunDeliveryError(
	ctx context.Context,
	runID string,
	runErr error,
) (automation.Run, error)

RecordRunDeliveryError stores delivery diagnostics separately from normal execution errors on an existing automation run.

func (*AutomationRepo) RecordSuggestionTransition

func (g *AutomationRepo) RecordSuggestionTransition(
	ctx context.Context,
	suggestion automation.Suggestion,
	jobID string,
) error

func (*AutomationRepo) ReserveRun

ReserveRun atomically checks a rolling fire-limit window and reserves one run.

func (*AutomationRepo) ResolveSuggestion

func (g *AutomationRepo) ResolveSuggestion(
	ctx context.Context,
	profileID string,
	workspaceID string,
	id string,
	to automation.SuggestionStatus,
) (resolved automation.Suggestion, err error)

func (*AutomationRepo) RollbackSuggestionAcceptance

func (g *AutomationRepo) RollbackSuggestionAcceptance(
	ctx context.Context,
	profileID string,
	workspaceID string,
	id string,
	resolvedAt time.Time,
) error

func (*AutomationRepo) SaveSchedulerState

func (g *AutomationRepo) SaveSchedulerState(
	ctx context.Context,
	state automation.SchedulerState,
) (automation.SchedulerState, error)

SaveSchedulerState upserts one durable automation scheduler cursor.

func (*AutomationRepo) SetJobEnabledOverlay

func (g *AutomationRepo) SetJobEnabledOverlay(
	ctx context.Context,
	overlay automation.JobEnabledOverlay,
) (automation.JobEnabledOverlay, error)

SetJobEnabledOverlay upserts the runtime enabled override for a config-backed job.

func (*AutomationRepo) SetScheduledDeferral

func (g *AutomationRepo) SetScheduledDeferral(
	ctx context.Context,
	claim automation.SchedulerClaim,
	retryAt *time.Time,
) (automation.SchedulerState, error)

SetScheduledDeferral changes only the fire that still owns this schedule cursor.

func (*AutomationRepo) SetTriggerEnabledOverlay

func (g *AutomationRepo) SetTriggerEnabledOverlay(
	ctx context.Context,
	overlay automation.TriggerEnabledOverlay,
) (automation.TriggerEnabledOverlay, error)

SetTriggerEnabledOverlay upserts the runtime enabled override for a config-backed trigger.

func (*AutomationRepo) UpdateJob

func (g *AutomationRepo) UpdateJob(ctx context.Context, job automation.Job) (automation.Job, error)

UpdateJob replaces the mutable fields of a persisted automation job definition.

func (*AutomationRepo) UpdateRun

func (g *AutomationRepo) UpdateRun(ctx context.Context, run automation.Run) (automation.Run, error)

UpdateRun replaces the mutable fields of a persisted automation run.

func (*AutomationRepo) UpdateTrigger

func (g *AutomationRepo) UpdateTrigger(
	ctx context.Context,
	trigger automation.Trigger,
) (updated automation.Trigger, err error)

UpdateTrigger replaces the mutable fields of a persisted automation trigger definition.

type CmdPaletteRepo

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

func (*CmdPaletteRepo) CmdPalettePersonalization

func (r *CmdPaletteRepo) CmdPalettePersonalization(
	ctx context.Context,
	profileLensID cmdpalette.ProfileLensID,
	workspaceID cmdpalette.WorkspaceID,
) (cmdpalette.PersonalizationRows, error)

func (*CmdPaletteRepo) DeleteCmdPalettePin

func (r *CmdPaletteRepo) DeleteCmdPalettePin(
	ctx context.Context,
	profileLensID cmdpalette.ProfileLensID,
	workspaceID cmdpalette.WorkspaceID,
	commandID cmdpalette.CommandID,
) error

func (*CmdPaletteRepo) PruneCmdPaletteCommand

func (r *CmdPaletteRepo) PruneCmdPaletteCommand(
	ctx context.Context,
	profileLensID cmdpalette.ProfileLensID,
	workspaceID cmdpalette.WorkspaceID,
	commandID cmdpalette.CommandID,
) error

func (*CmdPaletteRepo) PruneCmdPaletteQueryHit

func (r *CmdPaletteRepo) PruneCmdPaletteQueryHit(
	ctx context.Context,
	profileLensID cmdpalette.ProfileLensID,
	workspaceID cmdpalette.WorkspaceID,
	query string,
	commandID cmdpalette.CommandID,
) error

func (*CmdPaletteRepo) PruneCmdPaletteUsage

func (r *CmdPaletteRepo) PruneCmdPaletteUsage(
	ctx context.Context,
	profileLensID cmdpalette.ProfileLensID,
	workspaceID cmdpalette.WorkspaceID,
	commandID cmdpalette.CommandID,
) error

func (*CmdPaletteRepo) PutCmdPalettePin

func (r *CmdPaletteRepo) PutCmdPalettePin(
	ctx context.Context,
	profileLensID cmdpalette.ProfileLensID,
	workspaceID cmdpalette.WorkspaceID,
	commandID cmdpalette.CommandID,
	pinnedAt time.Time,
) error

func (*CmdPaletteRepo) RecordCmdPaletteUsage

func (r *CmdPaletteRepo) RecordCmdPaletteUsage(
	ctx context.Context,
	usage cmdpalette.Usage,
	weights cmdpalette.Weights,
) error

func (*CmdPaletteRepo) ResetCmdPalettePersonalization

func (r *CmdPaletteRepo) ResetCmdPalettePersonalization(
	ctx context.Context,
	profileLensID cmdpalette.ProfileLensID,
	workspaceID cmdpalette.WorkspaceID,
) error

type DeadEntityRepo

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

func (*DeadEntityRepo) ClearDeadEntity

func (g *DeadEntityRepo) ClearDeadEntity(
	ctx context.Context,
	key store.DeadEntityKey,
) error

ClearDeadEntity removes one dead mark. Missing rows are a successful no-op.

func (*DeadEntityRepo) FindDeadEntity

func (g *DeadEntityRepo) FindDeadEntity(
	ctx context.Context,
	key store.DeadEntityKey,
) (store.DeadEntity, bool, error)

FindDeadEntity returns one exact workspace-scoped dead mark.

func (*DeadEntityRepo) ListDeadEntities

func (g *DeadEntityRepo) ListDeadEntities(
	ctx context.Context,
	readScope store.ReadScope,
	workspaceID string,
) (entities []store.DeadEntity, err error)

ListDeadEntities returns dead marks for workspaceID matching readScope in stable forensic order.

func (*DeadEntityRepo) MarkDeadEntity

func (g *DeadEntityRepo) MarkDeadEntity(ctx context.Context, entity store.DeadEntity) error

MarkDeadEntity creates or refreshes one confirmed-dead workspace runtime.

type EventRecordInsert

type EventRecordInsert struct {
	ID        string
	TaskID    string
	RunID     string
	EventType string
	Actor     taskpkg.ActorIdentity
	Origin    taskpkg.Origin
	Payload   json.RawMessage
	Timestamp time.Time
}

EventRecordInsert captures the normalized task-event fields written by an owning transaction.

type ExtensionEnvRepo

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

func (*ExtensionEnvRepo) CountEnvBindingsBySecretRef

func (r *ExtensionEnvRepo) CountEnvBindingsBySecretRef(ctx context.Context, secretRef string) (int64, error)

CountEnvBindingsBySecretRef reports how many binding rows still reference one Vault ref.

func (*ExtensionEnvRepo) DeleteEnvBinding

func (r *ExtensionEnvRepo) DeleteEnvBinding(
	ctx context.Context,
	extension, profileID, workspaceID, envName string,
) error

DeleteEnvBinding removes one extension instance binding.

func (*ExtensionEnvRepo) DeleteEnvBindings

func (r *ExtensionEnvRepo) DeleteEnvBindings(
	ctx context.Context,
	extension, profileID, workspaceID string,
) error

DeleteEnvBindings removes all bindings for exactly one extension instance.

func (*ExtensionEnvRepo) ListEnvBindings

func (r *ExtensionEnvRepo) ListEnvBindings(
	ctx context.Context,
	extension string,
	profileID string,
	workspaceID string,
) ([]extensionenv.Binding, error)

ListEnvBindings returns one extension instance's bindings in env-name order.

func (*ExtensionEnvRepo) PutEnvBinding

func (r *ExtensionEnvRepo) PutEnvBinding(ctx context.Context, binding extensionenv.Binding) error

PutEnvBinding creates or replaces one extension instance binding.

func (*ExtensionEnvRepo) ResolveEnvBindings

func (r *ExtensionEnvRepo) ResolveEnvBindings(
	ctx context.Context,
	extension string,
	profileID string,
	workspaceID string,
) (bindings []extensionenv.Binding, err error)

ResolveEnvBindings applies profile-first precedence for each environment name: (profile, workspace), (profile, user), (user, workspace), (user, user).

type ExtensionInputRepo

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

func (*ExtensionInputRepo) Apply

func (r *ExtensionInputRepo) Apply(
	ctx context.Context, instance extensioninput.Instance, mutations []extensioninput.Mutation,
) (err error)

Apply verifies before-images and commits the complete batch in one transaction.

func (*ExtensionInputRepo) List

List reads all active and inactive inputs from one exact instance.

type ExtensionMCPRepo

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

func (*ExtensionMCPRepo) DeleteInstance

func (r *ExtensionMCPRepo) DeleteInstance(ctx context.Context, extension, profileID, workspaceID string) error

func (*ExtensionMCPRepo) DeleteTargets

func (r *ExtensionMCPRepo) DeleteTargets(ctx context.Context, targets []extensionmcp.Target) error

DeleteTargets compensates only allocations introduced by a failed lifecycle mutation.

func (*ExtensionMCPRepo) DeleteWorkspace

func (r *ExtensionMCPRepo) DeleteWorkspace(ctx context.Context, extension, workspaceID string) error

func (*ExtensionMCPRepo) List

func (r *ExtensionMCPRepo) List(ctx context.Context, profileID, workspaceID string) ([]extensionmcp.Record, error)

func (*ExtensionMCPRepo) ListAll

func (*ExtensionMCPRepo) Reserve

func (r *ExtensionMCPRepo) Reserve(
	ctx context.Context, target extensionmcp.Target, requested string, occupied []string,
) (record extensionmcp.Record, err error)

Reserve commits a new allocation once; an existing allocation is never renamed.

func (*ExtensionMCPRepo) RetireTargets

func (r *ExtensionMCPRepo) RetireTargets(
	ctx context.Context,
	targets []extensionmcp.Target,
	summary store.EventSummary,
) error

RetireTargets commits exact allocation retirement and its lifecycle event together.

func (*ExtensionMCPRepo) RetireWorkspace

func (r *ExtensionMCPRepo) RetireWorkspace(
	ctx context.Context,
	extension, workspaceID string,
	summary store.EventSummary,
) error

RetireWorkspace commits the unlink event and all profile allocations in the same transaction.

func (*ExtensionMCPRepo) Update

func (r *ExtensionMCPRepo) Update(
	ctx context.Context,
	target extensionmcp.Target,
	override extensionmcp.Override,
) error

Update edits only override fields and leaves the allocation untouched.

type GatewayRepo

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

func (*GatewayRepo) CreateAppToken

func (g *GatewayRepo) CreateAppToken(ctx context.Context, record gateway.StoredAppToken) ([]string, error)

func (*GatewayRepo) CreateDevice

func (g *GatewayRepo) CreateDevice(ctx context.Context, record gateway.StoredDeviceSession) error

func (*GatewayRepo) DeleteIngressBinding

func (g *GatewayRepo) DeleteIngressBinding(
	ctx context.Context,
	expected gateway.IngressSubject,
) (bool, error)

func (*GatewayRepo) DisableAll

func (g *GatewayRepo) DisableAll(ctx context.Context) (bool, error)

DisableAll atomically clears desired and observed exposure for every tier.

func (*GatewayRepo) FindAppTokenByTokenHash

func (g *GatewayRepo) FindAppTokenByTokenHash(
	ctx context.Context,
	hash string,
) (_ gateway.StoredAppToken, err error)

func (*GatewayRepo) FindDeviceByTokenHash

func (g *GatewayRepo) FindDeviceByTokenHash(
	ctx context.Context,
	tokenHash string,
	now time.Time,
) (gateway.StoredDeviceSession, error)

func (*GatewayRepo) GetDevice

func (g *GatewayRepo) GetDevice(ctx context.Context, deviceID string) (gateway.DeviceSession, error)

func (*GatewayRepo) GetIngressBinding

func (g *GatewayRepo) GetIngressBinding(
	ctx context.Context,
	ref gateway.IngressSubjectRef,
) (gateway.IngressBinding, error)

func (*GatewayRepo) GetIngressEndpoint

func (g *GatewayRepo) GetIngressEndpoint(
	ctx context.Context,
	tier gateway.Tier,
) (gateway.IngressEndpointState, error)

GetIngressEndpoint loads the durable address identity for one tier.

func (*GatewayRepo) ListActiveAppTokenOrigins

func (g *GatewayRepo) ListActiveAppTokenOrigins(ctx context.Context) ([]string, error)

func (*GatewayRepo) ListAppTokens

func (g *GatewayRepo) ListAppTokens(
	ctx context.Context,
	state gateway.AppTokenState,
) (_ []gateway.AppToken, err error)

func (*GatewayRepo) ListDevices

func (g *GatewayRepo) ListDevices(ctx context.Context) ([]gateway.DeviceSession, error)

func (*GatewayRepo) ListIngressBindings

func (g *GatewayRepo) ListIngressBindings(ctx context.Context) ([]gateway.IngressBinding, error)

func (*GatewayRepo) MarkIngressEndpointUnavailable

func (g *GatewayRepo) MarkIngressEndpointUnavailable(ctx context.Context, tier gateway.Tier, now time.Time) error

func (*GatewayRepo) ProviderIdentity

func (g *GatewayRepo) ProviderIdentity(ctx context.Context, name string) (gateway.ProviderIdentity, error)

ProviderIdentity reads the operator-confirmed gateway provider tuple.

func (*GatewayRepo) PutIngressBinding

func (g *GatewayRepo) PutIngressBinding(
	ctx context.Context,
	expected gateway.IngressSubject,
	endpointGeneration uint64,
	confirmedAt time.Time,
) (_ gateway.IngressBinding, changed bool, err error)

func (*GatewayRepo) RenameDevice

func (g *GatewayRepo) RenameDevice(
	ctx context.Context,
	deviceID string,
	name string,
) (gateway.DeviceSession, error)

func (*GatewayRepo) RenameDeviceForActor

func (g *GatewayRepo) RenameDeviceForActor(
	ctx context.Context,
	actorID string,
	actorEpoch uint64,
	deviceID string,
	name string,
) (gateway.DeviceSession, error)

func (*GatewayRepo) ResolveIngressSubject

func (g *GatewayRepo) ResolveIngressSubject(
	ctx context.Context,
	ref gateway.IngressSubjectRef,
) (gateway.IngressSubject, error)

ResolveIngressSubject loads scope and routing from the canonical subject table.

func (*GatewayRepo) RevalidateDeviceEpoch

func (g *GatewayRepo) RevalidateDeviceEpoch(ctx context.Context, deviceID string, epoch uint64) error

func (*GatewayRepo) RevokeAppToken

func (g *GatewayRepo) RevokeAppToken(
	ctx context.Context,
	id string,
	now time.Time,
) (gateway.AppToken, bool, []string, error)

func (*GatewayRepo) RevokeDevice

func (g *GatewayRepo) RevokeDevice(
	ctx context.Context,
	deviceID string,
	now time.Time,
) (gateway.DeviceSession, bool, error)

func (*GatewayRepo) RevokeDeviceForActor

func (g *GatewayRepo) RevokeDeviceForActor(
	ctx context.Context,
	actorID string,
	actorEpoch uint64,
	deviceID string,
	now time.Time,
) (gateway.DeviceSession, bool, error)

func (*GatewayRepo) SetObserved

func (g *GatewayRepo) SetObserved(
	ctx context.Context,
	plan gateway.TierPlan,
	providerObserved gateway.ProviderObservedState,
	surfaceObserved gateway.SurfaceObservedState,
	at time.Time,
	cause string,
) (bool, error)

SetObserved atomically applies effect output only to the expected generations.

func (*GatewayRepo) Snapshot

func (g *GatewayRepo) Snapshot(ctx context.Context) (_ gateway.Snapshot, err error)

Snapshot loads the complete operator-global gateway state.

func (*GatewayRepo) SweepOrphanedIngressBindings

func (g *GatewayRepo) SweepOrphanedIngressBindings(ctx context.Context) (int64, error)

func (*GatewayRepo) SyncIngressEndpoint

func (g *GatewayRepo) SyncIngressEndpoint(
	ctx context.Context,
	tier gateway.Tier,
	endpointURL string,
	now time.Time,
) (_ gateway.IngressEndpointState, changed bool, err error)

SyncIngressEndpoint preserves generation for a stable URL and advances it on change.

func (*GatewayRepo) TouchAppTokenLastSeen

func (g *GatewayRepo) TouchAppTokenLastSeen(
	ctx context.Context,
	id string,
	epoch uint64,
	now time.Time,
) error

func (*GatewayRepo) Transition

func (g *GatewayRepo) Transition(
	ctx context.Context,
	req gateway.TransitionRequest,
	now time.Time,
) (bool, error)

Transition atomically writes desired state and advances its generation.

func (*GatewayRepo) UpdateAppToken

func (g *GatewayRepo) UpdateAppToken(
	ctx context.Context,
	id string,
	patch gateway.AppTokenPatch,
	now time.Time,
) (gateway.AppToken, []string, error)

type GlobalDB

GlobalDB owns the global session index and observability database.

func OpenGlobalDB

func OpenGlobalDB(ctx context.Context, path string, options ...OpenOption) (*GlobalDB, error)

OpenGlobalDB opens or creates the global Compozy index database.

func (*GlobalDB) Close

func (g *GlobalDB) Close(ctx context.Context) error

Close checkpoints the WAL and closes the database.

func (*GlobalDB) CompleteUserScopeMigration

func (g *GlobalDB) CompleteUserScopeMigration(ctx context.Context, id string) (resultErr error)

CompleteUserScopeMigration refuses the cascade path while any table still references the source.

func (*GlobalDB) DB

func (g *GlobalDB) DB() *sql.DB

DB exposes the underlying SQL connection for composition-root adapters such as the extension registry.

func (*GlobalDB) ExecuteProfileWrite

func (g *GlobalDB) ExecuteProfileWrite(
	ctx context.Context,
	action string,
	run func(ProfileWriteExecutor) error,
) error

ExecuteProfileWrite runs one profile lifecycle mutation in an immediate SQLite transaction.

func (*GlobalDB) ExtensionInputStore

func (g *GlobalDB) ExtensionInputStore() extensioninput.Store

ExtensionInputStore exposes the input repository at the daemon composition boundary.

func (*GlobalDB) ExtensionMCPStore

func (g *GlobalDB) ExtensionMCPStore() extensionmcp.Store

func (*GlobalDB) FinishExitOperationWithEvent

func (g *GlobalDB) FinishExitOperationWithEvent(
	ctx context.Context,
	workspaceID string,
	worktreeID string,
	opID string,
	state string,
	finishedAt time.Time,
	event worktree.LifecycleEvent,
) (bool, error)

func (*GlobalDB) HasActiveWorktreeSession

func (g *GlobalDB) HasActiveWorktreeSession(
	ctx context.Context,
	workspaceID string,
	worktreeID string,
) (bool, error)

HasActiveWorktreeSession reports whether a live session still owns a workspace-scoped worktree binding.

func (*GlobalDB) HasOtherActiveWorktreeSession

func (g *GlobalDB) HasOtherActiveWorktreeSession(
	ctx context.Context,
	workspaceID, worktreeID, sessionID string,
) (bool, error)

HasOtherActiveWorktreeSession excludes only the exact managed-delivery caller.

func (*GlobalDB) MarkUserScopeStoreVerified

func (g *GlobalDB) MarkUserScopeStoreVerified(ctx context.Context, id, kind string) error

func (*GlobalDB) Path

func (g *GlobalDB) Path() string

Path reports the on-disk path for the global database file.

func (*GlobalDB) PendingUserScopeMigrations

func (g *GlobalDB) PendingUserScopeMigrations(ctx context.Context) (result []UserScopeMigration, resultErr error)

func (*GlobalDB) PublishWorktreeEvent

func (g *GlobalDB) PublishWorktreeEvent(ctx context.Context, event worktree.LifecycleEvent) error

func (*GlobalDB) SetGoalSessionOutboxCommitSignal

func (g *GlobalDB) SetGoalSessionOutboxCommitSignal(signal func())

SetGoalSessionOutboxCommitSignal installs the callback invoked after a transaction that enqueued Goal session projections or Loop session cleanup obligations commits. Nil clears it.

func (*GlobalDB) SetLoopEffectCommitSignal

func (g *GlobalDB) SetLoopEffectCommitSignal(signal func())

SetLoopEffectCommitSignal installs the callback invoked after a transaction that enqueued Loop effect deliveries commits. Nil clears it.

func (*GlobalDB) VerifyDefaultProfile

func (g *GlobalDB) VerifyDefaultProfile(ctx context.Context) error

VerifyDefaultProfile checks permanent identity without resetting editable presentation.

func (*GlobalDB) WorktreeStore

func (g *GlobalDB) WorktreeStore() worktree.Store

WorktreeStore exposes the domain repository without widening the daemon registry aggregate.

type GoalRepo

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

func (*GoalRepo) AcknowledgeGoalSessionOutbox

func (g *GoalRepo) AcknowledgeGoalSessionOutbox(
	ctx context.Context,
	eventID string,
	deliveredAt time.Time,
) error

AcknowledgeGoalSessionOutbox records the first successful delivery timestamp.

func (*GoalRepo) AcknowledgeLoopSessionCleanup

func (g *GoalRepo) AcknowledgeLoopSessionCleanup(
	ctx context.Context,
	cleanupID string,
	completedAt time.Time,
) error

AcknowledgeLoopSessionCleanup records the first successful idempotent session Stop.

func (*GoalRepo) ActivateSessionBinding

func (g *GoalRepo) ActivateSessionBinding(
	ctx context.Context,
	req goal.ActivateBindingRequest,
) (goal.SessionBinding, error)

ActivateSessionBinding swaps one successfully created run-owned attempt into active state.

func (*GoalRepo) AdvanceBindingCreationFailure

func (g *GoalRepo) AdvanceBindingCreationFailure(
	ctx context.Context,
	req goal.AdvanceBindingCreationFailureRequest,
) error

AdvanceBindingCreationFailure atomically consumes one proven-no-create Goal attempt.

func (*GoalRepo) AllocateSessionBindingAttempt

func (g *GoalRepo) AllocateSessionBindingAttempt(
	ctx context.Context,
	req *goal.AllocateBindingAttemptRequest,
) (goal.SessionBinding, error)

AllocateSessionBindingAttempt atomically selects and persists the next run-owned binding epoch.

func (*GoalRepo) BeginCompactionCancel

func (g *GoalRepo) BeginCompactionCancel(ctx context.Context, req goal.BeginCompactionCancelRequest) error

BeginCompactionCancel persists timeout intent before issuing the correlated cancellation effect.

func (*GoalRepo) BeginJudgeAttempt

func (g *GoalRepo) BeginJudgeAttempt(
	ctx context.Context,
	req goal.BeginJudgeAttemptRequest,
) (goal.JudgeAttempt, error)

BeginJudgeAttempt persists one aggregate judge attempt before evaluator effects.

func (*GoalRepo) BindCheckpoint

func (g *GoalRepo) BindCheckpoint(ctx context.Context, req goal.BindCheckpointRequest) (goal.Checkpoint, error)

BindCheckpoint adopts the exact active binding under the checkpoint owner fence.

func (*GoalRepo) CheckpointControl

func (g *GoalRepo) CheckpointControl(ctx context.Context, req goal.ControlCheckpointRequest) error

CheckpointControl records one typed nonterminal or terminal control boundary by CAS.

func (*GoalRepo) ClaimGoalSessionOutbox

func (g *GoalRepo) ClaimGoalSessionOutbox(
	ctx context.Context,
	limit int,
) (events []goal.SessionOutboxEvent, err error)

ClaimGoalSessionOutbox lists the oldest pending projection events for retryable relay.

func (*GoalRepo) ClaimLoopSessionCleanup

func (g *GoalRepo) ClaimLoopSessionCleanup(
	ctx context.Context,
	limit int,
) (obligations []looppkg.SessionCleanupObligation, err error)

ClaimLoopSessionCleanup lists the oldest unacknowledged run-owned session cleanup effects.

func (*GoalRepo) ClaimPreparedCompaction

func (g *GoalRepo) ClaimPreparedCompaction(
	ctx context.Context,
	req goal.ClaimPreparedCompactionRequest,
) (goal.ClaimedPrompt, error)

ClaimPreparedCompaction starts one compact operation without allocating a work turn.

func (*GoalRepo) ClaimPreparedWorkPrompt

func (g *GoalRepo) ClaimPreparedWorkPrompt(
	ctx context.Context,
	req goal.ClaimPreparedWorkPromptRequest,
) (goal.ClaimedPrompt, error)

ClaimPreparedWorkPrompt is the work-effect linearization: queue claim, token digest, and open turn commit together.

func (*GoalRepo) CloseSessionBinding

func (g *GoalRepo) CloseSessionBinding(ctx context.Context, req goal.CloseBindingRequest) error

CloseSessionBinding closes one exact active epoch idempotently.

func (*GoalRepo) CompleteCompaction

func (g *GoalRepo) CompleteCompaction(
	ctx context.Context,
	req goal.CompleteCompactionRequest,
) (goal.Checkpoint, error)

CompleteCompaction settles one correlated compact operation without creating a work-turn row.

func (*GoalRepo) CompleteJudgeAttempt

func (g *GoalRepo) CompleteJudgeAttempt(
	ctx context.Context,
	req goal.CompleteJudgeAttemptRequest,
) (goal.JudgeAttempt, error)

CompleteJudgeAttempt records the evaluator terminal exactly once.

func (*GoalRepo) CompleteTurn

func (g *GoalRepo) CompleteTurn(
	ctx context.Context,
	req goal.CompleteTurnRequest,
) (goal.Checkpoint, error)

CompleteTurn atomically terminalizes one existing turn, consumes its exact intent, and advances its checkpoint.

func (*GoalRepo) CreateCheckpoint

func (g *GoalRepo) CreateCheckpoint(
	ctx context.Context,
	req goal.CreateCheckpointRequest,
) (goal.Checkpoint, error)

CreateCheckpoint inserts one initial Goal checkpoint without overwriting durable progress.

func (*GoalRepo) EnqueueGoalSessionOutbox

func (g *GoalRepo) EnqueueGoalSessionOutbox(
	ctx context.Context,
	request goal.EnqueueSessionOutboxRequest,
) (goal.SessionOutboxEvent, error)

EnqueueGoalSessionOutbox inserts or returns one byte-identical projection event.

func (*GoalRepo) FencePreparedPrompt

func (g *GoalRepo) FencePreparedPrompt(ctx context.Context, req goal.FencePreparedPromptRequest) error

FencePreparedPrompt persists one pre-submit budget/control boundary without allocating a turn.

func (*GoalRepo) FinalizeGoalPrompt

func (g *GoalRepo) FinalizeGoalPrompt(ctx context.Context, req goal.FinalizePromptRequest) error

FinalizeGoalPrompt records one live token-authenticated terminal without settling its Goal turn.

func (*GoalRepo) FinalizeSessionBindingCreation

func (g *GoalRepo) FinalizeSessionBindingCreation(
	ctx context.Context,
	req goal.ActivateBindingRequest,
) (goal.SessionBinding, bool, error)

FinalizeSessionBindingCreation atomically activates a created session or exposes Stop cleanup.

func (*GoalRepo) FindGoalReportTarget

func (g *GoalRepo) FindGoalReportTarget(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	sessionID string,
) (goal.ToolReportTarget, bool, error)

FindGoalReportTarget returns the only currently prompting Goal bound to the session.

func (*GoalRepo) FlushAndCheck

func (g *GoalRepo) FlushAndCheck(
	ctx context.Context,
	snapshot goal.BudgetBoundarySnapshot,
) (goal.BudgetDecision, error)

FlushAndCheck synchronously max-flushes one Goal task's cumulative usage and fences the next effect.

func (*GoalRepo) GetActiveSessionBinding

func (g *GoalRepo) GetActiveSessionBinding(
	ctx context.Context,
	key goal.BindingKey,
) (goal.SessionBinding, error)

GetActiveSessionBinding returns the exact active epoch for one workspace-owned handle.

func (*GoalRepo) GetGoalTurnByPromptID

func (g *GoalRepo) GetGoalTurnByPromptID(
	ctx context.Context,
	key goal.TurnKey,
	promptID string,
) (goal.Turn, error)

GetGoalTurnByPromptID returns the exact workspace-owned turn identity.

func (*GoalRepo) GetJudgeAttempt

func (g *GoalRepo) GetJudgeAttempt(
	ctx context.Context,
	key goal.TurnKey,
	attemptID string,
) (goal.JudgeAttempt, error)

GetJudgeAttempt returns one workspace-owned judge attempt.

func (*GoalRepo) GetOrCreateSessionBinding

func (g *GoalRepo) GetOrCreateSessionBinding(
	ctx context.Context,
	req goal.GetOrCreateBindingRequest,
) (goal.SessionBinding, error)

GetOrCreateSessionBinding atomically adopts an origin session or returns the compatible active epoch.

func (*GoalRepo) GetSessionBindingAttempt

func (g *GoalRepo) GetSessionBindingAttempt(
	ctx context.Context,
	key goal.BindingKey,
	epoch int64,
) (goal.SessionBinding, error)

GetSessionBindingAttempt returns one immutable binding attempt by epoch.

func (*GoalRepo) GetSessionGoalProjection

func (g *GoalRepo) GetSessionGoalProjection(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	sessionID string,
) (projection goal.SessionProjection, err error)

GetSessionGoalProjection selects the newest session-origin Run before applying its clear tombstone.

func (*GoalRepo) GrantAndReactivate

func (g *GoalRepo) GrantAndReactivate(ctx context.Context, req goal.GrantRequest) error

GrantAndReactivate records one monotonic typed grant and advances the control epoch exactly once.

func (*GoalRepo) ListGoalTurns

func (g *GoalRepo) ListGoalTurns(
	ctx context.Context,
	query goal.TurnQuery,
) (page goal.TurnPage, err error)

ListGoalTurns returns one stable run-wide sequence page.

func (*GoalRepo) LoadAwaitingGoalControl

func (g *GoalRepo) LoadAwaitingGoalControl(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runID looppkg.RunID,
) (looppkg.GoalControlState, bool, error)

LoadAwaitingGoalControl returns the one node checkpoint that currently owns Run re-entry.

func (*GoalRepo) LoadCheckpoint

func (g *GoalRepo) LoadCheckpoint(ctx context.Context, key goal.TurnKey) (goal.Checkpoint, error)

LoadCheckpoint returns one checkpoint only through its owning workspace.

func (*GoalRepo) MarkAmbiguous

func (g *GoalRepo) MarkAmbiguous(ctx context.Context, req goal.AmbiguousRequest) error

MarkAmbiguous finalizes one already-started Goal operation without replaying or allocating a successor.

func (*GoalRepo) MarkJudgeAmbiguous

func (g *GoalRepo) MarkJudgeAmbiguous(ctx context.Context, req goal.MarkJudgeAmbiguousRequest) error

MarkJudgeAmbiguous terminalizes both the evaluator attempt and its already-open work turn.

func (*GoalRepo) PrepareGoalPrompt

func (g *GoalRepo) PrepareGoalPrompt(
	ctx context.Context,
	req goal.PreparePromptRequest,
) (goal.PromptTicket, error)

PrepareGoalPrompt inserts one idempotent non-dispatchable Goal queue ticket.

func (*GoalRepo) PrepareSessionBindingAttempt

func (g *GoalRepo) PrepareSessionBindingAttempt(
	ctx context.Context,
	req goal.PrepareBindingAttemptRequest,
) (goal.SessionBinding, error)

PrepareSessionBindingAttempt persists one run-owned creating epoch before session creation.

func (*GoalRepo) ReactivateGoalRun

ReactivateGoalRun atomically grants control, clears the Run gate, and queues one successor segment.

func (*GoalRepo) ReconcileLoopSessionCleanup

func (g *GoalRepo) ReconcileLoopSessionCleanup(ctx context.Context) error

ReconcileLoopSessionCleanup releases Stop/create races left in-flight by a previous daemon process.

func (*GoalRepo) RecordContextUsage

func (g *GoalRepo) RecordContextUsage(
	ctx context.Context,
	req goal.RecordContextUsageRequest,
) (goal.Checkpoint, error)

RecordContextUsage advances the durable freshness cursor for one exact active binding.

func (*GoalRepo) RecordGoalDriverAttached

func (g *GoalRepo) RecordGoalDriverAttached(ctx context.Context, req goal.DriverAttachmentRequest) error

RecordGoalDriverAttached advances one exact claimed operation to sent without allocating a turn.

func (*GoalRepo) RecordGoalReport

func (g *GoalRepo) RecordGoalReport(
	ctx context.Context,
	req goal.RecordToolReportRequest,
) (goal.ReportIntent, error)

RecordGoalReport content-addresses evidence and records its prompt-bound intent atomically.

func (*GoalRepo) RecordReportIntent

func (g *GoalRepo) RecordReportIntent(
	ctx context.Context,
	req goal.RecordReportIntentRequest,
) (goal.ReportIntent, error)

RecordReportIntent writes the only durable goal_report intent for the current prompt.

func (*GoalRepo) RecoverGoalPromptTerminal

func (g *GoalRepo) RecoverGoalPromptTerminal(
	ctx context.Context,
	req goal.RecoverPromptTerminalRequest,
) error

RecoverGoalPromptTerminal records exact session-event proof without exposing the raw dispatch token.

func (*GoalRepo) RejectPreparedGoalPrompt

func (g *GoalRepo) RejectPreparedGoalPrompt(
	ctx context.Context,
	req goal.RejectPreparedPromptRequest,
) error

RejectPreparedGoalPrompt records a proven no-effect attempt and advances its prompt identity.

func (*GoalRepo) ResolveActiveGoalOriginAlias

func (g *GoalRepo) ResolveActiveGoalOriginAlias(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	sessionID string,
) (originSessionID string, found bool, err error)

ResolveActiveGoalOriginAlias resolves an active moved binding back to its origin session.

func (*GoalRepo) RevokeGoalPrompt

func (g *GoalRepo) RevokeGoalPrompt(
	ctx context.Context,
	request goal.RevokePromptRequest,
) (goal.Checkpoint, error)

RevokeGoalPrompt atomically fences prepared work or terminalizes one already-claimed operation.

func (*GoalRepo) SettleStoppedSessionBindingCreation

func (g *GoalRepo) SettleStoppedSessionBindingCreation(
	ctx context.Context,
	req goal.SettleStoppedBindingCreationRequest,
) (bool, error)

SettleStoppedSessionBindingCreation releases cleanup after an in-flight create effect has returned.

type HeartbeatRepo

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

func (*HeartbeatRepo) AppendHeartbeatRevision

func (g *HeartbeatRepo) AppendHeartbeatRevision(
	ctx context.Context,
	revision heartbeat.Revision,
) (heartbeat.Revision, error)

AppendHeartbeatRevision appends one managed Heartbeat authoring revision row.

func (*HeartbeatRepo) AppendHeartbeatWakeEvent

func (g *HeartbeatRepo) AppendHeartbeatWakeEvent(
	ctx context.Context,
	event heartbeat.WakeEvent,
) (heartbeat.WakeEvent, error)

AppendHeartbeatWakeEvent appends one retained Heartbeat wake audit row.

func (*HeartbeatRepo) DeleteHeartbeatAgentHistory

func (g *HeartbeatRepo) DeleteHeartbeatAgentHistory(
	ctx context.Context,
	workspaceID string,
	agentName string,
	sourcePath string,
) error

DeleteHeartbeatAgentHistory removes revisions owned by one effective authored definition.

func (*HeartbeatRepo) FindHeartbeatRevisionForRollback

func (g *HeartbeatRepo) FindHeartbeatRevisionForRollback(
	ctx context.Context,
	query heartbeat.RollbackLookup,
) (heartbeat.Revision, error)

FindHeartbeatRevisionForRollback returns the revision body selected for a managed rollback.

func (*HeartbeatRepo) FindHeartbeatSnapshotByDigest

func (g *HeartbeatRepo) FindHeartbeatSnapshotByDigest(
	ctx context.Context,
	workspaceID string,
	agentName string,
	digest string,
) (heartbeat.Snapshot, bool, error)

FindHeartbeatSnapshotByDigest returns the snapshot matching an agent digest.

func (*HeartbeatRepo) GetHeartbeatRevision

func (g *HeartbeatRepo) GetHeartbeatRevision(ctx context.Context, id string) (heartbeat.Revision, error)

GetHeartbeatRevision returns a managed Heartbeat authoring revision by id.

func (*HeartbeatRepo) GetHeartbeatSnapshot

func (g *HeartbeatRepo) GetHeartbeatSnapshot(ctx context.Context, id string) (heartbeat.Snapshot, error)

GetHeartbeatSnapshot returns a persisted Heartbeat snapshot by id.

func (*HeartbeatRepo) GetHeartbeatWakeEvent

func (g *HeartbeatRepo) GetHeartbeatWakeEvent(ctx context.Context, id string) (heartbeat.WakeEvent, error)

GetHeartbeatWakeEvent returns one retained Heartbeat wake audit row.

func (*HeartbeatRepo) GetHeartbeatWakeState

func (g *HeartbeatRepo) GetHeartbeatWakeState(
	ctx context.Context,
	workspaceID string,
	agentName string,
	sessionID string,
) (heartbeat.WakeState, error)

GetHeartbeatWakeState returns one per-session Heartbeat wake summary.

func (*HeartbeatRepo) GetLatestValidHeartbeatSnapshot

func (g *HeartbeatRepo) GetLatestValidHeartbeatSnapshot(
	ctx context.Context,
	workspaceID string,
	agentName string,
) (heartbeat.Snapshot, error)

GetLatestValidHeartbeatSnapshot returns the current persisted valid Heartbeat policy for an agent.

func (*HeartbeatRepo) GetSessionHealth

func (g *HeartbeatRepo) GetSessionHealth(ctx context.Context, sessionID string) (heartbeat.SessionHealth, error)

GetSessionHealth returns metadata-only health for one session.

func (*HeartbeatRepo) ListHeartbeatRevisions

func (g *HeartbeatRepo) ListHeartbeatRevisions(
	ctx context.Context,
	query heartbeat.RevisionListQuery,
) (revisions []heartbeat.Revision, err error)

ListHeartbeatRevisions lists managed Heartbeat authoring revisions in newest-first order.

func (*HeartbeatRepo) ListHeartbeatSnapshots

func (g *HeartbeatRepo) ListHeartbeatSnapshots(
	ctx context.Context,
	query heartbeat.SnapshotListQuery,
) (snapshots []heartbeat.Snapshot, err error)

ListHeartbeatSnapshots lists persisted Heartbeat snapshots in newest-first order.

func (*HeartbeatRepo) ListHeartbeatWakeEvents

func (g *HeartbeatRepo) ListHeartbeatWakeEvents(
	ctx context.Context,
	query heartbeat.WakeEventListQuery,
) (events []heartbeat.WakeEvent, err error)

ListHeartbeatWakeEvents lists retained Heartbeat wake audit rows in newest-first order.

func (*HeartbeatRepo) ListHeartbeatWakeState

func (g *HeartbeatRepo) ListHeartbeatWakeState(
	ctx context.Context,
	query heartbeat.WakeStateListQuery,
) (states []heartbeat.WakeState, err error)

ListHeartbeatWakeState lists Heartbeat wake state rows in newest-first order.

func (*HeartbeatRepo) ListSessionHealth

func (g *HeartbeatRepo) ListSessionHealth(
	ctx context.Context,
	query heartbeat.SessionHealthListQuery,
) (rowsOut []heartbeat.SessionHealth, err error)

ListSessionHealth lists metadata-only session health rows in newest-first order.

func (*HeartbeatRepo) ListSessionHealthRecoveryInputs

func (g *HeartbeatRepo) ListSessionHealthRecoveryInputs(
	ctx context.Context,
	limit int,
) ([]heartbeat.SessionHealth, error)

ListSessionHealthRecoveryInputs returns persisted rows that restart recovery must recompute before wake.

func (*HeartbeatRepo) MarkSessionHealthStale

func (g *HeartbeatRepo) MarkSessionHealthStale(
	ctx context.Context,
	cutoff time.Time,
	updatedAt time.Time,
) (int64, error)

MarkSessionHealthStale marks stale persisted health rows as wake-ineligible without deleting authored policy.

func (*HeartbeatRepo) RecordHeartbeatWakeDecision

func (g *HeartbeatRepo) RecordHeartbeatWakeDecision(
	ctx context.Context,
	event heartbeat.WakeEvent,
	state heartbeat.WakeState,
) (outEvent heartbeat.WakeEvent, outState heartbeat.WakeState, err error)

RecordHeartbeatWakeDecision appends the audit row and updates cooldown state atomically.

func (*HeartbeatRepo) SweepHeartbeatWakeEvents

func (g *HeartbeatRepo) SweepHeartbeatWakeEvents(ctx context.Context, cutoff time.Time, limit int) (int64, error)

SweepHeartbeatWakeEvents deletes expired wake audit rows in one bounded batch.

func (*HeartbeatRepo) UpsertHeartbeatSnapshot

func (g *HeartbeatRepo) UpsertHeartbeatSnapshot(
	ctx context.Context,
	snapshot heartbeat.Snapshot,
) (heartbeat.Snapshot, error)

UpsertHeartbeatSnapshot inserts a resolved Heartbeat snapshot or reuses the existing row for its digest.

func (*HeartbeatRepo) UpsertHeartbeatWakeState

func (g *HeartbeatRepo) UpsertHeartbeatWakeState(
	ctx context.Context,
	state heartbeat.WakeState,
) (heartbeat.WakeState, error)

func (*HeartbeatRepo) UpsertSessionHealth

func (g *HeartbeatRepo) UpsertSessionHealth(
	ctx context.Context,
	health heartbeat.SessionHealth,
) (heartbeat.SessionHealth, error)

type LoopRepo

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

func (*LoopRepo) AcknowledgeLoopEffect

func (g *LoopRepo) AcknowledgeLoopEffect(
	ctx context.Context,
	ack looppkg.EffectAcknowledgement,
) (bool, error)

AcknowledgeLoopEffect atomically appends idempotent result events and closes one pending row.

func (*LoopRepo) AdvanceLoopRunProgress

func (g *LoopRepo) AdvanceLoopRunProgress(ctx context.Context, loopRunID string, at time.Time) error

func (*LoopRepo) AmendNodeOutput

func (g *LoopRepo) AmendNodeOutput(
	ctx context.Context,
	input looppkg.AmendInput,
) (looppkg.NodeAmendment, error)

func (*LoopRepo) ApplyGenerationOutputOverlays

func (g *LoopRepo) ApplyGenerationOutputOverlays(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runID looppkg.RunID,
	generation int,
	outputs []looppkg.GenerationOutput,
) ([]looppkg.GenerationOutput, error)

func (*LoopRepo) BackfillLoopProvenance

func (g *LoopRepo) BackfillLoopProvenance(ctx context.Context) (int, error)

BackfillLoopProvenance repairs coordinator metadata from relational ownership only.

func (*LoopRepo) BackfillLoopWaitAdmissionDeadlines

func (g *LoopRepo) BackfillLoopWaitAdmissionDeadlines(ctx context.Context, limit int) (int, error)

BackfillLoopWaitAdmissionDeadlines normalizes one page of released expiryless event waits. The executed definition and original creation time own the deadline.

func (*LoopRepo) ClearInlineGoal

ClearInlineGoal atomically selects and tombstones the newest session Goal, stopping it when live.

func (*LoopRepo) CompareAndSwapLoopRunStatus

func (g *LoopRepo) CompareAndSwapLoopRunStatus(
	ctx context.Context,
	runID looppkg.RunID,
	from looppkg.Status,
	to looppkg.Status,
	cause looppkg.TransitionCause,
	at time.Time,
) error

CompareAndSwapLoopRunStatus updates status only from the expected durable value.

func (*LoopRepo) CreateFork

func (g *LoopRepo) CreateFork(
	ctx context.Context,
	request looppkg.ForkStoreRequest,
) (created looppkg.Run, replayed bool, err error)

func (*LoopRepo) CreateInlineLoopRunForStart

func (g *LoopRepo) CreateInlineLoopRunForStart(
	ctx context.Context,
	run looppkg.Run,
) (looppkg.Run, error)

CreateInlineLoopRunForStart atomically validates the origin, starts the Run, and enqueues discovery.

func (*LoopRepo) CreateLoopRunForStart

func (g *LoopRepo) CreateLoopRunForStart(
	ctx context.Context,
	run looppkg.Run,
	policy dsl.ConcurrencyPolicy,
) (looppkg.Run, error)

CreateLoopRunForStart atomically applies the loop concurrency policy and persists a new run.

func (*LoopRepo) CreateRerun

func (g *LoopRepo) CreateRerun(
	ctx context.Context,
	request looppkg.RerunStoreRequest,
) (result looppkg.RerunResult, replayed bool, err error)

func (*LoopRepo) DeleteLoopDefinitionState

func (g *LoopRepo) DeleteLoopDefinitionState(
	ctx context.Context,
	ws looppkg.WorkspaceID, profileID string,
	loopName string,
) (looppkg.DefinitionState, error)

DeleteLoopDefinitionState atomically removes mutable sidecars owned by one Loop definition.

func (*LoopRepo) DeleteRunHistory

func (g *LoopRepo) DeleteRunHistory(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runID looppkg.RunID,
) error

DeleteRunHistory removes one imported run and its workspace-scoped event ledger. It refuses to touch a run that belongs to another workspace.

func (*LoopRepo) EnqueueDueLoopRetryWakesPage

func (g *LoopRepo) EnqueueDueLoopRetryWakesPage(
	ctx context.Context,
	origin taskpkg.Origin,
	now time.Time,
	cursor looppkg.RetryDueCursor,
	limit int,
) ([]taskpkg.Run, looppkg.RetryDueCursor, error)

EnqueueDueLoopRetryWakesPage reserves coordinator wakes for one due-time page.

func (*LoopRepo) EnqueueLoopCoordinatorWake

func (g *LoopRepo) EnqueueLoopCoordinatorWake(
	ctx context.Context,
	loopRunID string,
	idempotencyKey string,
	origin taskpkg.Origin,
	now time.Time,
) (taskpkg.Run, bool, error)

EnqueueLoopCoordinatorWake reserves a coordinator run for one loop_run.

func (*LoopRepo) EnqueueLoopRetryWakeIfCurrent

func (g *LoopRepo) EnqueueLoopRetryWakeIfCurrent(
	ctx context.Context,
	origin taskpkg.Origin,
	cell looppkg.RetryDueCell,
	firedAt time.Time,
) (returnRun taskpkg.Run, returnAdded bool, returnCurrent bool, returnErr error)

EnqueueLoopRetryWakeIfCurrent fences a timer or due-scan fire against the exact retry cell and reserves its coordinator wake in the same transaction.

func (*LoopRepo) EnqueueWatchEventsGapWakes

func (g *LoopRepo) EnqueueWatchEventsGapWakes(
	ctx context.Context,
	origin taskpkg.Origin,
	now time.Time,
) ([]taskpkg.Run, error)

EnqueueWatchEventsGapWakes scans parked watch-events nodes for durable cursor gaps and enqueues idempotent coordinator wakes.

func (*LoopRepo) EnqueueWatchEventsGapWakesPage

func (g *LoopRepo) EnqueueWatchEventsGapWakesPage(
	ctx context.Context,
	origin taskpkg.Origin,
	now time.Time,
	after looppkg.ParkedWatchEventScanCursor,
	limit int,
) ([]taskpkg.Run, looppkg.ParkedWatchEventScanCursor, error)

EnqueueWatchEventsGapWakesPage checks one bounded page of parked subscriptions and returns the durable cursor for the next scheduler cycle.

func (*LoopRepo) EscalateDueLoopWaitsPage

func (g *LoopRepo) EscalateDueLoopWaitsPage(
	ctx context.Context,
	now time.Time,
	cursor looppkg.WaitEscalationCursor,
	limit int,
) (looppkg.WaitEscalationCursor, error)

EscalateDueLoopWaitsPage advances one stable page of authored wait ladders.

func (*LoopRepo) FindActiveLoopRun

func (g *LoopRepo) FindActiveLoopRun(
	ctx context.Context,
	ws looppkg.WorkspaceID, profileID string,
	loopName string,
) (*looppkg.Run, error)

FindActiveLoopRun returns the oldest live run for a workspace loop.

func (*LoopRepo) GetAdmissionClaim

func (g *LoopRepo) GetAdmissionClaim(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID, profileID string,
	loopName string,
	sourceKey string,
	eventKey string,
) (looppkg.AdmissionClaim, error)

GetAdmissionClaim returns one workspace-scoped admission tombstone.

func (*LoopRepo) GetGenerationOutputPayload

func (g *LoopRepo) GetGenerationOutputPayload(
	ctx context.Context,
	key looppkg.GenerationOutputPayloadKey,
) (json.RawMessage, error)

GetGenerationOutputPayload loads an externalized payload through its workspace-owned cell.

func (*LoopRepo) GetLoopConfig

func (g *LoopRepo) GetLoopConfig(
	ctx context.Context,
	ws looppkg.WorkspaceID, profileID string,
	loopName string,
) (*looppkg.LoopConfig, error)

GetLoopConfig loads a no-fork per-loop config override.

func (*LoopRepo) GetLoopDefinitionSnapshot

func (g *LoopRepo) GetLoopDefinitionSnapshot(
	ctx context.Context,
	ws looppkg.WorkspaceID, profileID string,
	digest string,
) (looppkg.DefinitionSnapshot, error)

func (*LoopRepo) GetLoopRun

func (g *LoopRepo) GetLoopRun(
	ctx context.Context,
	ws looppkg.WorkspaceID,
	runID looppkg.RunID,
) (looppkg.Run, error)

GetLoopRun loads one workspace-scoped loop_run.

func (*LoopRepo) GetLoopRunByID

func (g *LoopRepo) GetLoopRunByID(ctx context.Context, runID looppkg.RunID) (looppkg.Run, error)

GetLoopRunByID loads one loop_run without a workspace filter for ancestry/transition internals.

func (*LoopRepo) GetLoopRunEventHead

func (g *LoopRepo) GetLoopRunEventHead(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runID looppkg.RunID,
) (int64, error)

GetLoopRunEventHead returns the durable sequence head for one workspace-owned run.

func (*LoopRepo) GetRequest

func (g *LoopRepo) GetRequest(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	ref looppkg.RequestRef,
	full bool,
) (looppkg.Request, error)

GetRequest returns one request, optionally hydrating its full redacted context.

func (*LoopRepo) ImportRunHistory

func (g *LoopRepo) ImportRunHistory(ctx context.Context, command *looppkg.RunHistoryImport) error

ImportRunHistory atomically imports one already-executed Loop run together with its generation, output, attempt, control, wait, request, verdict, and event ledger.

func (*LoopRepo) ImportRunHistoryBatch

func (g *LoopRepo) ImportRunHistoryBatch(ctx context.Context, commands []*looppkg.RunHistoryImport) error

ImportRunHistoryBatch atomically imports a related set of historical runs. Rows are materialized before lineage validation so parent and child ledgers may reference each other without weakening the single-run boundary.

func (*LoopRepo) ListAvailableLoopOutputRefs

func (g *LoopRepo) ListAvailableLoopOutputRefs(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runID looppkg.RunID,
) (map[string]bool, error)

ListAvailableLoopOutputRefs returns retained blob references owned by one workspace run.

func (*LoopRepo) ListDueLoopRetries

func (g *LoopRepo) ListDueLoopRetries(
	ctx context.Context,
	now time.Time,
	cursor looppkg.RetryDueCursor,
	limit int,
) (returnCells []looppkg.RetryDueCell, returnCursor looppkg.RetryDueCursor, returnErr error)

ListDueLoopRetries returns one stable page of live, unparked retry schedules.

func (*LoopRepo) ListEffectOutbox

func (g *LoopRepo) ListEffectOutbox(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runID looppkg.RunID,
) ([]looppkg.EffectOutboxEntry, error)

ListEffectOutbox returns workspace-scoped effect delivery rows for one run.

func (*LoopRepo) ListForks

func (g *LoopRepo) ListForks(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runID looppkg.RunID,
) (forks []looppkg.ForkRef, err error)

func (*LoopRepo) ListGateVerdicts

func (g *LoopRepo) ListGateVerdicts(
	ctx context.Context,
	workspaceID string,
	runID string,
	generation int64,
) ([]gate.VerdictRecord, error)

func (*LoopRepo) ListGenerationOutputs

func (g *LoopRepo) ListGenerationOutputs(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runID looppkg.RunID,
	generation int,
) ([]looppkg.GenerationOutput, error)

ListGenerationOutputs loads loop-owned per-node generation state in deterministic order.

func (*LoopRepo) ListGenerations

func (g *LoopRepo) ListGenerations(
	ctx context.Context,
	workspaceID string,
	runID string,
) ([]looppkg.LoopGeneration, error)

func (*LoopRepo) ListLoopCatalogRunSummaries

func (g *LoopRepo) ListLoopCatalogRunSummaries(
	ctx context.Context,
	query looppkg.CatalogRunQuery,
) (summaries map[string]looppkg.CatalogRunSummary, err error)

func (*LoopRepo) ListLoopGateDecisions

func (g *LoopRepo) ListLoopGateDecisions(
	ctx context.Context,
	ws looppkg.WorkspaceID,
	runID looppkg.RunID,
	generation int,
	gateID looppkg.NodeID,
) (decisions map[string]gate.HumanDecision, err error)

func (*LoopRepo) ListLoopRosterOutputs

func (g *LoopRepo) ListLoopRosterOutputs(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runID looppkg.RunID,
) ([]looppkg.GenerationOutput, error)

ListLoopRosterOutputs returns every generation output for one workspace-owned run.

func (*LoopRepo) ListLoopRosterRouteCauses

func (g *LoopRepo) ListLoopRosterRouteCauses(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runID looppkg.RunID,
) ([]looppkg.RouteCause, error)

ListLoopRosterRouteCauses returns every durable route decision for one workspace-owned run.

func (*LoopRepo) ListLoopRunEvents

func (g *LoopRepo) ListLoopRunEvents(
	ctx context.Context,
	query looppkg.RunEventQuery,
) ([]looppkg.RunEvent, error)

ListLoopRunEvents loads retained events after the requested sequence.

func (*LoopRepo) ListLoopRunEventsBackward

func (g *LoopRepo) ListLoopRunEventsBackward(
	ctx context.Context,
	query looppkg.RunEventBackwardQuery,
) ([]looppkg.RunEvent, error)

ListLoopRunEventsBackward returns one snapshot-fenced page in descending sequence order.

func (*LoopRepo) ListLoopRunSummaries

func (g *LoopRepo) ListLoopRunSummaries(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runIDs []looppkg.RunID,
) (summaries map[looppkg.RunID]looppkg.RunListSummary, err error)

func (*LoopRepo) ListLoopRuns

func (g *LoopRepo) ListLoopRuns(
	ctx context.Context,
	query looppkg.RunListQuery,
) (runs []looppkg.Run, err error)

ListLoopRuns loads loop runs matching the explicit profile scope and workspace filters in newest-first order.

func (*LoopRepo) ListLoopUIAnnotations

func (g *LoopRepo) ListLoopUIAnnotations(
	ctx context.Context,
	ws looppkg.WorkspaceID, profileID string,
	loopName string,
) ([]looppkg.UIAnnotation, error)

ListLoopUIAnnotations loads editor node positions for one workspace loop.

func (*LoopRepo) ListNodeAmendments

func (g *LoopRepo) ListNodeAmendments(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runID looppkg.RunID,
) ([]looppkg.NodeAmendment, error)

func (*LoopRepo) ListNodeAttempts

func (g *LoopRepo) ListNodeAttempts(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runID looppkg.RunID,
) ([]looppkg.NodeAttempt, error)

ListNodeAttempts returns the ordered workspace-scoped attempt ledger for one run.

func (*LoopRepo) ListNodeControls

func (g *LoopRepo) ListNodeControls(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runID looppkg.RunID,
) ([]looppkg.NodeControl, error)

ListNodeControls returns workspace-scoped control rows for one run.

func (*LoopRepo) ListNodeInventory

func (g *LoopRepo) ListNodeInventory(
	ctx context.Context,
	query looppkg.NodeInventoryQuery,
) (page looppkg.NodeInventoryPage, returnErr error)

ListNodeInventory returns one stable, workspace-scoped node-state page.

func (*LoopRepo) ListNodeWaits

func (g *LoopRepo) ListNodeWaits(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runID looppkg.RunID,
) ([]looppkg.NodeWait, error)

ListNodeWaits returns workspace-scoped durable waits for one run.

func (*LoopRepo) ListParkedLoopWaitEventSubscriptions

func (g *LoopRepo) ListParkedLoopWaitEventSubscriptions(
	ctx context.Context,
) ([]looppkg.ParkedWatchEventSubscription, error)

ListParkedLoopWaitEventSubscriptions rebuilds durable event-wait subscriptions after boot.

func (*LoopRepo) ListParkedLoopWaitEventSubscriptionsForLoopRun

func (g *LoopRepo) ListParkedLoopWaitEventSubscriptionsForLoopRun(
	ctx context.Context,
	runID string,
) ([]looppkg.ParkedWatchEventSubscription, error)

ListParkedLoopWaitEventSubscriptionsForLoopRun refreshes one run in the observer index.

func (*LoopRepo) ListPendingLoopEffects

func (g *LoopRepo) ListPendingLoopEffects(
	ctx context.Context,
	limit int,
) ([]looppkg.EffectOutboxEntry, error)

ListPendingLoopEffects pages committed pending rows across workspaces through loop_runs ownership.

func (*LoopRepo) ListRequests

func (g *LoopRepo) ListRequests(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	query looppkg.RequestQuery,
) (page looppkg.RequestPage, err error)

ListRequests returns a stable page without exposing private execution refs.

func (*LoopRepo) ListRouteCauses

func (g *LoopRepo) ListRouteCauses(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	runID looppkg.RunID,
	generation int64,
) ([]looppkg.RouteCause, error)

ListRouteCauses loads durable route decisions for one workspace-owned generation.

func (*LoopRepo) ListRouteCausingVerdicts

func (g *LoopRepo) ListRouteCausingVerdicts(
	ctx context.Context,
	workspaceID string,
	runID string,
	generation int64,
) ([]gate.VerdictRecord, error)

func (*LoopRepo) ListSessionLoopWork

func (g *LoopRepo) ListSessionLoopWork(
	ctx context.Context,
	scope store.ReadScope,
	workspaceID, sessionID string,
	ownerRunID looppkg.RunID,
) ([]looppkg.SessionWork, error)

ListSessionLoopWork reads durable reconciliation evidence within one session scope.

func (*LoopRepo) LookupLoopGenerationOutputStatus

func (g *LoopRepo) LookupLoopGenerationOutputStatus(
	ctx context.Context,
	workspaceID string,
	loopRunID string,
	taskRunID string,
) (string, bool, error)

LookupLoopGenerationOutputStatus returns the output correlated with one worker task run.

func (*LoopRepo) LookupRerunReplay

func (g *LoopRepo) LookupRerunReplay(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	key string,
	digest string,
) (looppkg.RerunResult, bool, error)

func (*LoopRepo) NeutralizeLoopRunOrphans

func (g *LoopRepo) NeutralizeLoopRunOrphans(ctx context.Context) (looppkg.SweepReport, error)

NeutralizeLoopRunOrphans removes claim eligibility before daemon recovery starts.

func (*LoopRepo) PauseNode

func (g *LoopRepo) PauseNode(
	ctx context.Context,
	mutation looppkg.NodePauseMutation,
) (looppkg.NodePauseResult, error)

PauseNode parks one authored node and fences every schedule it supersedes.

func (*LoopRepo) PromoteOldestQueuedLoopRun

func (g *LoopRepo) PromoteOldestQueuedLoopRun(
	ctx context.Context,
	workspaceID string,
	profileID string,
	loopName string,
	origin taskpkg.Origin,
	now time.Time,
) (taskpkg.Run, bool, error)

PromoteOldestQueuedLoopRun promotes the FIFO queued run for one workspace loop when no run is live.

func (*LoopRepo) ReactivateLoopCoordinator

ReactivateLoopCoordinator atomically transitions a parked Run and reserves its next coordinator.

func (*LoopRepo) ReconcileLoopCoordinatorsOnBoot

func (g *LoopRepo) ReconcileLoopCoordinatorsOnBoot(
	ctx context.Context,
	origin taskpkg.Origin,
	now time.Time,
) ([]taskpkg.Run, error)

ReconcileLoopCoordinatorsOnBoot re-enqueues missing coordinators and parked watch-events runs with durable cursor gaps.

func (*LoopRepo) RecordAppliedRuntime

func (g *LoopRepo) RecordAppliedRuntime(
	ctx context.Context,
	workspaceID looppkg.WorkspaceID,
	loopRunID looppkg.RunID,
	generation int,
	nodeID looppkg.NodeID,
	itemIndex int,
	resolved looppkg.ResolvedRuntime,
) error

RecordAppliedRuntime persists binder-applied runtime truth for one workspace-owned output.

func (*LoopRepo) RecordLoopGateDecisions

func (g *LoopRepo) RecordLoopGateDecisions(
	ctx context.Context,
	records []looppkg.GateDecisionRecord,
) error

func (*LoopRepo) RecordNodeLiveness

func (g *LoopRepo) RecordNodeLiveness(
	ctx context.Context,
	observation looppkg.NodeLivenessObservation,
) error

RecordNodeLiveness updates evidence or silence attention for one still-live task-run cell.

func (*LoopRepo) ReplaceInlineLoopRun

func (g *LoopRepo) ReplaceInlineLoopRun(
	ctx context.Context,
	request looppkg.InlineReplaceStoreRequest,
) (looppkg.InlineReplaceStoreResult, error)

ReplaceInlineLoopRun atomically revokes the expected live Goal and starts its prepared successor.

func (*LoopRepo) ReplaceLoopUIAnnotations

func (g *LoopRepo) ReplaceLoopUIAnnotations(
	ctx context.Context,
	ws looppkg.WorkspaceID, profileID string,
	loopName string,
	annotations []looppkg.UIAnnotation,
) error

ReplaceLoopUIAnnotations replaces editor node positions for one workspace loop.

func (*LoopRepo) RequestGoalPause

func (g *LoopRepo) RequestGoalPause(ctx context.Context, ws loop.WorkspaceID, runID loop.RunID,
	actor task.ActorContext) ([]loop.GoalPromptLease, error)

RequestGoalPause preserves terminal ownership while fencing every subsequent prompt claim.

func (*LoopRepo) RequestNodeCancellation

func (g *LoopRepo) RequestNodeCancellation(
	ctx context.Context,
	mutation looppkg.CancellationMutation,
) (looppkg.CancellationResult, error)

RequestNodeCancellation records node intent and fences all live cells for that node.

func (*LoopRepo) RequestRunCancellation

func (g *LoopRepo) RequestRunCancellation(
	ctx context.Context,
	mutation looppkg.CancellationMutation,
) (looppkg.CancellationResult, error)

RequestRunCancellation records first-writer Run intent and fences every live node cell.

func (*LoopRepo) RequeueNode

func (g *LoopRepo) RequeueNode(
	ctx context.Context,
	mutation looppkg.NodeRequeueMutation,
) (looppkg.NodeRequeueResult, error)

RequeueNode clears active quarantine, records provenance, and reserves one coordinator wake.

func (*LoopRepo) RespondRequest

func (g *LoopRepo) RespondRequest(
	ctx context.Context,
	input looppkg.RespondInput,
) (looppkg.RespondResult, error)

RespondRequest atomically claims a request and its parked cell, then reserves one coordinator wake.

func (*LoopRepo) RestoreLoopDefinitionState

func (g *LoopRepo) RestoreLoopDefinitionState(
	ctx context.Context,
	ws looppkg.WorkspaceID, profileID string,
	loopName string,
	state looppkg.DefinitionState,
) error

RestoreLoopDefinitionState atomically restores sidecars after a failed file-backed delete.

func (*LoopRepo) ResumeDeadNode

ResumeDeadNode retires one confirmed-dead worker and reserves exactly one continuation.

func (*LoopRepo) ResumeDueLoopWaitsPage

func (g *LoopRepo) ResumeDueLoopWaitsPage(
	ctx context.Context,
	now time.Time,
	cursor looppkg.WaitDueCursor,
	limit int,
) ([]taskpkg.Run, looppkg.WaitDueCursor, error)

ResumeDueLoopWaitsPage resolves one stable page of due timer waits.

func (*LoopRepo) ResumeNode

func (g *LoopRepo) ResumeNode(
	ctx context.Context,
	mutation looppkg.NodeResumeMutation,
) (looppkg.NodeResumeResult, error)

ResumeNode releases one paused node and reserves its coordinator wake atomically.

func (*LoopRepo) ResumeWait

func (g *LoopRepo) ResumeWait(
	ctx context.Context,
	mutation looppkg.WaitResumeMutation,
) (looppkg.WaitResumeResult, error)

ResumeWait atomically admits a payload, resolves the waiting cell, and reserves its coordinator.

func (*LoopRepo) SetLoopRunPauseRequested

func (g *LoopRepo) SetLoopRunPauseRequested(
	ctx context.Context,
	ws looppkg.WorkspaceID,
	runID looppkg.RunID,
	requested bool,
	actor taskpkg.ActorContext,
) error

SetLoopRunPauseRequested updates the durable operator pause intent and its authenticated actor.

func (*LoopRepo) SweepAdmissionClaims

func (g *LoopRepo) SweepAdmissionClaims(ctx context.Context, now time.Time, limit int) (int, error)

SweepAdmissionClaims removes claims whose persisted effective horizon has elapsed.

func (*LoopRepo) SweepLoopRunOrphans

func (g *LoopRepo) SweepLoopRunOrphans(ctx context.Context) (looppkg.SweepReport, error)

SweepLoopRunOrphans converges terminal execution records during daemon operation.

func (*LoopRepo) UpsertLoopConfig

func (g *LoopRepo) UpsertLoopConfig(
	ctx context.Context,
	ws looppkg.WorkspaceID, profileID string,
	loopName string,
	cfg looppkg.LoopConfig,
) error

UpsertLoopConfig persists a no-fork per-loop config override.

type MarketplaceRepo

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

func (*MarketplaceRepo) ConfigureMarketplaceSources

func (r *MarketplaceRepo) ConfigureMarketplaceSources(
	ctx context.Context, sources []store.MarketplaceSourceDefinition, revision string,
) (configuration store.MarketplaceSourceConfiguration, err error)

ConfigureMarketplaceSources publishes source membership and its fence in one transaction.

func (*MarketplaceRepo) GetMarketplaceCatalogEntry

func (r *MarketplaceRepo) GetMarketplaceCatalogEntry(
	ctx context.Context,
	source string,
	entryID string,
) (store.MarketplaceCatalogEntry, error)

GetMarketplaceCatalogEntry returns one projection by source and entry identity.

func (*MarketplaceRepo) GetMarketplaceCatalogState

func (r *MarketplaceRepo) GetMarketplaceCatalogState(
	ctx context.Context,
	source string,
) (store.MarketplaceCatalogState, error)

GetMarketplaceCatalogState returns persisted freshness plus the projected count.

func (*MarketplaceRepo) GetMarketplaceExtensionByInstallSlug

func (r *MarketplaceRepo) GetMarketplaceExtensionByInstallSlug(
	ctx context.Context,
	installSlug string,
	version string,
) (store.MarketplaceCatalogEntry, error)

GetMarketplaceExtensionByInstallSlug returns the exact curated extension acquisition row.

func (*MarketplaceRepo) ListMarketplaceCatalogEntries

func (r *MarketplaceRepo) ListMarketplaceCatalogEntries(
	ctx context.Context,
	source string,
	limit int64,
) ([]store.MarketplaceCatalogEntry, error)

ListMarketplaceCatalogEntries returns deterministic filtered projections.

func (*MarketplaceRepo) MarkMarketplaceCatalogStale

func (r *MarketplaceRepo) MarkMarketplaceCatalogStale(
	ctx context.Context, source string, generation int64, errorClass, lastError string,
) error

MarkMarketplaceCatalogStale records a refresh failure without changing entries.

func (*MarketplaceRepo) ReadMarketplaceCatalogSnapshot

func (r *MarketplaceRepo) ReadMarketplaceCatalogSnapshot(
	ctx context.Context, source string, limit int64,
) (snapshot store.MarketplaceCatalogSnapshot, err error)

ReadMarketplaceCatalogSnapshot reads entries and their revision in one transaction.

func (*MarketplaceRepo) ReadMarketplaceCatalogSources

func (r *MarketplaceRepo) ReadMarketplaceCatalogSources(
	ctx context.Context, sources []string, limit int64,
) (snapshot store.MarketplaceCatalogSourcesSnapshot, err error)

ReadMarketplaceCatalogSources binds every selected source to the same SQLite snapshot.

func (*MarketplaceRepo) ReplaceMarketplaceCatalog

func (r *MarketplaceRepo) ReplaceMarketplaceCatalog(
	ctx context.Context,
	replacement store.MarketplaceCatalogReplacement,
) (err error)

ReplaceMarketplaceCatalog atomically prunes and replaces one catalog source.

type ModelCatalogRepo

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

func (*ModelCatalogRepo) ListRowOwners

func (g *ModelCatalogRepo) ListRowOwners(
	ctx context.Context,
	opts modelcatalog.ListOptions,
) (owners []modelcatalog.SourceProviderKey, err error)

ListRowOwners returns distinct source/provider pairs owning rows that match opts. It shares ListRows filters but skips row scanning and option/effort/binding hydration.

func (*ModelCatalogRepo) ListRows

func (g *ModelCatalogRepo) ListRows(
	ctx context.Context,
	opts modelcatalog.ListOptions,
) (catalogRows []modelcatalog.ModelRow, err error)

ListRows returns deterministic catalog source rows matching the query.

func (*ModelCatalogRepo) ListSourceStatus

func (g *ModelCatalogRepo) ListSourceStatus(
	ctx context.Context,
	opts modelcatalog.StatusOptions,
) (statuses []modelcatalog.SourceStatus, err error)

ListSourceStatus returns provider-scoped source status rows.

func (*ModelCatalogRepo) ReplaceSourceRows

func (g *ModelCatalogRepo) ReplaceSourceRows(
	ctx context.Context,
	executionContext modelcatalog.CatalogExecutionContext,
	sourceID string,
	providerID string,
	rows []modelcatalog.ModelRow,
	status modelcatalog.SourceStatus,
) error

ReplaceSourceRows atomically replaces all model rows and status for one provider-scoped source.

func (*ModelCatalogRepo) ReplaceSourceRowsBatch

func (g *ModelCatalogRepo) ReplaceSourceRowsBatch(
	ctx context.Context,
	replacements []modelcatalog.SourceRowsReplacement,
) error

ReplaceSourceRowsBatch publishes a complete model catalog generation in one transaction.

type NotificationRepo

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

NotificationRepo owns notification cursor persistence.

func (*NotificationRepo) AcknowledgeAttentionSnapshot

func (r *NotificationRepo) AcknowledgeAttentionSnapshot(
	ctx context.Context, scope attention.Scope, snapshot, occurrence string,
) error

AcknowledgeAttentionSnapshot commits all requested receipts in one statement or none.

func (*NotificationRepo) AdvanceCursor

func (n *NotificationRepo) AdvanceCursor(
	ctx context.Context,
	update notifications.AdvanceCursor,
) (cursor notifications.Cursor, err error)

AdvanceCursor records a monotonic confirmed delivery position.

func (*NotificationRepo) CaptureAttentionSnapshot

func (r *NotificationRepo) CaptureAttentionSnapshot(
	ctx context.Context, scope attention.Scope, occurrences []string,
) (snapshot string, unread []string, err error)

CaptureAttentionSnapshot freezes the complete unread population before any display limit.

func (*NotificationRepo) GetCursor

GetCursor returns one durable notification cursor by key.

func (*NotificationRepo) ListCursors

func (n *NotificationRepo) ListCursors(
	ctx context.Context,
	query notifications.CursorQuery,
) (cursors []notifications.Cursor, err error)

ListCursors lists durable notification cursors matching the query.

func (*NotificationRepo) RecordCursorError

func (n *NotificationRepo) RecordCursorError(
	ctx context.Context,
	report notifications.CursorError,
) (cursor notifications.Cursor, err error)

RecordCursorError stores a cursor diagnostic without moving delivery progress.

func (*NotificationRepo) ResetCursor

func (n *NotificationRepo) ResetCursor(
	ctx context.Context,
	reset notifications.ResetCursor,
) (cursor notifications.Cursor, err error)

ResetCursor rewinds or repairs one cursor after an explicit recovery decision.

type ObserveRepo

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

func (*ObserveRepo) CountEventsByHourWeekday

func (g *ObserveRepo) CountEventsByHourWeekday(
	ctx context.Context,
	query store.OverviewSinceQuery,
) ([]store.EventHourWeekdayBucket, error)

CountEventsByHourWeekday returns hour-by-weekday session event counts inside the window.

func (*ObserveRepo) CountHookDispatchesSince

func (g *ObserveRepo) CountHookDispatchesSince(
	ctx context.Context,
	query store.OverviewSinceQuery,
) (store.HookDispatchCounts, error)

CountHookDispatchesSince counts hook dispatch completions and failures inside the window.

func (*ObserveRepo) CountTaskRunOutcomesByDay

func (g *ObserveRepo) CountTaskRunOutcomesByDay(
	ctx context.Context,
	query store.OverviewSinceQuery,
) ([]store.TaskRunOutcomeDay, error)

CountTaskRunOutcomesByDay returns terminal worker-run outcome counts per daemon-local day.

func (*ObserveRepo) CountTasksClosedByDay

func (g *ObserveRepo) CountTasksClosedByDay(
	ctx context.Context,
	query store.OverviewSinceQuery,
) ([]store.TaskClosedDay, error)

CountTasksClosedByDay returns completed-task closure counts per daemon-local day.

func (*ObserveRepo) DeleteWorkspaceObservability

func (g *ObserveRepo) DeleteWorkspaceObservability(ctx context.Context, workspaceID string) error

DeleteWorkspaceObservability removes one workspace's event summaries and token usage rollups. Bootstrap importers call it before re-seeding, because the daily usage rollup is additive and would otherwise double on every replace.

func (*ObserveRepo) LatestEventSummaryAt

func (g *ObserveRepo) LatestEventSummaryAt(
	ctx context.Context,
	query store.OverviewWorkspaceQuery,
) (time.Time, error)

LatestEventSummaryAt returns the newest event summary timestamp, zero when none exist.

func (*ObserveRepo) ListEventSummaries

func (g *ObserveRepo) ListEventSummaries(
	ctx context.Context,
	query store.EventSummaryQuery,
) (summaries []store.EventSummary, err error)

ListEventSummaries returns global event summaries filtered by the supplied options.

func (*ObserveRepo) ListTokenStats

func (g *ObserveRepo) ListTokenStats(
	ctx context.Context,
	query store.TokenStatsQuery,
) (stats []store.TokenStats, err error)

ListTokenStats returns aggregated token usage rows.

func (*ObserveRepo) ListTokenUsageByAgent

func (g *ObserveRepo) ListTokenUsageByAgent(
	ctx context.Context,
	query store.OverviewDayQuery,
) ([]store.TokenUsageAgentTotal, error)

ListTokenUsageByAgent returns summed per-agent token usage inside the rollup window.

func (*ObserveRepo) ListTokenUsageByDay

func (g *ObserveRepo) ListTokenUsageByDay(
	ctx context.Context,
	query store.OverviewDayQuery,
) ([]store.TokenUsageDay, error)

ListTokenUsageByDay returns summed daily token usage inside the rollup window.

func (*ObserveRepo) ListTokenUsageByProfile

func (g *ObserveRepo) ListTokenUsageByProfile(
	ctx context.Context,
	query store.OverviewDayQuery,
) ([]store.TokenUsageProfileTotal, error)

ListTokenUsageByProfile returns owner-labeled usage buckets inside the rollup window.

func (*ObserveRepo) LongestUserSessionSince

func (g *ObserveRepo) LongestUserSessionSince(
	ctx context.Context,
	query store.OverviewSinceQuery,
) (*store.LongestSessionSample, error)

LongestUserSessionSince returns the longest user session started inside the window, nil when none.

func (*ObserveRepo) RecordTokenUsage

func (g *ObserveRepo) RecordTokenUsage(
	ctx context.Context,
	stats store.TokenStatsUpdate,
	daily store.TokenUsageDailyUpdate,
) (err error)

RecordTokenUsage writes the session aggregate and the daily rollup in one transaction so a rollup failure cannot leave overview usage undercounting the tokens already committed to token_stats.

func (*ObserveRepo) SumTokenUsageCost

func (g *ObserveRepo) SumTokenUsageCost(
	ctx context.Context,
	query store.OverviewDayQuery,
) ([]store.TokenUsageCostGroup, error)

SumTokenUsageCost returns provenance-grouped cost totals inside the rollup window.

func (*ObserveRepo) SweepObservability

func (g *ObserveRepo) SweepObservability(
	ctx context.Context,
	cutoff time.Time,
) (result store.ObservabilityRetentionSweepResult, err error)

func (*ObserveRepo) UpdateTokenStats

func (g *ObserveRepo) UpdateTokenStats(ctx context.Context, update store.TokenStatsUpdate) error

UpdateTokenStats merges one or more turns of token usage into the session aggregate.

func (*ObserveRepo) UpsertTokenUsageDaily

func (g *ObserveRepo) UpsertTokenUsageDaily(ctx context.Context, update store.TokenUsageDailyUpdate) error

UpsertTokenUsageDaily merges one turn of token usage into the daily rollup bucket.

func (*ObserveRepo) WriteEventSummaries

func (g *ObserveRepo) WriteEventSummaries(
	ctx context.Context,
	summaries []store.EventSummary,
) (err error)

WriteEventSummaries stores related observability summaries in one transaction.

func (*ObserveRepo) WriteEventSummary

func (g *ObserveRepo) WriteEventSummary(ctx context.Context, summary store.EventSummary) error

WriteEventSummary stores a lightweight cross-session summary entry.

type OpenOption

type OpenOption func(*openConfig)

OpenOption configures optional GlobalDB composition dependencies.

func WithOperatorHomeDir

func WithOperatorHomeDir(operatorHomeDir string) OpenOption

WithOperatorHomeDir supplies the canonical operator home to workspace-removal migrations.

func WithSessionEventMetadataOpener

func WithSessionEventMetadataOpener(opener store.SessionEventMetadataOpener) OpenOption

WithSessionEventMetadataOpener supplies the per-session replay reader used by watch-events.

type PermissionRepo

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

func (*PermissionRepo) ListPermissionLog

func (g *PermissionRepo) ListPermissionLog(
	ctx context.Context,
	query store.PermissionLogQuery,
) (entries []store.PermissionLogEntry, err error)

ListPermissionLog returns permission audit rows filtered by the supplied options.

func (*PermissionRepo) WritePermissionLog

func (g *PermissionRepo) WritePermissionLog(ctx context.Context, entry store.PermissionLogEntry) error

WritePermissionLog stores one permission decision audit row.

type ProfileWriteExecutor

type ProfileWriteExecutor interface {
	ExecContext(context.Context, string, ...any) (sql.Result, error)
	QueryContext(context.Context, string, ...any) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...any) *sql.Row
}

ProfileWriteExecutor is the transaction surface used by the profile domain. The profile manager owns cross-table lifecycle mutations, while GlobalDB retains ownership of SQLite write serialization.

type SessionProcessRepo

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

func (*SessionProcessRepo) LoadProcessObservations

func (g *SessionProcessRepo) LoadProcessObservations(ctx context.Context) ([]sessionprocess.Observation, error)

func (*SessionProcessRepo) SaveProcessObservations

func (g *SessionProcessRepo) SaveProcessObservations(
	ctx context.Context,
	updates []sessionprocess.Observation,
	deletes []sessionprocess.Identity,
) (err error)

type SessionRepo

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

func (*SessionRepo) AbandonReplyWatch

func (g *SessionRepo) AbandonReplyWatch(ctx context.Context, id, reason string) error

func (*SessionRepo) Acknowledge

func (g *SessionRepo) Acknowledge(
	ctx context.Context,
	id, turnID string,
) (out store.SessionSubagent, wake *store.SessionSubagentWake, err error)

func (*SessionRepo) AdvanceSessionInputGeneration

func (g *SessionRepo) AdvanceSessionInputGeneration(
	ctx context.Context,
	sessionID string,
	now time.Time,
) (int64, error)

AdvanceSessionInputGeneration increments the session generation used to fence stale queue entries.

func (*SessionRepo) AggregateSessionsByAgent

func (g *SessionRepo) AggregateSessionsByAgent(
	ctx context.Context,
	query store.SessionAgentMetricsQuery,
) (metrics []store.SessionAgentMetrics, err error)

AggregateSessionsByAgent returns exact durable visible-session metrics grouped by agent.

func (*SessionRepo) AssociateSubagentWorktree

func (g *SessionRepo) AssociateSubagentWorktree(ctx context.Context, row store.SessionSubagent) error

func (*SessionRepo) AttachSession

AttachSession acquires a short-lived attach lease for a resumable session.

func (*SessionRepo) BindReplyWatch

func (g *SessionRepo) BindReplyWatch(ctx context.Context, id, turn, queue string) error

func (*SessionRepo) CancelPendingSessionInputs

func (g *SessionRepo) CancelPendingSessionInputs(
	ctx context.Context,
	sessionID string,
	generation int64,
	now time.Time,
) (int, error)

CancelPendingSessionInputs cancels stale entries older than the supplied generation.

func (*SessionRepo) CancelPendingSessionSteer

func (g *SessionRepo) CancelPendingSessionSteer(ctx context.Context, sessionID, entryID string, now time.Time) error

CancelPendingSessionSteer retires guidance canceled with its owning session, leaving the original admission receipt available for idempotent replay.

func (*SessionRepo) CancelSessionInput

func (g *SessionRepo) CancelSessionInput(
	ctx context.Context,
	sessionID string,
	entryID string,
	now time.Time,
) (store.SessionInputQueueEntry, error)

CancelSessionInput cancels one pending queue entry.

func (*SessionRepo) ClaimNextSessionInput

func (g *SessionRepo) ClaimNextSessionInput(
	ctx context.Context,
	sessionID string,
	now time.Time,
) (entry store.SessionInputQueueEntry, ok bool, err error)

ClaimNextSessionInput atomically leases the next eligible input for dispatch.

func (*SessionRepo) ClaimSessionInputBatch

func (g *SessionRepo) ClaimSessionInputBatch(
	ctx context.Context,
	sessionID string,
	limit int,
	accept func(*store.SessionInputQueueEntry) bool,
	now time.Time,
) (claimed []store.SessionInputQueueEntry, err error)

ClaimSessionInputBatch leases the consecutive dispatch-ordered entries that follow an already claimed head, stopping at the first one accept refuses. The candidates use the dispatch filter, so a Goal cutoff, a newer generation, or a different owner always ends the batch.

func (*SessionRepo) ClaimSessionPromptAdmission

func (g *SessionRepo) ClaimSessionPromptAdmission(
	ctx context.Context,
	req store.SessionPromptAdmissionRequest,
) (admission store.SessionPromptAdmission, created bool, err error)

ClaimSessionPromptAdmission reserves one exact external prompt command.

func (*SessionRepo) ClearLaterReturn

func (g *SessionRepo) ClearLaterReturn(ctx context.Context, sessionID string) (bool, error)

ClearLaterReturn clears the back-from-Later mark of one session.

func (*SessionRepo) ClearSessionInputs

func (*SessionRepo) CommitSessionPromptDispatch

func (g *SessionRepo) CommitSessionPromptDispatch(
	ctx context.Context,
	workspaceID string,
	sessionID string,
	idempotencyKey string,
	now time.Time,
) error

CommitSessionPromptDispatch crosses the at-most-once boundary before any non-idempotent effect.

func (*SessionRepo) CompleteSessionPromptAdmission

func (g *SessionRepo) CompleteSessionPromptAdmission(
	ctx context.Context,
	workspaceID string,
	sessionID string,
	idempotencyKey string,
	result store.SessionPromptAdmissionResult,
	now time.Time,
) (store.SessionPromptAdmission, error)

CompleteSessionPromptAdmission stores the stable replay result for one command.

func (*SessionRepo) CreatePendingInteraction

func (g *SessionRepo) CreatePendingInteraction(
	ctx context.Context,
	req store.PendingInteractionCreate,
) (commit store.SessionAttentionCommit, err error)

CreatePendingInteraction persists the canonical record and count projection together.

func (*SessionRepo) CreateSessionFolder

func (g *SessionRepo) CreateSessionFolder(
	ctx context.Context,
	scope store.SessionLayoutScope,
	id string,
	name string,
) (store.SessionFolder, error)

CreateSessionFolder inserts a folder at the top of the scope's folder order.

func (*SessionRepo) CreateWorkspaceFolder

func (g *SessionRepo) CreateWorkspaceFolder(
	ctx context.Context,
	profileID string,
	id string,
	name string,
) (store.WorkspaceFolder, error)

CreateWorkspaceFolder inserts a root folder at the top of the folder order.

func (*SessionRepo) CurrentSessionInputGeneration

func (g *SessionRepo) CurrentSessionInputGeneration(ctx context.Context, sessionID string) (int64, error)

CurrentSessionInputGeneration returns the persisted busy-input generation for a session.

func (*SessionRepo) DeleteReserved

func (g *SessionRepo) DeleteReserved(ctx context.Context, id string) error

func (*SessionRepo) DeleteSession

func (g *SessionRepo) DeleteSession(ctx context.Context, sessionID string) error

DeleteSession removes one durable session catalog row and tombstones any derive receipt whose child it was, in the same transaction.

func (*SessionRepo) DeleteSessionFolder

func (g *SessionRepo) DeleteSessionFolder(ctx context.Context, scope store.SessionLayoutScope, id string) error

DeleteSessionFolder removes a folder. Its placements cascade away, which returns member sessions to the workspace root without touching sessions.

func (*SessionRepo) DeleteWorkspaceFolder

func (g *SessionRepo) DeleteWorkspaceFolder(ctx context.Context, profileID string, id string) error

DeleteWorkspaceFolder removes a folder. Its placements cascade away, which returns member workspaces to the unplaced root without touching them.

func (*SessionRepo) DeliverReplyWatch

func (g *SessionRepo) DeliverReplyWatch(
	ctx context.Context,
	id string,
	entry store.SessionInputQueueInsert,
) (delivered bool, err error)

func (*SessionRepo) Dispose

func (g *SessionRepo) Dispose(
	ctx context.Context,
	f store.SubagentDisposeFilter,
) (out []store.SessionSubagent, err error)

func (*SessionRepo) EnqueueAdmittedSessionInput

func (g *SessionRepo) EnqueueAdmittedSessionInput(
	ctx context.Context,
	admissionReq store.SessionPromptAdmissionRequest,
	queueReq store.SessionInputQueueInsert,
) (
	admission store.SessionPromptAdmission,
	entry store.SessionInputQueueEntry,
	position int,
	created bool,
	err error,
)

EnqueueAdmittedSessionInput atomically binds a command receipt and one queue entry.

func (*SessionRepo) EnqueueInterruptSessionInput

func (g *SessionRepo) EnqueueInterruptSessionInput(
	ctx context.Context,
	req store.SessionInputQueueInsert,
) (entry store.SessionInputQueueEntry, canceled int, err error)

EnqueueInterruptSessionInput persists replacement input without removing parked work.

func (*SessionRepo) EnqueueSessionInput

func (g *SessionRepo) EnqueueSessionInput(
	ctx context.Context,
	req store.SessionInputQueueInsert,
) (entry store.SessionInputQueueEntry, position int, err error)

EnqueueSessionInput appends one queued operator input entry under the configured cap.

func (*SessionRepo) EnrichNativeSubagentResult

func (g *SessionRepo) EnrichNativeSubagentResult(
	ctx context.Context,
	in store.NativeSubagentResultEnrichment,
) (out store.SessionSubagent, changed bool, err error)

func (*SessionRepo) EnsureSessionTranscriptEpoch

func (g *SessionRepo) EnsureSessionTranscriptEpoch(
	ctx context.Context,
	update store.SessionTranscriptEpochUpdate,
) (int64, error)

EnsureSessionTranscriptEpoch raises one session transcript epoch to update.Minimum without incrementing past it.

func (*SessionRepo) FailStaleDispatchingSessionInputs

func (g *SessionRepo) FailStaleDispatchingSessionInputs(ctx context.Context, now time.Time) (int, error)

FailStaleDispatchingSessionInputs settles non-Goal leases left by a previous daemon process. Their dispatch outcome is unknown, so they fail (marking any admission receipt indeterminate) instead of requeueing and risking a duplicate turn; either way they stop holding queue capacity. Steers staged but never reserved are recovered first so they cannot stay undispatchable.

func (*SessionRepo) FailWake

func (g *SessionRepo) FailWake(
	ctx context.Context,
	id string,
) (wake store.SessionSubagentWake, rows []store.SessionSubagent, err error)

func (*SessionRepo) FinalizeSubagent

func (g *SessionRepo) FinalizeSubagent(
	ctx context.Context,
	in store.SubagentFinalize,
) (out store.SessionSubagent, changed bool, err error)

func (*SessionRepo) FireReplyWatch

func (g *SessionRepo) FireReplyWatch(ctx context.Context, id string, f store.ReplyWatchFire) (bool, error)

func (*SessionRepo) GetReplyWatch

func (g *SessionRepo) GetReplyWatch(ctx context.Context, id string) (store.ReplyWatch, error)

func (*SessionRepo) GetSessionAttention

func (g *SessionRepo) GetSessionAttention(
	ctx context.Context,
	sessionID string,
) (store.SessionAttention, error)

GetSessionAttention returns the catalog-owned attention fence for one session.

func (*SessionRepo) GetSessionCreationIdentity

func (g *SessionRepo) GetSessionCreationIdentity(
	ctx context.Context,
	sessionID string,
) (store.SessionCreationIdentity, error)

GetSessionCreationIdentity loads one complete immutable identity witness.

func (*SessionRepo) GetSessionCreationProfile

func (g *SessionRepo) GetSessionCreationProfile(
	ctx context.Context,
	profileRef string,
) (store.SessionCreationProfile, error)

GetSessionCreationProfile loads and verifies one immutable profile.

func (*SessionRepo) GetSessionInputQueueEntry

func (g *SessionRepo) GetSessionInputQueueEntry(
	ctx context.Context,
	sessionID string,
	entryID string,
) (store.SessionInputQueueEntry, error)

GetSessionInputQueueEntry returns one exact queue entry for durable await/recovery.

func (*SessionRepo) GetSessionInputQueueEntryByID

func (g *SessionRepo) GetSessionInputQueueEntryByID(
	ctx context.Context,
	entryID string,
) (store.SessionInputQueueEntry, error)

GetSessionInputQueueEntryByID returns one exact internal queue entry by its globally unique ID.

func (*SessionRepo) GetSubagent

func (g *SessionRepo) GetSubagent(ctx context.Context, workspaceID, id string) (store.SessionSubagent, error)

func (*SessionRepo) GetSubagentByChild

func (g *SessionRepo) GetSubagentByChild(ctx context.Context, id string) (store.SessionSubagent, error)

func (*SessionRepo) GetSubagentByID

func (g *SessionRepo) GetSubagentByID(ctx context.Context, id string) (store.SessionSubagent, error)

func (*SessionRepo) GetWake

func (g *SessionRepo) GetWake(
	ctx context.Context,
	id string,
) (out store.SessionSubagentWake, items []store.SessionSubagent, err error)

func (*SessionRepo) HasSubagentCommittedAdmission

func (g *SessionRepo) HasSubagentCommittedAdmission(ctx context.Context, ws, child, id string) (bool, error)

func (*SessionRepo) InsertReplyWatchTx

func (g *SessionRepo) InsertReplyWatchTx(
	ctx context.Context,
	exec store.DBTX,
	w store.ReplyWatchRegistration,
) (store.ReplyWatch, error)

func (*SessionRepo) LinkChild

func (g *SessionRepo) LinkChild(
	ctx context.Context,
	id, childID string,
	at time.Time,
) (out store.SessionSubagent, err error)

func (*SessionRepo) ListNativeMissingResult

func (g *SessionRepo) ListNativeMissingResult(
	ctx context.Context,
	since time.Time,
	after store.NativeMissingResultCursor,
	limit int,
) ([]store.SessionSubagent, error)

func (*SessionRepo) ListOpenWakes

func (g *SessionRepo) ListOpenWakes(ctx context.Context) ([]store.SessionSubagentWake, error)

func (*SessionRepo) ListOrphanSubagentSessions

func (g *SessionRepo) ListOrphanSubagentSessions(ctx context.Context) ([]string, error)

func (*SessionRepo) ListPending

func (g *SessionRepo) ListPending(ctx context.Context, parentID string) ([]store.SessionSubagent, error)

func (*SessionRepo) ListPendingInteractions

func (g *SessionRepo) ListPendingInteractions(
	ctx context.Context,
	sessionID string,
	statuses []string,
) (interactions []store.PendingInteraction, err error)

ListPendingInteractions returns sanitized durable interactions for one session.

func (*SessionRepo) ListPendingReplyWatchesBySender

func (g *SessionRepo) ListPendingReplyWatchesBySender(ctx context.Context, sender string) ([]store.ReplyWatch, error)

ListPendingReplyWatchesBySender reads one sender's armed and fired watches through its index.

func (*SessionRepo) ListPendingSessionInputClearTraces

func (g *SessionRepo) ListPendingSessionInputClearTraces(
	ctx context.Context,
	sessionID string,
) ([]store.SessionInputClearTrace, error)

func (*SessionRepo) ListPendingSessionInputs

func (g *SessionRepo) ListPendingSessionInputs(
	ctx context.Context,
	sessionID string,
) ([]store.SessionInputQueueEntry, error)

ListPendingSessionInputs returns current-generation operator inputs in dispatch order.

func (*SessionRepo) ListReplyWatches

func (g *SessionRepo) ListReplyWatches(ctx context.Context, f store.ReplyWatchFilter) ([]store.ReplyWatch, error)

func (*SessionRepo) ListSessionFolders

func (g *SessionRepo) ListSessionFolders(
	ctx context.Context,
	scope store.SessionLayoutScope,
) ([]store.SessionFolder, error)

ListSessionFolders returns one profile's folders in a workspace in manual order.

func (*SessionRepo) ListSessionHealthByIDs

func (g *SessionRepo) ListSessionHealthByIDs(
	ctx context.Context,
	sessionIDs []string,
) ([]heartbeat.SessionHealth, error)

ListSessionHealthByIDs loads health for one bounded session catalog page in one query.

func (*SessionRepo) ListSessions

func (g *SessionRepo) ListSessions(
	ctx context.Context,
	query store.SessionListQuery,
) (sessions []store.SessionInfo, err error)

ListSessions returns indexed sessions ordered by most recent update.

func (*SessionRepo) ListStaleReserved

func (g *SessionRepo) ListStaleReserved(ctx context.Context, olderThan time.Time) ([]store.SessionSubagent, error)

func (*SessionRepo) ListSubagentWorktreeCleanupPending

func (g *SessionRepo) ListSubagentWorktreeCleanupPending(ctx context.Context) ([]store.SessionSubagent, error)

func (*SessionRepo) ListSubagents

func (*SessionRepo) ListUnfinalizedDelegated

func (g *SessionRepo) ListUnfinalizedDelegated(ctx context.Context) ([]store.SessionSubagent, error)

func (*SessionRepo) ListUnfinalizedNative

func (g *SessionRepo) ListUnfinalizedNative(ctx context.Context) ([]store.SessionSubagent, error)

func (*SessionRepo) ListWakesByParent

func (g *SessionRepo) ListWakesByParent(
	ctx context.Context, parentID string, states []string,
) ([]store.SessionSubagentWake, error)

func (*SessionRepo) LookupSessionPromptAdmission

func (g *SessionRepo) LookupSessionPromptAdmission(
	ctx context.Context,
	workspaceID, sessionID, idempotencyKey string,
) (store.SessionPromptAdmission, bool, error)

LookupSessionPromptAdmission reads an admitted command by its idempotency key without classifying a replay, so a caller can recover the frozen origin before re-applying new-send checks.

func (*SessionRepo) LookupSessionPromptAdmissionByMessageID

func (g *SessionRepo) LookupSessionPromptAdmissionByMessageID(
	ctx context.Context,
	workspaceID, sessionID, messageID string,
) (store.SessionPromptAdmission, bool, error)

LookupSessionPromptAdmissionByMessageID reads one admission by its message identity.

func (*SessionRepo) MarkDerivationChildDeleted

func (g *SessionRepo) MarkDerivationChildDeleted(ctx context.Context, childSessionID string, at time.Time) error

MarkDerivationChildDeleted tombstones every receipt whose child is sessionID. The receipts themselves are never deleted, so a retry keeps its recorded answer.

func (*SessionRepo) MarkFirstPromptAdmitted

func (g *SessionRepo) MarkFirstPromptAdmitted(ctx context.Context, id string) error

func (*SessionRepo) MarkSessionEndedEarly

func (g *SessionRepo) MarkSessionEndedEarly(
	ctx context.Context,
	sessionID string,
	turnID string,
) (commit store.SessionAttentionCommit, err error)

MarkSessionEndedEarly records or clears the turn that ended without delivering. It leaves the revision fences alone: the settle that follows owns the badge edge.

func (*SessionRepo) MarkSessionInputClearTraceProjected

func (g *SessionRepo) MarkSessionInputClearTraceProjected(
	ctx context.Context,
	sessionID, entryID string,
	now time.Time,
) error

func (*SessionRepo) MarkSessionInputFailed

func (g *SessionRepo) MarkSessionInputFailed(
	ctx context.Context,
	sessionID string,
	entryID string,
	summary string,
	now time.Time,
) error

MarkSessionInputFailed records a dispatch failure for one queue entry.

func (*SessionRepo) MarkSessionInputSent

func (g *SessionRepo) MarkSessionInputSent(
	ctx context.Context,
	sessionID string,
	entryID string,
	now time.Time,
) error

MarkSessionInputSent records successful dispatch for one queue entry.

func (*SessionRepo) MarkSessionInputSentInTurn

func (g *SessionRepo) MarkSessionInputSentInTurn(
	ctx context.Context,
	sessionID string,
	entryID string,
	turnID string,
	now time.Time,
) error

MarkSessionInputSentInTurn records successful dispatch and the turn that consumed the entry; a batched dispatch stamps every entry with the one turn that carried them. An empty turn id keeps the stored one.

func (*SessionRepo) MarkSessionPromptAdmissionIndeterminate

func (g *SessionRepo) MarkSessionPromptAdmissionIndeterminate(
	ctx context.Context,
	workspaceID string,
	sessionID string,
	idempotencyKey string,
	reason string,
	now time.Time,
) error

MarkSessionPromptAdmissionIndeterminate permanently fences an uncertain post-admission effect.

func (*SessionRepo) MarkSessionSeen

func (g *SessionRepo) MarkSessionSeen(
	ctx context.Context,
	sessionID string,
	at time.Time,
) (commit store.SessionAttentionCommit, err error)

MarkSessionSeen advances the seen fence only when unseen settled work exists.

func (*SessionRepo) MarkSessionSettled

func (g *SessionRepo) MarkSessionSettled(
	ctx context.Context,
	sessionID string,
	seen bool,
	at time.Time,
) (commit store.SessionAttentionCommit, err error)

MarkSessionSettled advances the catalog-owned settled fence.

func (*SessionRepo) MarkWakeDispatched

func (g *SessionRepo) MarkWakeDispatched(ctx context.Context, id string) error

func (*SessionRepo) MarkWakeSteerRequeued

func (g *SessionRepo) MarkWakeSteerRequeued(ctx context.Context, id string) error

func (*SessionRepo) MoveSession

func (g *SessionRepo) MoveSession(
	ctx context.Context,
	scope store.SessionLayoutScope,
	sessionID string,
	folderID string,
) error

MoveSession places a session at the end of a folder, or returns it to the unplaced workspace root when folderID is empty.

func (*SessionRepo) MoveWorkspace

func (g *SessionRepo) MoveWorkspace(ctx context.Context, profileID string, workspaceID string, folderID string) error

MoveWorkspace changes a workspace's container: it joins the end of a folder, or the end of the placed root when folderID is empty. A workspace already in that container keeps its position; ReorderWorkspaces owns order within it.

func (*SessionRepo) OpenOrJoinWake

func (g *SessionRepo) OpenOrJoinWake(
	ctx context.Context,
	parentID string,
	ids []string,
	newWakeID string,
) (out store.SessionSubagentWake, err error)

func (*SessionRepo) PageSessions

func (g *SessionRepo) PageSessions(
	ctx context.Context,
	query store.SessionCatalogPageQuery,
) (page store.SessionCatalogPage, err error)

PageSessions returns one bounded durable-catalog page and a filter-scoped total.

func (*SessionRepo) ParkSession

func (g *SessionRepo) ParkSession(ctx context.Context, park store.SessionLaterPark) (store.SessionInfo, error)

ParkSession marks one stopped, unarchived workspace session as parked in Later.

func (*SessionRepo) PeekNextSessionInput

func (g *SessionRepo) PeekNextSessionInput(
	ctx context.Context,
	sessionID string,
) (store.SessionInputQueueEntry, bool, error)

PeekNextSessionInput returns the oldest eligible human or managed row without claiming it.

func (*SessionRepo) PromoteQueuedAgentSessionInputToSteer

func (g *SessionRepo) PromoteQueuedAgentSessionInputToSteer(
	ctx context.Context,
	sessionID string,
	entryID string,
	targetTurnID string,
	now time.Time,
) (entry store.SessionInputQueueEntry, promoted bool, err error)

PromoteQueuedAgentSessionInputToSteer turns one queued agent message into staged steering for the target's live turn in place, keeping its message, event, admission, and origin identity. It reports false when the entry is no longer eligible: already dispatched, carrying skill invocations, operator input waiting, or the sender already holding a queued steer.

func (*SessionRepo) PromoteSessionInputToSteer

func (g *SessionRepo) PromoteSessionInputToSteer(
	ctx context.Context,
	sessionID string,
	entryID string,
	replacement store.SessionInputQueueInsert,
) (store.SessionInputQueueEntry, bool, error)

PromoteSessionInputToSteer atomically replaces one queued entry with priority steering input.

func (*SessionRepo) PutSessionCreationProfile

func (g *SessionRepo) PutSessionCreationProfile(
	ctx context.Context,
	profile store.SessionCreationProfile,
) (string, error)

PutSessionCreationProfile persists one immutable content-addressed profile.

func (*SessionRepo) ReconcileSessions

func (g *SessionRepo) ReconcileSessions(
	ctx context.Context,
	sessions []store.SessionInfo,
) (store.ReconcileResult, error)

ReconcileSessions upserts on-disk sessions and marks missing ones as orphaned.

func (*SessionRepo) ReconcileStoppedChildActivity

func (g *SessionRepo) ReconcileStoppedChildActivity(ctx context.Context) ([]store.SessionSubagent, error)

func (*SessionRepo) RecoverSessionWorktreeBinding

func (g *SessionRepo) RecoverSessionWorktreeBinding(
	ctx context.Context,
	update store.SessionWorktreeBindingUpdate,
) error

func (*SessionRepo) RegisterDerivedSession

func (g *SessionRepo) RegisterDerivedSession(
	ctx context.Context,
	info store.SessionInfo,
	identity store.SessionCreationIdentity,
	receipt store.SessionDerivationReceipt,
) error

RegisterDerivedSession writes the child's catalog row, its creation identity, and the derive receipt with its immutable outcome in one transaction. A receipt already recorded for the same scope (workspace, or User profile) and key rolls the whole transaction back with store.ErrSessionDerivationExists.

func (*SessionRepo) RegisterSession

func (g *SessionRepo) RegisterSession(ctx context.Context, session store.SessionInfo) error

RegisterSession inserts or refreshes a session index row.

func (*SessionRepo) RegisterSessionWithCreationIdentity

func (g *SessionRepo) RegisterSessionWithCreationIdentity(
	ctx context.Context,
	session store.SessionInfo,
	identity store.SessionCreationIdentity,
) (store.SessionCreationRegistration, error)

RegisterSessionWithCreationIdentity atomically creates or refreshes one identity-matched session.

func (*SessionRepo) ReleaseSessionInput

func (g *SessionRepo) ReleaseSessionInput(ctx context.Context, sessionID string, entryID string, now time.Time) error

ReleaseSessionInput returns a leased entry to the queued state after a dispatch race.

func (*SessionRepo) RenameSessionFolder

func (g *SessionRepo) RenameSessionFolder(
	ctx context.Context,
	scope store.SessionLayoutScope,
	id string,
	name string,
) (store.SessionFolder, error)

RenameSessionFolder changes one folder's display name.

func (*SessionRepo) RenameWorkspaceFolder

func (g *SessionRepo) RenameWorkspaceFolder(
	ctx context.Context,
	profileID string,
	id string,
	name string,
) (store.WorkspaceFolder, error)

RenameWorkspaceFolder changes one folder's display name.

func (*SessionRepo) ReorderSessionFolders

func (g *SessionRepo) ReorderSessionFolders(
	ctx context.Context,
	scope store.SessionLayoutScope,
	ids []string,
) ([]store.SessionFolder, error)

ReorderSessionFolders applies a complete folder order for the scope.

func (*SessionRepo) ReorderSessions

func (g *SessionRepo) ReorderSessions(
	ctx context.Context,
	scope store.SessionLayoutScope,
	folderID string,
	sessionIDs []string,
) error

ReorderSessions pins the listed sessions, in order, at the head of one container (a folder, or the workspace root when folderID is empty). Members already in the container but absent from the list keep their relative order after the listed sessions, so a partial page never drops placements.

func (*SessionRepo) ReorderWorkspaceFolders

func (g *SessionRepo) ReorderWorkspaceFolders(ctx context.Context, profileID string, ids []string) error

ReorderWorkspaceFolders applies a complete folder order for the profile.

func (*SessionRepo) ReorderWorkspaces

func (g *SessionRepo) ReorderWorkspaces(
	ctx context.Context,
	profileID string,
	folderID string,
	workspaceIDs []string,
) error

ReorderWorkspaces pins the listed workspaces, in order, at the head of one container (a folder, or the root when folderID is empty). Members already in the container but absent from the list keep their relative order after the listed workspaces.

func (*SessionRepo) ReplaceSessionInput

func (g *SessionRepo) ReplaceSessionInput(
	ctx context.Context,
	sessionID string,
	entryID string,
	replacement store.SessionInputQueueInsert,
) (store.SessionInputQueueEntry, bool, error)

ReplaceSessionInput atomically cancels one queued entry and inserts its replacement.

func (*SessionRepo) ReplaySessionPromptAdmission

func (g *SessionRepo) ReplaySessionPromptAdmission(
	ctx context.Context,
	req store.SessionPromptAdmissionRequest,
) (store.SessionPromptAdmission, bool, error)

ReplaySessionPromptAdmission returns an exact prior receipt without claiming a new identity.

func (*SessionRepo) ReplyWatchByMessage

func (g *SessionRepo) ReplyWatchByMessage(
	ctx context.Context,
	targetSessionID, messageID string,
) (store.ReplyWatch, bool, error)

ReplyWatchByMessage reads the watch armed for one message admitted into a target session.

func (*SessionRepo) ReserveSessionSteer

func (g *SessionRepo) ReserveSessionSteer(
	ctx context.Context, sessionID, entryID string, now time.Time,
) (entry store.SessionInputQueueEntry, reserved bool, err error)

func (*SessionRepo) ReserveSubagent

func (g *SessionRepo) ReserveSubagent(
	ctx context.Context,
	row store.SessionSubagent,
) (out store.SessionSubagent, created bool, err error)

func (*SessionRepo) ResolveSessionSteer

func (g *SessionRepo) ResolveSessionSteer(
	ctx context.Context, sessionID, entryID string, delivery store.SteerDeliveryMode, now time.Time,
) (entry store.SessionInputQueueEntry, err error)

func (*SessionRepo) ReturnDueLaterSessions

func (g *SessionRepo) ReturnDueLaterSessions(
	ctx context.Context,
	now time.Time,
	limit int,
) ([]store.SessionLaterReturn, error)

ReturnDueLaterSessions brings back parked sessions whose return time passed. Each return is a conditional update, so concurrent sweeps never return a session twice.

func (*SessionRepo) RevertPromotedAgentSessionInput

func (g *SessionRepo) RevertPromotedAgentSessionInput(
	ctx context.Context,
	sessionID string,
	entryID string,
	now time.Time,
) (bool, error)

RevertPromotedAgentSessionInput returns a promoted agent message whose live delivery never started to after-turn delivery, so a failed promotion defers the message instead of dropping it. A reservation already committed the message's admission dispatch; reverting a reserved row completes that admission again in the same transaction, so the later ordinary claim can commit it.

func (*SessionRepo) RewriteSubagentWakeInput

func (g *SessionRepo) RewriteSubagentWakeInput(
	ctx context.Context, wakeID, text string, metadata json.RawMessage,
) error

func (*SessionRepo) SaveSessionBranch

func (g *SessionRepo) SaveSessionBranch(ctx context.Context, workspaceID, id, branch string) error

func (*SessionRepo) SessionArchivedAt

func (g *SessionRepo) SessionArchivedAt(
	ctx context.Context,
	workspaceID string,
	sessionID string,
) (*time.Time, error)

SessionArchivedAt returns workspace-scoped archive metadata for one session.

func (*SessionRepo) SessionBranches

func (g *SessionRepo) SessionBranches(ctx context.Context, ids []string) (map[string]string, error)

func (*SessionRepo) SessionCatalogBranches

func (g *SessionRepo) SessionCatalogBranches(
	ctx context.Context,
	query store.SessionCatalogPageQuery,
) (_ []store.SessionBranchKey, err error)

SessionCatalogBranches discovers lightweight refresh keys before the board column and page cut.

func (*SessionRepo) SessionCatalogFacets

func (g *SessionRepo) SessionCatalogFacets(
	ctx context.Context,
	query store.SessionCatalogPageQuery,
) (result store.SessionCatalogFacetResult, err error)

SessionCatalogFacets counts eligible durable badge and approval metadata. It never scans rich rows, per-session databases, or health/transcript payloads.

func (*SessionRepo) SessionCatalogProfiles

func (g *SessionRepo) SessionCatalogProfiles(ctx context.Context, workspaceID string) ([]string, error)

func (*SessionRepo) SessionCatalogRelations

func (g *SessionRepo) SessionCatalogRelations(
	ctx context.Context,
	query store.SessionCatalogRelationsQuery,
) (result store.SessionCatalogRelations, err error)

SessionCatalogRelations reads direct-child aggregates and parent titles in one scoped query. Continued and forked sessions name their source as provenance, so they never count as its children.

func (*SessionRepo) SessionDerivationReceipt

func (g *SessionRepo) SessionDerivationReceipt(
	ctx context.Context,
	workspaceID string,
	idempotencyKey string,
	profileID string,
) (store.SessionDerivationReceipt, bool, error)

SessionDerivationReceipt loads one receipt by its project or User-profile idempotency key.

func (*SessionRepo) SessionInputQueueSummary

func (g *SessionRepo) SessionInputQueueSummary(
	ctx context.Context,
	sessionID string,
) (summary store.SessionInputQueueSummary, err error)

SessionInputQueueSummary returns the current generation and active pending counts for one session.

func (*SessionRepo) SessionLaterState

func (g *SessionRepo) SessionLaterState(
	ctx context.Context,
	workspaceID string,
	sessionID string,
) (*store.SessionLater, *time.Time, error)

SessionLaterState reads the Later state and back-from-Later mark of one session.

func (*SessionRepo) SessionMessageWindow

func (g *SessionRepo) SessionMessageWindow(
	ctx context.Context,
	targetWorkspaceID, targetSessionID, senderSessionID string,
	since time.Time,
) (store.SessionMessageWindow, error)

SessionMessageWindow counts one sender's durable admissions into a target since a cutoff.

func (*SessionRepo) SessionPlacements

func (g *SessionRepo) SessionPlacements(
	ctx context.Context,
	sessionIDs []string,
) (map[string]store.SessionPlacement, error)

SessionPlacements returns placements for a bounded set of session IDs.

func (*SessionRepo) SessionTranscriptEpoch

func (g *SessionRepo) SessionTranscriptEpoch(ctx context.Context, sessionID string) (int64, error)

SessionTranscriptEpoch returns the durable transcript reset epoch for one session.

func (*SessionRepo) SetPending

func (g *SessionRepo) SetPending(ctx context.Context, ids []string) error

func (*SessionRepo) SetSessionArchived

func (g *SessionRepo) SetSessionArchived(
	ctx context.Context,
	workspaceID string,
	sessionID string,
	archived bool,
) (store.SessionInfo, error)

SetSessionArchived archives or restores one workspace-owned session.

func (*SessionRepo) SetSubagentWorktreeCleanup

func (g *SessionRepo) SetSubagentWorktreeCleanup(ctx context.Context, id, state string) error

func (*SessionRepo) SetWakeInput

func (g *SessionRepo) SetWakeInput(ctx context.Context, id, route, inputID string) error

func (*SessionRepo) SettlePendingSessionSteer

func (g *SessionRepo) SettlePendingSessionSteer(
	ctx context.Context, sessionID, entryID string, delivery store.SteerDeliveryMode, now time.Time,
) (entry store.SessionInputQueueEntry, settled bool, err error)

SettlePendingSessionSteer records delivery completion without rewriting the immutable admission receipt. Only the first result in the current generation may release the original entry for fallback dispatch.

func (*SessionRepo) SettleWake

func (g *SessionRepo) SettleWake(
	ctx context.Context,
	id string,
	canceled bool,
) (out []store.SessionSubagent, err error)

func (*SessionRepo) StageAdmittedSessionSteer

func (g *SessionRepo) StageAdmittedSessionSteer(
	ctx context.Context,
	admissionReq store.SessionPromptAdmissionRequest,
	queueReq store.SessionInputQueueInsert,
) (admission store.SessionPromptAdmission, entry store.SessionInputQueueEntry, created bool, err error)

StageAdmittedSessionSteer atomically binds a receipt and replaces the active staged steer.

func (*SessionRepo) StageSessionSteer

func (g *SessionRepo) StageSessionSteer(
	ctx context.Context,
	req store.SessionInputQueueInsert,
) (entry store.SessionInputQueueEntry, err error)

StageSessionSteer replaces any active staged steer entry for the session.

func (*SessionRepo) Summaries

func (g *SessionRepo) Summaries(ctx context.Context, parentIDs []string) (map[string]store.SubagentSummary, error)

func (*SessionRepo) SweepExpiredSessionAttachLocks

func (g *SessionRepo) SweepExpiredSessionAttachLocks(ctx context.Context, now time.Time) (int64, error)

SweepExpiredSessionAttachLocks clears expired attach leases from the session catalog.

func (*SessionRepo) TransitionPendingInteraction

func (g *SessionRepo) TransitionPendingInteraction(
	ctx context.Context,
	req store.PendingInteractionTransition,
) (commit store.SessionAttentionCommit, err error)

TransitionPendingInteraction moves one canonical record and updates its projection atomically.

func (*SessionRepo) UnparkSession

func (g *SessionRepo) UnparkSession(ctx context.Context, workspaceID string, sessionID string) (bool, error)

UnparkSession clears Later state for one workspace session.

func (*SessionRepo) UnparkSessionParkedAt

func (g *SessionRepo) UnparkSessionParkedAt(
	ctx context.Context,
	workspaceID string,
	sessionID string,
	parkedAt time.Time,
) (bool, error)

UnparkSessionParkedAt clears Later state only when the session still carries the park made at parkedAt, so undoing a failed move never clears a newer park.

func (*SessionRepo) UnparkSessions

func (g *SessionRepo) UnparkSessions(ctx context.Context, workspaceID string, sessionIDs []string) error

UnparkSessions clears Later state for a family in one transaction, so a failure leaves every member as it was.

func (*SessionRepo) UpdateNativeSubagentTitle

func (g *SessionRepo) UpdateNativeSubagentTitle(
	ctx context.Context,
	id, title string,
	at time.Time,
) (out store.SessionSubagent, changed bool, err error)

func (*SessionRepo) UpdateProgress

func (g *SessionRepo) UpdateProgress(ctx context.Context, id, progress string, at time.Time) error

func (*SessionRepo) UpdateSessionLineages

func (g *SessionRepo) UpdateSessionLineages(
	ctx context.Context,
	workspaceID string,
	updates []store.SessionLineageUpdate,
) error

UpdateSessionLineages rewrites the hierarchy columns of every listed session in one transaction. A missing session aborts the whole batch.

func (*SessionRepo) UpdateSessionState

func (g *SessionRepo) UpdateSessionState(ctx context.Context, update store.SessionStateUpdate) error

UpdateSessionState updates the mutable session state fields.

func (*SessionRepo) UpdateSessionWorktreeBinding

func (g *SessionRepo) UpdateSessionWorktreeBinding(
	ctx context.Context,
	update store.SessionWorktreeBindingUpdate,
) error

func (*SessionRepo) UpdateSubagentChildActivity

func (g *SessionRepo) UpdateSubagentChildActivity(
	ctx context.Context, id string, activity store.SubagentChildActivity, at time.Time,
) (out store.SessionSubagent, changed bool, err error)

func (*SessionRepo) UpdateSubagentState

func (g *SessionRepo) UpdateSubagentState(
	ctx context.Context, id, status, workState string, at time.Time,
) (out store.SessionSubagent, changed bool, err error)

func (*SessionRepo) UpgradeWakePolicy

func (g *SessionRepo) UpgradeWakePolicy(ctx context.Context, id string) (out store.SessionSubagent, err error)

func (*SessionRepo) WorkspaceLayout

func (g *SessionRepo) WorkspaceLayout(ctx context.Context, profileID string) (store.WorkspaceLayout, error)

WorkspaceLayout returns one profile's workspace folders and placements.

type SkillExposureRepo

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

func (*SkillExposureRepo) CreateSkillExposure

func (r *SkillExposureRepo) CreateSkillExposure(
	ctx context.Context,
	record store.SkillExposureRecord,
) (store.SkillExposureRecord, error)

CreateSkillExposure inserts one durable link-ownership record.

func (*SkillExposureRepo) DeleteSkillExposure

func (r *SkillExposureRepo) DeleteSkillExposure(ctx context.Context, id int64) error

DeleteSkillExposure removes one ownership record after its proven link is gone.

func (*SkillExposureRepo) GetSkillExposureByOwnerTarget

func (r *SkillExposureRepo) GetSkillExposureByOwnerTarget(
	ctx context.Context,
	skillName string,
	ownerScope store.SkillExposureOwnerScope,
	workspaceID string,
	targetSlug string,
) (store.SkillExposureRecord, error)

GetSkillExposureByOwnerTarget returns one owner-scoped target record.

func (*SkillExposureRepo) ListSkillExposuresByCanonicalDir

func (r *SkillExposureRepo) ListSkillExposuresByCanonicalDir(
	ctx context.Context,
	canonicalDir string,
) ([]store.SkillExposureRecord, error)

ListSkillExposuresByCanonicalDir returns every record that must be cleaned before skill removal.

func (*SkillExposureRepo) ListSkillExposuresByOwner

func (r *SkillExposureRepo) ListSkillExposuresByOwner(
	ctx context.Context,
	skillName string,
	ownerScope store.SkillExposureOwnerScope,
	workspaceID string,
) ([]store.SkillExposureRecord, error)

ListSkillExposuresByOwner returns deterministic records for one skill owner.

type SoulRepo

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

func (*SoulRepo) AppendSoulRevision

func (g *SoulRepo) AppendSoulRevision(ctx context.Context, revision soul.Revision) (soul.Revision, error)

AppendSoulRevision appends one managed authoring revision row.

func (*SoulRepo) DeleteSoulAgentHistory

func (g *SoulRepo) DeleteSoulAgentHistory(
	ctx context.Context,
	workspaceID string,
	agentName string,
	sourcePath string,
) error

DeleteSoulAgentHistory removes revisions owned by one effective authored definition.

func (*SoulRepo) FindSoulRevisionForRollback

func (g *SoulRepo) FindSoulRevisionForRollback(
	ctx context.Context,
	query soul.RollbackLookup,
) (soul.Revision, error)

FindSoulRevisionForRollback returns the revision body selected for a managed rollback.

func (*SoulRepo) FindSoulSnapshotByDigest

func (g *SoulRepo) FindSoulSnapshotByDigest(
	ctx context.Context,
	workspaceID string,
	agentName string,
	digest string,
) (soul.Snapshot, bool, error)

FindSoulSnapshotByDigest returns the snapshot matching an agent digest.

func (*SoulRepo) GetSoulRevision

func (g *SoulRepo) GetSoulRevision(ctx context.Context, id string) (soul.Revision, error)

GetSoulRevision returns a managed authoring revision by id.

func (*SoulRepo) GetSoulSnapshot

func (g *SoulRepo) GetSoulSnapshot(ctx context.Context, id string) (soul.Snapshot, error)

GetSoulSnapshot returns a persisted Soul snapshot by id.

func (*SoulRepo) ListSoulRevisions

func (g *SoulRepo) ListSoulRevisions(
	ctx context.Context,
	query soul.RevisionListQuery,
) (revisions []soul.Revision, err error)

ListSoulRevisions lists managed authoring revisions in newest-first order.

func (*SoulRepo) ListSoulSnapshots

func (g *SoulRepo) ListSoulSnapshots(
	ctx context.Context,
	query soul.SnapshotListQuery,
) (snapshots []soul.Snapshot, err error)

ListSoulSnapshots lists persisted Soul snapshots in newest-first order.

func (*SoulRepo) UpdateSessionSoulSnapshot

func (g *SoulRepo) UpdateSessionSoulSnapshot(ctx context.Context, update store.SessionSoulSnapshotUpdate) error

UpdateSessionSoulSnapshot updates only the Soul provenance fields on a session row.

func (*SoulRepo) UpsertSoulSnapshot

func (g *SoulRepo) UpsertSoulSnapshot(ctx context.Context, snapshot soul.Snapshot) (soul.Snapshot, error)

UpsertSoulSnapshot inserts a resolved Soul snapshot or reuses the existing row for its digest.

type TaskRepo

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

func (*TaskRepo) AdvanceTerminalRunCommandPhase

func (g *TaskRepo) AdvanceTerminalRunCommandPhase(
	ctx context.Context,
	command taskpkg.TerminalRunCommand,
	next taskpkg.TerminalRunCommandPhase,
	updatedAt time.Time,
) (taskpkg.TerminalRunCommand, error)

AdvanceTerminalRunCommandPhase durably records the external-effect boundary.

func (*TaskRepo) BlockTaskAndReleaseRun

BlockTaskAndReleaseRun inserts a block, evaluates breaker accounting, and releases the active run atomically.

func (*TaskRepo) ClearTaskBlock

func (g *TaskRepo) ClearTaskBlock(
	ctx context.Context,
	mutation taskpkg.ClearTaskBlockMutation,
) (taskpkg.TaskBlock, error)

ClearTaskBlock stamps one open block as cleared and rejects repeated clears as conflicts.

func (*TaskRepo) ClearTaskNeedsAttention

func (g *TaskRepo) ClearTaskNeedsAttention(
	ctx context.Context,
	mutation taskpkg.NeedsAttentionClearMutation,
) (taskpkg.NeedsAttentionClearResult, error)

ClearTaskNeedsAttention clears escalation metadata and returns its exact co-committed recovery event.

func (*TaskRepo) CompleteCoordinatorAndEnqueueNext

func (g *TaskRepo) CompleteCoordinatorAndEnqueueNext(
	ctx context.Context,
	completion taskpkg.CoordinatorCompletion,
	finalizer taskpkg.GenerationStateFinalizer,
) (taskpkg.CoordinatorCompletionResult, error)

CompleteCoordinatorAndEnqueueNext applies a coordinator plan in one BEGIN IMMEDIATE transaction.

func (*TaskRepo) CountActiveSessionBindings

func (g *TaskRepo) CountActiveSessionBindings(ctx context.Context, sessionID string) (int, error)

CountActiveSessionBindings reports how many non-terminal runs are bound to one session.

func (*TaskRepo) CountActiveTaskRunClaims

func (g *TaskRepo) CountActiveTaskRunClaims(ctx context.Context) (int, error)

CountActiveTaskRunClaims returns currently leased task runs.

func (*TaskRepo) CountDependencies

func (g *TaskRepo) CountDependencies(ctx context.Context, taskID string) (int, error)

CountDependencies reports how many dependency edges are stored for one task.

func (*TaskRepo) CountDirectChildren

func (g *TaskRepo) CountDirectChildren(ctx context.Context, parentTaskID string) (int, error)

CountDirectChildren reports how many persisted tasks reference the supplied parent id.

func (*TaskRepo) CountEscalatingQueuedTaskRuns

func (g *TaskRepo) CountEscalatingQueuedTaskRuns(ctx context.Context) (int, error)

CountEscalatingQueuedTaskRuns counts active durable convergence episodes for claimable queued runs.

func (*TaskRepo) CountNeedsAttentionTaskRuns

func (g *TaskRepo) CountNeedsAttentionTaskRuns(ctx context.Context) (int, error)

CountNeedsAttentionTaskRuns counts runs the convergence backstop escalated to needs_attention.

func (*TaskRepo) CountPausedTasks

func (g *TaskRepo) CountPausedTasks(ctx context.Context) (int, error)

CountPausedTasks returns the number of directly paused tasks.

func (*TaskRepo) CountQueuedTaskRuns

func (g *TaskRepo) CountQueuedTaskRuns(ctx context.Context, includePaused bool) (int, error)

CountQueuedTaskRuns returns queued run pressure, optionally excluding paused tasks.

func (*TaskRepo) CreateDependency

func (g *TaskRepo) CreateDependency(ctx context.Context, dependency taskpkg.Dependency) error

CreateDependency inserts one durable task-dependency edge under a single SQLite write lock.

func (*TaskRepo) CreateTask

func (g *TaskRepo) CreateTask(ctx context.Context, record taskpkg.Task) error

CreateTask inserts one durable task record.

func (*TaskRepo) CreateTaskBlock

func (g *TaskRepo) CreateTaskBlock(
	ctx context.Context,
	mutation taskpkg.CreateTaskBlockMutation,
) (taskpkg.BlockMutationResult, error)

CreateTaskBlock inserts one task block, stamping workspace_id from the owning task.

func (*TaskRepo) CreateTaskDefinition

func (g *TaskRepo) CreateTaskDefinition(
	ctx context.Context,
	mutation *taskpkg.CreateTaskDefinitionMutation,
) error

CreateTaskDefinition commits the task row, optional profile, and causal events in one immediate transaction.

func (*TaskRepo) CreateTaskEvent

func (g *TaskRepo) CreateTaskEvent(ctx context.Context, event taskpkg.Event) error

CreateTaskEvent inserts one immutable task audit event.

func (*TaskRepo) DeleteDependency

func (g *TaskRepo) DeleteDependency(ctx context.Context, taskID string, dependsOnID string) error

DeleteDependency removes one persisted dependency edge.

func (*TaskRepo) DeleteExecutionProfile

func (g *TaskRepo) DeleteExecutionProfile(ctx context.Context, taskID string) error

DeleteExecutionProfile removes one profile and its selector rows.

func (*TaskRepo) DeleteTask

func (g *TaskRepo) DeleteTask(ctx context.Context, id string) error

DeleteTask removes one durable task record and any ON DELETE CASCADE children owned by the task tables.

func (*TaskRepo) DeleteTaskExecutionProfile

func (g *TaskRepo) DeleteTaskExecutionProfile(
	ctx context.Context,
	mutation taskpkg.ExecutionProfileDeleteMutation,
) error

DeleteTaskExecutionProfile commits a profile deletion and its event.

func (*TaskRepo) ExpireTaskBlocks

ExpireTaskBlocks finalizes expired transient blocks as daemon-cleared rows, grouped one transaction per task.

func (*TaskRepo) GetExecutionProfile

func (g *TaskRepo) GetExecutionProfile(
	ctx context.Context,
	taskID string,
) (taskpkg.ExecutionProfile, error)

GetExecutionProfile returns the persisted typed execution profile for one task.

func (*TaskRepo) GetSchedulerPause

func (g *TaskRepo) GetSchedulerPause(ctx context.Context) (taskpkg.SchedulerPauseState, error)

GetSchedulerPause returns the singleton scheduler pause state.

func (*TaskRepo) GetSchedulerPauseState

func (g *TaskRepo) GetSchedulerPauseState(ctx context.Context) (taskpkg.InspectSchedulerState, error)

GetSchedulerPauseState returns the singleton scheduler pause state for inspect diagnostics.

func (*TaskRepo) GetTask

func (g *TaskRepo) GetTask(ctx context.Context, id string) (taskpkg.Task, error)

GetTask returns one persisted task by primary key.

func (*TaskRepo) GetTaskBlock

func (g *TaskRepo) GetTaskBlock(ctx context.Context, taskID string, blockID string) (taskpkg.TaskBlock, error)

GetTaskBlock returns one task block when it belongs to the supplied task.

func (*TaskRepo) GetTaskBlockRecurrence

func (g *TaskRepo) GetTaskBlockRecurrence(
	ctx context.Context,
	taskID string,
	kind taskpkg.BlockKind,
) (taskpkg.BlockRecurrence, error)

GetTaskBlockRecurrence returns the counter for one task and block kind, or a zero counter when absent.

func (*TaskRepo) GetTaskEventRecord

func (g *TaskRepo) GetTaskEventRecord(ctx context.Context, eventID string) (taskpkg.EventRecord, error)

GetTaskEventRecord returns one persisted task event plus its stable row sequence.

func (*TaskRepo) GetTaskInReadScope

func (g *TaskRepo) GetTaskInReadScope(
	ctx context.Context,
	id string,
	readScope store.ReadScope,
) (taskpkg.Task, error)

GetTaskInReadScope returns one task only when its immutable owner matches the explicit profile lens. Aggregate reads remain explicit through AllProfiles.

func (*TaskRepo) GetTaskRun

func (g *TaskRepo) GetTaskRun(ctx context.Context, id string) (taskpkg.Run, error)

GetTaskRun returns one persisted task run by primary key.

func (*TaskRepo) GetTaskRunByIdempotencyKey

func (g *TaskRepo) GetTaskRunByIdempotencyKey(
	ctx context.Context,
	key string,
	origin taskpkg.Origin,
) (taskpkg.Run, error)

GetTaskRunByIdempotencyKey returns the original persisted run bound to one origin-scoped idempotency key.

func (*TaskRepo) GetTaskTriageState

func (g *TaskRepo) GetTaskTriageState(
	ctx context.Context,
	taskID string,
	actor taskpkg.ActorIdentity,
) (taskpkg.TriageState, error)

GetTaskTriageState returns the durable actor-scoped triage state for one task.

func (*TaskRepo) HasDependencyPath

func (g *TaskRepo) HasDependencyPath(ctx context.Context, fromTaskID string, toTaskID string) (bool, error)

HasDependencyPath reports whether the dependency graph already contains a path from one task to another.

func (*TaskRepo) HasOpenTaskBlocks

func (g *TaskRepo) HasOpenTaskBlocks(ctx context.Context, taskID string) (bool, error)

HasOpenTaskBlocks returns whether a task currently has any open, non-expired block.

func (*TaskRepo) ImportTerminalRunHistory

func (g *TaskRepo) ImportTerminalRunHistory(
	ctx context.Context,
	command *taskpkg.TerminalRunHistoryImport,
) error

ImportTerminalRunHistory atomically imports one finished bootstrap record, its task projection, and its canonical audit event.

func (*TaskRepo) IncrementTaskBlockRecurrence

func (g *TaskRepo) IncrementTaskBlockRecurrence(
	ctx context.Context,
	taskID string,
	kind taskpkg.BlockKind,
	updatedAt time.Time,
) (taskpkg.BlockRecurrence, error)

IncrementTaskBlockRecurrence increments and returns the counter for one task and block kind.

func (*TaskRepo) IsTaskEffectivelyPaused

func (g *TaskRepo) IsTaskEffectivelyPaused(ctx context.Context, taskID string) (bool, string, error)

IsTaskEffectivelyPaused reports whether a task or one of its ancestors is paused.

func (*TaskRepo) ListDependencies

func (g *TaskRepo) ListDependencies(ctx context.Context, taskID string) ([]taskpkg.Dependency, error)

ListDependencies returns the persisted dependency edges for one task.

func (*TaskRepo) ListDependents

func (g *TaskRepo) ListDependents(ctx context.Context, dependsOnTaskID string) ([]taskpkg.Dependency, error)

ListDependents returns persisted dependency edges that point at one task.

func (*TaskRepo) ListExpiredTaskBlockTargets

func (g *TaskRepo) ListExpiredTaskBlockTargets(
	ctx context.Context,
	now time.Time,
) ([]taskpkg.BlockExpiryTarget, error)

ListExpiredTaskBlockTargets returns the stable block identities eligible at the supplied cutoff.

func (*TaskRepo) ListTaskBlocks

func (g *TaskRepo) ListTaskBlocks(
	ctx context.Context,
	taskID string,
	includeCleared bool,
) ([]taskpkg.TaskBlock, error)

ListTaskBlocks returns task blocks for one task, open-only by default.

func (*TaskRepo) ListTaskCatalog

func (g *TaskRepo) ListTaskCatalog(
	ctx context.Context,
	query taskpkg.CatalogQuery,
) (page taskpkg.CatalogPage, err error)

ListTaskCatalog returns one transactionally consistent task catalog page.

func (*TaskRepo) ListTaskDesignationRollups

func (g *TaskRepo) ListTaskDesignationRollups(
	ctx context.Context,
	query store.TaskDesignationRollupQuery,
) (rollups []store.TaskDesignationRollup, err error)

ListTaskDesignationRollups returns rollups by task or group.

func (*TaskRepo) ListTaskEventRecords

func (g *TaskRepo) ListTaskEventRecords(
	ctx context.Context,
	query taskpkg.EventRecordQuery,
) ([]taskpkg.EventRecord, error)

ListTaskEventRecords returns persisted task events ordered by stable sequence for live replay.

func (*TaskRepo) ListTaskEvents

func (g *TaskRepo) ListTaskEvents(ctx context.Context, query taskpkg.EventQuery) ([]taskpkg.Event, error)

ListTaskEvents returns persisted audit events that match the supplied filters.

func (*TaskRepo) ListTaskInbox

func (g *TaskRepo) ListTaskInbox(
	ctx context.Context,
	query taskpkg.InboxQuery,
	actor taskpkg.ActorIdentity,
) (page taskpkg.InboxPage, err error)

ListTaskInbox returns one transactionally consistent actor-scoped inbox page.

func (*TaskRepo) ListTaskRuns

func (g *TaskRepo) ListTaskRuns(
	ctx context.Context,
	query taskpkg.RunQuery,
) ([]taskpkg.Run, error)

ListTaskRuns returns persisted runs that match the supplied filters.

func (*TaskRepo) ListTaskRunsByStatus

func (g *TaskRepo) ListTaskRunsByStatus(
	ctx context.Context,
	statuses []taskpkg.RunStatus,
) ([]taskpkg.Run, error)

ListTaskRunsByStatus returns persisted runs that match any of the supplied statuses.

func (*TaskRepo) ListTaskTriageStates

func (g *TaskRepo) ListTaskTriageStates(
	ctx context.Context,
	actor taskpkg.ActorIdentity,
) ([]taskpkg.TriageState, error)

ListTaskTriageStates returns all durable triage states persisted for one actor.

func (*TaskRepo) ListTasks

func (g *TaskRepo) ListTasks(
	ctx context.Context,
	query taskpkg.Query,
) (summaries []taskpkg.Summary, err error)

ListTasks returns durable task summaries that match the supplied filters.

func (*TaskRepo) ListTerminalRunCommands

func (g *TaskRepo) ListTerminalRunCommands(
	ctx context.Context,
) ([]taskpkg.TerminalRunCommand, error)

ListTerminalRunCommands lists durable recovery obligations for daemon boot.

func (*TaskRepo) MarkTaskNeedsAttention

func (g *TaskRepo) MarkTaskNeedsAttention(
	ctx context.Context,
	mutation taskpkg.NeedsAttentionMutation,
) (taskpkg.Task, error)

MarkTaskNeedsAttention writes the task-level escalation metadata columns.

func (*TaskRepo) PauseTask

func (g *TaskRepo) PauseTask(ctx context.Context, mutation taskpkg.PauseMutation) (taskpkg.Task, error)

PauseTask marks one task as paused for future claim eligibility.

func (*TaskRepo) PutTaskDesignationRollup

func (g *TaskRepo) PutTaskDesignationRollup(ctx context.Context, rollup store.TaskDesignationRollup) error

PutTaskDesignationRollup upserts one terminal rollup artifact.

func (*TaskRepo) ReleaseTerminalRunCommand

func (g *TaskRepo) ReleaseTerminalRunCommand(
	ctx context.Context,
	command taskpkg.TerminalRunCommand,
) error

ReleaseTerminalRunCommand removes only the matching receipt while its full source fence is still current.

func (*TaskRepo) ReserveTerminalRunCommand

func (g *TaskRepo) ReserveTerminalRunCommand(
	ctx context.Context,
	command taskpkg.TerminalRunCommand,
) (taskpkg.TerminalRunCommand, bool, error)

ReserveTerminalRunCommand admits one exact terminal intent before any external session effect. Existing commands are returned only in the same workspace/task/run scope.

func (*TaskRepo) ResetTaskBlockRecurrences

func (g *TaskRepo) ResetTaskBlockRecurrences(ctx context.Context, taskID string) error

ResetTaskBlockRecurrences clears all breaker counters for one task.

func (*TaskRepo) ResumeTask

func (g *TaskRepo) ResumeTask(ctx context.Context, mutation taskpkg.ResumeMutation) (taskpkg.Task, error)

ResumeTask clears one task pause for future claim eligibility.

func (*TaskRepo) SaveTaskRunIdempotency

func (g *TaskRepo) SaveTaskRunIdempotency(ctx context.Context, record taskpkg.RunIdempotency) error

SaveTaskRunIdempotency inserts one origin-scoped idempotency binding for a persisted run.

func (*TaskRepo) SchedulerBacklog

func (g *TaskRepo) SchedulerBacklog(
	ctx context.Context,
	query taskpkg.SchedulerBacklogQuery,
) (backlog taskpkg.SchedulerBacklog, err error)

SchedulerBacklog returns queued task runs ordered by scheduler priority.

func (*TaskRepo) SetSchedulerPaused

func (g *TaskRepo) SetSchedulerPaused(
	ctx context.Context,
	actor string,
	reason string,
) (taskpkg.SchedulerPauseState, error)

SetSchedulerPaused marks the scheduler-wide pause singleton as paused.

func (*TaskRepo) SetSchedulerResumed

func (g *TaskRepo) SetSchedulerResumed(ctx context.Context) (taskpkg.SchedulerPauseState, error)

SetSchedulerResumed clears the scheduler-wide pause singleton.

func (*TaskRepo) SetTaskEventCommitObserver

func (g *TaskRepo) SetTaskEventCommitObserver(observer taskpkg.EventObserver)

SetTaskEventCommitObserver installs the single task service that owns live fanout for this database.

func (*TaskRepo) SetTaskExecutionProfile

func (g *TaskRepo) SetTaskExecutionProfile(
	ctx context.Context,
	mutation *taskpkg.ExecutionProfileMutation,
) (stored taskpkg.ExecutionProfile, err error)

SetTaskExecutionProfile commits a profile replacement and its event.

func (*TaskRepo) SetTaskWakeCreator

func (g *TaskRepo) SetTaskWakeCreator(
	ctx context.Context,
	mutation taskpkg.WakeCreatorMutation,
) (taskpkg.Task, error)

SetTaskWakeCreator writes the per-task creator wake opt-in flag.

func (*TaskRepo) SetTaskWorktreePolicy

func (g *TaskRepo) SetTaskWorktreePolicy(
	ctx context.Context,
	mutation *taskpkg.WorktreePolicyMutation,
) (stored taskpkg.ExecutionProfile, err error)

SetTaskWorktreePolicy commits one worktree policy patch and its event.

func (*TaskRepo) TaskWakeEventExists

func (g *TaskRepo) TaskWakeEventExists(
	ctx context.Context,
	taskID string,
	wakeEventID string,
) (bool, error)

TaskWakeEventExists reports whether the task ledger already contains a delivered or suppressed wake identity.

func (*TaskRepo) UpdateTask

func (g *TaskRepo) UpdateTask(ctx context.Context, record taskpkg.Task, actor taskpkg.ActorContext) error

UpdateTask replaces the persisted canonical task record.

func (*TaskRepo) UpdateTaskDefinition

func (g *TaskRepo) UpdateTaskDefinition(
	ctx context.Context,
	mutation *taskpkg.UpdateTaskDefinitionMutation,
) (stored taskpkg.ExecutionProfile, err error)

UpdateTaskDefinition commits task-row/profile changes and causal events in one immediate transaction.

func (*TaskRepo) UpdateTaskRunMetadata

func (g *TaskRepo) UpdateTaskRunMetadata(
	ctx context.Context,
	mutation taskpkg.RunMetadataMutation,
) (taskpkg.Run, error)

UpdateTaskRunMetadata applies a metadata-only compare-and-set. The SQL shape cannot alter lifecycle, identity, session, lease, result, or error fields.

func (*TaskRepo) UpsertExecutionProfile

func (g *TaskRepo) UpsertExecutionProfile(
	ctx context.Context,
	profile *taskpkg.ExecutionProfile,
) (stored taskpkg.ExecutionProfile, err error)

UpsertExecutionProfile replaces one task-owned execution profile and its selectors atomically.

func (*TaskRepo) UpsertTaskBlockRecurrence

func (g *TaskRepo) UpsertTaskBlockRecurrence(
	ctx context.Context,
	recurrence taskpkg.BlockRecurrence,
) (taskpkg.BlockRecurrence, error)

UpsertTaskBlockRecurrence sets the persisted counter for one task and block kind.

func (*TaskRepo) UpsertTaskTriageState

func (g *TaskRepo) UpsertTaskTriageState(ctx context.Context, state taskpkg.TriageState) error

UpsertTaskTriageState inserts or replaces one durable actor-scoped triage state.

func (*TaskRepo) WithDeleteTaskTransaction

func (g *TaskRepo) WithDeleteTaskTransaction(
	ctx context.Context,
	fn func(taskpkg.DeleteTaskMutationStore) error,
) error

WithDeleteTaskTransaction executes one delete-task mutation flow inside a single immediate transaction so reconciliation failures can roll back the primary delete.

func (*TaskRepo) WithLeaseSettlementTransaction

func (g *TaskRepo) WithLeaseSettlementTransaction(
	ctx context.Context,
	action string,
	fn func(taskpkg.LeaseSettlementMutationStore) error,
) error

WithLeaseSettlementTransaction runs one lease settlement under the repository's writer transaction.

func (*TaskRepo) WithTaskExecutionTransaction

func (g *TaskRepo) WithTaskExecutionTransaction(
	ctx context.Context,
	fn func(taskpkg.ExecutionMutationStore) error,
) error

WithTaskExecutionTransaction runs one Task execution command under the repository's immediate writer transaction.

func (*TaskRepo) WithTaskMutationTransaction

func (g *TaskRepo) WithTaskMutationTransaction(
	ctx context.Context,
	action string,
	mutation taskpkg.RunMutation,
) error

WithTaskMutationTransaction runs one authoritative task mutation under an immediate writer transaction and publishes collected events only after commit.

type TaskRunRepo

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

func (*TaskRunRepo) BindRunReviewSession

func (g *TaskRunRepo) BindRunReviewSession(
	ctx context.Context,
	req taskpkg.BindRunReviewSessionRequest,
	boundAt time.Time,
) (stored taskpkg.RunReview, err error)

BindRunReviewSession binds an active review request to a reviewer session.

func (*TaskRunRepo) ClearRunStarvation

func (g *TaskRunRepo) ClearRunStarvation(ctx context.Context, runID string) error

ClearRunStarvation removes a run's escalation budget once it leaves the starved set.

func (*TaskRunRepo) CompleteRunLeaseSettlement

func (g *TaskRunRepo) CompleteRunLeaseSettlement(
	ctx context.Context,
	completion taskpkg.LeaseCompletion,
) (taskpkg.CompletedRunSettlement, error)

CompleteRunLeaseSettlement completes one fenced run and atomically applies successful task-hierarchy aggregation.

func (*TaskRunRepo) GetRunReview

func (g *TaskRunRepo) GetRunReview(ctx context.Context, reviewID string) (taskpkg.RunReview, error)

GetRunReview returns one persisted run review by id.

func (*TaskRunRepo) ListAutonomyLeaseHandles

func (g *TaskRunRepo) ListAutonomyLeaseHandles(
	ctx context.Context,
	sessionID string,
) (handles []taskpkg.AutonomyLeaseHandle, err error)

ListAutonomyLeaseHandles returns internal-only lease handles for one session. Public task-run read projections keep claim_token masked.

func (*TaskRunRepo) ListRunReviews

func (g *TaskRunRepo) ListRunReviews(
	ctx context.Context,
	query taskpkg.RunReviewQuery,
) ([]taskpkg.RunReview, error)

ListRunReviews returns persisted run reviews that match the supplied filters.

func (*TaskRunRepo) ListRunStarvation

func (g *TaskRunRepo) ListRunStarvation(ctx context.Context) ([]taskpkg.RunStarvation, error)

ListRunStarvation returns every escalation budget row so the convergence backstop can reconcile rows whose run has left the queued set.

func (*TaskRunRepo) LoadRunStarvation

func (g *TaskRunRepo) LoadRunStarvation(
	ctx context.Context,
	runID string,
) (taskpkg.RunStarvation, bool, error)

LoadRunStarvation reads a run's durable escalation budget. The bool reports row presence; absence is not an error — the convergence backstop treats it as a fresh budget.

func (*TaskRunRepo) LookupRunReviewBySession

func (g *TaskRunRepo) LookupRunReviewBySession(ctx context.Context, sessionID string) (taskpkg.RunReview, error)

LookupRunReviewBySession returns the active run review bound to one reviewer session.

func (*TaskRunRepo) ReadTaskRunResultPage

func (g *TaskRunRepo) ReadTaskRunResultPage(
	ctx context.Context,
	runID string,
	offset int64,
	limit int64,
) (_ taskpkg.RunResultPage, returnErr error)

ReadTaskRunResultPage returns one integrity-checked exact page from an externalized result.

func (*TaskRunRepo) RecordRunReview

func (g *TaskRunRepo) RecordRunReview(
	ctx context.Context,
	req taskpkg.RecordRunReviewRequest,
	actor taskpkg.ActorContext,
	recordedAt time.Time,
	continuationRunID string,
) (result taskpkg.RunReviewResult, err error)

RecordRunReview persists one authoritative review verdict and optional continuation run.

func (*TaskRunRepo) RecoverExpiredRunLeases

func (g *TaskRunRepo) RecoverExpiredRunLeases(
	ctx context.Context,
	recovery taskpkg.ExpiredLeaseRecovery,
) ([]taskpkg.ExpiredLeaseRecoveryResult, error)

RecoverExpiredRunLeases requeues stale active leases without issuing new ownership.

func (*TaskRunRepo) RequestRunReview

func (g *TaskRunRepo) RequestRunReview(
	ctx context.Context,
	review *taskpkg.RunReview,
) (stored taskpkg.RunReview, created bool, err error)

RequestRunReview persists one review request or returns the existing idempotent request.

func (*TaskRunRepo) ReserveRunLeaseSettlement

func (g *TaskRunRepo) ReserveRunLeaseSettlement(
	ctx context.Context,
	runID, claimToken string,
	at time.Time,
	actor taskpkg.ActorContext,
) (func(), error)

ReserveRunLeaseSettlement registers a token-fenced in-process reservation without acquiring the SQLite writer. Recovery checks it after writer admission, so a recovery already waiting for SQLite cannot reclaim the pending result.

func (*TaskRunRepo) UpsertRunStarvation

func (g *TaskRunRepo) UpsertRunStarvation(
	ctx context.Context,
	mutation taskpkg.RunStarvationMutation,
) (taskpkg.RunStarvation, error)

UpsertRunStarvation writes the run's escalation budget, advancing it in place on conflict.

type ToolRuntimeRepo

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

func (*ToolRuntimeRepo) ListProcessRecords

func (g *ToolRuntimeRepo) ListProcessRecords(
	ctx context.Context,
	query toolruntime.ProcessQuery,
) (records []toolruntime.ProcessRecord, err error)

ListProcessRecords returns process records matching the query.

func (*ToolRuntimeRepo) UpdateProcessRecordState

func (g *ToolRuntimeRepo) UpdateProcessRecordState(ctx context.Context, update toolruntime.ProcessStateUpdate) error

UpdateProcessRecordState mutates lifecycle fields for one process record.

func (*ToolRuntimeRepo) UpsertProcessRecord

func (g *ToolRuntimeRepo) UpsertProcessRecord(ctx context.Context, record toolruntime.ProcessRecord) error

UpsertProcessRecord writes one durable process checkpoint.

type UserScopeMigration

type UserScopeMigration struct {
	SourceWorkspaceID string
	SourceRoot        string
	Disposition       string
	ProfileIDs        []string
	JournalState      string
	LayoutState       string
}

type VaultRepo

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

func (*VaultRepo) DeleteMCPAuthRegistration

func (g *VaultRepo) DeleteMCPAuthRegistration(ctx context.Context, target mcpauth.Target) error

DeleteMCPAuthRegistration removes one target-scoped OAuth client registration and its DCR secrets.

func (*VaultRepo) DeleteMCPAuthToken

func (g *VaultRepo) DeleteMCPAuthToken(ctx context.Context, target mcpauth.Target) error

DeleteMCPAuthToken removes persisted token state for one server.

func (*VaultRepo) DeleteMCPAuthorizationState

func (g *VaultRepo) DeleteMCPAuthorizationState(ctx context.Context, target mcpauth.Target) error

DeleteMCPAuthorizationState atomically removes OAuth tokens, DCR registration state, and their Vault secrets.

func (*VaultRepo) DeleteVaultSecret

func (g *VaultRepo) DeleteVaultSecret(ctx context.Context, ref string) error

DeleteVaultSecret removes one encrypted vault secret record.

func (*VaultRepo) GetMCPAuthRegistration

func (g *VaultRepo) GetMCPAuthRegistration(
	ctx context.Context,
	target mcpauth.Target,
) (mcpauth.ClientRegistration, error)

GetMCPAuthRegistration returns one target-scoped OAuth client registration.

func (*VaultRepo) GetMCPAuthToken

func (g *VaultRepo) GetMCPAuthToken(ctx context.Context, target mcpauth.Target) (mcpauth.TokenRecord, error)

GetMCPAuthToken returns one persisted token record.

func (*VaultRepo) GetVaultSecret

func (g *VaultRepo) GetVaultSecret(ctx context.Context, ref string) (vault.Record, error)

GetVaultSecret returns one encrypted vault secret record.

func (*VaultRepo) ListMCPAuthTokens

func (g *VaultRepo) ListMCPAuthTokens(ctx context.Context) ([]mcpauth.TokenRecord, error)

ListMCPAuthTokens returns all persisted token records.

func (*VaultRepo) ListVaultSecrets

func (g *VaultRepo) ListVaultSecrets(ctx context.Context, prefix string) (_ []vault.Record, err error)

ListVaultSecrets returns encrypted vault secret records filtered by ref prefix.

func (*VaultRepo) PutVaultSecret

func (g *VaultRepo) PutVaultSecret(ctx context.Context, record vault.Record) error

PutVaultSecret stores one encrypted vault secret record.

func (*VaultRepo) SaveMCPAuthRegistration

func (g *VaultRepo) SaveMCPAuthRegistration(
	ctx context.Context,
	registration mcpauth.ClientRegistration,
	secrets mcpauth.RegistrationSecrets,
) (mcpauth.ClientRegistration, error)

SaveMCPAuthRegistration atomically persists one registration and its DCR secrets.

func (*VaultRepo) SaveMCPAuthToken

func (g *VaultRepo) SaveMCPAuthToken(ctx context.Context, token mcpauth.TokenRecord) error

SaveMCPAuthToken persists one remote MCP OAuth token record.

type WatchEventsRepo

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

func (*WatchEventsRepo) ListParkedWatchEventSubscriptions

func (g *WatchEventsRepo) ListParkedWatchEventSubscriptions(
	ctx context.Context,
) ([]looppkg.ParkedWatchEventSubscription, error)

ListParkedWatchEventSubscriptions rebuilds the in-memory daemon index from durable watch-events pending output refs.

func (*WatchEventsRepo) ListParkedWatchEventSubscriptionsForLoopRun

func (g *WatchEventsRepo) ListParkedWatchEventSubscriptionsForLoopRun(
	ctx context.Context,
	loopRunID string,
) ([]looppkg.ParkedWatchEventSubscription, error)

ListParkedWatchEventSubscriptionsForLoopRun returns the current parked subscriptions for one loop run without rebuilding the global index.

func (*WatchEventsRepo) ListParkedWatchEventSubscriptionsPage

func (g *WatchEventsRepo) ListParkedWatchEventSubscriptionsPage(
	ctx context.Context,
	cursor looppkg.ParkedWatchEventScanCursor,
	limit int,
) ([]looppkg.ParkedWatchEventSubscription, error)

ListParkedWatchEventSubscriptionsPage returns one bounded recovery page strictly after cursor in the same order as the full parked index.

func (*WatchEventsRepo) ReadCursors

func (g *WatchEventsRepo) ReadCursors(
	ctx context.Context,
	query looppkg.WatchEventsQuery,
) (map[string]int64, error)

ReadCursors returns the current max replay cursor for each requested stream.

func (*WatchEventsRepo) ReadMatches

func (g *WatchEventsRepo) ReadMatches(
	ctx context.Context,
	query looppkg.WatchEventsQuery,
) ([]looppkg.WatchEvent, error)

ReadMatches returns replay rows strictly after each stream cursor.

type WorkspaceRepo

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

func (*WorkspaceRepo) CompleteWorkspaceDeletion

func (g *WorkspaceRepo) CompleteWorkspaceDeletion(ctx context.Context, id string) error

CompleteWorkspaceDeletion releases a durable intent only after external cleanup succeeds.

func (*WorkspaceRepo) DeleteWorkspace

func (g *WorkspaceRepo) DeleteWorkspace(ctx context.Context, id string) error

DeleteWorkspace removes a persisted workspace registration row. It refuses to delete if any active sessions reference the workspace. Stopped or orphaned sessions are cleaned up automatically before deletion.

func (*WorkspaceRepo) GetWorkspace

func (g *WorkspaceRepo) GetWorkspace(
	ctx context.Context,
	id string,
) (compozyworkspace.Workspace, error)

GetWorkspace loads a workspace registration by primary key.

func (*WorkspaceRepo) GetWorkspaceByName

func (g *WorkspaceRepo) GetWorkspaceByName(
	ctx context.Context,
	name string,
) (compozyworkspace.Workspace, error)

GetWorkspaceByName loads a workspace registration by unique workspace name.

func (*WorkspaceRepo) GetWorkspaceByPath

func (g *WorkspaceRepo) GetWorkspaceByPath(
	ctx context.Context,
	rootDir string,
) (compozyworkspace.Workspace, error)

GetWorkspaceByPath loads a workspace registration by canonical root directory.

func (*WorkspaceRepo) GetWorkspaceDeletionIntent

func (g *WorkspaceRepo) GetWorkspaceDeletionIntent(
	ctx context.Context,
	id string,
) (compozyworkspace.DeletionIntent, error)

GetWorkspaceDeletionIntent loads one durable post-delete finalization owner.

func (*WorkspaceRepo) InsertWorkspace

func (g *WorkspaceRepo) InsertWorkspace(ctx context.Context, ws compozyworkspace.Workspace) error

InsertWorkspace creates a new persisted workspace registration row.

func (*WorkspaceRepo) ListWorkspaceDeletionIntents

func (g *WorkspaceRepo) ListWorkspaceDeletionIntents(
	ctx context.Context,
) ([]compozyworkspace.DeletionIntent, error)

ListWorkspaceDeletionIntents returns every pending finalization in stable order.

func (*WorkspaceRepo) ListWorkspaces

func (g *WorkspaceRepo) ListWorkspaces(ctx context.Context) ([]compozyworkspace.Workspace, error)

ListWorkspaces returns all registered workspaces in stable name order.

func (*WorkspaceRepo) SetWorkspaceArchived

func (g *WorkspaceRepo) SetWorkspaceArchived(
	ctx context.Context,
	id string,
	archived bool,
) (workspace.Workspace, error)

func (*WorkspaceRepo) StageWorkspaceDeletion

func (g *WorkspaceRepo) StageWorkspaceDeletion(ctx context.Context, id string) error

StageWorkspaceDeletion atomically persists recovery identity and removes the workspace row.

func (*WorkspaceRepo) UpdateWorkspace

func (g *WorkspaceRepo) UpdateWorkspace(ctx context.Context, ws compozyworkspace.Workspace) error

UpdateWorkspace updates an existing persisted workspace registration row.

type WorktreeRepo

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

func (*WorktreeRepo) CompareAndSwapState

func (g *WorktreeRepo) CompareAndSwapState(
	ctx context.Context,
	workspaceID string,
	id string,
	expected worktree.State,
	next worktree.State,
	updatedAt time.Time,
) (bool, error)

func (*WorktreeRepo) CompleteCreate

func (g *WorktreeRepo) CompleteCreate(
	ctx context.Context,
	workspaceID string,
	id string,
	setupState worktree.SetupState,
	setupError string,
	updatedAt time.Time,
) error

func (*WorktreeRepo) CompleteFailedCreateRollback

func (g *WorktreeRepo) CompleteFailedCreateRollback(
	ctx context.Context,
	workspaceID string,
	id string,
	updatedAt time.Time,
) error

func (*WorktreeRepo) DeletePending

func (g *WorktreeRepo) DeletePending(ctx context.Context, workspaceID, id string) error

func (*WorktreeRepo) DeleteRunMaterialization

func (g *WorktreeRepo) DeleteRunMaterialization(
	ctx context.Context,
	workspaceID string,
	id string,
	runID string,
) error

func (*WorktreeRepo) FailCreate

func (g *WorktreeRepo) FailCreate(
	ctx context.Context,
	workspaceID string,
	id string,
	createError string,
	rollbackError string,
	updatedAt time.Time,
) error

func (*WorktreeRepo) FailRunningExitOperations

func (g *WorktreeRepo) FailRunningExitOperations(ctx context.Context, finishedAt time.Time) error

func (*WorktreeRepo) FinishExitOperation

func (g *WorktreeRepo) FinishExitOperation(
	ctx context.Context,
	workspaceID string,
	worktreeID string,
	opID string,
	state string,
	finishedAt time.Time,
) (bool, error)

func (*WorktreeRepo) Get

func (g *WorktreeRepo) Get(ctx context.Context, workspaceID, idOrName string) (*worktree.Worktree, error)

Get resolves IDs before live names. Dismissed rows remain addressable only by ID.

func (*WorktreeRepo) GetByPath

func (g *WorktreeRepo) GetByPath(ctx context.Context, workspaceID, path string) (*worktree.Worktree, error)

func (*WorktreeRepo) GetStatus

func (g *WorktreeRepo) GetStatus(
	ctx context.Context,
	workspaceID string,
	id string,
) (*worktree.Status, error)

func (*WorktreeRepo) Insert

func (g *WorktreeRepo) Insert(ctx context.Context, item worktree.Worktree) error

func (*WorktreeRepo) InsertExitOperation

func (g *WorktreeRepo) InsertExitOperation(ctx context.Context, operation worktree.ExitOperation) error

func (*WorktreeRepo) List

func (g *WorktreeRepo) List(ctx context.Context, workspaceID string) ([]worktree.Worktree, error)

func (*WorktreeRepo) ListAggregate

func (g *WorktreeRepo) ListAggregate(ctx context.Context) ([]worktree.Worktree, error)

func (*WorktreeRepo) ListRecoverable

func (g *WorktreeRepo) ListRecoverable(ctx context.Context) ([]worktree.Worktree, error)

func (*WorktreeRepo) ListRunningExitOperations

func (g *WorktreeRepo) ListRunningExitOperations(ctx context.Context) ([]worktree.ExitOperation, error)

func (*WorktreeRepo) PathOwnedByAnyWorkspace

func (g *WorktreeRepo) PathOwnedByAnyWorkspace(ctx context.Context, path string) (bool, error)

PathOwnedByAnyWorkspace crosses workspaces on purpose: one repository can back several workspaces, and Git lists every linked worktree to each of them.

func (*WorktreeRepo) ReadPullRequests

func (*WorktreeRepo) RemoveMissing

func (g *WorktreeRepo) RemoveMissing(ctx context.Context, workspaceID, id string, at time.Time) (bool, error)

func (*WorktreeRepo) SavePullRequest

func (g *WorktreeRepo) SavePullRequest(ctx context.Context, entry worktree.PullRequestEntry) error

func (*WorktreeRepo) SaveStatus

func (g *WorktreeRepo) SaveStatus(
	ctx context.Context,
	workspaceID string,
	id string,
	status worktree.Status,
) error

func (*WorktreeRepo) SetState

func (g *WorktreeRepo) SetState(
	ctx context.Context,
	workspaceID string,
	id string,
	state worktree.State,
	updatedAt time.Time,
) error

func (*WorktreeRepo) UpdatePending

func (g *WorktreeRepo) UpdatePending(
	ctx context.Context,
	workspaceID string,
	id string,
	update worktree.PendingUpdate,
) error

Source Files

Directories

Path Synopsis
Package schema embeds the global database schema and migration directory.
Package schema embeds the global database schema and migration directory.

Jump to

Keyboard shortcuts

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