store

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 69 Imported by: 0 modules, 0 packages

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

Documentation

Index

Constants

View Source
const ChildTurnLimitSummary = "Stopped at its action limit before finishing; guide_agent can continue it."

ChildTurnLimitSummary accompanies the potentially partial child response.

View Source
const KnowledgeStoragePageLimit = 16

KnowledgeStoragePageLimit bounds the plugin values of one source page.

View Source
const MaxKnowledgeCollections = 128

MaxKnowledgeCollections bounds the collections of one Node.

Variables

View Source
var CodeSchema string
View Source
var ErrCommandHeld = errors.New("background command is held by a stop")

ErrCommandHeld reports that a command held by a user stop records no stall yet.

View Source
var ErrProviderRenewalNotSelected = errors.New("scheduled provider authorization is no longer selected")

ErrProviderRenewalNotSelected means the account stopped being eligible after the scheduler collected it.

View Source
var KnowledgeSchema string
View Source
var NodeSchema string

Functions

func AgentCompactionBudget

func AgentCompactionBudget(selected protocol.ConversationModel, percent uint8) *protocol.ConversationCompactionBudget

AgentCompactionBudget describes the same captured threshold used by execution.

func AgentTurnReviewed

func AgentTurnReviewed(ctx context.Context, db *sql.Conn, turn protocol.TurnID) (bool, error)

AgentTurnReviewed follows explicit completion of a planning input. Nonempty feedback returns through the tool response so the model can revise its plan.

func AppendCanonical

func AppendCanonical(ctx context.Context, db *sql.Conn, session protocol.SessionID, record canonical.Record) (protocol.ConversationEntry, []protocol.Event, error)

AppendCanonical preserves immutable record identity and updates only derived membership and materialized state in the caller's transaction.

func ApplyIdentityDirectory

func ApplyIdentityDirectory(ctx context.Context, db *sql.Conn, source protocol.NodeID, revision uint64, addresses []link.EndpointAddress, metadata ...map[protocol.NodeID]string) error

func ApprovedWorkspaceRequest

func ApprovedWorkspaceRequest(ctx context.Context, db *sql.Conn, turn protocol.TurnID, approval protocol.ApprovalID, request protocol.Request) error

ApprovedWorkspaceRequest keeps the exact durable identity already claimed by the loop; preparing an effect never creates another request after approval.

func AssignSessionMemberModel

func AssignSessionMemberModel(ctx context.Context, db *sql.Conn, node protocol.NodeID, previous protocol.RoleSnapshot, role protocol.RoleID, model *protocol.RoleModel) (protocol.RoleSnapshot, error)

func AuthorizeLocalModelRemoval

func AuthorizeLocalModelRemoval(ctx context.Context, db *sql.Conn, request protocol.Request) error

AuthorizeLocalModelRemoval admits a plugin's model removal only as the approved tool call that captured it. Controllers pass.

func AuthorizePluginRequest

func AuthorizePluginRequest(ctx context.Context, db *sql.Conn, node, caller protocol.NodeID, request protocol.Request, invocation *protocol.PluginInfo) (protocol.PluginInfo, error)

AuthorizePluginRequest keeps verified dispatch provenance inside the Node. Authored plugin contexts cannot grant themselves deferred session creation.

func BackupPlan

func BackupPlan(ctx context.Context, db *sql.Conn, expected *uint64) (backup.Plan, error)

BackupPlan captures the configuration of one operation. A non-nil expected revision must match the stored one.

func BackupSource

func BackupSource(ctx context.Context, db *sql.Conn, node protocol.NodeID, profile string, revision uint64) (backup.Plan, []string, error)

BackupSource reads the plan and profile-relative content roots while the caller holds exclusive ownership through the database copy.

func BindTurnAttachments

func BindTurnAttachments(ctx context.Context, db *sql.Conn, turn protocol.TurnID, ids []protocol.AttachmentID) error

func CallerUser

func CallerUser(ctx context.Context, db *sql.Conn, node, caller protocol.NodeID) (protocol.User, error)

CallerUser resolves only authenticated inbound device membership. A known outbound host does not become a controller by presenting its device identity.

func CanonicalEntry

func CanonicalEntry(record canonical.Record, sequence uint64) (protocol.ConversationEntry, error)

func CaptureCanonicalPayload

func CaptureCanonicalPayload(ctx context.Context, db *sql.Conn, data json.RawMessage) (canonical.Payload, error)

CaptureCanonicalPayload externalizes only declared MIME-tagged binary fields.

func CaptureFileCheckpointsRequest

func CaptureFileCheckpointsRequest(ctx context.Context, db *sql.Conn, turn protocol.TurnID, approval protocol.ApprovalID, request protocol.Request, prepared *files.Prepared) error

CaptureFileCheckpointsRequest records what the approved request's prepared change replaces. Call it in the admission transaction before releasing the prepared filesystem effect.

func CaptureProvider

CaptureProvider freezes current native declaration policy independently of the saved configuration. Inherited turns retain their existing captured binding.

func CaptureProviderAuthorization

func CaptureProviderAuthorization(ctx context.Context, db *sql.Conn, id protocol.ProviderID) (protocol.ConversationProvider, error)

CaptureProviderAuthorization also reads the unlisted provider a paired Node forwarded, which holds only a transferable authentication.

func CaptureSearchProvider

func CaptureSearchProvider(ctx context.Context, db *sql.Conn, selection protocol.SearchModelConfig) (protocol.ConversationProvider, error)

CaptureSearchProvider freezes public metadata while credentials remain current.

func CapturedUser

func CapturedUser(ctx context.Context, db *sql.Conn) (protocol.UserID, error)

func CapturedUserFromContext

func CapturedUserFromContext(ctx context.Context) (protocol.UserID, bool)

func CheckArtifactAccess

func CheckArtifactAccess(ctx context.Context, db *sql.Conn, id protocol.ArtifactID) error

func CheckChildAccess

func CheckChildAccess(ctx context.Context, db *sql.Conn, kind, id string) error

func CheckControllerLoginWait

func CheckControllerLoginWait(ctx context.Context, db *sql.Conn, node, caller protocol.NodeID, input protocol.CommandResumeControllerLoginPayload) (protocol.ConversationRun, error)

CheckControllerLoginWait is repeated before admission and in the effect transaction. A shared project's visibility alone never grants the right to change another controller's captured account.

func CheckIdentityCreation added in v0.2.4

func CheckIdentityCreation(ctx context.Context, profile string) error

CheckIdentityCreation requires a fresh database family before a missing link.key can be created. Call it while holding the profile lock.

func CheckKnowledgeOutcome

func CheckKnowledgeOutcome(ctx context.Context, db *sql.Conn, request protocol.Request, output protocol.Output) error

CheckKnowledgeOutcome checks current collection access before a stored result can be disclosed again. A delete result has no remaining source to expose.

func CheckKnowledgeScope

func CheckKnowledgeScope(ctx context.Context, request protocol.Request) error

CheckKnowledgeScope checks a trusted runtime's declared knowledge action. Ordinary plugin requests keep using the main plugin authorization path.

func CheckNotificationAccess

func CheckNotificationAccess(ctx context.Context, db *sql.Conn, id protocol.NotificationID) error

func CheckPluginCardRequest

func CheckPluginCardRequest(ctx context.Context, db *sql.Conn, node, _ protocol.NodeID, request protocol.Request) error

func CheckPluginConnectionRequest

func CheckPluginConnectionRequest(request protocol.Request, info protocol.PluginInfo) error

func CheckPluginConnectionTarget

func CheckPluginConnectionTarget(ctx context.Context, db *sql.Conn, scope protocol.PluginContext, target protocol.ConnectionResource) error

CheckPluginConnectionTarget applies the core sharing decision to the resource a plugin scope captured. A Node-wide controller surface manages every connection.

func CheckPluginPlanAction

func CheckPluginPlanAction(ctx context.Context, db *sql.Conn, request protocol.Request, action protocol.PluginAction) error

func CheckPluginRequest

func CheckPluginRequest(ctx context.Context, db *sql.Conn, request protocol.Request, info protocol.PluginInfo) error

func CheckProjectAccess

func CheckProjectAccess(ctx context.Context, db *sql.Conn, id protocol.ProjectID, manage bool) error

func CheckProviderResource

func CheckProviderResource(ctx context.Context, db *sql.Conn, capture ProviderResourceCapture) error

func CheckSessionAccess

func CheckSessionAccess(ctx context.Context, db *sql.Conn, id protocol.SessionID) error

func CheckTerminalAccess

func CheckTerminalAccess(ctx context.Context, db *sql.Conn, id protocol.TerminalID) error

func CheckTurnAccess

func CheckTurnAccess(ctx context.Context, db *sql.Conn, id protocol.TurnID) error

func CheckWorktreeAccess

func CheckWorktreeAccess(ctx context.Context, db *sql.Conn, id protocol.WorktreeID) error

func ClaimHook

func ClaimHook(ctx context.Context, db *sql.Conn, turn protocol.TurnID, phase protocol.HooksPhase, ordinal uint64) error

func ClassifyPeer

func ClassifyPeer(ctx context.Context, db *sql.Conn, node, peer protocol.NodeID, hasNode bool) error

ClassifyPeer applies the authenticated device type to an existing pairing. It never adds trust, changes direction, or rewrites captured history owners.

func CollectPlugins

func CollectPlugins(ctx context.Context, db *sql.Conn) (map[string]struct{}, error)

CollectPlugins deletes the package versions and settings revisions that no installation, queued callback, admitted turn or bound provider or assistant refers to, and returns the digests still in use so their directories can be kept. A removed package keeps its latest settings revision: reinstalling it restores that configuration. The caller runs this only while nothing can install or capture a package.

func CommandBackgroundPending added in v0.2.4

func CommandBackgroundPending(ctx context.Context, db *sql.Conn, snapshot protocol.ProcessSnapshot) (bool, error)

CommandBackgroundPending checks for committed evidence. A process with a failed completion write exposes its retained output without another write.

func CommandFollowUpAllowed added in v0.2.4

func CommandFollowUpAllowed(ctx context.Context, db *sql.Conn, session protocol.SessionID) (bool, error)

CommandFollowUpAllowed gates automatic delivery from commands owned by a conversation. A delegated session polls its commands within the child turn.

func CompleteProviderLogin

func CompleteProviderLogin(ctx context.Context, db *sql.Conn, node protocol.NodeID, capture ProviderLoginCapture, grant providers.AccountGrant) ([]protocol.Event, error)

func CompleteProviderModelDiscovery

func CompleteProviderModelDiscovery(ctx context.Context, db *sql.Conn, node protocol.NodeID, captured protocol.ConversationProvider, catalog protocol.ConversationDiscoveryCatalog) ([]protocol.Event, error)

CompleteProviderModelDiscovery adds an account's discovered models after sign-in. The captured revision keeps a late result from replacing edits or a new login. Existing models keep their configuration and adopt current native OAuth speed tiers.

func CompleteProviderRenewal

func CompleteProviderRenewal(ctx context.Context, db *sql.Conn, node protocol.NodeID, renewal ProviderRenewal, grant providers.AccountGrant) ([]protocol.Event, error)

func ConfigureWorkspaceApproval

func ConfigureWorkspaceApproval(ctx context.Context, db *sql.Conn, turn protocol.TurnID, value protocol.ConversationApproval, operation protocol.ToolOperation, command protocol.Command, changes *protocol.ChangePreview) (protocol.ConversationApproval, error)

ConfigureWorkspaceApproval applies the captured native operation's source permission policy before its approval is committed and shown to controllers.

func ConnectionBound

func ConnectionBound(ctx context.Context, db *sql.Conn, turn protocol.TurnID) (*protocol.ConnectionResource, error)

ConnectionBound returns the resource the turn's captured configuration is bound to, if any.

func ConnectionCommand

ConnectionCommand translates a captured tool request into the shared command the Node workers execute, after checking the turn may reach its target.

func ConnectionCreated

func ConnectionCreated(ctx context.Context, db *sql.Conn, turn protocol.TurnID, owner protocol.PluginReference, target protocol.ConnectionResource) (bool, error)

ConnectionCreated reports whether this turn's package created the target through its own approved and completed save. Such a connection is available in the same turn before another admission captures its new identifier.

func ConnectionOwner

func ConnectionOwner(ctx context.Context, db *sql.Conn, turn protocol.TurnID) (protocol.ConversationRun, error)

ConnectionOwner returns the running turn that owns a connection operation.

func ConnectionPermits

func ConnectionPermits(bound *protocol.ConnectionResource, project *protocol.ProjectID, target protocol.ConnectionResource, sharing *protocol.ConnectionSharing) bool

ConnectionPermits is the execution Node's sharing decision. An SSH conversation's primary connection is its default, not an access boundary: it can manage this Node's saved SSH profiles. Database conversations keep their resource boundary; project conversations use their sharing rules.

