Documentation
¶
Overview ¶
Package sessiontree stores durable conversation journals.
Repo implementations own thread metadata, append-only entries, forks, leaf movement, and provider-visible context reconstruction. FileRepo and MemoryRepo are safe for concurrent use. Repos used by agentharness should implement TurnLeaseRepo so active-turn serialization is durable per ThreadID and shared across harness instances that use the same backend. Different ThreadIDs, including forked threads, may run concurrently.
Index ¶
- Constants
- Variables
- func ActivePathHash(path []Entry) string
- func AddInterruptedTurnApprovalQueueProof(metadata map[string]string, proof *InterruptedTurnApprovalQueueProof) error
- func AddInterruptedTurnRecoverySourceFailureProof(metadata map[string]string, proof *InterruptedTurnRecoveryFailureProof) error
- func ApprovalBatchCancellationFingerprint(fingerprint string) string
- func ApprovalCancellationEntryID(cancellationFingerprint, approvalID string) string
- func ApprovalDispatchEntryID(decisionID, approvalID string) string
- func ApprovalDispatchEntryRequestMatches(stored, requested Entry) bool
- func ApprovalEffectAttemptID(invocation EffectInvocationIdentity) string
- func ApprovalFinalizationEntryID(decisionID, approvalID string) string
- func ApprovalPreflightMatchesEffect(item ApprovalPreflightItem, lease TurnLease, attempt EffectAttempt) bool
- func ApprovalPreflightMatchesRecord(record ApprovalRecord, rootID, parentID string, item ApprovalPreflightItem, ...) bool
- func ApprovalQueueVisible(state ApprovalState) bool
- func ApprovalRejectedEntryID(decisionID, approvalID string) string
- func ApprovalRequestedEntryID(approvalID string) string
- func BuildContext(path []Entry, opts ContextOptions) []session.Message
- func BuildContextChecked(path []Entry, opts ContextOptions) ([]session.Message, error)
- func ContextWithTurnLease(ctx context.Context, lease TurnLease) context.Context
- func CreateRootFingerprint(req CreateRootRequest) string
- func CreateRootReplayMatches(meta ThreadMeta, threadID string) bool
- func EffectResultRequestMatches(committed, requested Entry, effectAttemptID string) bool
- func InterruptedTurnRecoveryApprovalCancellationID(recoveryFingerprint, approvalID string) string
- func InterruptedTurnRecoveryCancelledEffectFingerprint(recoveryFingerprint string) string
- func InterruptedTurnRecoveryFingerprint(expectedLease TurnLease, parentThreadID string, runID string, ...) (string, error)
- func InterruptedTurnRecoveryUnknownEffectFingerprint(recoveryFingerprint string) string
- func InterruptedTurnToolResult(call session.Message, effectState EffectAttemptState) session.Message
- func MatchesForkDestinationMeta(meta ThreadMeta, destination *ForkDestinationMeta) bool
- func NormalizeApprovalCancellationEntries(req CancelApprovalBatchRequest) (map[string]Entry, error)
- func NormalizeSubAgentCloseIntent(operationID, parentThreadID, targetThreadID, reason string) (string, string, string, string, string, error)
- func PublishSubAgentChildMatches(req PublishSubAgentRequest, child ThreadMeta) bool
- func RawForEntry(entry Entry) string
- func RetryPathHasRetryEligibleDurableInput(path []Entry) (bool, error)
- func RetrySourceHasRetryEligibleDurableInput(path []Entry, sourceTurnID, sourceEntryID string) (int, bool, error)
- func SameApprovalIdentity(left, right ApprovalIdentity) bool
- func SameThreadAuthority(left, right ThreadMeta) bool
- func SameThreadTitleState(left, right ThreadMeta) bool
- func SameTurnLease(left, right TurnLease) bool
- func SortThreadsByCreatedAtDesc(threads []ThreadMeta)
- func StableHash(value string) string
- func SubAgentCloseRequestFingerprint(intentFingerprint string, nodes []SubAgentCloseNode) (string, error)
- func SubAgentUserMessageOrigin(kind SubAgentRequestKind) (string, error)
- func ThreadAuthorityTreeIDs(threads []ThreadMeta, rootThreadID string) ([]string, error)
- func TurnAdmissionRequestFingerprint(req AdmitTurnRequest) (string, error)
- func UpdateTurnLeaseContext(ctx context.Context, previous, renewed TurnLease) error
- func ValidTurnFailureCode(code string) bool
- func ValidateAdmitPendingToolCompletionEnvelope(req AdmitPendingToolCompletionRequest) error
- func ValidateAdmitPendingToolCompletionReplayRequest(req AdmitPendingToolCompletionRequest) error
- func ValidateAdmitPendingToolCompletionRequest(req AdmitPendingToolCompletionRequest) error
- func ValidateAdmitTurnReplayRequest(req AdmitTurnRequest) error
- func ValidateAdmitTurnRequest(req AdmitTurnRequest) error
- func ValidateAdmitTurnRequestEnvelope(req AdmitTurnRequest) error
- func ValidateApprovalDecisionReceiptAuthority(receipt ApprovalDecisionReceipt, record ApprovalRecord, queue ApprovalQueue) error
- func ValidateApprovalRecord(record ApprovalRecord) error
- func ValidateBeginAutomaticThreadTitleRequest(req BeginAutomaticThreadTitleRequest) error
- func ValidateBeginCompactionRequest(req BeginCompactionRequest) error
- func ValidateCancelApprovalBatchRequest(req CancelApprovalBatchRequest) error
- func ValidateCanonicalThreadTitle(title string) error
- func ValidateCanonicalTurnEntries(entries []Entry, threadID, turnID, runID string) error
- func ValidateCanonicalTurnReadAuthority(turn CanonicalTurn, admission CanonicalTurnAdmissionFact) error
- func ValidateCanonicalTurnReadStructure(turn CanonicalTurn, threadID string) error
- func ValidateCommitApprovalDispatchRequest(req CommitApprovalDispatchRequest) error
- func ValidateCompleteAutomaticThreadTitleRequest(req CompleteAutomaticThreadTitleRequest) error
- func ValidateCreateRootRequest(req CreateRootRequest) error
- func ValidateEffectLeaseSuccessor(proof, current TurnLease) error
- func ValidateEntryIntegrity(entry Entry) error
- func ValidateEntryMessageAttachments(entry Entry) error
- func ValidateEntryMessageReferences(entry Entry) error
- func ValidateFailAutomaticThreadTitleRequest(req FailAutomaticThreadTitleRequest) error
- func ValidateFinalizeApprovalRequest(req FinalizeApprovalRequest) error
- func ValidateFinalizeApprovalRequestedEntry(record ApprovalRecord, entry Entry) error
- func ValidateFinalizeApprovalResultAuthority(req FinalizeApprovalRequest, result FinalizeApprovalResult) error
- func ValidateFinalizeApprovalSourceAuthority(req FinalizeApprovalRequest, record ApprovalRecord, effect EffectAttempt, ...) error
- func ValidateFinishTurnRequest(req FinishTurnRequest) error
- func ValidateForkPrepareState(rootThreadID string, nodes []ForkOptions, states []ForkPrepareThreadState) error
- func ValidateForkRetryAuthorityPath(path []Entry, threadID string) error
- func ValidateInterruptedTurnAdmissionPath(path []Entry, threadID, turnID, runID, turnStartedID string) error
- func ValidateInterruptedTurnLeaseSuccessor(target, current TurnLease) error
- func ValidateInterruptedTurnRecoveryEffectAttempts(attempts []EffectAttempt, threadID, turnID, runID string) error
- func ValidateInterruptedTurnRecoveryPath(path []Entry, turnID, runID string) error
- func ValidateInterruptedTurnStartedEntry(entry Entry, threadID, turnID, runID, turnStartedID string) error
- func ValidateListCanonicalTurnsOptions(opts ListCanonicalTurnsOptions) error
- func ValidateNewEntryMessageAttachments(entry Entry) error
- func ValidatePendingToolCompletionPath(path []Entry) error
- func ValidatePublishSubAgentIdentity(req PublishSubAgentRequest) error
- func ValidatePublishSubAgentInputEnvelope(req PublishSubAgentInputRequest) error
- func ValidatePublishSubAgentInputReplayRequest(req PublishSubAgentInputRequest) error
- func ValidatePublishSubAgentInputRequest(req PublishSubAgentInputRequest) error
- func ValidatePublishSubAgentPendingToolCompletionEnvelope(req PublishSubAgentPendingToolCompletionRequest) error
- func ValidatePublishSubAgentPendingToolCompletionReplayRequest(req PublishSubAgentPendingToolCompletionRequest) error
- func ValidatePublishSubAgentPendingToolCompletionRequest(req PublishSubAgentPendingToolCompletionRequest) error
- func ValidatePublishSubAgentReplayRequest(req PublishSubAgentRequest) error
- func ValidatePublishSubAgentRequest(req PublishSubAgentRequest) error
- func ValidateRecoverInterruptedTurnRequest(req RecoverInterruptedTurnRequest) error
- func ValidateResolveApprovalReplayAuthority(expectedDecisionID string, decision ApprovalDecision, ...) error
- func ValidateResolveApprovalRequest(req ResolveApprovalRequest) error
- func ValidateRetrySourcePath(path []Entry, sourceTurnID, sourceEntryID string) (int, error)
- func ValidateRetryStartedEntry(entry Entry, threadID, turnID, runID, startedEntryID string, ...) error
- func ValidateSetThreadTitleRequest(req SetThreadTitleRequest) error
- func ValidateThreadAuthorityGraph(threads []ThreadMeta) error
- func ValidateThreadAuthoritySnapshot(meta ThreadMeta, path []Entry, lease *TurnLease, claimOperationID string, ...) error
- func ValidateThreadAuthorityState(path []Entry, lease *TurnLease, claimOperationID string) error
- func ValidateThreadMetaAuthority(meta ThreadMeta) error
- func ValidateThreadTitleProjection(projection ThreadTitleProjection) error
- func ValidateThreadTitleState(meta ThreadMeta) error
- type AdmitPendingToolCompletionRequest
- type AdmitPendingToolCompletionResult
- type AdmitSubAgentInputRequest
- type AdmitSubAgentInputResult
- type AdmitTurnRequest
- type AdmitTurnResult
- type AgentTodoItem
- type AgentTodoState
- type AgentTodoStateRepo
- type AgentTodoStatus
- type AppendCommittedError
- type AppendOptions
- type ApprovalAuthorityRepo
- type ApprovalCancellationEntry
- type ApprovalDecision
- type ApprovalDecisionReceipt
- type ApprovalIdentity
- type ApprovalPreflightItem
- type ApprovalQueue
- type ApprovalRecord
- type ApprovalResource
- type ApprovalState
- type ArtifactAuthorityRepo
- type ArtifactClosureRequest
- type ArtifactContent
- type ArtifactReadRequest
- type BeginAutomaticThreadTitleRequest
- type BeginCompactionRequest
- type BeginCompactionResult
- type BeginEffectDispatchRequest
- type CancelApprovalBatchRequest
- type CancelApprovalBatchResult
- type CanonicalTurn
- type CanonicalTurnAdmissionFact
- type CanonicalTurnBeforeCursor
- type CanonicalTurnPageRepo
- type CanonicalTurnPathEntry
- type CanonicalTurnRead
- type CanonicalTurnReadRepo
- type CanonicalTurnRepo
- type CanonicalTurnRetrySource
- type CanonicalTurnSinceCursor
- type CanonicalTurnsPage
- type CommitApprovalDispatchRequest
- type CommitApprovalDispatchResult
- type CompactionAuthorityRepo
- type CompactionOperation
- type CompactionOperationState
- type CompleteAutomaticThreadTitleRequest
- type ContextOptions
- type ContextProjection
- type ContextProjectionOptions
- type CreateRootRequest
- type CreateRootResult
- type DeleteRootTreeResult
- type EffectAttempt
- type EffectAttemptAuthorityRepo
- type EffectAttemptState
- type EffectInvocationIdentity
- type Entry
- func AppendActiveTools(ctx context.Context, repo JournalRepo, threadID string, ...) (Entry, error)
- func AppendCompaction(ctx context.Context, repo JournalRepo, threadID, turnID string, ...) (Entry, error)
- func AppendFailure(ctx context.Context, repo JournalRepo, threadID, turnID string, message string) (Entry, error)
- func AppendMessage(ctx context.Context, repo JournalRepo, threadID, turnID string, ...) (Entry, error)
- func AppendMessageAt(ctx context.Context, repo JournalRepo, threadID, turnID string, ...) (Entry, error)
- func AppendTurnMarker(ctx context.Context, repo JournalRepo, threadID, turnID string, ...) (Entry, error)
- func AppendTurnMarkerWithID(ctx context.Context, repo JournalRepo, threadID, turnID, entryID string, ...) (Entry, error)
- func CanonicalTurnEntriesForRead(entries []Entry) []Entry
- func CompactionEntry(threadID, turnID string, result compaction.Result) (Entry, error)
- func PrepareBranchBoundaryEntry(path []Entry, threadID, parentEntryID, entryID, reason string, now time.Time) (Entry, error)
- func PrepareEntry(entry Entry) Entry
- func PrepareSubAgentCloseLifecycleEntry(operation SubAgentCloseOperation, threadID, parentEntryID, entryID string, ...) Entry
- func UnresolvedInterruptedTurnCalls(path []Entry, turnID string) []Entry
- type EntryType
- type FailAutomaticThreadTitleRequest
- type FileRepo
- func (r *FileRepo) AcquireTurnLease(ctx context.Context, lease TurnLease) error
- func (r *FileRepo) ActiveTurnLease(ctx context.Context, threadID string) (TurnLease, bool, error)
- func (r *FileRepo) Append(ctx context.Context, entry Entry, opts AppendOptions) (Entry, error)
- func (r *FileRepo) ArtifactClosure(context.Context, ArtifactClosureRequest) (artifact.Closure, error)
- func (r *FileRepo) BeginAutomaticThreadTitle(ctx context.Context, req BeginAutomaticThreadTitleRequest) (ThreadTitleMutationResult, error)
- func (r *FileRepo) CanonicalTurnEntries(ctx context.Context, threadID, turnID, runID string) ([]Entry, bool, error)
- func (r *FileRepo) ClearExpiredTurnLease(ctx context.Context, threadID string, cutoff time.Time) (TurnLease, bool, error)
- func (r *FileRepo) CompareAndSwapAgentTodoState(ctx context.Context, state AgentTodoState, expectedVersion int64) (AgentTodoState, error)
- func (r *FileRepo) CompleteAutomaticThreadTitle(ctx context.Context, req CompleteAutomaticThreadTitleRequest) (ThreadTitleMutationResult, error)
- func (r *FileRepo) CreateThread(ctx context.Context, meta ThreadMeta) (ThreadMeta, error)
- func (r *FileRepo) Entries(ctx context.Context, threadID string) ([]Entry, error)
- func (r *FileRepo) Entry(ctx context.Context, threadID, entryID string) (Entry, error)
- func (r *FileRepo) FailAutomaticThreadTitle(ctx context.Context, req FailAutomaticThreadTitleRequest) (ThreadTitleMutationResult, error)
- func (r *FileRepo) Fork(ctx context.Context, opts ForkOptions) (ThreadMeta, error)
- func (r *FileRepo) ListCanonicalTurns(ctx context.Context, opts ListCanonicalTurnsOptions) (CanonicalTurnsPage, error)
- func (r *FileRepo) ListThreads(ctx context.Context, opts ListThreadsOptions) ([]ThreadMeta, error)
- func (r *FileRepo) MoveLeaf(ctx context.Context, threadID, entryID string) error
- func (r *FileRepo) Path(ctx context.Context, threadID, leafID string) ([]Entry, error)
- func (r *FileRepo) PathPage(ctx context.Context, threadID, leafID, beforeEntryID string, limit int) (PathPage, error)
- func (r *FileRepo) PendingAutomaticThreadTitles(ctx context.Context) ([]ThreadMeta, error)
- func (r *FileRepo) ReadAgentTodoState(ctx context.Context, threadID string) (AgentTodoState, error)
- func (r *FileRepo) ReadArtifact(context.Context, ArtifactReadRequest) (ArtifactContent, error)
- func (r *FileRepo) ReleaseTurnLease(ctx context.Context, lease TurnLease) error
- func (r *FileRepo) SetThreadTitle(ctx context.Context, req SetThreadTitleRequest) (ThreadTitleMutationResult, error)
- func (r *FileRepo) Thread(ctx context.Context, threadID string) (ThreadMeta, error)
- func (r *FileRepo) UpdateThread(ctx context.Context, meta ThreadMeta) error
- type FinalizeApprovalRequest
- type FinalizeApprovalResult
- type FinishCompactionRequest
- type FinishCompactionResult
- type FinishEffectDispatchRequest
- type FinishEffectDispatchResult
- type FinishSubAgentCloseRequest
- type FinishSubAgentCloseResult
- type FinishTurnRequest
- type FinishTurnResult
- type ForkDestinationMeta
- type ForkEntryIdentity
- type ForkOptions
- type ForkPosition
- type ForkPrepareThreadState
- type InterruptedTurnApprovalQueueProof
- type InterruptedTurnRecoveryEffect
- type InterruptedTurnRecoveryFailureProof
- type InterruptedTurnRecoveryPlan
- type InterruptedTurnRecoveryRepo
- type InterruptedTurnResolutionValidationRepo
- type JournalRepo
- type LeasePolicy
- type LeasePolicyRepo
- type ListCanonicalTurnsOptions
- type ListThreadsOptions
- type MarkEffectUnknownRequest
- type MemoryRepo
- func (r *MemoryRepo) AcquireThreadAuthorityClaim(_ context.Context, operationID string, ...) error
- func (r *MemoryRepo) AcquireTurnLease(_ context.Context, request TurnLease) (TurnLease, error)
- func (r *MemoryRepo) ActiveTurnLease(_ context.Context, threadID string) (TurnLease, bool, error)
- func (r *MemoryRepo) AdmitPendingToolCompletion(_ context.Context, req AdmitPendingToolCompletionRequest) (AdmitPendingToolCompletionResult, error)
- func (r *MemoryRepo) AdmitSubAgentInput(ctx context.Context, req AdmitSubAgentInputRequest) (AdmitSubAgentInputResult, error)
- func (r *MemoryRepo) AdmitTurn(_ context.Context, req AdmitTurnRequest) (AdmitTurnResult, error)
- func (r *MemoryRepo) Append(ctx context.Context, entry Entry, opts AppendOptions) (Entry, error)
- func (r *MemoryRepo) Approval(_ context.Context, approvalID string) (ApprovalRecord, error)
- func (r *MemoryRepo) ArtifactClosure(_ context.Context, req ArtifactClosureRequest) (artifact.Closure, error)
- func (r *MemoryRepo) AuthorityLeasePolicy() LeasePolicy
- func (r *MemoryRepo) BeginAutomaticThreadTitle(ctx context.Context, req BeginAutomaticThreadTitleRequest) (ThreadTitleMutationResult, error)
- func (r *MemoryRepo) BeginCompaction(_ context.Context, req BeginCompactionRequest) (BeginCompactionResult, error)
- func (r *MemoryRepo) BeginEffectDispatch(_ context.Context, req BeginEffectDispatchRequest) (EffectAttempt, error)
- func (r *MemoryRepo) CancelApprovalBatch(ctx context.Context, req CancelApprovalBatchRequest) (CancelApprovalBatchResult, error)
- func (r *MemoryRepo) CanonicalTurnEntries(_ context.Context, threadID, turnID, runID string) ([]Entry, bool, error)
- func (r *MemoryRepo) CommitApprovalDispatch(ctx context.Context, req CommitApprovalDispatchRequest) (CommitApprovalDispatchResult, error)
- func (r *MemoryRepo) CommitForkBatch(ctx context.Context, operationID string, nodes []ForkOptions, ...) ([]ThreadMeta, error)
- func (r *MemoryRepo) CompareAndSwapAgentTodoState(ctx context.Context, state AgentTodoState, expectedVersion int64) (AgentTodoState, error)
- func (r *MemoryRepo) CompleteAutomaticThreadTitle(ctx context.Context, req CompleteAutomaticThreadTitleRequest) (ThreadTitleMutationResult, error)
- func (r *MemoryRepo) CreateRoot(_ context.Context, req CreateRootRequest) (CreateRootResult, error)
- func (r *MemoryRepo) CreateThread(_ context.Context, meta ThreadMeta) (ThreadMeta, error)
- func (r *MemoryRepo) CreateThreadWithInitialEntry(ctx context.Context, meta ThreadMeta, initial Entry) (ThreadMeta, Entry, error)
- func (r *MemoryRepo) DeleteProviderState(ctx context.Context, threadID string) error
- func (r *MemoryRepo) DeleteRootTree(_ context.Context, rootThreadID string) (DeleteRootTreeResult, error)
- func (r *MemoryRepo) Entries(_ context.Context, threadID string) ([]Entry, error)
- func (r *MemoryRepo) Entry(_ context.Context, threadID, entryID string) (Entry, error)
- func (r *MemoryRepo) FailAutomaticThreadTitle(ctx context.Context, req FailAutomaticThreadTitleRequest) (ThreadTitleMutationResult, error)
- func (r *MemoryRepo) FailForkClaim(operationID string, sourceThreadIDs, authorityThreadIDs []string, ...) error
- func (r *MemoryRepo) FinalizeApproval(_ context.Context, req FinalizeApprovalRequest) (FinalizeApprovalResult, error)
- func (r *MemoryRepo) FinishCompaction(_ context.Context, req FinishCompactionRequest) (FinishCompactionResult, error)
- func (r *MemoryRepo) FinishEffectDispatch(_ context.Context, req FinishEffectDispatchRequest) (FinishEffectDispatchResult, error)
- func (r *MemoryRepo) FinishSubAgentClose(_ context.Context, req FinishSubAgentCloseRequest) (FinishSubAgentCloseResult, error)
- func (r *MemoryRepo) FinishTurn(_ context.Context, req FinishTurnRequest) (FinishTurnResult, error)
- func (r *MemoryRepo) Fork(ctx context.Context, opts ForkOptions) (ThreadMeta, error)
- func (r *MemoryRepo) ForkWithInitialEntry(ctx context.Context, opts ForkOptions, initial Entry) (ThreadMeta, Entry, error)
- func (r *MemoryRepo) InspectSubAgentThreadAuthority(_ context.Context, parentThreadID, childThreadID string) (SubAgentThreadAuthoritySnapshot, error)
- func (r *MemoryRepo) InspectThreadAuthority(_ context.Context, threadID string) (ThreadAuthoritySnapshot, error)
- func (r *MemoryRepo) ListCanonicalTurns(_ context.Context, opts ListCanonicalTurnsOptions) (CanonicalTurnsPage, error)
- func (r *MemoryRepo) ListSubAgentInputs(_ context.Context, childThreadID string, state SubAgentInputState) ([]SubAgentInputRecord, error)
- func (r *MemoryRepo) ListThreads(_ context.Context, opts ListThreadsOptions) ([]ThreadMeta, error)
- func (r *MemoryRepo) MarkEffectUnknown(_ context.Context, req MarkEffectUnknownRequest) (EffectAttempt, error)
- func (r *MemoryRepo) MoveLeaf(_ context.Context, threadID, entryID string) error
- func (r *MemoryRepo) Path(_ context.Context, threadID, leafID string) ([]Entry, error)
- func (r *MemoryRepo) PathPage(_ context.Context, threadID, leafID, beforeEntryID string, limit int) (PathPage, error)
- func (r *MemoryRepo) PendingAutomaticThreadTitles(_ context.Context) ([]ThreadMeta, error)
- func (r *MemoryRepo) PrepareApprovalBatch(_ context.Context, req PrepareApprovalBatchRequest) (PrepareApprovalBatchResult, error)
- func (r *MemoryRepo) PrepareEffectAttempt(_ context.Context, req PrepareEffectAttemptRequest) (PrepareEffectAttemptResult, error)
- func (r *MemoryRepo) PrepareForkClaim(ctx context.Context, operationID, rootThreadID string, nodes []ForkOptions) error
- func (r *MemoryRepo) PrepareSubAgentClose(_ context.Context, req PrepareSubAgentCloseRequest) (PrepareSubAgentCloseResult, error)
- func (r *MemoryRepo) ProviderState(_ context.Context, threadID string) (ProviderStateRecord, error)
- func (r *MemoryRepo) PublishSubAgent(_ context.Context, req PublishSubAgentRequest) (PublishSubAgentResult, error)
- func (r *MemoryRepo) PublishSubAgentInput(_ context.Context, req PublishSubAgentInputRequest) (SubAgentInputRecord, bool, error)
- func (r *MemoryRepo) PublishSubAgentPendingToolCompletion(_ context.Context, req PublishSubAgentPendingToolCompletionRequest) (PublishSubAgentPendingToolCompletionResult, error)
- func (r *MemoryRepo) PutProviderState(ctx context.Context, record ProviderStateRecord) error
- func (r *MemoryRepo) ReadAgentTodoState(_ context.Context, threadID string) (AgentTodoState, error)
- func (r *MemoryRepo) ReadApprovalQueue(_ context.Context, threadID string) (ApprovalQueue, error)
- func (r *MemoryRepo) ReadArtifact(_ context.Context, req ArtifactReadRequest) (ArtifactContent, error)
- func (r *MemoryRepo) ReadCanonicalTurn(_ context.Context, threadID, turnID string) (CanonicalTurnRead, error)
- func (r *MemoryRepo) ReadCompaction(_ context.Context, threadID, requestID string) (CompactionOperation, bool, error)
- func (r *MemoryRepo) ReadPendingToolCompletion(_ context.Context, req AdmitPendingToolCompletionRequest) (AdmitPendingToolCompletionResult, bool, error)
- func (r *MemoryRepo) ReadSubAgentInput(_ context.Context, inputID string) (SubAgentInputRecord, bool, error)
- func (r *MemoryRepo) ReadTurnAdmission(_ context.Context, threadID, turnID, runID string) (AdmitTurnResult, bool, error)
- func (r *MemoryRepo) RecoverInterruptedTurn(_ context.Context, req RecoverInterruptedTurnRequest) (RecoverInterruptedTurnResult, error)
- func (r *MemoryRepo) RejectEffectAttempt(_ context.Context, req RejectEffectAttemptRequest) (EffectAttempt, error)
- func (r *MemoryRepo) ReleaseThreadAuthorityClaim(_ context.Context, operationID string)
- func (r *MemoryRepo) ReleaseTurnLease(_ context.Context, proof TurnLease) error
- func (r *MemoryRepo) RenewTurnLease(_ context.Context, proof TurnLease) (TurnLease, error)
- func (r *MemoryRepo) ResolveApproval(_ context.Context, req ResolveApprovalRequest) (ResolveApprovalResult, error)
- func (r *MemoryRepo) SetThreadTitle(ctx context.Context, req SetThreadTitleRequest) (ThreadTitleMutationResult, error)
- func (r *MemoryRepo) SettlePendingToolRecovery(_ context.Context, req SettlePendingToolRecoveryRequest) (SettlePendingToolRecoveryResult, error)
- func (r *MemoryRepo) TakeOverCompaction(_ context.Context, req TakeOverCompactionRequest) (BeginCompactionResult, error)
- func (r *MemoryRepo) Thread(_ context.Context, threadID string) (ThreadMeta, error)
- func (r *MemoryRepo) ThreadTombstone(_ context.Context, threadID string) (ThreadTombstone, error)
- func (r *MemoryRepo) UpdateThread(ctx context.Context, meta ThreadMeta) error
- func (r *MemoryRepo) ValidateArtifactForkDestination(_ context.Context, closure artifact.Closure) error
- func (r *MemoryRepo) ValidateInterruptedTurnResolution(_ context.Context, req RecoverInterruptedTurnRequest) error
- func (r *MemoryRepo) WaitApprovalDecision(ctx context.Context, approvalID string) (WaitApprovalDecisionResult, error)
- type PathPage
- type PendingToolCompletionAuthorityRepo
- type PendingToolRecoveryRepo
- type PendingToolSettlementTarget
- type PrepareApprovalBatchRequest
- type PrepareApprovalBatchResult
- type PrepareEffectAttemptRequest
- type PrepareEffectAttemptResult
- type PrepareSubAgentCloseRequest
- type PrepareSubAgentCloseResult
- type ProjectedSegment
- type ProjectionPurpose
- type ProviderStateReader
- type ProviderStateRecord
- type ProviderStateStore
- type PublishSubAgentInputRequest
- type PublishSubAgentPendingToolCompletionRequest
- type PublishSubAgentPendingToolCompletionResult
- type PublishSubAgentRequest
- type PublishSubAgentResult
- type RecoverInterruptedTurnRequest
- type RecoverInterruptedTurnResult
- type RejectEffectAttemptRequest
- type Repo
- type ResolveApprovalRequest
- type ResolveApprovalResult
- type RootAuthorityRepo
- type SetThreadTitleRequest
- type SettlePendingToolRecoveryRequest
- type SettlePendingToolRecoveryResult
- type SubAgentCloseAuthorityRepo
- type SubAgentCloseNode
- type SubAgentCloseOperation
- type SubAgentCloseState
- type SubAgentInputAuthorityRepo
- type SubAgentInputReadRepo
- type SubAgentInputRecord
- type SubAgentInputState
- type SubAgentRequestKind
- type SubAgentThreadAuthorityInspectionRepo
- type SubAgentThreadAuthoritySnapshot
- type TakeOverCompactionRequest
- type ThreadAuthorityInspectionRepo
- type ThreadAuthoritySnapshot
- type ThreadLifecycle
- type ThreadListRepo
- type ThreadMeta
- type ThreadPublishRepo
- type ThreadTitleAuthorityRepo
- type ThreadTitleMutationResult
- type ThreadTitleProjection
- type ThreadTitleSource
- type ThreadTitleStatus
- type ThreadTombstone
- type ThreadTombstoneRepo
- type TurnAuthorityRepo
- type TurnLease
- type TurnLeasePurpose
- type TurnLeaseRepo
- type TurnMarkerStatus
- type TurnTerminalOutcome
- type WaitApprovalDecisionResult
Constants ¶
const ( ApprovalReasonUserRejected = "user_rejected" ApprovalReasonPolicyDenied = "policy_denied" ApprovalReasonAuthorizationContract = "authorization_contract" ApprovalReasonCancelled = "cancelled" ApprovalReasonTimedOut = "timed_out" )
const ( SubAgentInputIDMetadataKey = "subagent_input_id" SubAgentUserMessageOriginMetadataKey = "subagent_user_message_origin" SubAgentUserMessageOriginDelegatedMission = "delegated_mission" SubAgentUserMessageOriginInput = "subagent_input" SubAgentUserMessageOriginPendingToolCompletion = "pending_tool_completion" )
const ( InterruptedTurnRecoveryKindKey = "authority_kind" InterruptedTurnRecoveryKind = "interrupted_turn_recovery" InterruptedTurnRecoveryFingerprintKey = "authority_fingerprint" InterruptedTurnRecoveryParentKey = "authority_parent_thread_id" InterruptedTurnRecoveryApprovalRootKey = "authority_approval_root_thread_id" InterruptedTurnRecoveryApprovalGenerationKey = "authority_approval_queue_generation" InterruptedTurnRecoveryApprovalRevisionKey = "authority_approval_queue_revision" InterruptedTurnRecoverySourceFailureEntryKey = "authority_source_failure_entry_id" InterruptedTurnRecoverySourceFailureRawHashKey = "authority_source_failure_raw_hash" InterruptedTurnFailureMessage = "turn interrupted during previous process" InterruptedTurnEffectOutcomeUnknownMessage = "effect outcome is unknown because the turn was interrupted after dispatch" BranchBoundaryTurnFailureMessage = "turn interrupted by branch boundary" )
const ( PendingToolSettlementKindKey = "authority_kind" PendingToolSettlementKind = "pending_tool_settlement" PendingToolSettlementFingerprintKey = "authority_fingerprint" PendingToolEffectAttemptIDKey = "effect_attempt_id" )
const ( RetrySourceTurnIDMetadataKey = "retry_source_turn_id" RetrySourceEntryIDMetadataKey = "retry_source_entry_id" )
const ( TurnFailureCodeMetadataKey = "failure_code" TurnFailureCancelled = "cancelled" TurnFailureInterrupted = "interrupted" TurnFailureProvider = "provider" TurnFailureToolDispatch = "tool_dispatch" TurnFailureEffectOutcomeUnknown = "effect_outcome_unknown" TurnFailureAuthorizationContract = "authorization_contract" TurnFailureStorage = "storage" TurnFailureEngineContract = "engine_contract" TurnFailureLegacyUnclassified = "legacy_unclassified" )
const CompactionMutationKind = "compaction"
const MaxThreadTitleRunes = 200
MaxThreadTitleRunes is the canonical title admission and projection limit.
Variables ¶
var ( ErrArtifactNotFound = errors.New("session tree artifact not found") ErrSubAgentNotFound = errors.New("session tree subagent not found") ErrSubAgentParentRequired = errors.New("session tree subagent requires parent authority") ErrUnsupportedStoreCapability = errors.New("session tree store capability is unsupported") )
var ( ErrRequestConflict = errors.New("session tree authority request conflicts with persisted request") ErrSubAgentRequestConflict = fmt.Errorf("subagent request identity conflicts with persisted request: %w", ErrRequestConflict) ErrSubAgentInputNotFound = errors.New("session tree subagent input not found") ErrEffectAttemptNotFound = errors.New("session tree effect attempt not found") ErrEffectOutcomeUnknown = errors.New("session tree effect outcome is unknown") )
var ( ErrPendingToolTurnNotFound = errors.New("session tree pending tool turn not found") ErrPendingToolRunNotFound = errors.New("session tree pending tool run not found") ErrPendingToolNotFound = errors.New("session tree pending tool not found") ErrPendingToolNotPending = errors.New("session tree pending tool is not pending") )
var ( ErrThreadNotFound = errors.New("session tree thread not found") ErrEntryNotFound = errors.New("session tree entry not found") ErrInvalidParent = errors.New("session tree invalid parent") ErrActiveTurn = errors.New("session tree thread already has an active turn") ErrThreadExists = errors.New("session tree thread already exists") ErrInvalidThreadAuthority = errors.New("session tree invalid thread authority") ErrThreadAuthorityBusy = errors.New("session tree thread authority is busy") ErrThreadClosed = errors.New("session tree thread is closed") ErrThreadDeleted = errors.New("session tree thread is deleted") ErrSubAgentClosing = errors.New("session tree subagent is closing") ErrStaleAuthority = errors.New("session tree authority proof is stale") ErrRecoveryTargetResolved = errors.New("session tree interrupted recovery target is resolved") ErrAuthorityCorrupt = errors.New("session tree authority state is corrupt") ErrForkDestinationConflict = errors.New("session tree fork destination conflicts with operation marker") ErrAgentTodoVersionConflict = errors.New("session tree agent todo version conflict") ErrStaleCanonicalTurnCursor = errors.New("session tree canonical turn cursor is stale") )
var DefaultLeasePolicy = LeasePolicy{ TTL: 30 * time.Second, RenewInterval: 10 * time.Second, ClockSkewAllowance: 2 * time.Second, }
var ErrApprovalNotFound = errors.New("session tree approval not found")
var ErrCanonicalTurnNotFound = errors.New("session tree canonical turn not found")
var ErrProviderStateNotFound = errors.New("provider state not found")
Functions ¶
func ActivePathHash ¶ added in v0.18.0
func AddInterruptedTurnApprovalQueueProof ¶ added in v0.20.0
func AddInterruptedTurnApprovalQueueProof(metadata map[string]string, proof *InterruptedTurnApprovalQueueProof) error
func AddInterruptedTurnRecoverySourceFailureProof ¶ added in v0.20.0
func AddInterruptedTurnRecoverySourceFailureProof(metadata map[string]string, proof *InterruptedTurnRecoveryFailureProof) error
func ApprovalBatchCancellationFingerprint ¶ added in v0.20.0
func ApprovalCancellationEntryID ¶ added in v0.20.0
func ApprovalDispatchEntryID ¶ added in v0.20.0
func ApprovalDispatchEntryRequestMatches ¶ added in v0.20.0
func ApprovalEffectAttemptID ¶ added in v0.20.0
func ApprovalEffectAttemptID(invocation EffectInvocationIdentity) string
func ApprovalFinalizationEntryID ¶ added in v0.20.0
func ApprovalPreflightMatchesEffect ¶ added in v0.20.0
func ApprovalPreflightMatchesEffect(item ApprovalPreflightItem, lease TurnLease, attempt EffectAttempt) bool
func ApprovalPreflightMatchesRecord ¶ added in v0.20.0
func ApprovalPreflightMatchesRecord(record ApprovalRecord, rootID, parentID string, item ApprovalPreflightItem, attempt EffectAttempt) bool
func ApprovalQueueVisible ¶ added in v0.20.0
func ApprovalQueueVisible(state ApprovalState) bool
func ApprovalRejectedEntryID ¶ added in v0.20.0
func ApprovalRequestedEntryID ¶ added in v0.20.0
func BuildContext ¶
func BuildContext(path []Entry, opts ContextOptions) []session.Message
func BuildContextChecked ¶ added in v0.20.0
func BuildContextChecked(path []Entry, opts ContextOptions) ([]session.Message, error)
func ContextWithTurnLease ¶ added in v0.18.0
ContextWithTurnLease binds the exact durable mutation owner to journal writes.
func CreateRootFingerprint ¶ added in v0.18.0
func CreateRootFingerprint(req CreateRootRequest) string
CreateRootFingerprint is the stable identity used by root-create replay.
func CreateRootReplayMatches ¶ added in v0.18.0
func CreateRootReplayMatches(meta ThreadMeta, threadID string) bool
CreateRootReplayMatches reports whether a live row is the exact canonical root shape eligible for root-create replay.
func EffectResultRequestMatches ¶ added in v0.18.0
func InterruptedTurnRecoveryApprovalCancellationID ¶ added in v0.20.0
func InterruptedTurnRecoveryCancelledEffectFingerprint ¶ added in v0.20.0
func InterruptedTurnRecoveryFingerprint ¶ added in v0.18.0
func InterruptedTurnRecoveryFingerprint( expectedLease TurnLease, parentThreadID string, runID string, status TurnMarkerStatus, failureCode string, failureMessage string, sourceFailure *InterruptedTurnRecoveryFailureProof, effects []InterruptedTurnRecoveryEffect, ) (string, error)
func InterruptedTurnRecoveryUnknownEffectFingerprint ¶ added in v0.20.0
func InterruptedTurnToolResult ¶ added in v0.18.0
func InterruptedTurnToolResult(call session.Message, effectState EffectAttemptState) session.Message
func MatchesForkDestinationMeta ¶ added in v0.17.0
func MatchesForkDestinationMeta(meta ThreadMeta, destination *ForkDestinationMeta) bool
MatchesForkDestinationMeta reports whether persisted ownership metadata exactly matches the fork plan. It is used for replay idempotency.
func NormalizeApprovalCancellationEntries ¶ added in v0.20.0
func NormalizeApprovalCancellationEntries(req CancelApprovalBatchRequest) (map[string]Entry, error)
func NormalizeSubAgentCloseIntent ¶ added in v0.18.0
func NormalizeSubAgentCloseIntent(operationID, parentThreadID, targetThreadID, reason string) (string, string, string, string, string, error)
NormalizeSubAgentCloseIntent validates the storage-kernel close identity and returns its normalized fields plus immutable intent fingerprint.
func PublishSubAgentChildMatches ¶ added in v0.18.0
func PublishSubAgentChildMatches(req PublishSubAgentRequest, child ThreadMeta) bool
PublishSubAgentChildMatches verifies the durable child authority produced by or replayed for one exact publication request.
func RawForEntry ¶
func RetryPathHasRetryEligibleDurableInput ¶ added in v0.20.0
RetryPathHasRetryEligibleDurableInput evaluates the newest canonical user input at or before a retry source. Callers must provide an authority-validated ancestor path ending at the source entry.
func RetrySourceHasRetryEligibleDurableInput ¶ added in v0.20.0
func RetrySourceHasRetryEligibleDurableInput(path []Entry, sourceTurnID, sourceEntryID string) (int, bool, error)
RetrySourceHasRetryEligibleDurableInput validates the structural retry source and reports whether its canonical user input contains durable text or an attachment. References alone require ephemeral supplemental context and are therefore not replayable.
func SameApprovalIdentity ¶ added in v0.20.0
func SameApprovalIdentity(left, right ApprovalIdentity) bool
func SameThreadAuthority ¶ added in v0.17.0
func SameThreadAuthority(left, right ThreadMeta) bool
SameThreadAuthority reports whether an update preserves immutable ownership and lineage identity.
func SameThreadTitleState ¶ added in v0.20.0
func SameThreadTitleState(left, right ThreadMeta) bool
func SameTurnLease ¶ added in v0.18.0
func SortThreadsByCreatedAtDesc ¶
func SortThreadsByCreatedAtDesc(threads []ThreadMeta)
func StableHash ¶
func SubAgentCloseRequestFingerprint ¶ added in v0.18.0
func SubAgentCloseRequestFingerprint(intentFingerprint string, nodes []SubAgentCloseNode) (string, error)
SubAgentCloseRequestFingerprint binds one close intent to the subtree membership derived by the storage transaction.
func SubAgentUserMessageOrigin ¶ added in v0.30.0
func SubAgentUserMessageOrigin(kind SubAgentRequestKind) (string, error)
func ThreadAuthorityTreeIDs ¶ added in v0.17.0
func ThreadAuthorityTreeIDs(threads []ThreadMeta, rootThreadID string) ([]string, error)
ThreadAuthorityTreeIDs returns one root and all descendants owned through ParentThreadID after validating the complete authority graph.
func TurnAdmissionRequestFingerprint ¶ added in v0.20.0
func TurnAdmissionRequestFingerprint(req AdmitTurnRequest) (string, error)
func UpdateTurnLeaseContext ¶ added in v0.18.0
UpdateTurnLeaseContext advances one context binding after a successful durable renewal. It cannot replace a different owner or generation.
func ValidTurnFailureCode ¶ added in v0.20.0
func ValidateAdmitPendingToolCompletionEnvelope ¶ added in v0.25.0
func ValidateAdmitPendingToolCompletionEnvelope(req AdmitPendingToolCompletionRequest) error
func ValidateAdmitPendingToolCompletionReplayRequest ¶ added in v0.25.0
func ValidateAdmitPendingToolCompletionReplayRequest(req AdmitPendingToolCompletionRequest) error
func ValidateAdmitPendingToolCompletionRequest ¶ added in v0.18.0
func ValidateAdmitPendingToolCompletionRequest(req AdmitPendingToolCompletionRequest) error
func ValidateAdmitTurnReplayRequest ¶ added in v0.25.0
func ValidateAdmitTurnReplayRequest(req AdmitTurnRequest) error
ValidateAdmitTurnReplayRequest preserves the attachment shape accepted by historical admissions while retaining every other request-shape check.
func ValidateAdmitTurnRequest ¶ added in v0.20.0
func ValidateAdmitTurnRequest(req AdmitTurnRequest) error
func ValidateAdmitTurnRequestEnvelope ¶ added in v0.25.0
func ValidateAdmitTurnRequestEnvelope(req AdmitTurnRequest) error
ValidateAdmitTurnRequestEnvelope validates the authority fields required to look up an existing admission before applying new-admission input limits.
func ValidateApprovalDecisionReceiptAuthority ¶ added in v0.20.0
func ValidateApprovalDecisionReceiptAuthority(receipt ApprovalDecisionReceipt, record ApprovalRecord, queue ApprovalQueue) error
func ValidateApprovalRecord ¶ added in v0.20.0
func ValidateApprovalRecord(record ApprovalRecord) error
func ValidateBeginAutomaticThreadTitleRequest ¶ added in v0.20.0
func ValidateBeginAutomaticThreadTitleRequest(req BeginAutomaticThreadTitleRequest) error
func ValidateBeginCompactionRequest ¶ added in v0.18.0
func ValidateBeginCompactionRequest(req BeginCompactionRequest) error
func ValidateCancelApprovalBatchRequest ¶ added in v0.20.0
func ValidateCancelApprovalBatchRequest(req CancelApprovalBatchRequest) error
func ValidateCanonicalThreadTitle ¶ added in v0.29.0
ValidateCanonicalThreadTitle validates committed title text independently from its authority state.
func ValidateCanonicalTurnEntries ¶ added in v0.20.0
func ValidateCanonicalTurnReadAuthority ¶ added in v0.31.0
func ValidateCanonicalTurnReadAuthority(turn CanonicalTurn, admission CanonicalTurnAdmissionFact) error
func ValidateCanonicalTurnReadStructure ¶ added in v0.31.0
func ValidateCanonicalTurnReadStructure(turn CanonicalTurn, threadID string) error
ValidateCanonicalTurnReadStructure validates journal shape independently of optional execution-admission authority.
func ValidateCommitApprovalDispatchRequest ¶ added in v0.20.0
func ValidateCommitApprovalDispatchRequest(req CommitApprovalDispatchRequest) error
func ValidateCompleteAutomaticThreadTitleRequest ¶ added in v0.20.0
func ValidateCompleteAutomaticThreadTitleRequest(req CompleteAutomaticThreadTitleRequest) error
func ValidateCreateRootRequest ¶ added in v0.18.0
func ValidateCreateRootRequest(req CreateRootRequest) error
ValidateCreateRootRequest validates the exact root-create contract.
func ValidateEffectLeaseSuccessor ¶ added in v0.20.0
ValidateEffectLeaseSuccessor permits an effect authority operation to use a proof captured before one or more durable heartbeat renewals. Ownership, generation, acquisition identity, and monotonic lease time must remain exact.
func ValidateEntryIntegrity ¶ added in v0.20.0
func ValidateEntryMessageAttachments ¶ added in v0.25.0
func ValidateEntryMessageReferences ¶ added in v0.20.0
func ValidateFailAutomaticThreadTitleRequest ¶ added in v0.20.0
func ValidateFailAutomaticThreadTitleRequest(req FailAutomaticThreadTitleRequest) error
func ValidateFinalizeApprovalRequest ¶ added in v0.20.0
func ValidateFinalizeApprovalRequest(req FinalizeApprovalRequest) error
func ValidateFinalizeApprovalRequestedEntry ¶ added in v0.20.0
func ValidateFinalizeApprovalRequestedEntry(record ApprovalRecord, entry Entry) error
func ValidateFinalizeApprovalResultAuthority ¶ added in v0.20.0
func ValidateFinalizeApprovalResultAuthority(req FinalizeApprovalRequest, result FinalizeApprovalResult) error
func ValidateFinalizeApprovalSourceAuthority ¶ added in v0.20.0
func ValidateFinalizeApprovalSourceAuthority(req FinalizeApprovalRequest, record ApprovalRecord, effect EffectAttempt, queue ApprovalQueue) error
func ValidateFinishTurnRequest ¶ added in v0.20.0
func ValidateFinishTurnRequest(req FinishTurnRequest) error
func ValidateForkPrepareState ¶ added in v0.18.0
func ValidateForkPrepareState(rootThreadID string, nodes []ForkOptions, states []ForkPrepareThreadState) error
ValidateForkPrepareState rejects a plan whose pinned source snapshot or terminal-child set no longer matches the canonical state at claim time.
func ValidateForkRetryAuthorityPath ¶ added in v0.20.0
ValidateForkRetryAuthorityPath validates the complete staged destination path before a fork publishes entries or retry admission facts.
func ValidateInterruptedTurnAdmissionPath ¶ added in v0.19.0
func ValidateInterruptedTurnLeaseSuccessor ¶ added in v0.19.0
ValidateInterruptedTurnLeaseSuccessor verifies that current is a canonical monotonic successor of the exact recovery target proof.
func ValidateInterruptedTurnRecoveryEffectAttempts ¶ added in v0.20.0
func ValidateInterruptedTurnRecoveryEffectAttempts(attempts []EffectAttempt, threadID, turnID, runID string) error
func ValidateInterruptedTurnRecoveryPath ¶ added in v0.18.0
func ValidateInterruptedTurnStartedEntry ¶ added in v0.19.0
func ValidateListCanonicalTurnsOptions ¶ added in v0.20.0
func ValidateListCanonicalTurnsOptions(opts ListCanonicalTurnsOptions) error
func ValidateNewEntryMessageAttachments ¶ added in v0.25.0
func ValidatePendingToolCompletionPath ¶ added in v0.18.0
func ValidatePublishSubAgentIdentity ¶ added in v0.18.0
func ValidatePublishSubAgentIdentity(req PublishSubAgentRequest) error
ValidatePublishSubAgentIdentity validates the durable request-ledger key and conflict identity before a backend interprets the requested child shape.
func ValidatePublishSubAgentInputEnvelope ¶ added in v0.25.0
func ValidatePublishSubAgentInputEnvelope(req PublishSubAgentInputRequest) error
func ValidatePublishSubAgentInputReplayRequest ¶ added in v0.25.0
func ValidatePublishSubAgentInputReplayRequest(req PublishSubAgentInputRequest) error
func ValidatePublishSubAgentInputRequest ¶ added in v0.20.0
func ValidatePublishSubAgentInputRequest(req PublishSubAgentInputRequest) error
func ValidatePublishSubAgentPendingToolCompletionEnvelope ¶ added in v0.25.0
func ValidatePublishSubAgentPendingToolCompletionEnvelope(req PublishSubAgentPendingToolCompletionRequest) error
func ValidatePublishSubAgentPendingToolCompletionReplayRequest ¶ added in v0.25.0
func ValidatePublishSubAgentPendingToolCompletionReplayRequest(req PublishSubAgentPendingToolCompletionRequest) error
func ValidatePublishSubAgentPendingToolCompletionRequest ¶ added in v0.18.0
func ValidatePublishSubAgentPendingToolCompletionRequest(req PublishSubAgentPendingToolCompletionRequest) error
func ValidatePublishSubAgentReplayRequest ¶ added in v0.25.0
func ValidatePublishSubAgentReplayRequest(req PublishSubAgentRequest) error
func ValidatePublishSubAgentRequest ¶ added in v0.18.0
func ValidatePublishSubAgentRequest(req PublishSubAgentRequest) error
ValidatePublishSubAgentRequest enforces the exact parent, child, fork, and first-input identity before a backend starts the atomic publication.
func ValidateRecoverInterruptedTurnRequest ¶ added in v0.18.0
func ValidateRecoverInterruptedTurnRequest(req RecoverInterruptedTurnRequest) error
func ValidateResolveApprovalReplayAuthority ¶ added in v0.20.0
func ValidateResolveApprovalReplayAuthority( expectedDecisionID string, decision ApprovalDecision, expectedRootThreadID string, expectedGeneration int64, expectedRevision int64, expectedCurrent ApprovalIdentity, expectedApprovalRevision int64, receipt ApprovalDecisionReceipt, record ApprovalRecord, effect EffectAttempt, queue ApprovalQueue, ) error
func ValidateResolveApprovalRequest ¶ added in v0.20.0
func ValidateResolveApprovalRequest(req ResolveApprovalRequest) error
func ValidateRetrySourcePath ¶ added in v0.20.0
func ValidateRetryStartedEntry ¶ added in v0.20.0
func ValidateRetryStartedEntry(entry Entry, threadID, turnID, runID, startedEntryID string, source CanonicalTurnRetrySource) error
func ValidateSetThreadTitleRequest ¶ added in v0.18.0
func ValidateSetThreadTitleRequest(req SetThreadTitleRequest) error
func ValidateThreadAuthorityGraph ¶ added in v0.17.0
func ValidateThreadAuthorityGraph(threads []ThreadMeta) error
ValidateThreadAuthorityGraph requires every SubAgent parent chain to be acyclic and terminate at an existing root thread.
func ValidateThreadAuthoritySnapshot ¶ added in v0.19.0
func ValidateThreadAuthorityState ¶ added in v0.18.0
func ValidateThreadMetaAuthority ¶ added in v0.17.0
func ValidateThreadMetaAuthority(meta ThreadMeta) error
ValidateThreadMetaAuthority enforces the durable distinction between independent root threads and parent-owned SubAgent threads.
func ValidateThreadTitleProjection ¶ added in v0.29.0
func ValidateThreadTitleProjection(projection ThreadTitleProjection) error
ValidateThreadTitleProjection validates the observable canonical title state shared by durable authority and public runtime projections.
func ValidateThreadTitleState ¶ added in v0.20.0
func ValidateThreadTitleState(meta ThreadMeta) error
Types ¶
type AdmitPendingToolCompletionRequest ¶ added in v0.18.0
type AdmitPendingToolCompletionResult ¶ added in v0.18.0
type AdmitPendingToolCompletionResult struct {
Settlement Entry
SettlementReplayed bool
Admission AdmitTurnResult
Replayed bool
}
type AdmitSubAgentInputRequest ¶ added in v0.18.0
type AdmitSubAgentInputResult ¶ added in v0.18.0
type AdmitSubAgentInputResult struct {
Input SubAgentInputRecord
Lease TurnLease
TurnStarted Entry
UserMessage Entry
Replayed bool
}
type AdmitTurnRequest ¶ added in v0.18.0
type AdmitTurnResult ¶ added in v0.18.0
type AgentTodoItem ¶ added in v0.11.0
type AgentTodoItem struct {
ID string `json:"id"`
Content string `json:"content"`
Status AgentTodoStatus `json:"status"`
}
type AgentTodoState ¶ added in v0.11.0
type AgentTodoState struct {
ThreadID string `json:"thread_id"`
Version int64 `json:"version"`
Items []AgentTodoItem `json:"items"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
UpdatedByTurnID string `json:"updated_by_turn_id,omitempty"`
UpdatedByRunID string `json:"updated_by_run_id,omitempty"`
UpdatedByToolCall string `json:"updated_by_tool_call_id,omitempty"`
}
type AgentTodoStateRepo ¶ added in v0.11.0
type AgentTodoStateRepo interface {
ReadAgentTodoState(context.Context, string) (AgentTodoState, error)
CompareAndSwapAgentTodoState(context.Context, AgentTodoState, int64) (AgentTodoState, error)
}
type AgentTodoStatus ¶ added in v0.11.0
type AgentTodoStatus string
const ( AgentTodoPending AgentTodoStatus = "pending" AgentTodoInProgress AgentTodoStatus = "in_progress" AgentTodoCompleted AgentTodoStatus = "completed" )
type AppendCommittedError ¶
type AppendCommittedError struct {
Err error
}
func (AppendCommittedError) Error ¶
func (e AppendCommittedError) Error() string
func (AppendCommittedError) Unwrap ¶
func (e AppendCommittedError) Unwrap() error
type ApprovalAuthorityRepo ¶ added in v0.20.0
type ApprovalAuthorityRepo interface {
PrepareApprovalBatch(context.Context, PrepareApprovalBatchRequest) (PrepareApprovalBatchResult, error)
ReadApprovalQueue(context.Context, string) (ApprovalQueue, error)
Approval(context.Context, string) (ApprovalRecord, error)
WaitApprovalDecision(context.Context, string) (WaitApprovalDecisionResult, error)
ResolveApproval(context.Context, ResolveApprovalRequest) (ResolveApprovalResult, error)
CommitApprovalDispatch(context.Context, CommitApprovalDispatchRequest) (CommitApprovalDispatchResult, error)
FinalizeApproval(context.Context, FinalizeApprovalRequest) (FinalizeApprovalResult, error)
CancelApprovalBatch(context.Context, CancelApprovalBatchRequest) (CancelApprovalBatchResult, error)
}
type ApprovalCancellationEntry ¶ added in v0.20.0
type ApprovalDecision ¶ added in v0.20.0
type ApprovalDecision string
const ( ApprovalDecisionApprove ApprovalDecision = "approve" ApprovalDecisionReject ApprovalDecision = "reject" )
type ApprovalDecisionReceipt ¶ added in v0.20.0
type ApprovalDecisionReceipt struct {
DecisionID string
ApprovalID string
RootThreadID string
Decision ApprovalDecision
State ApprovalState
Reason string
AuthorizationProofHash string
QueueGeneration int64
QueueRevision int64
ApprovalRevision int64
SubmittedAt time.Time
ResolvedAt time.Time
}
func CanonicalApprovalDecisionReceipt ¶ added in v0.20.0
func CanonicalApprovalDecisionReceipt(record ApprovalRecord, queue ApprovalQueue) (ApprovalDecisionReceipt, error)
type ApprovalIdentity ¶ added in v0.20.0
type ApprovalPreflightItem ¶ added in v0.20.0
type ApprovalPreflightItem struct {
EffectAttemptID string
EffectRequestFingerprint string
ApprovalRequestFingerprint string
Invocation EffectInvocationIdentity
RequestedEntry Entry
ToolKind string
Step int
BatchIndex int
BatchSize int
Resources []ApprovalResource
Effects []string
Labels map[string]string
HostContext map[string]string
ReadOnly bool
Destructive bool
OpenWorld bool
}
func NormalizeApprovalPreflightBatch ¶ added in v0.20.0
func NormalizeApprovalPreflightBatch(req PrepareApprovalBatchRequest) ([]ApprovalPreflightItem, error)
type ApprovalQueue ¶ added in v0.20.0
type ApprovalRecord ¶ added in v0.20.0
type ApprovalRecord struct {
ApprovalID string
RootThreadID string
ParentThreadID string
ThreadID string
TurnID string
RunID string
ToolCallID string
EffectAttemptID string
ToolName string
ToolKind string
Step int
BatchIndex int
BatchSize int
ArgsHash string
Resources []ApprovalResource
Effects []string
Labels map[string]string
HostContext map[string]string
ReadOnly bool
Destructive bool
OpenWorld bool
RequestFingerprint string
State ApprovalState
Revision int64
QueueSequence int64
DecisionID string
Reason string
AuthorizationProofHash string
RequestedAt time.Time
UpdatedAt time.Time
ResolvedAt time.Time
}
func ApprovalRecordFromPreflight ¶ added in v0.20.0
func ApprovalRecordFromPreflight(rootID, parentID string, item ApprovalPreflightItem, attempt EffectAttempt, sequence int64, now time.Time) ApprovalRecord
func (ApprovalRecord) Identity ¶ added in v0.20.0
func (a ApprovalRecord) Identity() ApprovalIdentity
type ApprovalResource ¶ added in v0.20.0
type ApprovalState ¶ added in v0.20.0
type ApprovalState string
const ( ApprovalRequested ApprovalState = "requested" ApprovalDecisionSubmitted ApprovalState = "decision_submitted" ApprovalApproved ApprovalState = "approved" ApprovalRejected ApprovalState = "rejected" ApprovalFailed ApprovalState = "failed" ApprovalTimedOut ApprovalState = "timed_out" ApprovalCancelled ApprovalState = "cancelled" )
type ArtifactAuthorityRepo ¶ added in v0.18.0
type ArtifactAuthorityRepo interface {
ReadArtifact(context.Context, ArtifactReadRequest) (ArtifactContent, error)
ArtifactClosure(context.Context, ArtifactClosureRequest) (artifact.Closure, error)
}
type ArtifactClosureRequest ¶ added in v0.18.0
type ArtifactContent ¶ added in v0.18.0
type ArtifactReadRequest ¶ added in v0.18.0
type BeginAutomaticThreadTitleRequest ¶ added in v0.20.0
type BeginCompactionRequest ¶ added in v0.18.0
type BeginCompactionResult ¶ added in v0.18.0
type BeginCompactionResult struct {
Operation CompactionOperation
Owner bool
TakeoverEligible bool
Replayed bool
}
type BeginEffectDispatchRequest ¶ added in v0.18.0
type CancelApprovalBatchRequest ¶ added in v0.20.0
type CancelApprovalBatchResult ¶ added in v0.20.0
type CancelApprovalBatchResult struct {
Queue ApprovalQueue
Approvals []ApprovalRecord
Effects []EffectAttempt
CancellationEntries []Entry
Replayed bool
}
type CanonicalTurn ¶ added in v0.20.0
type CanonicalTurn struct {
TurnID string
RunID string
StartedEntryID string
StartedOrdinal int64
RetrySource *CanonicalTurnRetrySource
Entries []CanonicalTurnPathEntry
}
type CanonicalTurnAdmissionFact ¶ added in v0.31.0
type CanonicalTurnAdmissionFact struct {
ThreadID string
TurnID string
RunID string
TurnStartedID string
UserMessageID string
BaseLeafID string
}
CanonicalTurnAdmissionFact validates persisted execution authority when it exists for a normal turn and whenever a retry turn omits a user entry.
type CanonicalTurnBeforeCursor ¶ added in v0.20.0
type CanonicalTurnBeforeCursor struct {
EntryID string
}
type CanonicalTurnPageRepo ¶ added in v0.20.0
type CanonicalTurnPageRepo interface {
ListCanonicalTurns(context.Context, ListCanonicalTurnsOptions) (CanonicalTurnsPage, error)
}
type CanonicalTurnPathEntry ¶ added in v0.20.0
type CanonicalTurnRead ¶ added in v0.31.0
type CanonicalTurnRead struct {
Turn CanonicalTurn
LatestTurn CanonicalTurn
ThroughOrdinal int64
HasRetryTarget bool
}
CanonicalTurnRead is one admitted canonical turn on the current active path.
type CanonicalTurnReadRepo ¶ added in v0.31.0
type CanonicalTurnReadRepo interface {
ReadCanonicalTurn(context.Context, string, string) (CanonicalTurnRead, error)
}
CanonicalTurnReadRepo reads one admitted turn without scanning a public page.
type CanonicalTurnRepo ¶ added in v0.20.0
type CanonicalTurnRepo interface {
CanonicalTurnEntries(context.Context, string, string, string) ([]Entry, bool, error)
}
CanonicalTurnRepo reads all journal entries associated with one exact turn. Execution replay authority remains owned by TurnAuthorityRepo.
type CanonicalTurnRetrySource ¶ added in v0.20.0
func CanonicalTurnRetrySourceForStartedEntry ¶ added in v0.20.0
func CanonicalTurnRetrySourceForStartedEntry(entry Entry) (*CanonicalTurnRetrySource, error)
func ValidateCanonicalRetrySourceTurn ¶ added in v0.20.0
func ValidateCanonicalRetrySourceTurn(entries []Entry, threadID string, source CanonicalTurnRetrySource) (bool, *CanonicalTurnRetrySource, string, string, error)
type CanonicalTurnSinceCursor ¶ added in v0.20.0
type CanonicalTurnSinceCursor struct {
EntryID string
}
type CanonicalTurnsPage ¶ added in v0.20.0
type CanonicalTurnsPage struct {
Turns []CanonicalTurn
BeforeCursor *CanonicalTurnBeforeCursor
SinceCursor CanonicalTurnSinceCursor
HasMore bool
ThroughOrdinal int64
LatestTurnID string
HasRetryTarget bool
}
type CommitApprovalDispatchRequest ¶ added in v0.20.0
type CommitApprovalDispatchResult ¶ added in v0.20.0
type CommitApprovalDispatchResult struct {
Receipt ApprovalDecisionReceipt
Queue ApprovalQueue
Approval ApprovalRecord
Effect EffectAttempt
ApprovedEntry Entry
Replayed bool
}
type CompactionAuthorityRepo ¶ added in v0.18.0
type CompactionAuthorityRepo interface {
ReadCompaction(context.Context, string, string) (CompactionOperation, bool, error)
BeginCompaction(context.Context, BeginCompactionRequest) (BeginCompactionResult, error)
TakeOverCompaction(context.Context, TakeOverCompactionRequest) (BeginCompactionResult, error)
FinishCompaction(context.Context, FinishCompactionRequest) (FinishCompactionResult, error)
}
type CompactionOperation ¶ added in v0.18.0
type CompactionOperation struct {
ThreadID string
RequestID string
RequestFingerprint string
Source string
SourceLeafID string
ActivePathHash string
SummarySchemaVersion string
PromptIdentity string
RequestPayloadHash string
State CompactionOperationState
Lease TurnLease
ResultEntryID string
ErrorCode string
ErrorMessage string
OutcomeFingerprint string
FinishedOwnerID string
FinishedGeneration int64
CreatedAt time.Time
UpdatedAt time.Time
FinishedAt time.Time
}
type CompactionOperationState ¶ added in v0.18.0
type CompactionOperationState string
const ( CompactionOperationPrepared CompactionOperationState = "prepared" CompactionOperationCompleted CompactionOperationState = "completed" CompactionOperationFailed CompactionOperationState = "failed" )
type CompleteAutomaticThreadTitleRequest ¶ added in v0.20.0
type ContextOptions ¶
type ContextOptions struct{}
type ContextProjection ¶
type ContextProjection struct {
Messages []session.Message `json:"messages"`
Segments []ProjectedSegment `json:"segments,omitempty"`
}
func BuildContextProjection ¶
func BuildContextProjection(path []Entry, opts ContextProjectionOptions) ContextProjection
func BuildContextProjectionChecked ¶ added in v0.20.0
func BuildContextProjectionChecked(path []Entry, opts ContextProjectionOptions) (ContextProjection, error)
type ContextProjectionOptions ¶
type ContextProjectionOptions struct {
Purpose ProjectionPurpose
}
type CreateRootRequest ¶ added in v0.18.0
type CreateRootRequest struct {
ThreadID string
CreateIntentID string
ContractVersion string
Meta ThreadMeta
}
type CreateRootResult ¶ added in v0.18.0
type CreateRootResult struct {
Thread ThreadMeta
Replayed bool
}
type DeleteRootTreeResult ¶ added in v0.18.0
type EffectAttempt ¶ added in v0.18.0
type EffectAttemptAuthorityRepo ¶ added in v0.18.0
type EffectAttemptAuthorityRepo interface {
PrepareEffectAttempt(context.Context, PrepareEffectAttemptRequest) (PrepareEffectAttemptResult, error)
RejectEffectAttempt(context.Context, RejectEffectAttemptRequest) (EffectAttempt, error)
BeginEffectDispatch(context.Context, BeginEffectDispatchRequest) (EffectAttempt, error)
FinishEffectDispatch(context.Context, FinishEffectDispatchRequest) (FinishEffectDispatchResult, error)
MarkEffectUnknown(context.Context, MarkEffectUnknownRequest) (EffectAttempt, error)
}
type EffectAttemptState ¶ added in v0.18.0
type EffectAttemptState string
const ( EffectAttemptPrepared EffectAttemptState = "prepared" EffectAttemptDispatching EffectAttemptState = "dispatching" EffectAttemptCompleted EffectAttemptState = "completed" EffectAttemptFailed EffectAttemptState = "failed" EffectAttemptRejected EffectAttemptState = "rejected" EffectAttemptUnknown EffectAttemptState = "unknown" EffectAttemptCancelled EffectAttemptState = "cancelled" )
type EffectInvocationIdentity ¶ added in v0.18.0
type Entry ¶
type Entry struct {
ID string `json:"id"`
ThreadID string `json:"thread_id"`
ParentID string `json:"parent_id,omitempty"`
PathDepth int64 `json:"path_depth"`
Type EntryType `json:"type"`
TurnID string `json:"turn_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
Message session.Message `json:"message,omitempty"`
Raw string `json:"raw,omitempty"`
RawHash string `json:"raw_hash,omitempty"`
TurnStatus TurnMarkerStatus `json:"turn_status,omitempty"`
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
CompactionID string `json:"compaction_id,omitempty"`
PreviousCompactionID string `json:"previous_compaction_id,omitempty"`
CompactedThroughEntryID string `json:"compacted_through_entry_id,omitempty"`
SummarySchemaVersion string `json:"summary_schema_version,omitempty"`
CompactionGeneration int `json:"compaction_generation,omitempty"`
CompactionWindowID string `json:"compaction_window_id,omitempty"`
FirstKeptEntryID string `json:"first_kept_entry_id,omitempty"`
KeptUserEntryIDs []string `json:"kept_user_entry_ids,omitempty"`
Summary string `json:"summary,omitempty"`
CompactionTrigger string `json:"compaction_trigger,omitempty"`
CompactionReason string `json:"compaction_reason,omitempty"`
CompactionPhase string `json:"compaction_phase,omitempty"`
CompactionOperationID string `json:"compaction_operation_id,omitempty"`
CompactionRequestID string `json:"compaction_request_id,omitempty"`
CompactionSource string `json:"compaction_source,omitempty"`
TokensBefore int64 `json:"tokens_before,omitempty"`
TokensAfterEstimate int64 `json:"tokens_after_estimate,omitempty"`
ContextUsageBefore contextpolicy.Usage `json:"context_usage_before,omitempty"`
ContextUsageAfter contextpolicy.Usage `json:"context_usage_after,omitempty"`
Error string `json:"error,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
func AppendActiveTools ¶
func AppendCompaction ¶
func AppendCompaction(ctx context.Context, repo JournalRepo, threadID, turnID string, result compaction.Result) (Entry, error)
func AppendFailure ¶
func AppendMessage ¶
func AppendMessageAt ¶ added in v0.3.56
func AppendTurnMarker ¶
func AppendTurnMarker(ctx context.Context, repo JournalRepo, threadID, turnID string, status TurnMarkerStatus, metadata map[string]string) (Entry, error)
func AppendTurnMarkerWithID ¶ added in v0.11.0
func AppendTurnMarkerWithID(ctx context.Context, repo JournalRepo, threadID, turnID, entryID string, status TurnMarkerStatus, metadata map[string]string) (Entry, error)
func CanonicalTurnEntriesForRead ¶ added in v0.20.0
CanonicalTurnEntriesForRead excludes retry/fork structural closures when the same turn already has its execution terminal. A copied unfinished turn keeps its branch boundary as the only canonical terminal.
func CompactionEntry ¶ added in v0.18.0
func CompactionEntry(threadID, turnID string, result compaction.Result) (Entry, error)
func PrepareBranchBoundaryEntry ¶ added in v0.18.0
func PrepareBranchBoundaryEntry(path []Entry, threadID, parentEntryID, entryID, reason string, now time.Time) (Entry, error)
PrepareBranchBoundaryEntry closes one copied or rewound unfinished turn so a fork or retry path is idle before another turn authority is admitted.
func PrepareEntry ¶
func PrepareSubAgentCloseLifecycleEntry ¶ added in v0.18.0
func PrepareSubAgentCloseLifecycleEntry(operation SubAgentCloseOperation, threadID, parentEntryID, entryID string, now time.Time) Entry
PrepareSubAgentCloseLifecycleEntry builds the canonical lifecycle entry that FinishSubAgentClose persists atomically with terminal child state.
func UnresolvedInterruptedTurnCalls ¶ added in v0.18.0
type EntryType ¶
type EntryType string
const ( EntryThreadInfo EntryType = "thread_info" EntryTurnMarker EntryType = "turn_marker" EntryUserMessage EntryType = "user_message" EntryAssistantMessage EntryType = "assistant_message" EntryToolCall EntryType = "tool_call" EntryToolResult EntryType = "tool_result" EntryModelChange EntryType = "model_change" EntryActiveTools EntryType = "active_tools_change" EntryCompaction EntryType = "compaction" EntryBranchSummary EntryType = "branch_summary" EntryRunFailure EntryType = "run_failure" EntryCustom EntryType = "custom" )
type FailAutomaticThreadTitleRequest ¶ added in v0.20.0
type FileRepo ¶
type FileRepo struct {
// contains filtered or unexported fields
}
func NewFileRepo ¶
func (*FileRepo) AcquireTurnLease ¶
func (*FileRepo) ActiveTurnLease ¶
func (*FileRepo) ArtifactClosure ¶ added in v0.18.0
func (*FileRepo) BeginAutomaticThreadTitle ¶ added in v0.20.0
func (r *FileRepo) BeginAutomaticThreadTitle(ctx context.Context, req BeginAutomaticThreadTitleRequest) (ThreadTitleMutationResult, error)
func (*FileRepo) CanonicalTurnEntries ¶ added in v0.20.0
func (*FileRepo) ClearExpiredTurnLease ¶
func (*FileRepo) CompareAndSwapAgentTodoState ¶ added in v0.11.0
func (r *FileRepo) CompareAndSwapAgentTodoState(ctx context.Context, state AgentTodoState, expectedVersion int64) (AgentTodoState, error)
func (*FileRepo) CompleteAutomaticThreadTitle ¶ added in v0.20.0
func (r *FileRepo) CompleteAutomaticThreadTitle(ctx context.Context, req CompleteAutomaticThreadTitleRequest) (ThreadTitleMutationResult, error)
func (*FileRepo) CreateThread ¶
func (r *FileRepo) CreateThread(ctx context.Context, meta ThreadMeta) (ThreadMeta, error)
func (*FileRepo) FailAutomaticThreadTitle ¶ added in v0.20.0
func (r *FileRepo) FailAutomaticThreadTitle(ctx context.Context, req FailAutomaticThreadTitleRequest) (ThreadTitleMutationResult, error)
func (*FileRepo) Fork ¶
func (r *FileRepo) Fork(ctx context.Context, opts ForkOptions) (ThreadMeta, error)
func (*FileRepo) ListCanonicalTurns ¶ added in v0.20.0
func (r *FileRepo) ListCanonicalTurns(ctx context.Context, opts ListCanonicalTurnsOptions) (CanonicalTurnsPage, error)
func (*FileRepo) ListThreads ¶
func (r *FileRepo) ListThreads(ctx context.Context, opts ListThreadsOptions) ([]ThreadMeta, error)
func (*FileRepo) PendingAutomaticThreadTitles ¶ added in v0.20.0
func (r *FileRepo) PendingAutomaticThreadTitles(ctx context.Context) ([]ThreadMeta, error)
func (*FileRepo) ReadAgentTodoState ¶ added in v0.11.0
func (*FileRepo) ReadArtifact ¶ added in v0.18.0
func (r *FileRepo) ReadArtifact(context.Context, ArtifactReadRequest) (ArtifactContent, error)
func (*FileRepo) ReleaseTurnLease ¶
func (*FileRepo) SetThreadTitle ¶ added in v0.20.0
func (r *FileRepo) SetThreadTitle(ctx context.Context, req SetThreadTitleRequest) (ThreadTitleMutationResult, error)
func (*FileRepo) UpdateThread ¶
func (r *FileRepo) UpdateThread(ctx context.Context, meta ThreadMeta) error
type FinalizeApprovalRequest ¶ added in v0.20.0
type FinalizeApprovalRequest struct {
ResolutionID string
ExpectedRootThreadID string
ExpectedGeneration int64
ExpectedCurrent ApprovalIdentity
ExpectedApprovalRevision int64
State ApprovalState
Reason string
FinalizedEntry Entry
Now time.Time
}
type FinalizeApprovalResult ¶ added in v0.20.0
type FinalizeApprovalResult struct {
Receipt ApprovalDecisionReceipt
Queue ApprovalQueue
Approval ApprovalRecord
Effect EffectAttempt
FinalizedEntry Entry
Replayed bool
}
type FinishCompactionRequest ¶ added in v0.18.0
type FinishCompactionResult ¶ added in v0.18.0
type FinishCompactionResult struct {
Operation CompactionOperation
Entry *Entry
Replayed bool
}
type FinishEffectDispatchRequest ¶ added in v0.18.0
type FinishEffectDispatchResult ¶ added in v0.18.0
type FinishEffectDispatchResult struct {
Attempt EffectAttempt
Result Entry
Artifact *artifact.Ref
Replayed bool
}
type FinishSubAgentCloseRequest ¶ added in v0.18.0
type FinishSubAgentCloseResult ¶ added in v0.18.0
type FinishSubAgentCloseResult struct {
Operation SubAgentCloseOperation
Threads []ThreadMeta
Entries []Entry
CancelledInputIDs []string
Replayed bool
}
type FinishTurnRequest ¶ added in v0.18.0
type FinishTurnResult ¶ added in v0.18.0
type ForkDestinationMeta ¶ added in v0.17.0
type ForkDestinationMeta struct {
ParentThreadID string `json:"parent_thread_id"`
ParentTurnID string `json:"parent_turn_id,omitempty"`
TaskName string `json:"task_name,omitempty"`
TaskDescription string `json:"task_description,omitempty"`
AgentPath string `json:"agent_path,omitempty"`
HostProfileRef string `json:"host_profile_ref,omitempty"`
ForkMode string `json:"fork_mode,omitempty"`
Lifecycle ThreadLifecycle `json:"lifecycle,omitempty"`
}
ForkDestinationMeta is the child ownership metadata written atomically with a fork destination. A nil value creates an independent root fork.
type ForkEntryIdentity ¶ added in v0.10.0
type ForkOptions ¶
type ForkOptions struct {
SourceThreadID string
EntryID string
EntryIDPinned bool
ExpectedSourceLeafID string
Position ForkPosition
NewThreadID string
OperationID string
OperationNodeID string
Now time.Time
TurnIDMap map[string]string
RunIDMap map[string]string
DestinationMeta *ForkDestinationMeta
ArtifactClosure artifact.Closure
RewriteEntry func(Entry, ForkEntryIdentity) (Entry, error)
}
type ForkPosition ¶
type ForkPosition string
const ( ForkAt ForkPosition = "at" ForkBefore ForkPosition = "before" )
type ForkPrepareThreadState ¶ added in v0.18.0
type ForkPrepareThreadState struct {
Meta ThreadMeta
Path []Entry
PinnedPath []Entry
PendingInputCount int
}
ForkPrepareThreadState is the transaction-local source state used to validate one complete replayable fork plan before any structural claim is published.
type InterruptedTurnApprovalQueueProof ¶ added in v0.20.0
type InterruptedTurnApprovalQueueProof struct {
RootThreadID string
Generation int64
Revision int64
}
func InterruptedTurnApprovalQueueProofFromMetadata ¶ added in v0.20.0
func InterruptedTurnApprovalQueueProofFromMetadata(metadata map[string]string) (*InterruptedTurnApprovalQueueProof, error)
type InterruptedTurnRecoveryEffect ¶ added in v0.20.0
type InterruptedTurnRecoveryEffect struct {
EffectAttemptID string `json:"effect_attempt_id"`
ToolCallID string `json:"tool_call_id"`
State EffectAttemptState `json:"state"`
}
func InterruptedTurnRecoveryEffects ¶ added in v0.20.0
func InterruptedTurnRecoveryEffects(attempts []EffectAttempt, committedFingerprint string) ([]InterruptedTurnRecoveryEffect, error)
type InterruptedTurnRecoveryFailureProof ¶ added in v0.20.0
type InterruptedTurnRecoveryFailureProof struct {
EntryID string `json:"entry_id"`
Message string `json:"message"`
RawHash string `json:"raw_hash"`
}
func InterruptedTurnRecoverySourceFailureProofFromMetadata ¶ added in v0.20.0
func InterruptedTurnRecoverySourceFailureProofFromMetadata(metadata map[string]string) (*InterruptedTurnRecoveryFailureProof, error)
type InterruptedTurnRecoveryPlan ¶ added in v0.18.0
type InterruptedTurnRecoveryPlan struct {
RunID string
Status TurnMarkerStatus
FailureCode string
FailureMessage string
SourceFailure *InterruptedTurnRecoveryFailureProof
OutcomeFingerprint string
TerminalEntryID string
Effects []InterruptedTurnRecoveryEffect
}
func DeriveInterruptedTurnRecoveryPlan ¶ added in v0.18.0
func DeriveInterruptedTurnRecoveryPlan(path []Entry, expectedLease TurnLease, parentThreadID string, effects []InterruptedTurnRecoveryEffect) (InterruptedTurnRecoveryPlan, error)
type InterruptedTurnRecoveryRepo ¶ added in v0.18.0
type InterruptedTurnRecoveryRepo interface {
RecoverInterruptedTurn(context.Context, RecoverInterruptedTurnRequest) (RecoverInterruptedTurnResult, error)
}
type InterruptedTurnResolutionValidationRepo ¶ added in v0.19.0
type InterruptedTurnResolutionValidationRepo interface {
ValidateInterruptedTurnResolution(context.Context, RecoverInterruptedTurnRequest) error
}
type JournalRepo ¶ added in v0.18.0
type JournalRepo interface {
Thread(context.Context, string) (ThreadMeta, error)
Append(context.Context, Entry, AppendOptions) (Entry, error)
Entry(context.Context, string, string) (Entry, error)
Entries(context.Context, string) ([]Entry, error)
Path(context.Context, string, string) ([]Entry, error)
PathPage(context.Context, string, string, string, int) (PathPage, error)
}
JournalRepo is the durable journal capability used by normal Agent execution. It intentionally excludes lifecycle creation, deletion, fork, and metadata replacement capabilities.
type LeasePolicy ¶ added in v0.18.0
type LeasePolicy struct {
TTL time.Duration
RenewInterval time.Duration
ClockSkewAllowance time.Duration
}
func (LeasePolicy) Validate ¶ added in v0.18.0
func (p LeasePolicy) Validate() error
type LeasePolicyRepo ¶ added in v0.18.0
type LeasePolicyRepo interface {
AuthorityLeasePolicy() LeasePolicy
}
type ListCanonicalTurnsOptions ¶ added in v0.20.0
type ListCanonicalTurnsOptions struct {
ThreadID string
BeforeCursor *CanonicalTurnBeforeCursor
SinceCursor *CanonicalTurnSinceCursor
Tail int
Limit int
}
type ListThreadsOptions ¶
type MarkEffectUnknownRequest ¶ added in v0.18.0
type MemoryRepo ¶
type MemoryRepo struct {
// contains filtered or unexported fields
}
func NewMemoryRepo ¶
func NewMemoryRepo() *MemoryRepo
func NewMemoryRepoWithLeasePolicy ¶ added in v0.18.0
func NewMemoryRepoWithLeasePolicy(policy LeasePolicy, now func() time.Time) (*MemoryRepo, error)
func (*MemoryRepo) AcquireThreadAuthorityClaim ¶ added in v0.18.0
func (r *MemoryRepo) AcquireThreadAuthorityClaim(_ context.Context, operationID string, requiredSourceThreadIDs, authorityThreadIDs []string) error
AcquireThreadAuthorityClaim reserves identities for one replayable structural operation. Required source threads must exist and have no active turn lease.
func (*MemoryRepo) AcquireTurnLease ¶
func (*MemoryRepo) ActiveTurnLease ¶
func (*MemoryRepo) AdmitPendingToolCompletion ¶ added in v0.18.0
func (r *MemoryRepo) AdmitPendingToolCompletion(_ context.Context, req AdmitPendingToolCompletionRequest) (AdmitPendingToolCompletionResult, error)
func (*MemoryRepo) AdmitSubAgentInput ¶ added in v0.18.0
func (r *MemoryRepo) AdmitSubAgentInput(ctx context.Context, req AdmitSubAgentInputRequest) (AdmitSubAgentInputResult, error)
func (*MemoryRepo) AdmitTurn ¶ added in v0.18.0
func (r *MemoryRepo) AdmitTurn(_ context.Context, req AdmitTurnRequest) (AdmitTurnResult, error)
func (*MemoryRepo) Append ¶
func (r *MemoryRepo) Append(ctx context.Context, entry Entry, opts AppendOptions) (Entry, error)
func (*MemoryRepo) Approval ¶ added in v0.20.0
func (r *MemoryRepo) Approval(_ context.Context, approvalID string) (ApprovalRecord, error)
func (*MemoryRepo) ArtifactClosure ¶ added in v0.18.0
func (r *MemoryRepo) ArtifactClosure(_ context.Context, req ArtifactClosureRequest) (artifact.Closure, error)
func (*MemoryRepo) AuthorityLeasePolicy ¶ added in v0.18.0
func (r *MemoryRepo) AuthorityLeasePolicy() LeasePolicy
func (*MemoryRepo) BeginAutomaticThreadTitle ¶ added in v0.20.0
func (r *MemoryRepo) BeginAutomaticThreadTitle(ctx context.Context, req BeginAutomaticThreadTitleRequest) (ThreadTitleMutationResult, error)
func (*MemoryRepo) BeginCompaction ¶ added in v0.18.0
func (r *MemoryRepo) BeginCompaction(_ context.Context, req BeginCompactionRequest) (BeginCompactionResult, error)
func (*MemoryRepo) BeginEffectDispatch ¶ added in v0.18.0
func (r *MemoryRepo) BeginEffectDispatch(_ context.Context, req BeginEffectDispatchRequest) (EffectAttempt, error)
func (*MemoryRepo) CancelApprovalBatch ¶ added in v0.20.0
func (r *MemoryRepo) CancelApprovalBatch(ctx context.Context, req CancelApprovalBatchRequest) (CancelApprovalBatchResult, error)
func (*MemoryRepo) CanonicalTurnEntries ¶ added in v0.20.0
func (*MemoryRepo) CommitApprovalDispatch ¶ added in v0.20.0
func (r *MemoryRepo) CommitApprovalDispatch(ctx context.Context, req CommitApprovalDispatchRequest) (CommitApprovalDispatchResult, error)
func (*MemoryRepo) CommitForkBatch ¶ added in v0.18.0
func (r *MemoryRepo) CommitForkBatch(ctx context.Context, operationID string, nodes []ForkOptions, commit func() error) ([]ThreadMeta, error)
CommitForkBatch publishes every destination and releases the operation's complete claim set in one MemoryRepo critical section. The callback persists the terminal operation record before readers can observe the destinations.
func (*MemoryRepo) CompareAndSwapAgentTodoState ¶ added in v0.11.0
func (r *MemoryRepo) CompareAndSwapAgentTodoState(ctx context.Context, state AgentTodoState, expectedVersion int64) (AgentTodoState, error)
func (*MemoryRepo) CompleteAutomaticThreadTitle ¶ added in v0.20.0
func (r *MemoryRepo) CompleteAutomaticThreadTitle(ctx context.Context, req CompleteAutomaticThreadTitleRequest) (ThreadTitleMutationResult, error)
func (*MemoryRepo) CreateRoot ¶ added in v0.18.0
func (r *MemoryRepo) CreateRoot(_ context.Context, req CreateRootRequest) (CreateRootResult, error)
func (*MemoryRepo) CreateThread ¶
func (r *MemoryRepo) CreateThread(_ context.Context, meta ThreadMeta) (ThreadMeta, error)
func (*MemoryRepo) CreateThreadWithInitialEntry ¶ added in v0.18.0
func (r *MemoryRepo) CreateThreadWithInitialEntry(ctx context.Context, meta ThreadMeta, initial Entry) (ThreadMeta, Entry, error)
func (*MemoryRepo) DeleteProviderState ¶ added in v0.18.0
func (r *MemoryRepo) DeleteProviderState(ctx context.Context, threadID string) error
func (*MemoryRepo) DeleteRootTree ¶ added in v0.18.0
func (r *MemoryRepo) DeleteRootTree(_ context.Context, rootThreadID string) (DeleteRootTreeResult, error)
func (*MemoryRepo) FailAutomaticThreadTitle ¶ added in v0.20.0
func (r *MemoryRepo) FailAutomaticThreadTitle(ctx context.Context, req FailAutomaticThreadTitleRequest) (ThreadTitleMutationResult, error)
func (*MemoryRepo) FailForkClaim ¶ added in v0.18.0
func (r *MemoryRepo) FailForkClaim(operationID string, sourceThreadIDs, authorityThreadIDs []string, commit func() error) error
FailForkClaim records one deterministic pre-publication failure and releases the complete claim set without exposing an unclaimed prepared operation.
func (*MemoryRepo) FinalizeApproval ¶ added in v0.20.0
func (r *MemoryRepo) FinalizeApproval(_ context.Context, req FinalizeApprovalRequest) (FinalizeApprovalResult, error)
func (*MemoryRepo) FinishCompaction ¶ added in v0.18.0
func (r *MemoryRepo) FinishCompaction(_ context.Context, req FinishCompactionRequest) (FinishCompactionResult, error)
func (*MemoryRepo) FinishEffectDispatch ¶ added in v0.18.0
func (r *MemoryRepo) FinishEffectDispatch(_ context.Context, req FinishEffectDispatchRequest) (FinishEffectDispatchResult, error)
func (*MemoryRepo) FinishSubAgentClose ¶ added in v0.18.0
func (r *MemoryRepo) FinishSubAgentClose(_ context.Context, req FinishSubAgentCloseRequest) (FinishSubAgentCloseResult, error)
func (*MemoryRepo) FinishTurn ¶ added in v0.18.0
func (r *MemoryRepo) FinishTurn(_ context.Context, req FinishTurnRequest) (FinishTurnResult, error)
func (*MemoryRepo) Fork ¶
func (r *MemoryRepo) Fork(ctx context.Context, opts ForkOptions) (ThreadMeta, error)
func (*MemoryRepo) ForkWithInitialEntry ¶ added in v0.18.0
func (r *MemoryRepo) ForkWithInitialEntry(ctx context.Context, opts ForkOptions, initial Entry) (ThreadMeta, Entry, error)
func (*MemoryRepo) InspectSubAgentThreadAuthority ¶ added in v0.19.0
func (r *MemoryRepo) InspectSubAgentThreadAuthority(_ context.Context, parentThreadID, childThreadID string) (SubAgentThreadAuthoritySnapshot, error)
func (*MemoryRepo) InspectThreadAuthority ¶ added in v0.18.0
func (r *MemoryRepo) InspectThreadAuthority(_ context.Context, threadID string) (ThreadAuthoritySnapshot, error)
func (*MemoryRepo) ListCanonicalTurns ¶ added in v0.20.0
func (r *MemoryRepo) ListCanonicalTurns(_ context.Context, opts ListCanonicalTurnsOptions) (CanonicalTurnsPage, error)
func (*MemoryRepo) ListSubAgentInputs ¶ added in v0.18.0
func (r *MemoryRepo) ListSubAgentInputs(_ context.Context, childThreadID string, state SubAgentInputState) ([]SubAgentInputRecord, error)
func (*MemoryRepo) ListThreads ¶
func (r *MemoryRepo) ListThreads(_ context.Context, opts ListThreadsOptions) ([]ThreadMeta, error)
func (*MemoryRepo) MarkEffectUnknown ¶ added in v0.18.0
func (r *MemoryRepo) MarkEffectUnknown(_ context.Context, req MarkEffectUnknownRequest) (EffectAttempt, error)
func (*MemoryRepo) MoveLeaf ¶
func (r *MemoryRepo) MoveLeaf(_ context.Context, threadID, entryID string) error
func (*MemoryRepo) PendingAutomaticThreadTitles ¶ added in v0.20.0
func (r *MemoryRepo) PendingAutomaticThreadTitles(_ context.Context) ([]ThreadMeta, error)
func (*MemoryRepo) PrepareApprovalBatch ¶ added in v0.20.0
func (r *MemoryRepo) PrepareApprovalBatch(_ context.Context, req PrepareApprovalBatchRequest) (PrepareApprovalBatchResult, error)
func (*MemoryRepo) PrepareEffectAttempt ¶ added in v0.18.0
func (r *MemoryRepo) PrepareEffectAttempt(_ context.Context, req PrepareEffectAttemptRequest) (PrepareEffectAttemptResult, error)
func (*MemoryRepo) PrepareForkClaim ¶ added in v0.18.0
func (r *MemoryRepo) PrepareForkClaim(ctx context.Context, operationID, rootThreadID string, nodes []ForkOptions) error
PrepareForkClaim validates and publishes one complete Memory authority claim in the same critical section.
func (*MemoryRepo) PrepareSubAgentClose ¶ added in v0.18.0
func (r *MemoryRepo) PrepareSubAgentClose(_ context.Context, req PrepareSubAgentCloseRequest) (PrepareSubAgentCloseResult, error)
func (*MemoryRepo) ProviderState ¶ added in v0.18.0
func (r *MemoryRepo) ProviderState(_ context.Context, threadID string) (ProviderStateRecord, error)
func (*MemoryRepo) PublishSubAgent ¶ added in v0.18.0
func (r *MemoryRepo) PublishSubAgent(_ context.Context, req PublishSubAgentRequest) (PublishSubAgentResult, error)
func (*MemoryRepo) PublishSubAgentInput ¶ added in v0.18.0
func (r *MemoryRepo) PublishSubAgentInput(_ context.Context, req PublishSubAgentInputRequest) (SubAgentInputRecord, bool, error)
func (*MemoryRepo) PublishSubAgentPendingToolCompletion ¶ added in v0.18.0
func (r *MemoryRepo) PublishSubAgentPendingToolCompletion(_ context.Context, req PublishSubAgentPendingToolCompletionRequest) (PublishSubAgentPendingToolCompletionResult, error)
func (*MemoryRepo) PutProviderState ¶ added in v0.18.0
func (r *MemoryRepo) PutProviderState(ctx context.Context, record ProviderStateRecord) error
func (*MemoryRepo) ReadAgentTodoState ¶ added in v0.11.0
func (r *MemoryRepo) ReadAgentTodoState(_ context.Context, threadID string) (AgentTodoState, error)
func (*MemoryRepo) ReadApprovalQueue ¶ added in v0.20.0
func (r *MemoryRepo) ReadApprovalQueue(_ context.Context, threadID string) (ApprovalQueue, error)
func (*MemoryRepo) ReadArtifact ¶ added in v0.18.0
func (r *MemoryRepo) ReadArtifact(_ context.Context, req ArtifactReadRequest) (ArtifactContent, error)
func (*MemoryRepo) ReadCanonicalTurn ¶ added in v0.31.0
func (r *MemoryRepo) ReadCanonicalTurn(_ context.Context, threadID, turnID string) (CanonicalTurnRead, error)
func (*MemoryRepo) ReadCompaction ¶ added in v0.18.0
func (r *MemoryRepo) ReadCompaction(_ context.Context, threadID, requestID string) (CompactionOperation, bool, error)
func (*MemoryRepo) ReadPendingToolCompletion ¶ added in v0.18.0
func (r *MemoryRepo) ReadPendingToolCompletion(_ context.Context, req AdmitPendingToolCompletionRequest) (AdmitPendingToolCompletionResult, bool, error)
func (*MemoryRepo) ReadSubAgentInput ¶ added in v0.30.0
func (r *MemoryRepo) ReadSubAgentInput(_ context.Context, inputID string) (SubAgentInputRecord, bool, error)
func (*MemoryRepo) ReadTurnAdmission ¶ added in v0.20.0
func (r *MemoryRepo) ReadTurnAdmission(_ context.Context, threadID, turnID, runID string) (AdmitTurnResult, bool, error)
func (*MemoryRepo) RecoverInterruptedTurn ¶ added in v0.18.0
func (r *MemoryRepo) RecoverInterruptedTurn(_ context.Context, req RecoverInterruptedTurnRequest) (RecoverInterruptedTurnResult, error)
func (*MemoryRepo) RejectEffectAttempt ¶ added in v0.18.0
func (r *MemoryRepo) RejectEffectAttempt(_ context.Context, req RejectEffectAttemptRequest) (EffectAttempt, error)
func (*MemoryRepo) ReleaseThreadAuthorityClaim ¶ added in v0.18.0
func (r *MemoryRepo) ReleaseThreadAuthorityClaim(_ context.Context, operationID string)
ReleaseThreadAuthorityClaim releases every identity held by one operation.
func (*MemoryRepo) ReleaseTurnLease ¶
func (r *MemoryRepo) ReleaseTurnLease(_ context.Context, proof TurnLease) error
func (*MemoryRepo) RenewTurnLease ¶ added in v0.18.0
func (*MemoryRepo) ResolveApproval ¶ added in v0.20.0
func (r *MemoryRepo) ResolveApproval(_ context.Context, req ResolveApprovalRequest) (ResolveApprovalResult, error)
func (*MemoryRepo) SetThreadTitle ¶ added in v0.18.0
func (r *MemoryRepo) SetThreadTitle(ctx context.Context, req SetThreadTitleRequest) (ThreadTitleMutationResult, error)
func (*MemoryRepo) SettlePendingToolRecovery ¶ added in v0.18.0
func (r *MemoryRepo) SettlePendingToolRecovery(_ context.Context, req SettlePendingToolRecoveryRequest) (SettlePendingToolRecoveryResult, error)
func (*MemoryRepo) TakeOverCompaction ¶ added in v0.18.0
func (r *MemoryRepo) TakeOverCompaction(_ context.Context, req TakeOverCompactionRequest) (BeginCompactionResult, error)
func (*MemoryRepo) Thread ¶
func (r *MemoryRepo) Thread(_ context.Context, threadID string) (ThreadMeta, error)
func (*MemoryRepo) ThreadTombstone ¶ added in v0.18.0
func (r *MemoryRepo) ThreadTombstone(_ context.Context, threadID string) (ThreadTombstone, error)
func (*MemoryRepo) UpdateThread ¶
func (r *MemoryRepo) UpdateThread(ctx context.Context, meta ThreadMeta) error
func (*MemoryRepo) ValidateArtifactForkDestination ¶ added in v0.18.0
func (r *MemoryRepo) ValidateArtifactForkDestination(_ context.Context, closure artifact.Closure) error
ValidateArtifactForkDestination verifies the complete copied artifact set without relying on the source thread still being live.
func (*MemoryRepo) ValidateInterruptedTurnResolution ¶ added in v0.19.0
func (r *MemoryRepo) ValidateInterruptedTurnResolution(_ context.Context, req RecoverInterruptedTurnRequest) error
func (*MemoryRepo) WaitApprovalDecision ¶ added in v0.20.0
func (r *MemoryRepo) WaitApprovalDecision(ctx context.Context, approvalID string) (WaitApprovalDecisionResult, error)
type PendingToolCompletionAuthorityRepo ¶ added in v0.18.0
type PendingToolCompletionAuthorityRepo interface {
AdmitPendingToolCompletion(context.Context, AdmitPendingToolCompletionRequest) (AdmitPendingToolCompletionResult, error)
ReadPendingToolCompletion(context.Context, AdmitPendingToolCompletionRequest) (AdmitPendingToolCompletionResult, bool, error)
}
type PendingToolRecoveryRepo ¶ added in v0.18.0
type PendingToolRecoveryRepo interface {
SettlePendingToolRecovery(context.Context, SettlePendingToolRecoveryRequest) (SettlePendingToolRecoveryResult, error)
}
type PendingToolSettlementTarget ¶ added in v0.18.0
type PrepareApprovalBatchRequest ¶ added in v0.20.0
type PrepareApprovalBatchRequest struct {
Lease TurnLease
Items []ApprovalPreflightItem
Now time.Time
}
type PrepareApprovalBatchResult ¶ added in v0.20.0
type PrepareApprovalBatchResult struct {
Queue ApprovalQueue
Effects []EffectAttempt
Approvals []ApprovalRecord
RequestedEntries []Entry
Replayed bool
}
type PrepareEffectAttemptRequest ¶ added in v0.18.0
type PrepareEffectAttemptRequest struct {
Lease TurnLease
Invocation EffectInvocationIdentity
RequestFingerprint string
Now time.Time
}
type PrepareEffectAttemptResult ¶ added in v0.18.0
type PrepareEffectAttemptResult struct {
Attempt EffectAttempt
Replayed bool
}
type PrepareSubAgentCloseRequest ¶ added in v0.18.0
type PrepareSubAgentCloseResult ¶ added in v0.18.0
type PrepareSubAgentCloseResult struct {
Operation SubAgentCloseOperation
Replayed bool
}
type ProjectedSegment ¶
type ProjectedSegment struct {
EntryID string `json:"entry_id,omitempty"`
EntryType EntryType `json:"entry_type,omitempty"`
MessageIndex int `json:"message_index"`
Role session.Role `json:"role,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
ToolName string `json:"tool_name,omitempty"`
TokenEstimate int64 `json:"token_estimate,omitempty"`
ArtifactRefs []artifact.Ref `json:"artifact_refs,omitempty"`
UIPreview string `json:"ui_preview,omitempty"`
}
type ProjectionPurpose ¶
type ProjectionPurpose string
const ( ProjectionProviderRequest ProjectionPurpose = "provider_request" ProjectionCompaction ProjectionPurpose = "compaction" ProjectionTestUI ProjectionPurpose = "test_ui" )
type ProviderStateReader ¶ added in v0.18.0
type ProviderStateReader interface {
ProviderState(context.Context, string) (ProviderStateRecord, error)
}
type ProviderStateRecord ¶ added in v0.18.0
type ProviderStateStore ¶ added in v0.18.0
type ProviderStateStore interface {
ProviderStateReader
PutProviderState(context.Context, ProviderStateRecord) error
DeleteProviderState(context.Context, string) error
}
type PublishSubAgentInputRequest ¶ added in v0.18.0
type PublishSubAgentPendingToolCompletionRequest ¶ added in v0.18.0
type PublishSubAgentPendingToolCompletionRequest struct {
InputRequestID string
RequestFingerprint string
SettlementFingerprint string
ParentThreadID string
ChildThreadID string
Target PendingToolSettlementTarget
Settlement Entry
Message session.Message
HostLabels map[string]string
CorrelationLabels map[string]string
Now time.Time
}
type PublishSubAgentPendingToolCompletionResult ¶ added in v0.18.0
type PublishSubAgentPendingToolCompletionResult struct {
Settlement Entry
SettlementReplayed bool
Input SubAgentInputRecord
Replayed bool
}
type PublishSubAgentRequest ¶ added in v0.18.0
type PublishSubAgentResult ¶ added in v0.18.0
type PublishSubAgentResult struct {
Thread ThreadMeta
Input SubAgentInputRecord
Replayed bool
}
type RecoverInterruptedTurnRequest ¶ added in v0.18.0
type RecoverInterruptedTurnResult ¶ added in v0.18.0
type RejectEffectAttemptRequest ¶ added in v0.18.0
type Repo ¶
type Repo interface {
JournalRepo
CreateThread(context.Context, ThreadMeta) (ThreadMeta, error)
UpdateThread(context.Context, ThreadMeta) error
MoveLeaf(context.Context, string, string) error
Fork(context.Context, ForkOptions) (ThreadMeta, error)
}
Repo is the internal storage implementation contract. Production runtime actors receive narrower capabilities such as JournalRepo instead.
type ResolveApprovalRequest ¶ added in v0.20.0
type ResolveApprovalRequest struct {
DecisionID string
ExpectedRootThreadID string
ExpectedGeneration int64
ExpectedRevision int64
ExpectedCurrent ApprovalIdentity
ExpectedApprovalRevision int64
Decision ApprovalDecision
RejectedEntry Entry
Now time.Time
}
type ResolveApprovalResult ¶ added in v0.20.0
type ResolveApprovalResult struct {
Receipt ApprovalDecisionReceipt
Queue ApprovalQueue
Approval ApprovalRecord
Effect EffectAttempt
RejectedEntry Entry
Replayed bool
}
type RootAuthorityRepo ¶ added in v0.18.0
type RootAuthorityRepo interface {
ThreadTombstoneRepo
CreateRoot(context.Context, CreateRootRequest) (CreateRootResult, error)
DeleteRootTree(context.Context, string) (DeleteRootTreeResult, error)
}
type SetThreadTitleRequest ¶ added in v0.18.0
type SettlePendingToolRecoveryRequest ¶ added in v0.18.0
type SettlePendingToolRecoveryRequest struct {
Target PendingToolSettlementTarget
RequestFingerprint string
Settlement Entry
Now time.Time
}
type SettlePendingToolRecoveryResult ¶ added in v0.18.0
type SubAgentCloseAuthorityRepo ¶ added in v0.18.0
type SubAgentCloseAuthorityRepo interface {
PrepareSubAgentClose(context.Context, PrepareSubAgentCloseRequest) (PrepareSubAgentCloseResult, error)
FinishSubAgentClose(context.Context, FinishSubAgentCloseRequest) (FinishSubAgentCloseResult, error)
}
type SubAgentCloseNode ¶ added in v0.18.0
type SubAgentCloseOperation ¶ added in v0.18.0
type SubAgentCloseState ¶ added in v0.18.0
type SubAgentCloseState string
const ( SubAgentClosePrepared SubAgentCloseState = "prepared" SubAgentCloseCompleted SubAgentCloseState = "completed" )
type SubAgentInputAuthorityRepo ¶ added in v0.18.0
type SubAgentInputAuthorityRepo interface {
SubAgentInputReadRepo
PublishSubAgent(context.Context, PublishSubAgentRequest) (PublishSubAgentResult, error)
PublishSubAgentInput(context.Context, PublishSubAgentInputRequest) (SubAgentInputRecord, bool, error)
PublishSubAgentPendingToolCompletion(context.Context, PublishSubAgentPendingToolCompletionRequest) (PublishSubAgentPendingToolCompletionResult, error)
AdmitSubAgentInput(context.Context, AdmitSubAgentInputRequest) (AdmitSubAgentInputResult, error)
ListSubAgentInputs(context.Context, string, SubAgentInputState) ([]SubAgentInputRecord, error)
}
type SubAgentInputReadRepo ¶ added in v0.30.0
type SubAgentInputRecord ¶ added in v0.18.0
type SubAgentInputRecord struct {
SubAgentInputID string
ParentThreadID string
ChildThreadID string
RequestKind SubAgentRequestKind
RequestID string
RequestFingerprint string
Sequence int64
State SubAgentInputState
Message session.Message
HostLabels map[string]string
CorrelationLabels map[string]string
AdmittedTurnID string
AdmittedRunID string
CreatedAt time.Time
AdmittedAt time.Time
CancelledAt time.Time
}
type SubAgentInputState ¶ added in v0.18.0
type SubAgentInputState string
const ( SubAgentInputPending SubAgentInputState = "pending" SubAgentInputAdmitted SubAgentInputState = "admitted" SubAgentInputCancelled SubAgentInputState = "cancelled" )
type SubAgentRequestKind ¶ added in v0.18.0
type SubAgentRequestKind string
const ( SubAgentRequestPublication SubAgentRequestKind = "publication" SubAgentRequestInput SubAgentRequestKind = "input" SubAgentRequestPendingToolCompletion SubAgentRequestKind = "pending_tool_completion" )
type SubAgentThreadAuthorityInspectionRepo ¶ added in v0.19.0
type SubAgentThreadAuthoritySnapshot ¶ added in v0.19.0
type SubAgentThreadAuthoritySnapshot struct {
Parent ThreadMeta
Child ThreadAuthoritySnapshot
}
type TakeOverCompactionRequest ¶ added in v0.18.0
type ThreadAuthorityInspectionRepo ¶ added in v0.18.0
type ThreadAuthorityInspectionRepo interface {
InspectThreadAuthority(context.Context, string) (ThreadAuthoritySnapshot, error)
}
type ThreadAuthoritySnapshot ¶ added in v0.18.0
type ThreadAuthoritySnapshot struct {
Thread ThreadMeta
Lease *TurnLease
ClaimOperationID string
LeaseGeneration int64
}
type ThreadLifecycle ¶ added in v0.18.0
type ThreadLifecycle string
ThreadLifecycle is the durable canonical lifecycle of a thread identity. A deleted identity is represented by a tombstone rather than by absence.
const ( ThreadLifecycleOpen ThreadLifecycle = "open" ThreadLifecycleClosing ThreadLifecycle = "closing" ThreadLifecycleClosed ThreadLifecycle = "closed" ThreadLifecycleDeleted ThreadLifecycle = "deleted" )
func (ThreadLifecycle) Valid ¶ added in v0.18.0
func (l ThreadLifecycle) Valid() bool
type ThreadListRepo ¶
type ThreadListRepo interface {
ListThreads(context.Context, ListThreadsOptions) ([]ThreadMeta, error)
}
type ThreadMeta ¶
type ThreadMeta struct {
ID string `json:"id"`
LeafID string `json:"leaf_id,omitempty"`
ParentThreadID string `json:"parent_thread_id,omitempty"`
ParentTurnID string `json:"parent_turn_id,omitempty"`
ForkedFromThreadID string `json:"forked_from_thread_id,omitempty"`
ForkedFromEntryID string `json:"forked_from_entry_id,omitempty"`
ForkOperationID string `json:"fork_operation_id,omitempty"`
ForkOperationNodeID string `json:"fork_operation_node_id,omitempty"`
TaskName string `json:"task_name,omitempty"`
TaskDescription string `json:"task_description,omitempty"`
AgentPath string `json:"agent_path,omitempty"`
HostProfileRef string `json:"host_profile_ref,omitempty"`
ForkMode string `json:"fork_mode,omitempty"`
Lifecycle ThreadLifecycle `json:"lifecycle,omitempty"`
CloseOperationID string `json:"close_operation_id,omitempty"`
Archived bool `json:"archived,omitempty"`
Title string `json:"title,omitempty"`
TitleStatus ThreadTitleStatus `json:"title_status,omitempty"`
TitleSource ThreadTitleSource `json:"title_source,omitempty"`
TitleUpdatedAt time.Time `json:"title_updated_at,omitempty"`
TitleError string `json:"title_error,omitempty"`
TitleGeneration int64 `json:"title_generation,omitempty"`
TitleToken string `json:"title_token,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LastViewedAt time.Time `json:"last_viewed_at,omitempty"`
}
func ApplyThreadListOptions ¶
func ApplyThreadListOptions(threads []ThreadMeta, opts ListThreadsOptions) []ThreadMeta
func ListThreads ¶
func ListThreads(ctx context.Context, repo JournalRepo, opts ListThreadsOptions) ([]ThreadMeta, error)
func (ThreadMeta) CanonicalLifecycle ¶ added in v0.18.0
func (m ThreadMeta) CanonicalLifecycle() (ThreadLifecycle, error)
func (ThreadMeta) IsClosed ¶ added in v0.18.0
func (m ThreadMeta) IsClosed() bool
func (ThreadMeta) IsClosing ¶ added in v0.18.0
func (m ThreadMeta) IsClosing() bool
type ThreadPublishRepo ¶ added in v0.18.0
type ThreadPublishRepo interface {
CreateThreadWithInitialEntry(context.Context, ThreadMeta, Entry) (ThreadMeta, Entry, error)
ForkWithInitialEntry(context.Context, ForkOptions, Entry) (ThreadMeta, Entry, error)
}
type ThreadTitleAuthorityRepo ¶ added in v0.18.0
type ThreadTitleAuthorityRepo interface {
SetThreadTitle(context.Context, SetThreadTitleRequest) (ThreadTitleMutationResult, error)
BeginAutomaticThreadTitle(context.Context, BeginAutomaticThreadTitleRequest) (ThreadTitleMutationResult, error)
CompleteAutomaticThreadTitle(context.Context, CompleteAutomaticThreadTitleRequest) (ThreadTitleMutationResult, error)
FailAutomaticThreadTitle(context.Context, FailAutomaticThreadTitleRequest) (ThreadTitleMutationResult, error)
PendingAutomaticThreadTitles(context.Context) ([]ThreadMeta, error)
}
type ThreadTitleMutationResult ¶ added in v0.20.0
type ThreadTitleMutationResult struct {
Thread ThreadMeta
Changed bool
}
type ThreadTitleProjection ¶ added in v0.29.0
type ThreadTitleProjection struct {
Title string
Status ThreadTitleStatus
Source ThreadTitleSource
UpdatedAt time.Time
Error string
Generation int64
}
ThreadTitleProjection is the observable subset of canonical title authority.
type ThreadTitleSource ¶
type ThreadTitleSource string
const ( ThreadTitleSourceProvider ThreadTitleSource = "provider" ThreadTitleSourceHost ThreadTitleSource = "host" )
type ThreadTitleStatus ¶
type ThreadTitleStatus string
const ( ThreadTitlePending ThreadTitleStatus = "pending" ThreadTitleReady ThreadTitleStatus = "ready" ThreadTitleFailed ThreadTitleStatus = "failed" )
type ThreadTombstone ¶ added in v0.18.0
type ThreadTombstone struct {
ThreadID string
RootThreadID string
ParentThreadID string
CreateIntentID string
ForkOperationID string
ForkOperationNodeID string
ForkedFromThreadID string
ForkedFromEntryID string
DeletedAt time.Time
}
ThreadTombstone retains identity provenance after queryable Agent state is deleted. It is intentionally not a ThreadMeta and is never returned as a normal thread read.
type ThreadTombstoneRepo ¶ added in v0.18.0
type ThreadTombstoneRepo interface {
ThreadTombstone(context.Context, string) (ThreadTombstone, error)
}
type TurnAuthorityRepo ¶ added in v0.18.0
type TurnAuthorityRepo interface {
AdmitTurn(context.Context, AdmitTurnRequest) (AdmitTurnResult, error)
ReadTurnAdmission(context.Context, string, string, string) (AdmitTurnResult, bool, error)
FinishTurn(context.Context, FinishTurnRequest) (FinishTurnResult, error)
}
type TurnLease ¶
type TurnLease struct {
ThreadID string `json:"thread_id"`
Purpose TurnLeasePurpose `json:"purpose"`
TurnID string `json:"turn_id,omitempty"`
MutationID string `json:"mutation_id,omitempty"`
MutationKind string `json:"mutation_kind,omitempty"`
OwnerID string `json:"owner_id"`
Generation int64 `json:"generation"`
Heartbeat int64 `json:"heartbeat"`
AcquiredAt time.Time `json:"acquired_at"`
RenewedAt time.Time `json:"renewed_at"`
ExpiresAt time.Time `json:"expires_at"`
}
func TurnLeaseFromContext ¶ added in v0.18.0
TurnLeaseFromContext returns the durable mutation owner bound to ctx.
func (TurnLease) TakeoverEligible ¶ added in v0.18.0
func (l TurnLease) TakeoverEligible(now time.Time, policy LeasePolicy) bool
type TurnLeasePurpose ¶ added in v0.18.0
type TurnLeasePurpose string
const ( TurnLeasePurposeTurn TurnLeasePurpose = "turn" TurnLeasePurposeMutation TurnLeasePurpose = "mutation" )
func (TurnLeasePurpose) Normalize ¶ added in v0.18.0
func (p TurnLeasePurpose) Normalize() (TurnLeasePurpose, error)
type TurnLeaseRepo ¶
type TurnMarkerStatus ¶
type TurnMarkerStatus string
const ( TurnStarted TurnMarkerStatus = "started" TurnSavePoint TurnMarkerStatus = "save_point" TurnCompleted TurnMarkerStatus = "completed" TurnWaiting TurnMarkerStatus = "waiting" TurnFailed TurnMarkerStatus = "failed" TurnAborted TurnMarkerStatus = "aborted" )
type TurnTerminalOutcome ¶ added in v0.20.0
type WaitApprovalDecisionResult ¶ added in v0.20.0
type WaitApprovalDecisionResult struct {
Receipt ApprovalDecisionReceipt
Queue ApprovalQueue
Approval ApprovalRecord
}
Source Files
¶
- approval_authority.go
- artifact_authority.go
- authority.go
- canonical_turn_page.go
- canonical_turn_read.go
- compaction_authority.go
- doc.go
- effect_authority.go
- fork_prepare_authority.go
- interrupted_turn_authority.go
- lifecycle.go
- pending_tool_authority.go
- pending_tool_completion_authority.go
- sessiontree.go
- subagent_close_authority.go
- subagent_pending_tool_completion_authority.go
- title_authority.go
- turn_authority.go
- turn_failure.go