func ConnectionTrust

func ConnectionTrust(ctx context.Context, db *sql.Conn, turn protocol.TurnID, owner protocol.PluginReference, inspection ConnectionInspection, captured []protocol.ConnectionResource) (protocol.SshTrust, error)

ConnectionTrust builds the host-key consent an approval presents for a captured SSH operation.

func ConnectorRenewalAt

func ConnectorRenewalAt(record ConnectorRecord) *uint64

func ConnectorTypes

func ConnectorTypes(ctx context.Context, db *sql.Conn) ([]protocol.PluginConnectorType, error)

func ConsumeChildBackground

func ConsumeChildBackground(ctx context.Context, db *sql.Conn, parent protocol.TurnID, child protocol.SessionID, exact *protocol.TurnID) ([]protocol.Event, error)

func ConsumeCommandBackground

func ConsumeCommandBackground(ctx context.Context, db *sql.Conn, parent protocol.TurnID, snapshot protocol.ProcessSnapshot, now time.Time) ([]protocol.Event, error)

func ConsumeStoppedChildren

func ConsumeStoppedChildren(ctx context.Context, db *sql.Conn, parent protocol.TurnID, children []protocol.TurnID) ([]protocol.Event, error)

ConsumeStoppedChildren consumes the completion records of the child turns a stopped or failed parent turn cancelled. The parent's history already holds their cancellation, so the records never join a later message or start a notice turn.

func ControllerLoginReplacementAvailable

func ControllerLoginReplacementAvailable(ctx context.Context, db *sql.Conn, node protocol.NodeID, input protocol.CommandResumeControllerLoginPayload) (bool, error)

ControllerLoginReplacementAvailable checks retained controller credentials before admitting a durable recovery. Local credentials are checked at admission.

func CreateUser

func CreateUser(ctx context.Context, db *sql.Conn, name string) (protocol.User, error)

func CurrentController

func CurrentController(ctx context.Context, db *sql.Conn, node protocol.NodeID) (protocol.NodeID, error)

CurrentController resolves the Node identity used by captured controller credentials. A user without a recorded controller resolves to this Node.

func CurrentUser

func CurrentUser(ctx context.Context, db *sql.Conn) (protocol.User, error)

CurrentUser defaults only trusted internal maintenance to the local user. Public Node entry points resolve CallerUser before they call a service.

func DelegationAvailable added in v0.2.1

func DelegationAvailable(session protocol.Session, turn protocol.QueuedTurn) bool

DelegationAvailable uses the captured turn. A team supplies a roster, while Collaborate also supports children that inherit the parent's model.

func DeliverBackground added in v0.2.3

func DeliverBackground(ctx context.Context, db *sql.Conn, turn protocol.TurnID, initialNotice bool, now time.Time) (*protocol.ConversationEntry, []protocol.Event, error)

DeliverBackground appends one hidden callback and settles its evidence in the caller's write. An initial notice takes only the queued turn's reservation. It may produce queue events without an entry if the evidence was collected.

func DeliverInputBackground added in v0.2.3

func DeliverInputBackground(ctx context.Context, db *sql.Conn, turn protocol.TurnID, now time.Time) (*protocol.ConversationEntry, []protocol.Event, error)

DeliverInputBackground preserves waiting results, including held and non-follow-up commands, at an initial user or package input boundary only.

func DetachChildren added in v0.2.4

func DetachChildren(ctx context.Context, db *sql.Conn, parent protocol.TurnID, children []protocol.TurnID) ([]protocol.Event, error)

DetachChildren hands a turn's foreground children to background delivery when the turn makes no further model call. Their completion records then follow up like a background child's: as a notice, or with the next input.

func DiscardAttachment

func DiscardAttachment(ctx context.Context, db *sql.Conn, caller protocol.NodeID, worktree protocol.WorktreeID, id protocol.AttachmentID) error

func DiscardDraftAttachment

func DiscardDraftAttachment(ctx context.Context, db *sql.Conn, caller protocol.NodeID, id protocol.AttachmentID) error

func DispatchJobContext

func DispatchJobContext(ctx context.Context, db *sql.Conn, identity protocol.JobID) (context.Context, error)

DispatchJobContext restores a trusted scheduled operation's canonical actor separately from the immutable settings principal retained at enqueue time.

func DispatchSettingsChanged

func DispatchSettingsChanged(ctx context.Context, db *sql.Conn, reference protocol.PluginReference, timestamp int64) ([]protocol.Event, error)

func DispatchTick

func DispatchTick(ctx context.Context, db *sql.Conn, node protocol.NodeID, timestamp int64, recovering bool) (dispatcher.Batch, []protocol.Event, error)

func EffectiveTurnCredential

func EffectiveTurnCredential(ctx context.Context, db *sql.Conn, turn protocol.TurnID, captured protocol.CredentialRef) (protocol.CredentialRef, error)

EffectiveTurnCredential leaves the admission capture immutable. Only this run's future model steps consult the latest explicitly accepted recovery.

func EventCursor

func EventCursor(ctx context.Context, db *sql.Conn) (uint64, error)

func EventPage

func EventPage(ctx context.Context, db *sql.Conn, node protocol.NodeID, after, through uint64) (uint64, []protocol.EventEnvelope, error)

EventPage bounds each read while preserving the committed cursor watermark.

func ExecuteAgentCommand

func ExecuteAgentCommand(ctx context.Context, db *sql.Conn, node protocol.NodeID, profile string, caller protocol.NodeID, request protocol.Request, now time.Time) (protocol.Output, []protocol.Event, error)

func ExecuteBackgroundCommand

func ExecuteBackgroundCommand(ctx context.Context, db *sql.Conn, node, caller protocol.NodeID, request protocol.Request, now time.Time) (protocol.Output, []protocol.Event, error)

func ExecuteCommand

func ExecuteCommand(ctx context.Context, db *sql.Conn, node, caller protocol.NodeID, profile string, request protocol.Request, prepared PreparedPaths) (protocol.Output, []protocol.Event, error)

func ExecuteConnectorCommand

func ExecuteConnectorCommand(ctx context.Context, db *sql.Conn, command protocol.Command, consent *ConnectorLoginCapture) (protocol.Output, error)

func ExecuteDatabaseCommand

func ExecuteDatabaseCommand(ctx context.Context, db *sql.Conn, command protocol.Command) (protocol.Output, []protocol.Event, error)

ExecuteDatabaseCommand owns the profile configuration commands. Passwords stay in their own column and never enter an output, event or fault.

func ExecuteDispatch

func ExecuteDispatch(ctx context.Context, db *sql.Conn, node protocol.NodeID, reference protocol.PluginReference, action protocol.DispatchCommand, timestamp int64) (protocol.Output, []protocol.Event, error)

func ExecuteDispatchAdmitted

func ExecuteDispatchAdmitted(ctx context.Context, db *sql.Conn, node protocol.NodeID, reference protocol.PluginReference, action protocol.DispatchCommand, timestamp int64) (protocol.Output, []protocol.Event, error)

func ExecuteIdentityCommand

func ExecuteIdentityCommand(ctx context.Context, db *sql.Conn, node, caller protocol.NodeID, request protocol.Request) (protocol.Output, []protocol.Event, error)

func ExecuteKnowledge

func ExecuteKnowledge(ctx context.Context, db *sql.Conn, request protocol.Request) (protocol.Output, []protocol.Event, error)

ExecuteKnowledge applies one collection mutation.

func ExecutePluginStorageCommand

func ExecutePluginStorageCommand(ctx context.Context, db *sql.Conn, node protocol.NodeID, profile string, caller protocol.NodeID, request protocol.Request) (protocol.Output, []protocol.Event, error)

func ExecuteProviderCommand

func ExecuteProviderCommand(ctx context.Context, db *sql.Conn, node protocol.NodeID, request protocol.Request, prepared *providers.Prepared) (output protocol.Output, changes []protocol.Event, resultErr error)

func ExecuteSshCommand

func ExecuteSshCommand(ctx context.Context, db *sql.Conn, command protocol.Command) (protocol.Output, []protocol.Event, error)

func ExecuteTeamCommand

func ExecuteTeamCommand(ctx context.Context, db *sql.Conn, command protocol.Command) (protocol.Output, []protocol.Event, error)

func FilterPluginDatabases

func FilterPluginDatabases(ctx context.Context, db *sql.Conn, scope protocol.PluginContext, profiles []protocol.DatabaseProfile) ([]protocol.DatabaseProfile, error)

FilterPluginDatabases keeps the profiles a plugin scope may reach.

func FilterPluginSsh

func FilterPluginSsh(ctx context.Context, db *sql.Conn, scope protocol.PluginContext, profiles []protocol.SshProfile) ([]protocol.SshProfile, error)

FilterPluginSsh keeps the profiles a plugin scope may reach.

func FinishChildBackground

func FinishChildBackground(ctx context.Context, db *sql.Conn, child protocol.ConversationRun, now time.Time) ([]protocol.Event, error)

func FinishCommand

func FinishCommand(ctx context.Context, db *sql.Conn, finished process.Finished, now time.Time) ([]protocol.Event, error)

func FinishDispatch

func FinishDispatch(ctx context.Context, db *sql.Conn, identity protocol.JobID, result error, timestamp int64) ([]protocol.Event, error)

func FinishFilesCommand

func FinishFilesCommand(ctx context.Context, db *sql.Conn, caller protocol.NodeID, request protocol.Request, output protocol.Output, effectErr error) ([]protocol.Event, error)

func FinishHook

func FinishHook(ctx context.Context, db *sql.Conn, turn protocol.TurnID, phase protocol.HooksPhase, ordinal uint64, outcome protocol.ProcessOutcome, resultErr error) error

func FinishQueuedChild

func FinishQueuedChild(ctx context.Context, db *sql.Conn, turn protocol.TurnID, status protocol.ConversationStatus, failure *protocol.Fault, now time.Time) ([]protocol.Event, error)

func FinishRemovedWorktree

func FinishRemovedWorktree(ctx context.Context, db *sql.Conn, id protocol.WorktreeID) ([]protocol.Event, error)

func FitConversationPage

func FitConversationPage(page *protocol.ConversationPage, extraBytes int) ([]protocol.TurnID, error)

func ForgetLocalModel

func ForgetLocalModel(ctx context.Context, db *sql.Conn, id string) (bool, error)

ForgetLocalModel deletes the registration of a model whose files were removed and reports whether it did. A model the settings select or a knowledge collection names stays registered, so that the choice keeps its name and the collection its model. A pinned model has no registration and stays listed.

func ForkPluginConversation

func ForkPluginConversation(ctx context.Context, db *sql.Conn, source, target protocol.SessionID, through protocol.TurnID, preserveCurrent bool) error

func FrozenHooks

func FrozenHooks(ctx context.Context, db *sql.Conn, turn protocol.TurnID) (protocol.HooksSettings, error)

func GetBlob

func GetBlob(ctx context.Context, connection *sql.Conn, digest string) ([]byte, error)

func GetTurnAttachment

func GetTurnAttachment(ctx context.Context, db *sql.Conn, turn protocol.TurnID, id protocol.AttachmentID) (protocol.Attachment, error)

func GuideChild

func GuideChild(ctx context.Context, db *sql.Conn, node protocol.NodeID, parent protocol.TurnID, identity canonical.ToolIdentity, arguments json.RawMessage, overlap bool, now time.Time) (ChildState, *AgentInvocation, []protocol.Event, error)

GuideChild guides or resumes a child of the parent turn. identity is the recorded call, guide_agent or a package tool bound to agents.guide, and locates it in the conversation; arguments are the ones that execute, which such a package tool prepares.

func HoldStoppedCommands added in v0.2.4

func HoldStoppedCommands(ctx context.Context, db *sql.Conn, session protocol.SessionID) error

HoldStoppedCommands keeps a user stop from being undone by command evidence: the session's running and undelivered command results start no notice turn and join the user's next message instead. The Node stops the non-service commands after the stop commits; their completion finds a held record.

func HostRemovals

func HostRemovals(ctx context.Context, db *sql.Conn) ([]link.HostRemovalAttempt, error)

func HydrateCanonicalPayload

func HydrateCanonicalPayload(ctx context.Context, db *sql.Conn, payload canonical.Payload) (json.RawMessage, error)

func IdentityPeerRelationships

func IdentityPeerRelationships(ctx context.Context, db *sql.Conn) ([]link.PeerRelationship, error)

func InitializeConfigurationUsers

func InitializeConfigurationUsers(ctx context.Context, db *sql.Conn) error

InitializeConfigurationUsers runs after the local user exists in the same rehearsed schema transaction. Legacy configuration remains private to it.

func InitializeIdentity

func InitializeIdentity(ctx context.Context, db *sql.Conn) error

InitializeIdentity fixes the owner of legacy unprefixed storage namespaces. Its identity stays stable when the local administrator flag moves in a merge.

func InsertAttachment

func InsertAttachment(ctx context.Context, db *sql.Conn, caller protocol.NodeID, attachment protocol.Attachment) error

func InsertDraftAttachment

func InsertDraftAttachment(ctx context.Context, db *sql.Conn, caller protocol.NodeID, value protocol.Attachment, now time.Time) error

InsertDraftAttachment records a file published in the profile's attachment store before its controller has created a conversation or worktree.

func InstallCatalogPlugin

func InstallCatalogPlugin(ctx context.Context, db *sql.Conn, info protocol.PluginInfo, expectedRevision uint64, mode protocol.PluginInstallMode, declared protocol.PluginMcpConfiguration) (protocol.PluginInfo, error)

func InstallPlugin

func InstallPlugin(ctx context.Context, db *sql.Conn, info protocol.PluginInfo, expectedRevision uint64, enabled bool) (protocol.PluginInfo, error)

func IsStorageFull added in v0.2.4

func IsStorageFull(err error) bool

IsStorageFull reports when the storage engine could not write for lack of space.

func KnowledgeExecutionContext

func KnowledgeExecutionContext(ctx context.Context, db *sql.Conn, stored KnowledgeStored) (context.Context, error)

KnowledgeExecutionContext restores the owner of a trusted indexing capture. Public queries select allowed collections before the indexing service uses it.

func KnowledgePackageFromContext

func KnowledgePackageFromContext(ctx context.Context) (protocol.PluginInfo, bool)

KnowledgePackageFromContext reads only the package installed by the verified resource-call entry point, never a package declared in model arguments.

func KnowledgeStorageChanged

func KnowledgeStorageChanged(ctx context.Context, db *sql.Conn, request protocol.Request) (bool, error)

KnowledgeStorageChanged follows a committed storage write of a plugin: it registers a collection that gained its first source and restarts the indexing of the package's automatic collections. It runs in the transaction of the write.

func KnowledgeStorageCommand

func KnowledgeStorageCommand(command protocol.Command) bool

KnowledgeStorageCommand reports a command that may change the plugin values a storage collection indexes.

func KnowledgeStorageUnchanged

func KnowledgeStorageUnchanged(ctx context.Context, db *sql.Conn, stored KnowledgeStored, record KnowledgeStorageRecord) (bool, error)

KnowledgeStorageUnchanged rechecks a captured record before its chunks are published or its citation is returned.

func LatestAgentPlan added in v0.2.4

func LatestAgentPlan(records []canonical.Record) *protocol.ConversationProgress

LatestAgentPlan returns the last successful plan in chronological session history unless all its steps are completed or skipped.

func LegacyStorageUser

func LegacyStorageUser(ctx context.Context, db *sql.Conn) (protocol.UserID, error)

func LinkAddresses

func LinkAddresses(ctx context.Context, db *sql.Conn) ([]link.EndpointAddress, error)

func LinkDirections

func LinkDirections(ctx context.Context, db *sql.Conn) ([]link.PeerTrust, error)

LinkDirections loads persisted direction independently of reachability.

func LinkPeers

func LinkPeers(ctx context.Context, db *sql.Conn) ([]protocol.NodeID, error)

func ListArtifactRevisions

func ListArtifactRevisions(ctx context.Context, db *sql.Conn, id protocol.ArtifactID, before *uint32, limit uint16, session protocol.SessionID) (protocol.ArtifactRevisionPage, error)

func ListArtifacts

func ListArtifacts(ctx context.Context, db *sql.Conn, session protocol.SessionID, after *protocol.ArtifactID, limit uint16) (protocol.ArtifactPage, error)

func ListAssociatedSessions

func ListAssociatedSessions(ctx context.Context, db *sql.Conn, request protocol.Request) (protocol.ConversationAssociationAssociatedSessions, error)

ListAssociatedSessions pages the sessions a package associated with one business identity, newest first. A worktree scope confines the page.

func ListConversationAssets

ListConversationAssets derives bounded inventory pages from canonical history. It does not index workspace writes or inspect the filesystem.

func ListDatabases

func ListDatabases(ctx context.Context, db *sql.Conn) ([]protocol.DatabaseProfile, error)

func ListKnowledgeCollections

func ListKnowledgeCollections(ctx context.Context, db *sql.Conn, request protocol.Request) ([]protocol.KnowledgeCollection, error)

ListKnowledgeCollections lists the collections a request may read.

func ListPluginKeys

func ListPluginKeys(ctx context.Context, db *sql.Conn, reference protocol.PluginReference, prefix string, after *string, limit uint16) (protocol.PluginStoragePage, error)

func ListSsh

func ListSsh(ctx context.Context, db *sql.Conn) ([]protocol.SshProfile, error)

func ListSshTerminals

func ListSshTerminals(ctx context.Context, db *sql.Conn, profile protocol.SshID, caller protocol.NodeID) ([]protocol.TerminalInfo, error)

ListSshTerminals returns the caller's open terminals of one SSH profile.

func ListTurnAttachments

func ListTurnAttachments(ctx context.Context, db *sql.Conn, turn protocol.TurnID) ([]protocol.Attachment, error)

func ListUsers

func ListUsers(ctx context.Context, db *sql.Conn) ([]protocol.User, error)

func LoadAgentContext

func LoadAgentContext(ctx context.Context, db *sql.Conn, session protocol.SessionID) (canonical.Context, []string, error)

LoadAgentContext reads a session's materialized context and loaded tools without its history. Captured is derived from history and stays unset.

func LocalModelDefinition

func LocalModelDefinition(ctx context.Context, db *sql.Conn, id string) (*protocol.ModelsDefinition, error)

LocalModelDefinition reads one pinned or registered definition.

func LocalUser

func LocalUser(ctx context.Context, db *sql.Conn) (protocol.User, error)

func MCPFormSpec

func MCPFormSpec(message string, schema json.RawMessage) (protocol.ConversationQuestionSpec, error)

func MCPSettingsTargets

func MCPSettingsTargets(schema *protocol.PluginSettingsSchema, configuration protocol.PluginMcpConfiguration) map[string]string

func MarkCheckpointRestored

func MarkCheckpointRestored(ctx context.Context, db *sql.Conn, id protocol.CheckpointID) error

MarkCheckpointRestored records that a checkpoint's change was undone, in the transaction that stores the restore's receipt, so the fact survives a restart and reaches every controller with the checkpoint list.

func MarkProviderRenewalUncertain

func MarkProviderRenewalUncertain(ctx context.Context, db *sql.Conn, provider protocol.ConversationProvider, id protocol.CredentialID) error

func MaterializeSemanticSearch

func MaterializeSemanticSearch(ctx context.Context, db *sql.Conn, request protocol.Request, plan SemanticPlan, selection SemanticSelection) (page protocol.PluginStorageSearchPage, stale bool, err error)

MaterializeSemanticSearch reads the selected values of a plan. A result whose source, tags, grants or embedding choice moved since the plan falls back to the keyword page and reports it stale.

func MediaConfig

func MediaConfig(provider protocol.ProviderID, name string) protocol.SessionConfig

MediaConfig selects one assigned model outside any session.

func MediaModels

func MediaModels(ctx context.Context, db *sql.Conn) ([]protocol.MediaCandidate, error)

MediaModels lists, per purpose, the enabled models whose capability tags include it and whose channel has a driver for it.

func MigrateHeadlessPeers

func MigrateHeadlessPeers(ctx context.Context, db *sql.Conn) error

MigrateHeadlessPeers preserves inbound access without treating legacy Host controllers as outbound execution services.

func NarrowLegacyController

func NarrowLegacyController(ctx context.Context, db *sql.Conn, peer protocol.NodeID) error

func NextChildGuidance

func NextChildGuidance(ctx context.Context, db *sql.Conn, recipient protocol.TurnID) (*protocol.ConversationRun, []protocol.Event, error)

func NextCounter

func NextCounter(ctx context.Context, connection *sql.Conn, namespace Counter) (uint64, error)

NextCounter advances a watermark inside the caller's existing write transaction.

func OAuthHost

func OAuthHost(ctx context.Context, db *sql.Conn) (string, error)

func OAuthRegistration

func OAuthRegistration(ctx context.Context, db *sql.Conn, key string) (*string, error)

func ObserveCommandStop added in v0.2.4

func ObserveCommandStop(ctx context.Context, db *sql.Conn, parent protocol.TurnID, snapshot protocol.ProcessSnapshot, now time.Time) ([]protocol.Event, error)

ObserveCommandStop records a stop acknowledged by a tool turn. Only a confirmed stopped outcome is consumed by that acknowledgment.

func OriginalTurnUser

func OriginalTurnUser(ctx context.Context, db *sql.Conn, turn protocol.TurnID) (protocol.User, error)

OriginalTurnUser does not follow merged_into: immutable settings revisions with the same number can contain different credentials for different users.

func OrphanedKnowledge

func OrphanedKnowledge(ctx context.Context, db *sql.Conn, catalog []KnowledgeStored) (bool, error)

OrphanedKnowledge reports whether any collection of a catalog lost its owner.

func PairIdentityMember

func PairIdentityMember(ctx context.Context, db *sql.Conn, node, peer protocol.NodeID, direction link.PeerDirection, inviter *protocol.UserID, myDevice bool) error

PairIdentityMember receives only the sharing endpoint's captured invitation scope. A repeated pairing never transfers an existing device to another user.

func PairIdentityPeer

func PairIdentityPeer(ctx context.Context, db *sql.Conn, node, peer protocol.NodeID, direction link.PeerDirection, scope link.InvitationScope) error

func PairLinkPeer

func PairLinkPeer(ctx context.Context, db *sql.Conn, peer protocol.NodeID, direction link.PeerDirection) error

PairLinkPeer unions two explicit pairings without moving a device between users. Only a newly admitted controller creates a new local user.

func PairPeerIdentity

func PairPeerIdentity(ctx context.Context, db *sql.Conn, node, peer protocol.NodeID, direction link.PeerDirection, hasNode bool) error

PairPeerIdentity records fresh membership and its authenticated device type in one transaction. A shell joins the local user without creating an orphan user.

func PendingGuidance

func PendingGuidance(ctx context.Context, db *sql.Conn, recipient protocol.TurnID) (bool, error)

func PluginConnectionAction

func PluginConnectionAction(ctx context.Context, db *sql.Conn, request protocol.Request) (protocol.PluginAction, bool, error)

PluginConnectionAction maps a database or SSH command to the software action its package must declare and checks that the captured plugin scope may reach the command's connection. It reports false for every command outside the two families, including terminals that are not SSH terminals.

func PluginModels

func PluginModels(ctx context.Context, db *sql.Conn) (protocol.PluginModelsCatalog, error)

func PluginRecorded

func PluginRecorded(ctx context.Context, db *sql.Conn, name string) (bool, error)

func PluginRequestPackage

func PluginRequestPackage(ctx context.Context, db *sql.Conn, node, caller protocol.NodeID, request protocol.Request, invocation *protocol.PluginInfo) (protocol.PluginInfo, error)

func PluginSearchDefinition

func PluginSearchDefinition(name string) string

func PluginSearchDefinitions

func PluginSearchDefinitions(ctx context.Context, db *sql.Conn) ([]string, error)

func PluginSettingsBody

func PluginSettingsBody(ctx context.Context, db *sql.Conn, name string, revision uint64) (json.RawMessage, error)

func PluginStorageRequestContext

func PluginStorageRequestContext(ctx context.Context, db *sql.Conn, request protocol.Request) (context.Context, error)

PluginStorageRequestContext resolves the requested namespace through the captured resource. The personal namespace remains the default for old SDKs.

func PluginTransactionProviders

func PluginTransactionProviders(ctx context.Context, db *sql.Conn, request protocol.Request) ([]protocol.ProviderID, error)

func PowerFailed

func PowerFailed(ctx context.Context, db *sql.Conn, code int64) ([]protocol.Event, error)

PowerFailed records the system's refusal of the idle-sleep request as an error notice carrying its code.

func PrepareBackup

func PrepareBackup(ctx context.Context, db *sql.Conn, profile string, command protocol.Command) error

PrepareBackup refuses a durable backup command before it is admitted.

func PrepareCheckpointRestore

PrepareCheckpointRestore captures a checkpoint's content for a restore and the versions that already count as restored: what the file held before this change or before an earlier change of the same turn to the same file.

func PrepareHostRemoval

func PrepareHostRemoval(ctx context.Context, db *sql.Conn, host protocol.NodeID, request protocol.Request) (link.HostRemovalAttempt, error)

func PrepareProviderCommand

func PrepareProviderCommand(ctx context.Context, db *sql.Conn, node protocol.NodeID, request protocol.Request) (*providers.Work, error)

func PrepareRestored

func PrepareRestored(ctx context.Context, staging string, node protocol.NodeID, original, target string) ([]string, error)

PrepareRestored validates an unpacked profile in private staging, upgrades its Node database to the current schema and rewrites the paths that pointed into the original profile. It returns the staging-relative files of the pre-upgrade database copy, which the restored profile retains.

func PrepareSessionForward

func PrepareSessionForward(ctx context.Context, db *sql.Conn, node, caller protocol.NodeID, request protocol.Request) (protocol.Request, error)

PrepareSessionForward keeps exact replays of already admitted operations, but a new session must be created by the Node that owns its selected model.

func ProbeConnector

func ProbeConnector(ctx context.Context, db *sql.Conn, previous ConnectorRecord, identity *protocol.PluginConnectorIdentity, checked uint64, failure *protocol.Fault) (protocol.PluginConnectorConnection, error)

func ProviderRecoveryIdentity

func ProviderRecoveryIdentity(ctx context.Context, db *sql.Conn, node protocol.NodeID, provider protocol.ConversationProvider, reference protocol.CredentialRef) (string, string, error)

ProviderRecoveryIdentity reads account identity even after expiry, without treating an expired token or an unresolved refresh as usable authorization.

func PruneDraftAttachments

func PruneDraftAttachments(ctx context.Context, db *sql.Conn, now time.Time) error

PruneDraftAttachments keeps abandoned uploads for the same retry window as their finish receipts. A later collection removes the unreferenced files.

func PruneResourceCatalogSources

func PruneResourceCatalogSources(ctx context.Context, db *sql.Conn, entry protocol.NodeID, allowed []protocol.NodeID) ([]protocol.NodeID, error)

PruneResourceCatalogSources follows explicit relationship removal, including removals made while this Node was stopped. A failed peer listing must not call this with an empty list.

func PublishArtifactWrite

func PublishArtifactWrite(ctx context.Context, db *sql.Conn, capture ArtifactWrite, digest string) (protocol.Output, error)

func PutBlob

func PutBlob(ctx context.Context, connection *sql.Conn, data []byte) (string, error)

PutBlob stores binary content once per digest in the current transaction.

func ReadActivityCatalog

func ReadActivityCatalog(ctx context.Context, db *sql.Conn, node protocol.NodeID) (protocol.ActivityCatalog, error)

func ReadActivityPreviews

func ReadActivityPreviews(ctx context.Context, db *sql.Conn, sessions []protocol.SessionID) ([]protocol.ActivityPreview, error)

func ReadAgentCommand

func ReadAgentCommand(ctx context.Context, db *sql.Conn, node protocol.NodeID, command protocol.Command) (protocol.Output, error)

func ReadAgentCommandForCaller

func ReadAgentCommandForCaller(ctx context.Context, db *sql.Conn, node, caller protocol.NodeID, command protocol.Command) (protocol.Output, error)

func ReadAgentReference

func ReadAgentReference(ctx context.Context, db *sql.Conn, node protocol.NodeID, source AgentHistorySource, kind string, arguments json.RawMessage) (json.RawMessage, error)

func ReadAgentRun

func ReadAgentRun(ctx context.Context, db *sql.Conn, turn protocol.TurnID) (protocol.ConversationRun, error)

func ReadAgentStatistics

func ReadAgentStatistics(ctx context.Context, db *sql.Conn, session protocol.SessionID) (protocol.ConversationStatistics, error)

ReadAgentStatistics derives session totals from canonical turn membership. The caller's transaction keeps usage, observation and policy reads consistent.

func ReadArtifactCommand

func ReadArtifactCommand(ctx context.Context, db *sql.Conn, request protocol.Request) (protocol.Output, error)

func ReadAssistantDeclaration

ReadAssistantDeclaration returns the declaration in an exact package capture.

func ReadAttachment

func ReadAttachment(ctx context.Context, db *sql.Conn, worktree protocol.WorktreeID, id protocol.AttachmentID) (protocol.Attachment, error)

func ReadBackgroundTasks

func ReadBackgroundTasks(ctx context.Context, db *sql.Conn, session protocol.SessionID) ([]protocol.ConversationBackgroundTask, error)

func ReadBackupSettings

func ReadBackupSettings(ctx context.Context, db *sql.Conn) (protocol.BackupSettings, error)

ReadBackupSettings returns the settings without any credential value.

func ReadCanonicalImage

func ReadCanonicalImage(ctx context.Context, db *sql.Conn, session protocol.SessionID, image protocol.ConversationImage) ([]byte, error)

func ReadChildRole

func ReadChildRole(ctx context.Context, db *sql.Conn, turn protocol.TurnID) (*protocol.RoleProfile, error)

func ReadCodeIndexSettings

func ReadCodeIndexSettings(ctx context.Context, db *sql.Conn) (protocol.CodeIndexSettings, error)

ReadCodeIndexSettings returns the saved enablement, enabled by default.

func ReadConfigurationCache

func ReadConfigurationCache(ctx context.Context, db *sql.Conn, category, id string) (json.RawMessage, bool, error)

func ReadConfigurationFollow

func ReadConfigurationFollow(ctx context.Context, db *sql.Conn) (protocol.ConfigurationFollowStatus, error)

func ReadConversation

func ReadConversation(ctx context.Context, db *sql.Conn, session protocol.SessionID, before *protocol.TurnID, limit uint16) (protocol.ConversationHistory, error)

func ReadConversationTurn

func ReadConversationTurn(ctx context.Context, db *sql.Conn, session protocol.SessionID, turn protocol.TurnID, revision uint64, before *uint64, limit uint16) (protocol.ConversationTurnHistory, error)

func ReadDatabase

func ReadDatabase(ctx context.Context, db *sql.Conn, id protocol.DatabaseID) (*protocol.DatabaseProfile, error)

ReadDatabase returns nil when the profile is not saved on this Node.

func ReadDefaults

func ReadDefaults(ctx context.Context, db *sql.Conn) (protocol.Defaults, error)

func ReadDispatchTurn

func ReadDispatchTurn(ctx context.Context, db *sql.Conn, node protocol.NodeID, packageName string, identity protocol.JobID) (protocol.TurnID, error)

func ReadDraftAttachment

func ReadDraftAttachment(ctx context.Context, db *sql.Conn, caller protocol.NodeID, id protocol.AttachmentID) (protocol.Attachment, error)

func ReadFilesCommand

func ReadFilesCommand(ctx context.Context, db *sql.Conn, caller protocol.NodeID, request protocol.Request) (protocol.Output, error)

func ReadHooks

func ReadHooks(ctx context.Context, db *sql.Conn) (protocol.HooksSettings, error)

func ReadIdentity

func ReadIdentity(ctx context.Context, db *sql.Conn, node, caller protocol.NodeID) (protocol.IdentityState, error)

func ReadIdentityCommand

func ReadIdentityCommand(ctx context.Context, db *sql.Conn, node, caller protocol.NodeID, command protocol.Command) (protocol.Output, error)

func ReadIdentityDirectory

func ReadIdentityDirectory(ctx context.Context, db *sql.Conn, node, caller protocol.NodeID) (protocol.HostDirectory, error)

func ReadLocalModelSettings

func ReadLocalModelSettings(ctx context.Context, db *sql.Conn) (protocol.ModelsLocalSettings, error)

ReadLocalModelSettings reads the saved choices and mirror.

func ReadMediaSettings

func ReadMediaSettings(ctx context.Context, db *sql.Conn) (protocol.MediaSettings, error)

ReadMediaSettings returns the saved bindings and names every bound purpose whose model cannot run now.

func ReadNetworkSelection

func ReadNetworkSelection(ctx context.Context, db *sql.Conn) (uint64, *protocol.NetworkSelection, error)

func ReadNotifications

func ReadNotifications(ctx context.Context, db *sql.Conn) ([]protocol.NotificationNotice, error)

func ReadPlugin

func ReadPlugin(ctx context.Context, db *sql.Conn, name string) (*protocol.PluginInfo, error)

func ReadPluginCommand

func ReadPluginCommand(ctx context.Context, db *sql.Conn, request protocol.Request) (protocol.Output, error)

func ReadPluginConnection

func ReadPluginConnection(ctx context.Context, db *sql.Conn, profile string, reference protocol.PluginReference, card string) (protocol.PluginConnectionStatus, error)

func ReadPluginConnectionAdmitted

func ReadPluginConnectionAdmitted(ctx context.Context, db *sql.Conn, profile string, info protocol.PluginInfo, card string) (protocol.PluginConnectionStatus, error)

func ReadPluginInfos

func ReadPluginInfos(ctx context.Context, db *sql.Conn) ([]protocol.PluginInfo, error)

func ReadPluginSettings

func ReadPluginSettings(ctx context.Context, db *sql.Conn, reference protocol.PluginReference, targets ...map[string]string) (protocol.PluginSettingsState, error)

func ReadPluginStatusPackages

func ReadPluginStatusPackages(ctx context.Context, db *sql.Conn, scope protocol.PluginUiStatusScope) ([]protocol.PluginInfo, error)

func ReadPluginValue

func ReadPluginValue(ctx context.Context, db *sql.Conn, reference protocol.PluginReference, key string) (protocol.PluginStorageEntry, error)

func ReadPluginVersion

func ReadPluginVersion(ctx context.Context, db *sql.Conn, reference protocol.PluginReference) (protocol.PluginInfo, error)

ReadPluginVersion reads an immutable package capture independently of its live installation. It never creates inventory or substitutes a newer package.

func ReadPlugins

func ReadPlugins(ctx context.Context, db *sql.Conn) ([]protocol.PluginSummary, error)

func ReadPower

func ReadPower(ctx context.Context, db *sql.Conn) (protocol.PowerSettings, error)

func ReadProjects

func ReadProjects(ctx context.Context, db *sql.Conn) ([]protocol.Project, error)

func ReadProviderAuthorization

func ReadProviderAuthorization(ctx context.Context, db *sql.Conn, node protocol.NodeID, provider protocol.ConversationProvider, reference protocol.CredentialRef) (*protocol.Secret, error)

func ReadProviderCatalogStatus

func ReadProviderCatalogStatus(ctx context.Context, db *sql.Conn) (protocol.ConversationCatalogStatus, error)

func ReadProviderCommand

func ReadProviderCommand(ctx context.Context, db *sql.Conn, node protocol.NodeID, command protocol.Command) (protocol.Output, error)

func ReadProviderSnapshot

ReadProviderSnapshot exposes only the current user's providers. Authentication material is absent from both returned public projections.

func ReadPythonSettings

func ReadPythonSettings(ctx context.Context, db *sql.Conn) (protocol.PythonSettings, error)

func ReadQueue

func ReadQueue(ctx context.Context, db *sql.Conn, session protocol.SessionID) (protocol.ConversationQueue, error)

func ReadResourceCatalogSources

func ReadResourceCatalogSources(ctx context.Context, db *sql.Conn, entry protocol.NodeID) ([]protocol.ResourceSource, error)

Resource catalogs are projections of the current user's authenticated direct routes. They deliberately cannot store a full Snapshot, credentials, session history, file content or knowledge indexes.

func ReadRoles

func ReadRoles(ctx context.Context, db *sql.Conn) ([]protocol.RoleProfile, error)

func ReadRuntimeProviderCredential

func ReadRuntimeProviderCredential(ctx context.Context, db *sql.Conn, node protocol.NodeID, provider protocol.ConversationProvider, reference protocol.CredentialRef) (*protocol.Secret, error)

func ReadSandboxSettings

func ReadSandboxSettings(ctx context.Context, db *sql.Conn) (protocol.SandboxSettings, error)

func ReadSearchSettings

func ReadSearchSettings(ctx context.Context, db *sql.Conn) (protocol.SearchSettings, error)

func ReadSession

func ReadSession(ctx context.Context, db *sql.Conn, id protocol.SessionID) (protocol.Session, error)

func ReadSessions

func ReadSessions(ctx context.Context, db *sql.Conn) ([]protocol.Session, error)

func ReadTeamCommand

func ReadTeamCommand(ctx context.Context, db *sql.Conn, command protocol.Command) (protocol.Output, error)

func ReadTeamSettings

func ReadTeamSettings(ctx context.Context, db *sql.Conn) (protocol.TeamSettings, error)

func ReadTeams

func ReadTeams(ctx context.Context, db *sql.Conn) ([]protocol.TeamProfile, error)

func ReadTelemetry

func ReadTelemetry(ctx context.Context, db *sql.Conn) (protocol.TelemetrySettings, error)

func ReadTerminal

func ReadTerminal(ctx context.Context, db *sql.Conn, id protocol.TerminalID) (protocol.TerminalInfo, error)

func ReadTerminalSettings

func ReadTerminalSettings(ctx context.Context, db *sql.Conn) (protocol.TerminalSettings, error)

func ReadTerminals

func ReadTerminals(ctx context.Context, db *sql.Conn) ([]protocol.TerminalInfo, error)

func ReadWebSearchPlan

func ReadWebSearchPlan(ctx context.Context, db *sql.Conn) (web.SearchPlan, error)

ReadWebSearchPlan copies private credentials into a Node-owned execution capture. The caller binds the frozen model callback before leaving its admission owner.

func ReadWorkspaceRoot

func ReadWorkspaceRoot(ctx context.Context, db *sql.Conn, worktree protocol.WorktreeID, internal bool) (string, error)

ReadWorkspaceRoot captures database ownership only. Filesystem work follows after the caller closes its read lease.

func ReadWorktrees

func ReadWorktrees(ctx context.Context, db *sql.Conn) ([]protocol.Worktree, error)

func ReconcileProviderQuotas

func ReconcileProviderQuotas(ctx context.Context, db *sql.Conn, node protocol.NodeID) ([]protocol.Event, error)

func RecordBackupOutcome

func RecordBackupOutcome(ctx context.Context, db *sql.Conn, outcome protocol.BackupOutcome) error

RecordBackupOutcome keeps how the most recent backup ended, for the Backup page. It is not a settings change: the revision stays.

func RecordConnectionSave

func RecordConnectionSave(ctx context.Context, db *sql.Conn, request protocol.Request) error

RecordConnectionSave keeps an authorized turn's save without its secret. Call it after authorization in the save's writer transaction, so a failed save rolls back its proof. Controller saves have no turn proof to record. The request ledger holds only the digest; ConnectionCreated reads this row.

func RecordEvents

func RecordEvents(ctx context.Context, db *sql.Conn, node protocol.NodeID, changes []protocol.Event) ([]protocol.EventEnvelope, error)

func RecordHostRemoval

func RecordHostRemoval(ctx context.Context, db *sql.Conn, host protocol.NodeID, request protocol.RequestID, state string, failure *protocol.Fault) error

func RecordKnowledgeProgress

func RecordKnowledgeProgress(ctx context.Context, db *sql.Conn, id protocol.KnowledgeID, generation uint64, progress protocol.KnowledgeProgress) (bool, error)

RecordKnowledgeProgress stores the worker's progress for the generation it indexed. It reports whether the collection changed.

func RecordPluginStatusDiagnostic

func RecordPluginStatusDiagnostic(ctx context.Context, db *sql.Conn, report protocol.NotificationSystemSystemDiagnostic, timestamp int64) ([]protocol.Event, error)

func RecoverCommands

func RecoverCommands(ctx context.Context, db *sql.Conn, now time.Time) ([]protocol.Event, error)

func RecoverConnectorLogins

func RecoverConnectorLogins(ctx context.Context, db *sql.Conn) error

func RecoverCredentialRenewals

func RecoverCredentialRenewals(ctx context.Context, db *sql.Conn, node protocol.NodeID) error

RecoverCredentialRenewals never repeats an exchange whose response may have been lost. Its access token remains usable until expiry; explicit sign-in is needed afterward. Publish a new revision for the changed execution state.

func RecoverRuns

func RecoverRuns(ctx context.Context, db *sql.Conn, now time.Time) ([]protocol.Event, error)

func RecoverTerminals

func RecoverTerminals(ctx context.Context, db *sql.Conn) error

func RefreshEventAccess

func RefreshEventAccess(ctx context.Context, db *sql.Conn, event protocol.EventEnvelope) (protocol.EventEnvelope, error)

RefreshEventAccess rechecks buffered rows after another writer changes scope.

func RefreshTurnRoles

func RefreshTurnRoles(ctx context.Context, db *sql.Conn, node protocol.NodeID, snapshot *protocol.RoleSnapshot) error

func RegisterChildBackground

func RegisterChildBackground(ctx context.Context, db *sql.Conn, parent, child protocol.ConversationRun, title string, now time.Time) ([]protocol.Event, error)

func RegisterCommand

func RegisterCommand(ctx context.Context, db *sql.Conn, request protocol.Request, now time.Time) ([]protocol.Event, error)

func RegisterCreatedWorktree

func RegisterCreatedWorktree(ctx context.Context, db *sql.Conn, value protocol.Worktree, adopt bool) (protocol.Worktree, []protocol.Event, error)

RegisterCreatedWorktree commits a verified external checkout. No filesystem action or native Git command runs on the storage writer.

func RegisterKnowledgeSemantic

func RegisterKnowledgeSemantic(ctx context.Context, db *sql.Conn) (bool, error)

RegisterKnowledgeSemantic registers the semantic collections of every enabled package. It runs when the Node starts and after a package changes.

func RegisterLocalModel

func RegisterLocalModel(ctx context.Context, db *sql.Conn, capabilities localmodels.Capabilities, definition protocol.ModelsDefinition) (protocol.Output, []protocol.Event, error)

RegisterLocalModel stores a validated definition under its content identity and returns that identity. Registering a known definition changes nothing.

func RegisterPromotedCommand

func RegisterPromotedCommand(ctx context.Context, db *sql.Conn, request protocol.Request, now time.Time) ([]protocol.Event, error)

func ReleaseBackground

func ReleaseBackground(ctx context.Context, db *sql.Conn, turn protocol.TurnID, hold *protocol.ConversationBackgroundHold, suppress bool) ([]protocol.Event, error)

ReleaseBackground returns the results reserved for a turn that did not take them. The hold is why the turn did not. With suppress they are suppressed: they start no notice turn and join the user's next message, and the hold tells clients why. Without it only the results that were already suppressed take the hold, so none is left held without a reason.

func ReleaseChildren

func ReleaseChildren(ctx context.Context, db *sql.Conn, parent protocol.TurnID, children []protocol.TurnID) ([]protocol.Event, error)

func RelocateProfile

func RelocateProfile(ctx context.Context, db *sql.Conn, original, target string) error

RelocateProfile rewrites the stored paths that point into the profile at original so they point into target, for a profile that is about to move.

func RememberIdentityPeerName

func RememberIdentityPeerName(ctx context.Context, db *sql.Conn, peer protocol.NodeID, name string) error

func RememberLinkPeer

func RememberLinkPeer(ctx context.Context, db *sql.Conn, address link.EndpointAddress) error

func RemovePlugin

func RemovePlugin(ctx context.Context, db *sql.Conn, name string, expectedRevision uint64) (protocol.PluginSummary, error)

func RemovePluginValue

func RemovePluginValue(ctx context.Context, db *sql.Conn, reference protocol.PluginReference, key string, expectedRevision uint64) (protocol.PluginStorageEntry, error)

func RemoveResourceCatalogSource

func RemoveResourceCatalogSource(ctx context.Context, db *sql.Conn, source protocol.NodeID) error

func RemovedArtifactOwners

func RemovedArtifactOwners(ctx context.Context, db *sql.Conn) ([]protocol.SessionID, error)

RemovedArtifactOwners lists the removed sessions that keep no artifact; their artifact directories hold nothing a conversation can read.

func ResolveMediaBinding

func ResolveMediaBinding(ctx context.Context, db *sql.Conn, node protocol.NodeID, provider protocol.ConversationProvider, name string, session protocol.SessionID) (model.Binding, error)

ResolveMediaBinding binds a captured API-key provider to its current key.

func ResolvePluginInfo

func ResolvePluginInfo(ctx context.Context, db *sql.Conn, reference protocol.PluginReference) (protocol.PluginInfo, error)

func ResolvePluginMessageCommand

func ResolvePluginMessageCommand(ctx context.Context, db *sql.Conn, node protocol.NodeID, request protocol.Request) (*protocol.Request, error)

func ResolvePluginViewInfo

func ResolvePluginViewInfo(ctx context.Context, db *sql.Conn, reference protocol.PluginReference, surface protocol.PluginDesktopSurface) (protocol.PluginInfo, error)

func ResolveSearchBinding

func ResolveSearchBinding(ctx context.Context, db *sql.Conn, node protocol.NodeID, provider protocol.ConversationProvider, name string, session protocol.SessionID) (model.Binding, error)

func ResolveToolCommandStream

ResolveToolCommandStream verifies the current invocation and exact visible canonical result. The Node pages the existing Process owner after this read.

func ResolveTurnAttachment

func ResolveTurnAttachment(ctx context.Context, db *sql.Conn, turn protocol.TurnID, id protocol.AttachmentID) (protocol.Attachment, error)

func ResolveUser

func ResolveUser(ctx context.Context, db *sql.Conn, id protocol.UserID) (protocol.User, error)

ResolveUser follows only stored merge relationships; request bodies cannot supply a principal or select another user's resource namespace.

func RestorePluginConversation

func RestorePluginConversation(ctx context.Context, db *sql.Conn, session protocol.SessionID) error

func RetainedAttachments

func RetainedAttachments(ctx context.Context, db *sql.Conn) (map[protocol.AttachmentID]bool, error)

func RetireImportedPeerRoutes

func RetireImportedPeerRoutes(ctx context.Context, db *sql.Conn) error

RetireImportedPeerRoutes removes only outbound access inherited from an old directory. Explicit pairing directions and provenance records remain intact.

func RevokeIdentityDevice

func RevokeIdentityDevice(ctx context.Context, db *sql.Conn, node, caller protocol.NodeID, input protocol.RevokeDevice) error

func RewindPluginConversation

func RewindPluginConversation(ctx context.Context, db *sql.Conn, session protocol.SessionID, through *protocol.TurnID) error

func RuntimeCredentialEvent

func RuntimeCredentialEvent(event string) bool

func SameKnowledgeStored

func SameKnowledgeStored(left, right KnowledgeStored) bool

SameKnowledgeStored compares the identity an indexing pass or a citation read captured with the current collection.

func SaveBackupSettings

func SaveBackupSettings(ctx context.Context, db *sql.Conn, input protocol.BackupUpdate, timestamp int64) (protocol.BackupSettings, []protocol.Event, error)

SaveBackupSettings stores the destinations, credentials and schedule, and registers the Node's own scheduled export.

func SaveCodeIndexSettings

func SaveCodeIndexSettings(ctx context.Context, db *sql.Conn, input protocol.CodeIndexSettings, expected uint64) (protocol.CodeIndexSettings, error)

SaveCodeIndexSettings replaces the settings when both the edited value and the stored one carry the expected revision.

func SaveDefaults

func SaveDefaults(ctx context.Context, db *sql.Conn, node protocol.NodeID, input protocol.Defaults) (protocol.Defaults, error)

SaveDefaults replaces only the active user's default session configuration.

func SaveHooks

func SaveHooks(ctx context.Context, db *sql.Conn, input protocol.HooksSettings, expected uint64) (protocol.HooksSettings, error)

func SaveLocalModelSettings

func SaveLocalModelSettings(ctx context.Context, db *sql.Conn, settings protocol.ModelsLocalSettings) (protocol.Output, []protocol.Event, error)

SaveLocalModelSettings replaces the settings at their expected revision. Every selected model must be registered for its kind.

func SaveNetworkSelection

func SaveNetworkSelection(ctx context.Context, db *sql.Conn, expected uint64, selection protocol.NetworkSelection) (uint64, error)

func SaveOAuthRegistration

func SaveOAuthRegistration(ctx context.Context, db *sql.Conn, key, client string) error

func SavePythonSettings

func SavePythonSettings(ctx context.Context, db *sql.Conn, input protocol.PythonSettings) (protocol.Output, []protocol.Event, error)

func SaveResourceCatalogSource

func SaveResourceCatalogSource(ctx context.Context, db *sql.Conn, entry protocol.NodeID, source protocol.ResourceSource) error

SaveResourceCatalogSource publishes a complete directory version. Callers retain the previous version while snapshot pages are incomplete or a source is temporarily unavailable; absence means deletion only in a complete read.

func SaveSandboxSettings

func SaveSandboxSettings(ctx context.Context, db *sql.Conn, input protocol.SandboxSettings) (protocol.SandboxSettings, error)

func SaveSearchSettings

func SaveSearchSettings(ctx context.Context, db *sql.Conn, request protocol.Request, update protocol.SearchUpdate) (protocol.Output, []protocol.Event, error)

func SaveTerminal

func SaveTerminal(ctx context.Context, db *sql.Conn, value protocol.TerminalInfo, event bool) ([]protocol.Event, error)

func SaveTerminalSettings

func SaveTerminalSettings(ctx context.Context, db *sql.Conn, input protocol.TerminalSettings) (protocol.TerminalSettings, []protocol.Event, error)

SaveTerminalSettings stores the default shell and environment of new terminals. The shell is resolved on this Node, so it must be absolute here.

func ScheduleBackground

func ScheduleBackground(ctx context.Context, db *sql.Conn, node protocol.NodeID, session protocol.SessionID, now time.Time) (*protocol.QueuedTurn, []protocol.Event, error)

func SearchSettingsController

func SearchSettingsController(request protocol.Request) bool

func SelectSessionRoles

func SelectSessionRoles(ctx context.Context, db *sql.Conn, node protocol.NodeID, previous protocol.RoleSnapshot, references []protocol.RoleReference) (protocol.RoleSnapshot, error)

func SetIdentityPeerDirection

func SetIdentityPeerDirection(ctx context.Context, db *sql.Conn, peer protocol.NodeID, direction link.PeerDirection) error

func SetLinkDirection

func SetLinkDirection(ctx context.Context, db *sql.Conn, peer protocol.NodeID, direction link.PeerDirection) error

func SetLinkTrust

func SetLinkTrust(ctx context.Context, db *sql.Conn, peer protocol.NodeID, trusted bool) error

func SetPluginEnabled

func SetPluginEnabled(ctx context.Context, db *sql.Conn, name string, expectedRevision uint64, enabled bool) (protocol.PluginInfo, error)

func SetPluginPinned

func SetPluginPinned(ctx context.Context, db *sql.Conn, name string, expectedRevision uint64, pinned bool) (protocol.PluginInfo, error)

func SetRunCredentialWait

func SetRunCredentialWait(ctx context.Context, db *sql.Conn, node protocol.NodeID, turn protocol.TurnID, waiting *protocol.ConversationRunWaiting) ([]protocol.Event, error)

SetRunCredentialWait changes only the running turn's projection; its capture, canonical records and already completed effects remain untouched.

func SettleStoppedChildren

func SettleStoppedChildren(ctx context.Context, db *sql.Conn, now time.Time) ([]protocol.Event, error)

SettleStoppedChildren finishes the queued children a controller stopped. stop_turn leaves such a run cancelled without a finish time; finishing it here closes its completion record and refreshes its parent. The store is the source, so a stopped child is settled whether or not the Runtime still holds its owner.

func Snapshot

func Snapshot(ctx context.Context, db *sql.Conn, node protocol.NodeID) (protocol.Snapshot, error)

Snapshot reads all fields from the caller's pinned read transaction.

func StallCommand

func StallCommand(ctx context.Context, db *sql.Conn, stalled process.Stalled, now time.Time) ([]protocol.Event, bool, error)

StallCommand records at most one silent period for a follow-up command. The command itself stays running until it finishes.

func StartConnectorLogin

func StartConnectorLogin(ctx context.Context, db *sql.Conn, capture ConnectorLoginCapture) error

func StartSessionProvider

func StartSessionProvider(ctx context.Context, db *sql.Conn, draft protocol.ConversationStart) (protocol.ProviderID, error)

func StopChild added in v0.2.4

StopChild stops the current execution of a child the parent turn's conversation owns, on the same path as a controller's stop_turn: the request is recorded for stop_reason. A child that is not queued or running is returned unchanged.

func SupportsAgentCommand

func SupportsAgentCommand(kind string) bool

func SupportsFilesCommand

func SupportsFilesCommand(kind string) bool

func SupportsProviderCommand

func SupportsProviderCommand(kind string) bool

func SupportsTeamCommand

func SupportsTeamCommand(kind string) bool

func SupportsTeamRead

func SupportsTeamRead(kind string) bool

func UserFromContext

func UserFromContext(ctx context.Context) (protocol.User, bool)

UserFromContext returns only the principal already verified by Node.

func ValidAgentProgress

func ValidAgentProgress(value protocol.ConversationProgress) bool

ValidAgentProgress reports whether a progress snapshot is non-empty and within the 64 KiB text budget.

func ValidateConnectionTrust

func ValidateConnectionTrust(ctx context.Context, db *sql.Conn, turn protocol.TurnID, binding *ApprovalBinding, trust protocol.SshTrust) error

ValidateConnectionTrust accepts host-key consent only inside an approval of a captured SSH run or transfer, for the profile exactly as saved now and a key it does not already trust.

func ValidateMCPElicitation

func ValidateMCPElicitation(ctx context.Context, db *sql.Conn, record canonical.Record) error

func ValidatePluginStatusStates

func ValidatePluginStatusStates(info protocol.PluginInfo, value json.RawMessage) ([]protocol.PluginUiState, error)

func ValidateProjectDraft

func ValidateProjectDraft(value protocol.ProjectsDraft) error

ValidateProjectDraft checks the request before native clone effects begin.

func ValidateRole

func ValidateRole(role protocol.RoleProfile) error

ValidateRole reports what a role definition alone makes invalid. A caller that asks for approval of a definition checks it first.

func ValidateTeam

func ValidateTeam(team protocol.TeamProfile) error

ValidateTeam reports what a team definition alone makes invalid, before its members and model are resolved against the catalog.

func ViewCodeIndexSettings added in v0.2.4

func ViewCodeIndexSettings(ctx context.Context, db *sql.Conn) (protocol.CodeIndexSettings, error)

ViewCodeIndexSettings exposes only selections the requesting administrator can manage. Every user can still read whether the code tools are available.

func WithCapturedUser

func WithCapturedUser(ctx context.Context, user protocol.UserID) context.Context

WithCapturedUser retains the immutable storage principal of admitted work. CurrentUser remains the canonical actor for authorization after a user merge.

func WithKnowledgePackage

func WithKnowledgePackage(ctx context.Context, info protocol.PluginInfo) context.Context

WithKnowledgePackage retains a package after the trusted resource entry point checked its origin. Its Turn and Session belong to the execution Node, so the storage Node reads the captured package instead of resolving foreign IDs.

func WithKnowledgeScope

func WithKnowledgeScope(ctx context.Context, scope *protocol.ResourceScope) (context.Context, error)

WithKnowledgeScope checks the captured package identity before making it available to a local resource operation. Link caller and user verification belongs to the resource entry point and cannot be supplied in this payload.

func WithUser

func WithUser(ctx context.Context, user protocol.User) context.Context

WithUser carries a Node-verified principal through admitted asynchronous work. A peer never supplies this value in its request body.

func WritePluginConversationValue

func WritePluginConversationValue(ctx context.Context, db *sql.Conn, reference protocol.PluginReference, session protocol.SessionID, turn *protocol.TurnID, key string, value json.RawMessage, expectedRevision uint64) (protocol.PluginStorageConversationEntry, error)

func WritePluginValue

func WritePluginValue(ctx context.Context, db *sql.Conn, reference protocol.PluginReference, key string, value json.RawMessage, expectedRevision uint64, index *protocol.PluginStorageIndex) (protocol.PluginStorageEntry, error)

Types

type AgentGuidance

type AgentGuidance struct {
	Turn    protocol.QueuedTurn
	Message protocol.ConversationInput
}

func TakeGuidance

func TakeGuidance(ctx context.Context, db *sql.Conn, recipient protocol.TurnID) ([]AgentGuidance, []protocol.Event, error)

type AgentHistorySource

type AgentHistorySource struct {
	Caller  protocol.NodeID
	Session protocol.SessionID
	Turn    protocol.TurnID
}

type AgentInstruction

type AgentInstruction struct {
	Text     string   `json:"text"`
	AnyTools []string `json:"any_tools"`
}

type AgentInvocation

type AgentInvocation struct {
	User                 protocol.User
	StorageUser          protocol.UserID
	Hooks                protocol.HooksSettings
	Session              protocol.Session
	Worktree             protocol.Worktree
	Run                  protocol.ConversationRun
	Turn                 protocol.QueuedTurn
	Caller               protocol.NodeID
	Message              protocol.ConversationInput
	Provider             *protocol.ConversationProvider
	Secret               *protocol.Secret
	EffectiveCredential  *protocol.CredentialRef
	AuthorizationFailure *protocol.Fault
	Instructions         []AgentInstruction
	CompactionPercent    uint8
	// Media holds the per-purpose model assignments frozen at admission.
	Media MediaCapture
	// Assistant is the declaration frozen by the turn's assistant binding.
	Assistant *protocol.PluginConversationDeclaration
}

func ClaimChild

func ClaimChild(ctx context.Context, db *sql.Conn, turn protocol.TurnID, now time.Time) (*AgentInvocation, []protocol.Event, error)

func ClaimNext

func ClaimNext(ctx context.Context, db *sql.Conn, now time.Time) (*AgentInvocation, []protocol.Event, error)

func DelegateAgent

func DelegateAgent(ctx context.Context, db *sql.Conn, node protocol.NodeID, parent protocol.TurnID, identity canonical.ToolIdentity, selected *protocol.ConversationInput, ready bool, now time.Time) (AgentInvocation, []protocol.Event, error)

func DelegatePrepared

func DelegatePrepared(ctx context.Context, db *sql.Conn, node protocol.NodeID, parent protocol.TurnID, identity canonical.ToolIdentity, arguments json.RawMessage, selected *protocol.ConversationInput, ready, overlap bool, now time.Time) (AgentInvocation, []protocol.Event, error)

DelegatePrepared admits a child for a call whose executing arguments differ from the ones the model sent: a package tool bound to agents.delegate or agents.guide prepares them. identity stays the recorded call, which locates it in the conversation; arguments describe the child. overlap records the effective foreground mode, which a default can choose without an argument.

type AgentReviewChange

type AgentReviewChange struct {
	Session protocol.SessionID
	Change  protocol.ConversationChange
}

func ApplyReviewCommand

func ApplyReviewCommand(ctx context.Context, db *sql.Conn, request protocol.Request, output protocol.Output, now time.Time) ([]AgentReviewChange, []protocol.Event, error)

ApplyReviewCommand runs inside the command transaction and returns feed effects to publish after COMMIT. It never owns another command or event ledger.

type AgentState

type AgentState struct {
	Session protocol.Session
	// Records are shared with every state extended from this one: read-only.
	Records     []canonical.Record
	Context     canonical.Context
	LoadedTools []string
	Reviewed    bool
	// contains filtered or unexported fields
}

func ExtendAgentState

func ExtendAgentState(ctx context.Context, db *sql.Conn, session protocol.SessionID, previous AgentState) (AgentState, int, error)

ExtendAgentState loads a session's state, decoding only the records appended after previous, and reports how many leading records it shares with it. History only grows within one history revision; after a rewind, or for another session, everything is loaded again.

func LoadAgentState

func LoadAgentState(ctx context.Context, db *sql.Conn, session protocol.SessionID) (AgentState, error)

type ApprovalBinding

type ApprovalBinding struct {
	Owner     protocol.PluginReference `json:"owner"`
	Tool      string                   `json:"tool"`
	Operation *protocol.ToolOperation  `json:"operation"`
}

func (*ApprovalBinding) UnmarshalJSON

func (v *ApprovalBinding) UnmarshalJSON(data []byte) error

type ArtifactRead

type ArtifactRead struct {
	Content protocol.ArtifactContent
	Digest  string
}

ArtifactRead captures immutable metadata for a resource-worker read. It owns no database connection and must be rechecked against the session after IO.

func CaptureArtifactRead

func CaptureArtifactRead(ctx context.Context, db *sql.Conn, request protocol.Request) (ArtifactRead, error)

type ArtifactWrite

type ArtifactWrite struct {
	Artifact protocol.ArtifactSummary
	Previous *protocol.ArtifactSummary
	HTML     string
	Warnings []string
	Digest   string
	Request  protocol.Request
}

func CaptureArtifactWrite

func CaptureArtifactWrite(ctx context.Context, db *sql.Conn, request protocol.Request, allowedClasses []string, now time.Time) (ArtifactWrite, error)

type AutomaticChain

type AutomaticChain struct {
	Count int
	Limit int
}

AutomaticChain is a session's run of automatic turns since its last user input and the limit that run is held to.

func ReadAutomaticChain

func ReadAutomaticChain(ctx context.Context, db *sql.Conn, session protocol.SessionID) (AutomaticChain, error)

ReadAutomaticChain counts the notice turns and package continuations that started since the session's last user input. Automatic turns that never started neither count nor reset; joined guidance is user input, and so is the request behind a continuation the user asked for, which is the first turn of its chain. The limit is the one the chain's latest continuation declared, or the default.

type BackgroundRecord

type BackgroundRecord struct {
	Task            protocol.ConversationBackgroundTask `json:"task"`
	FollowUp        bool                                `json:"follow_up"`
	StopObserved    bool                                `json:"stop_observed,omitempty"`
	Stdout          *string                             `json:"stdout"`
	Stderr          *string                             `json:"stderr"`
	StdoutBytes     *uint64                             `json:"stdout_bytes,omitempty"`
	StderrBytes     *uint64                             `json:"stderr_bytes,omitempty"`
	StdoutTruncated bool                                `json:"stdout_truncated,omitempty"`
	StderrTruncated bool                                `json:"stderr_truncated,omitempty"`
	Response        *string                             `json:"response"`
	ResponseBytes   *uint64                             `json:"response_bytes,omitempty"`
	ElapsedMs       *uint64                             `json:"elapsed_ms"`
	SilenceMs       *uint64                             `json:"silence_ms,omitempty"`
	Sequence        uint64                              `json:"sequence"`
}

BackgroundRecord retains completion evidence independently of process handles. Background delivery consumes its follow-up flag through the same authoritative writer.

func (*BackgroundRecord) UnmarshalJSON

func (record *BackgroundRecord) UnmarshalJSON(data []byte) error

type ChildState

type ChildState struct {
	Run       protocol.ConversationRun
	Response  *string
	Recipient *protocol.TurnID
	Paused    bool
	Ready     bool
	// TurnLimit reports that the child's role action limit ended the run.
	TurnLimit bool
}

func ReadChildState

func ReadChildState(ctx context.Context, db *sql.Conn, parent protocol.TurnID, child protocol.SessionID, exact *protocol.TurnID) (ChildState, error)

type Closed

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

Closed retains exclusive maintenance ownership until Reopen or Close.

func (*Closed) Close

func (closed *Closed) Close() error

func (*Closed) Copy

func (closed *Closed) Copy(ctx context.Context, target string) error

Copy keeps every source connection closed while copying the native family. Reopen and Close wait for the copy to finish or return its cancellation.

func (*Closed) Path

func (closed *Closed) Path() string

func (*Closed) Reopen

func (closed *Closed) Reopen(ctx context.Context) error

type ConnectionAction

type ConnectionAction struct {
	Kind ConnectionActionKind
	// SaveDatabase and SaveSsh.
	DatabaseInput ConnectionDatabaseInput
	SshInput      ConnectionSshInput
	// Browse and Query.
	Database *string
	ReadOnly bool
	Sql      string
	RowLimit uint32
	// Run and Transfer. Run defaults to 120 seconds; Query and Transfer
	// require a value.
	Command    string
	TimeoutMs  *uint64
	Path       string
	RemotePath string
	Direction  protocol.SshDirection
}

ConnectionAction is one captured tool request. Only the fields of its kind are read.

type ConnectionActionKind

type ConnectionActionKind uint8
const (
	ConnectionListDatabases ConnectionActionKind = iota
	ConnectionListSsh
	ConnectionSaveDatabase
	ConnectionSaveSsh
	ConnectionBrowse
	ConnectionQuery
	ConnectionRun
	ConnectionTransfer
)

type ConnectionCatalog

type ConnectionCatalog struct {
	Bound     *protocol.ConnectionResource
	Databases []protocol.DatabaseProfile
	Ssh       []protocol.SshProfile
}

ConnectionCatalog is what one conversation may see of the saved database and SSH profiles. Credentials stay behind the Node workers.

func ReadConnectionCatalog

func ReadConnectionCatalog(ctx context.Context, db *sql.Conn, id protocol.SessionID) (ConnectionCatalog, error)

func (ConnectionCatalog) Resources

func (catalog ConnectionCatalog) Resources() []protocol.ConnectionResource

type ConnectionDatabaseInput

type ConnectionDatabaseInput struct {
	Connection       *protocol.DatabaseID     `json:"connection"`
	ExpectedRevision *uint64                  `json:"expected_revision"`
	Name             *string                  `json:"name"`
	Engine           *protocol.DatabaseEngine `json:"engine"`
	Path             *string                  `json:"path"`
	Host             *string                  `json:"host"`
	Port             *uint16                  `json:"port"`
	Username         *string                  `json:"username"`
	Database         *string                  `json:"database"`
	ReadOnly         *bool                    `json:"read_only"`
}

ConnectionDatabaseInput is a conversation's edit of a database connection. It carries public configuration only; a stored password is preserved.

func (*ConnectionDatabaseInput) UnmarshalJSON

func (value *ConnectionDatabaseInput) UnmarshalJSON(data []byte) error

type ConnectionInspection

type ConnectionInspection struct {
	Profile          protocol.SshID
	ExpectedRevision uint64
	Key              protocol.SshHostKey
	Changed          bool
}

ConnectionInspection is an unverified host key observed while a captured SSH operation connected.

type ConnectionSshInput

type ConnectionSshInput struct {
	Connection       *protocol.SshID             `json:"connection"`
	ExpectedRevision *uint64                     `json:"expected_revision"`
	Name             *string                     `json:"name"`
	Host             *string                     `json:"host"`
	Port             *uint16                     `json:"port"`
	Username         *string                     `json:"username"`
	Authentication   *protocol.SshAuthentication `json:"authentication"`
	Credential       *protocol.SshCredential     `json:"credential"`
	KeyPath          *string                     `json:"key_path"`
}

ConnectionSshInput is a conversation's edit of an SSH connection.

func (*ConnectionSshInput) UnmarshalJSON

func (value *ConnectionSshInput) UnmarshalJSON(data []byte) error

type ConnectionStatus

type ConnectionStatus struct {
	Target          protocol.ConnectionResource
	MissingPassword bool
}

ConnectionStatus is one reachable target and whether its network database password is still missing.

func ConnectionStatuses

func ConnectionStatuses(ctx context.Context, db *sql.Conn, turn protocol.TurnID, owner protocol.PluginReference, targets, captured []protocol.ConnectionResource) ([]ConnectionStatus, error)

ConnectionStatuses reports the targets the turn may reach, in request order. Targets outside the turn are omitted, not reported as faults.

type ConnectorBound

type ConnectorBound struct {
	Origin  *protocol.PluginOrigin                  `json:"origin"`
	Auth    protocol.PluginConnectorAuth            `json:"auth"`
	Origins []string                                `json:"origins"`
	Inject  []protocol.PluginConnectorInjection     `json:"inject"`
	Targets map[string]protocol.PluginMcpDefinition `json:"targets"`
}

type ConnectorLoginCapture

type ConnectorLoginCapture struct {
	Attempt     protocol.PluginConnectorAttempt
	Package     protocol.PluginInfo
	Declaration protocol.PluginConnectorDeclaration
	Previous    uint64
	Record      ConnectorRecord
	Input       protocol.PluginConnectorInput
	CLIIdentity *protocol.PluginConnectorIdentity // verified before the mutation is admitted
}

func PrepareConnectorConsent

func PrepareConnectorConsent(ctx context.Context, db *sql.Conn, id protocol.PluginConnectorID, expected uint64) (ConnectorLoginCapture, error)

type ConnectorRecord

type ConnectorRecord struct {
	ID            protocol.PluginConnectorID        `json:"id"`
	Plugin        string                            `json:"plugin"`
	Connector     string                            `json:"connector"`
	Revision      uint64                            `json:"revision"`
	AuthRevision  uint64                            `json:"auth_revision"`
	Method        protocol.PluginConnectorKind      `json:"method"`
	Enabled       bool                              `json:"enabled"`
	Fields        map[string]string                 `json:"fields"`
	Secrets       map[string]protocol.Secret        `json:"secrets"`
	Grant         *authorization.Issued             `json:"grant"`
	GrantRevision uint64                            `json:"grant_revision"`
	Identity      *protocol.PluginConnectorIdentity `json:"identity"`
	Bound         *ConnectorBound                   `json:"bound"`
	State         protocol.PluginConnectorState     `json:"state"`
	CheckedAtMs   *uint64                           `json:"checked_at_ms"`
	Login         *protocol.RequestID               `json:"login"`
}

func ReadConnectorRecord

func ReadConnectorRecord(ctx context.Context, db *sql.Conn, id protocol.PluginConnectorID) (ConnectorRecord, error)

func SaveConnectorGrant

func SaveConnectorGrant(ctx context.Context, db *sql.Conn, previous ConnectorRecord, grant authorization.Issued) (ConnectorRecord, error)

type Counter

type Counter string
const (
	CounterEvents         Counter = "events"
	CounterPluginRecords  Counter = "plugin_conversation_records"
	CounterAgentEvents    Counter = "agent_events"
	CounterDispatchEvents Counter = "dispatch_events"
	CounterDispatchJobs   Counter = "dispatch_jobs"
	CounterNotifications  Counter = "notifications"
	CounterSessions       Counter = "sessions"
	CounterTurns          Counter = "turns"
	CounterCheckpoints    Counter = "file_checkpoints"
	CounterArtifacts      Counter = "artifacts"
	CounterBackground     Counter = "agent_background"
)

type CredentialRenewal

type CredentialRenewal struct {
	User        protocol.User
	Provider    *protocol.ConversationProvider
	Credential  protocol.CredentialRef
	Connection  *ConnectorRecord
	Declaration protocol.PluginConnectorDeclaration
	Revision    uint64
	DueMs       uint64
}

func ReadCredentialRenewals

func ReadCredentialRenewals(ctx context.Context, db *sql.Conn, node protocol.NodeID) ([]CredentialRenewal, error)

ReadCredentialRenewals schedules currently used accounts owned here. A turn that has retained another account can renew it at its next model step.

type DatabaseBrowse

type DatabaseBrowse struct {
	Database *string
}

type DatabaseOperation

type DatabaseOperation struct {
	Profile  protocol.DatabaseProfile
	Password protocol.Secret
	// Ssh is set only for an SSH-tunnelled profile.
	Ssh   *DatabaseTunnel
	Query *DatabaseQuery
	// Browse is set only for browse_database.
	Browse *DatabaseBrowse
	// Storage is the Node profile directory external SQLite must not access.
	Storage string
}

DatabaseOperation is everything an external database operation needs after the storage lease is released. It carries secrets: never log, encode or return it to a controller.

func PrepareDatabase

func PrepareDatabase(ctx context.Context, db *sql.Conn, storage string, command protocol.Command) (DatabaseOperation, error)

PrepareDatabase validates test_database, check_database, browse_database or query_database against the saved profile and reads its secret and tunnel material. Execute the returned operation outside the storage lease.

type DatabaseQuery

type DatabaseQuery struct {
	Sql       string
	RowLimit  int
	TimeoutMs uint64
}

type DatabaseTunnel

type DatabaseTunnel struct {
	Profile    protocol.SshProfile
	Credential protocol.SshCredential
}

type Exclusive

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

Exclusive drains existing reads and admitted writes and blocks new leases.

func (*Exclusive) Close

func (exclusive *Exclusive) Close() error

func (*Exclusive) Connection

func (exclusive *Exclusive) Connection() *sql.Conn

Connection is the writer's connection, which is idle while every lease is held.

func (*Exclusive) Pause

func (exclusive *Exclusive) Pause(ctx context.Context) (*Closed, error)

Pause checkpoints and closes the database without releasing ownership between a read of its metadata and a copy of its files.

func (*Exclusive) Pin

func (exclusive *Exclusive) Pin(ctx context.Context) (*Pinned, error)

Pin begins a read transaction on the database exactly as it is under the exclusive lease. The transaction keeps its share of the lease when the exclusive owner closes, so reads and writes continue while the pinned state is read.

type Handle

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

Handle owns one file's writer and its independent read-only connection pool.

func OpenCodeIndex

func OpenCodeIndex(ctx context.Context, path string) (*Handle, error)

OpenCodeIndex opens one worktree's derived cache. The worktree owns the opening lock, so a recognized legacy cache can be rebuilt with no handles open and no other readers using its files.

func OpenHandle

func OpenHandle(ctx context.Context, path string) (*Handle, error)

func (*Handle) Close

func (handle *Handle) Close() error

func (*Handle) Exclusive

func (handle *Handle) Exclusive(ctx context.Context) (*Exclusive, error)

func (*Handle) Path

func (handle *Handle) Path() string

func (*Handle) Pause

func (handle *Handle) Pause(ctx context.Context) (*Closed, error)

func (*Handle) Read

func (handle *Handle) Read(ctx context.Context, callback func(*sql.Conn) error) error

Read pins the snapshot before invoking its callback exactly once.

func (*Handle) Write

func (handle *Handle) Write(ctx context.Context, callback func(*sql.Conn) error) error

Write submits related SQL without external effects or transaction controls. An admitted callback is not replayed, and its caller waits for the commit result. A callback returns its first SQL error so that the writer can roll its work back.

type KnowledgeCapture

type KnowledgeCapture struct {
	ExternalPackage bool                      `json:"external_package,omitempty"`
	Package         *protocol.PluginReference `json:"package"`
	Worktree        *protocol.WorktreeID      `json:"worktree"`
	Session         *protocol.SessionID       `json:"session"`
	User            *protocol.UserID          `json:"user,omitempty"`
	Space           string                    `json:"space,omitempty"`
	Namespace       string                    `json:"namespace,omitempty"`
}

KnowledgeCapture is the plugin scope a collection was created in.

type KnowledgeSource

type KnowledgeSource struct {
	Node     *protocol.NodeID            `json:"node,omitempty"`
	Kind     string                      `json:"kind"`
	Worktree protocol.WorktreeID         `json:"worktree"`
	Path     string                      `json:"path"`
	Scope    protocol.PluginStorageScope `json:"scope"`
	Prefix   string                      `json:"prefix"`
}

KnowledgeSource is the flat reading of a source union.

func ReadKnowledgeSource

func ReadKnowledgeSource(source protocol.KnowledgeSource) KnowledgeSource

ReadKnowledgeSource flattens a validated source union.

type KnowledgeStoragePage

type KnowledgeStoragePage struct {
	Records []KnowledgeStorageRecord
	After   *string
}

KnowledgeStoragePage is one page of captured plugin values. After continues the scan; skipped keys still advance it.

func ReadKnowledgeStoragePage

func ReadKnowledgeStoragePage(ctx context.Context, db *sql.Conn, stored KnowledgeStored, after *string, limit int) (KnowledgeStoragePage, error)

ReadKnowledgeStoragePage reads one page of the plugin values a storage collection indexes, in key order.

type KnowledgeStorageRecord

type KnowledgeStorageRecord struct {
	Key            string
	Revision       uint64
	Hash           [32]byte
	Title, Body    string
	Source         protocol.PluginStorageSource
	SourceRevision uint64
	SourceHash     [32]byte
	Tags           []string
}

KnowledgeStorageRecord is one plugin value captured as a knowledge source: the indexed entry and the value its text was read from.

func ReadKnowledgeStorageRecord

func ReadKnowledgeStorageRecord(ctx context.Context, db *sql.Conn, stored KnowledgeStored, key string) (*KnowledgeStorageRecord, error)

ReadKnowledgeStorageRecord captures one plugin value of a storage collection, or nil when it no longer exists.

func (KnowledgeStorageRecord) Identity

func (record KnowledgeStorageRecord) Identity() string

Identity is the source revision the index and citations carry. It changes with the entry, its index data and the text it points to.

type KnowledgeStored

type KnowledgeStored struct {
	Collection protocol.KnowledgeCollection `json:"collection"`
	Capture    KnowledgeCapture             `json:"capture"`
	Automatic  bool                         `json:"automatic"`
}

KnowledgeStored is one durable collection with its captured scope. The retrieval index is derived from it.

func AllowedKnowledge

func AllowedKnowledge(ctx context.Context, db *sql.Conn, request protocol.Request) ([]KnowledgeStored, error)

AllowedKnowledge returns the collections a request may read. Query plans intersect these durable grants before reading the derived index.

func ReadKnowledgeCatalog

func ReadKnowledgeCatalog(ctx context.Context, db *sql.Conn) ([]KnowledgeStored, error)

ReadKnowledgeCatalog reads every stored collection for the indexing worker.

func RemoveOrphanedKnowledge

func RemoveOrphanedKnowledge(ctx context.Context, db *sql.Conn) ([]KnowledgeStored, bool, error)

RemoveOrphanedKnowledge deletes the collections whose owner was removed and returns the remaining catalog. Their derived index goes with the next indexing pass. Registering the same worktree, project or package again does not bring a collection back.

type LocalModelCatalog

type LocalModelCatalog struct {
	Settings    protocol.ModelsLocalSettings
	Definitions map[string]*protocol.ModelsDefinition
}

LocalModelCatalog is the durable local model configuration: the settings and every pinned or registered definition by identity.

func ReadLocalModelCatalog

func ReadLocalModelCatalog(ctx context.Context, db *sql.Conn) (LocalModelCatalog, error)

ReadLocalModelCatalog reads the settings and joins registered definitions with the pinned builtins.

type MediaAssignment

type MediaAssignment struct {
	Model string `json:"model"`
	// Provider is absent when the bound model could not run at admission. The
	// purpose then has no model; it never falls back to another one.
	Provider *protocol.ConversationProvider `json:"provider,omitempty"`
}

MediaAssignment is one purpose's binding as captured when a turn was admitted.

type MediaCapture

type MediaCapture map[protocol.MediaKind]MediaAssignment

MediaCapture holds the assigned purposes only. An absent purpose follows the conversation model.

func CaptureMedia

func CaptureMedia(ctx context.Context, db *sql.Conn) (MediaCapture, error)

CaptureMedia freezes the per-purpose assignments for one admitted turn.

type Pinned

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

Pinned is a read transaction that began under an exclusive lease and outlives it. It keeps one lease, so the database stays open until Close.

func (*Pinned) Close

func (pinned *Pinned) Close() error

func (*Pinned) Connection

func (pinned *Pinned) Connection() *sql.Conn

Connection reads the pinned state.

type PluginValueRank

type PluginValueRank struct {
	Key      string
	Revision uint64
}

PluginValueRank is one keyword hit of a semantic plan: the key and the revision it was ranked at.

type PreparedPaths

type PreparedPaths struct {
	Path            string
	TerminalsClosed bool
}

PreparedPaths contains the observations and effects made outside SQL transactions: the canonical directory, and whether a project removal already closed one of the project's terminals.

func PreparePaths

func PreparePaths(command protocol.Command) (PreparedPaths, error)

type ProjectRemoval

type ProjectRemoval struct {
	Terminals []protocol.TerminalInfo
	Sessions  []protocol.SessionID
}

ProjectRemoval lists what the Node closes before a removal is recorded.

func PlanProjectRemoval

func PlanProjectRemoval(ctx context.Context, db *sql.Conn, expected protocol.Project) (ProjectRemoval, error)

PlanProjectRemoval validates a removal and lists the project's terminals that are not closed and its sessions, whose background commands stop. A stale or busy removal fails here, before anything is closed.

type ProviderLoginCapture

type ProviderLoginCapture struct {
	Attempt  protocol.ConversationLoginAttempt
	Provider protocol.ConversationProvider
	Target   providers.AccountTarget
}

func CaptureProviderLogin

func CaptureProviderLogin(ctx context.Context, db *sql.Conn, id protocol.ProviderID, expected uint64, attempt protocol.RequestID) (ProviderLoginCapture, error)

type ProviderRenewal

type ProviderRenewal struct {
	Capture    ProviderLoginCapture
	Credential protocol.CredentialID
	Revision   uint64
	Grant      providers.AccountGrant
}

func BeginProviderRenewal

func BeginProviderRenewal(ctx context.Context, db *sql.Conn, node protocol.NodeID, provider protocol.ConversationProvider, reference protocol.CredentialRef, now time.Time) (*ProviderRenewal, error)

func BeginScheduledProviderRenewal

func BeginScheduledProviderRenewal(ctx context.Context, db *sql.Conn, node protocol.NodeID, provider protocol.ConversationProvider, reference protocol.CredentialRef, now time.Time) (*ProviderRenewal, error)

BeginScheduledProviderRenewal rechecks selection in the write transaction that admits the refresh so a stale timer cannot renew a retired account.

type ProviderResourceCapture

type ProviderResourceCapture struct {
	Provider   protocol.ConversationProvider
	Endpoint   protocol.PluginModelAuthEndpoint
	Secret     protocol.Secret
	Credential protocol.Credential
}

func CaptureProviderResource

func CaptureProviderResource(ctx context.Context, db *sql.Conn, node protocol.NodeID, caller protocol.PluginReference, id protocol.ProviderID, revision uint64, name string, mutation bool) (ProviderResourceCapture, error)

type ResolvedPluginSettings

type ResolvedPluginSettings struct {
	Values     map[string]json.RawMessage
	Secrets    map[string]protocol.Secret
	MCP        json.RawMessage
	MCPAllowed map[string]bool
	MCPTargets map[string]string
}

func ResolvePluginSettings

func ResolvePluginSettings(ctx context.Context, db *sql.Conn, reference protocol.PluginReference) (ResolvedPluginSettings, error)

type SemanticPlan

type SemanticPlan struct {
	Package     protocol.PluginReference
	Space       string
	Collections []KnowledgeStored
	Keyword     []PluginValueRank
	Eligible    map[string]bool
	Embedding   protocol.ModelsLocalChoice
}

SemanticPlan captures what one plugin storage search may rank: the package, its automatic collections, the keyword ranking and the keys whose text is indexed.

func PrepareSemanticSearch

func PrepareSemanticSearch(ctx context.Context, db *sql.Conn, request protocol.Request) (SemanticPlan, error)

PrepareSemanticSearch captures the plan of one plugin storage search. A keyword search, or one without text, selects no collection.

type SemanticSelection

type SemanticSelection struct {
	Keys     []string
	Stamps   []SemanticStamp
	Mode     protocol.KnowledgeMode
	Indexing bool
}

SemanticSelection is the fused key order of one search.

type SemanticStamp

type SemanticStamp struct {
	Collection protocol.KnowledgeID
	Key        string
	Revision   string
}

SemanticStamp pins a semantic hit to the source revision it was indexed at.

type SessionLeftover

type SessionLeftover struct {
	Session  protocol.SessionID
	Worktree protocol.Worktree
}

SessionLeftover is the worktree a removed session leaves without a user.

func ReadSessionLeftovers

func ReadSessionLeftovers(ctx context.Context, db *sql.Conn, sessions []protocol.SessionID) ([]SessionLeftover, error)

ReadSessionLeftovers reports, for each of sessions that is removed, the worktrees it used, now or in an earlier revision, that no remaining session uses or used. A main worktree and one whose removal is already recorded are never a leftover.

type Store

type Store struct {
	Node      *Handle
	Knowledge *Handle
	NodeID    protocol.NodeID
	Profile   string
}

func Open

func Open(ctx context.Context, profile string, node protocol.NodeID) (_ *Store, failure error)

Open is called only by the owner of the profile's advisory lock.

func (*Store) Close

func (storage *Store) Close() error

func (*Store) CloseIdle

func (storage *Store) CloseIdle() error

CloseIdle closes each database that no read or write is using.

type SubagentListOptions added in v0.2.3

type SubagentListOptions struct {
	Before *string `json:"before"`
	Limit  *uint16 `json:"limit"`
}

type SubagentPage added in v0.2.3

type SubagentPage struct {
	Subagents  []SubagentSummary `json:"subagents"`
	NextBefore *string           `json:"next_before"`
}

func ListSubagents added in v0.2.3

func ListSubagents(ctx context.Context, db *sql.Conn, parent protocol.TurnID, options SubagentListOptions) (SubagentPage, error)

ListSubagents pages by immutable session creation order, not by the execution currently selected for that session. Only its founding delegation grants a parent access; follow-ups across parent turns do not create new entries.

type SubagentSummary added in v0.2.3

type SubagentSummary struct {
	Session    protocol.SessionID          `json:"session"`
	Turn       protocol.TurnID             `json:"turn"`
	Title      string                      `json:"title,omitempty"`
	Role       *subagentRole               `json:"role,omitempty"`
	Status     protocol.ConversationStatus `json:"status"`
	Paused     bool                        `json:"paused,omitempty"`
	StopReason string                      `json:"stop_reason,omitempty"`
}

type TurnFacts

type TurnFacts struct {
	// Usage is the turn's own model usage plus that of the children it
	// delegated; SessionUsage is the same for every turn of the session.
	Usage        TurnTokens
	SessionUsage TurnTokens
	// Running counts background work that will start a notice turn when it
	// ends; Pending counts ended results no turn has taken yet.
	Running int
	Pending int
	Chain   AutomaticChain
}

TurnFacts is what a session's stored state says once a turn has ended. A package loop decides from it whether to continue, wait or pause.

func ReadTurnFacts

func ReadTurnFacts(ctx context.Context, db *sql.Conn, session protocol.SessionID, turn protocol.TurnID) (TurnFacts, error)

ReadTurnFacts reads the facts of an ended turn in the caller's transaction. Usage follows the statistics selection: Sailry's own turns and the child turns delegated from them.

type TurnTokens

type TurnTokens struct {
	Input       uint64 `json:"input"`
	Output      uint64 `json:"output"`
	CachedInput uint64 `json:"cached_input"`
	Reasoning   uint64 `json:"reasoning"`
}

TurnTokens totals recorded model usage. Cached input and reasoning are parts of Input and Output, not additions to them.

type WorkspaceGitCapture

type WorkspaceGitCapture struct {
	Worktree protocol.Worktree
	Project  protocol.Project
}

WorkspaceGitCapture contains only durable resource identity. Filesystem and Git observations belong to the service after leaving the writer transaction.

func PrepareWorkspaceWorktreeRemoval

func PrepareWorkspaceWorktreeRemoval(ctx context.Context, db *sql.Conn, id protocol.WorktreeID) (WorkspaceGitCapture, error)

func ReadWorkspaceGitCapture

func ReadWorkspaceGitCapture(ctx context.Context, db *sql.Conn, id protocol.WorktreeID) (WorkspaceGitCapture, error)

Source Files

Jump to

Keyboard shortcuts

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