Documentation
¶
Overview ¶
Package mongo provides a MongoDB implementation of the Cortex composite store using Grove ORM with the mongodriver backend.
Index ¶
- type Store
- func (s *Store) BindDeliveryRun(ctx context.Context, d *a2a.Delivery, runID id.AgentRunID) error
- func (s *Store) CapturePreparation(ctx context.Context, collect func(store.PreparationSources) error) (*run.SourceSnapshot, error)
- func (s *Store) ClaimDelivery(ctx context.Context, deliveryID id.DeliveryID) (*a2a.Delivery, error)
- func (s *Store) ClaimExpiredSuspension(ctx context.Context, runID id.AgentRunID, at time.Time) (*suspension.Suspension, error)
- func (s *Store) ClaimOrchestrationContinuation(ctx context.Context, team id.OrchestrationID) (*orchestration.Run, error)
- func (s *Store) ClaimPendingAsk(ctx context.Context, replyWith string) (*a2a.PendingAsk, error)
- func (s *Store) ClaimSuspension(ctx context.Context, runID id.AgentRunID) (*suspension.Suspension, error)
- func (s *Store) ClearConversation(ctx context.Context, agentID id.AgentID, sessionID id.SessionID) error
- func (s *Store) ClearWorking(ctx context.Context, runID id.AgentRunID) error
- func (s *Store) Close() error
- func (s *Store) CountAgents(ctx context.Context, filter *agent.ListFilter) (int64, error)
- func (s *Store) CountBehaviors(ctx context.Context, filter *behavior.ListFilter) (int64, error)
- func (s *Store) CountOrchestrationRuns(ctx context.Context, filter *orchestration.RunListFilter) (int64, error)
- func (s *Store) CountOrchestrations(ctx context.Context, filter *orchestration.ConfigListFilter) (int64, error)
- func (s *Store) CountPending(ctx context.Context, filter *checkpoint.ListFilter) (int64, error)
- func (s *Store) CountPersonas(ctx context.Context, filter *persona.ListFilter) (int64, error)
- func (s *Store) CountRuns(ctx context.Context, filter *run.ListFilter) (int64, error)
- func (s *Store) CountSessions(ctx context.Context, filter *session.ListFilter) (int64, error)
- func (s *Store) CountSkills(ctx context.Context, filter *skill.ListFilter) (int64, error)
- func (s *Store) CountTraits(ctx context.Context, filter *trait.ListFilter) (int64, error)
- func (s *Store) Create(ctx context.Context, config *agent.Config) error
- func (s *Store) CreateBehavior(ctx context.Context, b *behavior.Behavior) error
- func (s *Store) CreateCheckpoint(ctx context.Context, cp *checkpoint.Checkpoint) error
- func (s *Store) CreateConversation(ctx context.Context, c *a2a.Conversation) error
- func (s *Store) CreateDelivery(ctx context.Context, d *a2a.Delivery) error
- func (s *Store) CreateMessage(ctx context.Context, e *a2a.Envelope) error
- func (s *Store) CreateOrchestration(ctx context.Context, c *orchestration.Config) error
- func (s *Store) CreateOrchestrationRun(ctx context.Context, r *orchestration.Run) error
- func (s *Store) CreateOverlay(ctx context.Context, o *prompt.Overlay) error
- func (s *Store) CreatePendingAsk(ctx context.Context, a *a2a.PendingAsk) error
- func (s *Store) CreatePersona(ctx context.Context, p *persona.Persona) error
- func (s *Store) CreateRun(ctx context.Context, r *run.Run) error
- func (s *Store) CreateSession(ctx context.Context, sess *session.Session) error
- func (s *Store) CreateSkill(ctx context.Context, sk *skill.Skill) error
- func (s *Store) CreateStep(ctx context.Context, step *run.Step) error
- func (s *Store) CreateSuspension(ctx context.Context, susp *suspension.Suspension) error
- func (s *Store) CreateToolCall(ctx context.Context, tc *run.ToolCall) error
- func (s *Store) CreateTrait(ctx context.Context, t *trait.Trait) error
- func (s *Store) Delete(ctx context.Context, agentID id.AgentID) error
- func (s *Store) DeleteBehavior(ctx context.Context, behaviorID id.BehaviorID) error
- func (s *Store) DeleteOrchestration(ctx context.Context, orchID id.OrchestrationConfigID) error
- func (s *Store) DeleteOverlay(ctx context.Context, overlayID id.OverlayID) error
- func (s *Store) DeletePersona(ctx context.Context, personaID id.PersonaID) error
- func (s *Store) DeleteProgress(ctx context.Context, runID id.AgentRunID) error
- func (s *Store) DeleteSession(ctx context.Context, sessionID id.SessionID) error
- func (s *Store) DeleteSkill(ctx context.Context, skillID id.SkillID) error
- func (s *Store) DeleteSuspension(ctx context.Context, runID id.AgentRunID) error
- func (s *Store) DeleteTrait(ctx context.Context, traitID id.TraitID) error
- func (s *Store) Get(ctx context.Context, agentID id.AgentID) (*agent.Config, error)
- func (s *Store) GetBehavior(ctx context.Context, behaviorID id.BehaviorID) (*behavior.Behavior, error)
- func (s *Store) GetBehaviorByName(ctx context.Context, name string) (*behavior.Behavior, error)
- func (s *Store) GetByName(ctx context.Context, name string) (*agent.Config, error)
- func (s *Store) GetCheckpoint(ctx context.Context, cpID id.CheckpointID) (*checkpoint.Checkpoint, error)
- func (s *Store) GetConversation(ctx context.Context, convID id.ConversationID) (*a2a.Conversation, error)
- func (s *Store) GetConversationByPeerContext(ctx context.Context, node, peerContext string) (*a2a.Conversation, error)
- func (s *Store) GetDelivery(ctx context.Context, deliveryID id.DeliveryID) (*a2a.Delivery, error)
- func (s *Store) GetMessage(ctx context.Context, msgID id.MessageID) (*a2a.Envelope, error)
- func (s *Store) GetOrchestration(ctx context.Context, orchID id.OrchestrationConfigID) (*orchestration.Config, error)
- func (s *Store) GetOrchestrationByName(ctx context.Context, name string) (*orchestration.Config, error)
- func (s *Store) GetOrchestrationRun(ctx context.Context, runID id.OrchestrationID) (*orchestration.Run, error)
- func (s *Store) GetOverlay(ctx context.Context, overlayID id.OverlayID) (*prompt.Overlay, error)
- func (s *Store) GetOverlayForAgent(ctx context.Context, agentID id.AgentID) (*prompt.Overlay, error)
- func (s *Store) GetOverlayForAgentAt(ctx context.Context, agentID id.AgentID, scope cortex.Scope) (*prompt.Overlay, error)
- func (s *Store) GetPersona(ctx context.Context, personaID id.PersonaID) (*persona.Persona, error)
- func (s *Store) GetPersonaByName(ctx context.Context, name string) (*persona.Persona, error)
- func (s *Store) GetProgress(ctx context.Context, runID id.AgentRunID) (*suspension.Progress, error)
- func (s *Store) GetRun(ctx context.Context, runID id.AgentRunID) (*run.Run, error)
- func (s *Store) GetSession(ctx context.Context, sessionID id.SessionID) (*session.Session, error)
- func (s *Store) GetSkill(ctx context.Context, skillID id.SkillID) (*skill.Skill, error)
- func (s *Store) GetSkillByName(ctx context.Context, name string) (*skill.Skill, error)
- func (s *Store) GetSuspension(ctx context.Context, runID id.AgentRunID) (*suspension.Suspension, error)
- func (s *Store) GetTrait(ctx context.Context, traitID id.TraitID) (*trait.Trait, error)
- func (s *Store) GetTraitByName(ctx context.Context, name string) (*trait.Trait, error)
- func (s *Store) HoldLease(ctx context.Context, runID id.AgentRunID, lease run.Lease) error
- func (s *Store) InspectScopes(ctx context.Context, visit func(store.ScopeIssue) error) error
- func (s *Store) LinkOrchestrationChild(ctx context.Context, team id.OrchestrationID, child id.AgentRunID) error
- func (s *Store) List(ctx context.Context, filter *agent.ListFilter) ([]*agent.Config, error)
- func (s *Store) ListAgentReplyRuns(ctx context.Context, after id.AgentRunID, limit int) ([]id.AgentRunID, error)
- func (s *Store) ListBehaviors(ctx context.Context, filter *behavior.ListFilter) ([]*behavior.Behavior, error)
- func (s *Store) ListContinuableAcrossScopes(ctx context.Context, notifiedBefore time.Time, limit int) ([]*run.Run, error)
- func (s *Store) ListConversations(ctx context.Context, f *a2a.ConversationListFilter) ([]*a2a.Conversation, error)
- func (s *Store) ListDeferredRecipients(ctx context.Context, after id.DeliveryID, limit int) ([]id.DeliveryID, error)
- func (s *Store) ListExpired(ctx context.Context, at time.Time, limit int) ([]*suspension.Suspension, error)
- func (s *Store) ListExpiredAcrossScopes(ctx context.Context, at time.Time, limit int) ([]*suspension.Suspension, error)
- func (s *Store) ListExpiredAsks(ctx context.Context, at time.Time, limit int) ([]*a2a.PendingAsk, error)
- func (s *Store) ListInbox(ctx context.Context, agentName string, f a2a.InboxFilter) ([]*a2a.Delivery, error)
- func (s *Store) ListLapsedAcrossScopes(ctx context.Context, now time.Time, limit int) ([]*run.Run, error)
- func (s *Store) ListMessages(ctx context.Context, f *a2a.MessageListFilter) ([]*a2a.Envelope, error)
- func (s *Store) ListOrchestrationRuns(ctx context.Context, filter *orchestration.RunListFilter) ([]*orchestration.Run, error)
- func (s *Store) ListOrchestrations(ctx context.Context, filter *orchestration.ConfigListFilter) ([]*orchestration.Config, error)
- func (s *Store) ListOverlays(ctx context.Context, filter *prompt.ListFilter) ([]*prompt.Overlay, error)
- func (s *Store) ListPending(ctx context.Context, filter *checkpoint.ListFilter) ([]*checkpoint.Checkpoint, error)
- func (s *Store) ListPendingAcrossScopes(ctx context.Context, after id.CheckpointID, limit int) ([]*checkpoint.Checkpoint, error)
- func (s *Store) ListPendingAsksByConversation(ctx context.Context, convID id.ConversationID) ([]*a2a.PendingAsk, error)
- func (s *Store) ListPersonas(ctx context.Context, filter *persona.ListFilter) ([]*persona.Persona, error)
- func (s *Store) ListQueuedDeliveries(ctx context.Context, limit int) ([]*a2a.Delivery, error)
- func (s *Store) ListRuns(ctx context.Context, filter *run.ListFilter) ([]*run.Run, error)
- func (s *Store) ListSessions(ctx context.Context, filter *session.ListFilter) ([]*session.Session, error)
- func (s *Store) ListSkills(ctx context.Context, filter *skill.ListFilter) ([]*skill.Skill, error)
- func (s *Store) ListSteps(ctx context.Context, runID id.AgentRunID) ([]*run.Step, error)
- func (s *Store) ListToolCalls(ctx context.Context, stepID id.StepID) ([]*run.ToolCall, error)
- func (s *Store) ListTraits(ctx context.Context, filter *trait.ListFilter) ([]*trait.Trait, error)
- func (s *Store) LoadConversation(ctx context.Context, agentID id.AgentID, sessionID id.SessionID, limit int) ([]memory.Message, error)
- func (s *Store) LoadSummaries(ctx context.Context, agentID id.AgentID) ([]string, error)
- func (s *Store) LoadWorking(ctx context.Context, runID id.AgentRunID, key string) (any, error)
- func (s *Store) MarkDeliveryRead(ctx context.Context, deliveryID id.DeliveryID) error
- func (s *Store) MarkNotified(ctx context.Context, runID id.AgentRunID, at time.Time) error
- func (s *Store) Migrate(ctx context.Context, opts ...cortex.MigrateOption) error
- func (s *Store) Ping(ctx context.Context) error
- func (s *Store) ReclaimStaleDeliveries(ctx context.Context, olderThan time.Time, limit int) (int, error)
- func (s *Store) Resolve(ctx context.Context, cpID id.CheckpointID, decision checkpoint.Decision) error
- func (s *Store) SaveConversation(ctx context.Context, agentID id.AgentID, sessionID id.SessionID, ...) error
- func (s *Store) SaveSummary(ctx context.Context, agentID id.AgentID, summary string) error
- func (s *Store) SaveWorking(ctx context.Context, runID id.AgentRunID, key string, value any) error
- func (s *Store) SupportsOrchestrationRouting() bool
- func (s *Store) SupportsScopedOrchestrationDiscovery() bool
- func (s *Store) Update(ctx context.Context, config *agent.Config) error
- func (s *Store) UpdateBehavior(ctx context.Context, b *behavior.Behavior) error
- func (s *Store) UpdateConversation(ctx context.Context, c *a2a.Conversation) error
- func (s *Store) UpdateDelivery(ctx context.Context, d *a2a.Delivery) error
- func (s *Store) UpdateOrchestration(ctx context.Context, c *orchestration.Config) error
- func (s *Store) UpdateOrchestrationRun(ctx context.Context, r *orchestration.Run) error
- func (s *Store) UpdateOverlay(ctx context.Context, o *prompt.Overlay) error
- func (s *Store) UpdatePersona(ctx context.Context, p *persona.Persona) error
- func (s *Store) UpdateRun(ctx context.Context, r *run.Run) error
- func (s *Store) UpdateSession(ctx context.Context, sess *session.Session) error
- func (s *Store) UpdateSkill(ctx context.Context, sk *skill.Skill) error
- func (s *Store) UpdateTrait(ctx context.Context, t *trait.Trait) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements store.Store using MongoDB via Grove ORM.
func (*Store) BindDeliveryRun ¶
BindDeliveryRun records a reserved child only while this claim still owns it.
func (*Store) CapturePreparation ¶
func (s *Store) CapturePreparation(ctx context.Context, collect func(store.PreparationSources) error) (*run.SourceSnapshot, error)
CapturePreparation collects sources under explicit snapshot read concern. MongoDB must support transactions, such as a replica set or sharded cluster.
func (*Store) ClaimDelivery ¶
ClaimDelivery takes a queued delivery and marks it delivering.
FindOneAndUpdate applies the match and the write as one operation, so the state = "queued" filter is the claim: two workers racing both issue it and exactly one of them matches a document. That is what stops one directive starting two runs.
func (*Store) ClaimExpiredSuspension ¶
func (s *Store) ClaimExpiredSuspension(ctx context.Context, runID id.AgentRunID, at time.Time) (*suspension.Suspension, error)
ClaimExpiredSuspension is ClaimSuspension with the deadline test inverted, for the sweeper. See the interface doc for why the two partition the same row rather than overlapping on it.
The same shape as ClaimSuspension above, for the same reason: mongo cannot fold the deadline into the FindOneAndUpdate's own filter, because the deadline lives on the suspension document while the transition writes the run one, and this store deliberately does not require a replica set to wrap the two in a transaction. What the ordering buys is the property that matters: the state = "paused" filter is still applied atomically, so a sweep can never take a run some resume has already claimed.
Zero matched documents is reported as ErrNotSuspended without a second read to classify it. The three ways to get here (the row is gone, the run is no longer paused, the deadline moved) all mean the same thing to the only caller: somebody else owns this run, leave it alone.
func (*Store) ClaimOrchestrationContinuation ¶
func (s *Store) ClaimOrchestrationContinuation(ctx context.Context, team id.OrchestrationID) (*orchestration.Run, error)
ClaimOrchestrationContinuation elects one waiting team pass at the exact scope.
func (*Store) ClaimPendingAsk ¶
ClaimPendingAsk takes the ask carrying replyWith, but only if nobody has yet.
The claimed_at: nil filter inside a FindOneAndUpdate is the whole guarantee: a late reply, the deadline sweep and a cancel can all reach for one document, and exactly one of them matches and goes on to resume the waiting run. The reply-with token is the document's _id, so there can only ever be one of them to race for.
func (*Store) ClaimSuspension ¶
func (s *Store) ClaimSuspension(ctx context.Context, runID id.AgentRunID) (*suspension.Suspension, error)
ClaimSuspension is the concurrency primitive for resume: it performs the run's paused-to-running transition and the suspension read as ONE operation, so two concurrent resumes cannot both proceed.
The transition is a single FindOneAndUpdate whose filter carries state = "paused". Mongo applies a FindOneAndUpdate's match and its write atomically against the document, so of two concurrent claims exactly one can see a paused run: the loser matches nothing, gets ErrNoDocuments back, and returns cortex.ErrNotSuspended rather than the suspension it lost the race for.
A read followed by a separate write is the exact race this method exists to close, so the no-document check below is load-bearing: without it both callers would return the same suspension and both would go on to resume the same run.
The expiry check sits in front of that write for the same reason the SQL backends fold it into their UPDATE's condition: a caller that claimed first and rejected an expired suspension second would already have flipped the run to running, leaving it stuck there with a suspension nobody can claim any more. Mongo cannot express the deadline as part of the FindOneAndUpdate's own filter, because the deadline lives on the suspension document and the transition writes the run one, and this store deliberately does not require a replica set to wrap the two in a transaction. Ordering the check before the write buys the property that actually matters: an expired resume never moves the run.
func (*Store) ClearConversation ¶
func (s *Store) ClearConversation(ctx context.Context, agentID id.AgentID, sessionID id.SessionID) error
ClearConversation removes a session's conversation messages and resets its counters in the same multi-document transaction, for the same drift reason as SaveConversation.
func (*Store) ClearWorking ¶
ClearWorking removes all working memory for a run within the caller's scope.
func (*Store) CountAgents ¶
CountAgents returns the total number of agents matching the filter within the caller's scope.
func (*Store) CountBehaviors ¶
CountBehaviors returns the total number of behaviors matching the filter within the caller's scope.
func (*Store) CountOrchestrationRuns ¶
func (s *Store) CountOrchestrationRuns(ctx context.Context, filter *orchestration.RunListFilter) (int64, error)
CountOrchestrationRuns returns the total number of orchestration runs matching the filter within the caller's scope.
func (*Store) CountOrchestrations ¶
func (s *Store) CountOrchestrations(ctx context.Context, filter *orchestration.ConfigListFilter) (int64, error)
CountOrchestrations returns the total number of orchestration configs matching the filter within the caller's scope.
func (*Store) CountPending ¶
func (s *Store) CountPending(ctx context.Context, filter *checkpoint.ListFilter) (int64, error)
CountPending returns the total number of pending checkpoints matching the filter, within the caller's scope.
func (*Store) CountPersonas ¶
CountPersonas returns the total number of personas matching the filter within the caller's scope.
func (*Store) CountRuns ¶
CountRuns returns the total number of runs matching the filter within the caller's scope.
func (*Store) CountSessions ¶
CountSessions returns the total number of sessions matching the filter within the caller's scope.
func (*Store) CountSkills ¶
CountSkills returns the total number of skills matching the filter within the caller's scope.
func (*Store) CountTraits ¶
CountTraits returns the total number of traits matching the filter within the caller's scope.
func (*Store) Create ¶
Create persists a new agent configuration, stamping the scope from the context. The (scope_canon, name) unique index is what actually enforces per-scope name uniqueness; app_id survives on the document as a vestigial field no longer read or filtered on.
func (*Store) CreateBehavior ¶
CreateBehavior persists a new behavior, stamping the scope from the context. The (scope_canon, name) unique index is what actually enforces per-scope name uniqueness; app_id survives on the document as a vestigial field no longer read or filtered on.
func (*Store) CreateCheckpoint ¶
func (s *Store) CreateCheckpoint(ctx context.Context, cp *checkpoint.Checkpoint) error
CreateCheckpoint persists a new checkpoint.
func (*Store) CreateConversation ¶
func (*Store) CreateDelivery ¶
func (*Store) CreateMessage ¶
CreateMessage persists an envelope, stamping the scope from the context. Envelopes are immutable once written, so there is no update counterpart.
func (*Store) CreateOrchestration ¶
CreateOrchestration persists a new orchestration config, stamping the scope from the context.
func (*Store) CreateOrchestrationRun ¶
CreateOrchestrationRun persists a new orchestration run, stamping the scope from the context.
func (*Store) CreateOverlay ¶
CreateOverlay persists a new overlay, stamping the scope from the context. The partial unique index on (agent_id, scope_canon) is what enforces one overlay per agent per scope, so a second create for the same pair comes back as cortex.ErrAlreadyExists rather than quietly shadowing the first.
func (*Store) CreatePendingAsk ¶
func (*Store) CreatePersona ¶
CreatePersona persists a new persona, stamping the scope from the context. The (scope_canon, name) unique index is what actually enforces per-scope name uniqueness; app_id survives on the document as a vestigial field no longer read or filtered on.
func (*Store) CreateSession ¶
CreateSession persists a new session, stamping the scope from the context. The partial (agent_id, scope_canon) unique index (WHERE is_default) is what actually enforces one default session per agent per scope; a non-default session never touches that index.
func (*Store) CreateSkill ¶
CreateSkill persists a new skill, stamping the scope from the context. The (scope_canon, name) unique index is what actually enforces per-scope name uniqueness; app_id survives on the document as a vestigial field no longer read or filtered on.
func (*Store) CreateStep ¶
CreateStep persists a new step.
func (*Store) CreateSuspension ¶
func (s *Store) CreateSuspension(ctx context.Context, susp *suspension.Suspension) error
CreateSuspension writes a new suspension document for a run that just paused, stamping the scope from the context. The partial unique index on run_id (WHERE scope_canon $gt "") is what enforces one suspension per run, which is what makes ClaimSuspension a meaningful primitive.
func (*Store) CreateToolCall ¶
CreateToolCall persists a new tool call.
func (*Store) CreateTrait ¶
CreateTrait persists a new trait, stamping the scope from the context. The (scope_canon, name) unique index is what actually enforces per-scope name uniqueness; app_id survives on the document as a vestigial field no longer read or filtered on.
func (*Store) DeleteBehavior ¶
DeleteBehavior removes a behavior within the caller's scope.
func (*Store) DeleteOrchestration ¶
DeleteOrchestration removes an orchestration config within the caller's scope.
func (*Store) DeleteOverlay ¶
DeleteOverlay removes an overlay within the caller's scope.
func (*Store) DeletePersona ¶
DeletePersona removes a persona within the caller's scope.
func (*Store) DeleteProgress ¶ added in v1.10.0
DeleteProgress removes a run's snapshot at the exact context scope. A run with none is not an error.
func (*Store) DeleteSession ¶
DeleteSession removes a session within the caller's scope, along with every conversation message it owns, in the same multi-document transaction. Mongo has no FOREIGN KEY to do this for it -- and unlike postgres/sqlite (see their DeleteSession comments for why a FK there isn't viable either, FK or no FK), so the delete below is what keeps all three backends observably identical: deleting a session leaves no orphaned messages on any of them.
func (*Store) DeleteSkill ¶
DeleteSkill removes a skill within the caller's scope.
func (*Store) DeleteSuspension ¶
DeleteSuspension removes a run's suspension within the caller's scope.
func (*Store) DeleteTrait ¶
DeleteTrait removes a trait within the caller's scope.
func (*Store) GetBehavior ¶
func (s *Store) GetBehavior(ctx context.Context, behaviorID id.BehaviorID) (*behavior.Behavior, error)
GetBehavior returns a behavior by ID within the caller's scope.
func (*Store) GetBehaviorByName ¶
GetBehaviorByName returns a behavior by name within the caller's scope.
func (*Store) GetCheckpoint ¶
func (s *Store) GetCheckpoint(ctx context.Context, cpID id.CheckpointID) (*checkpoint.Checkpoint, error)
GetCheckpoint returns a checkpoint by ID within the caller's scope.
func (*Store) GetConversation ¶
func (s *Store) GetConversation(ctx context.Context, convID id.ConversationID) (*a2a.Conversation, error)
func (*Store) GetConversationByPeerContext ¶
func (s *Store) GetConversationByPeerContext(ctx context.Context, node, peerContext string) (*a2a.Conversation, error)
UpdateConversation writes the mutable half of a conversation. The scope fields are deliberately absent from the $set: a conversation's scope is fixed at creation, and an update issued from a broader context would otherwise widen it. GetConversationByPeerContext finds the conversation opened for a remote thread. The node is half the key: two peers can use the same context id, and joining one peer's thread to another's would leak a conversation across a trust boundary.
func (*Store) GetDelivery ¶
GetDelivery reads one delivery document within the caller's scope.
func (*Store) GetMessage ¶
func (*Store) GetOrchestration ¶
func (s *Store) GetOrchestration(ctx context.Context, orchID id.OrchestrationConfigID) (*orchestration.Config, error)
GetOrchestration returns an orchestration config by ID within the caller's scope.
func (*Store) GetOrchestrationByName ¶
func (s *Store) GetOrchestrationByName(ctx context.Context, name string) (*orchestration.Config, error)
GetOrchestrationByName returns an orchestration config by name within the caller's scope. Fix round 1 dropped the appID parameter this method used to also filter on: with a unique (scope_canon, name) index, at most one document can ever exist per (scope, name), so an app_id predicate on top could only ever turn a hit into a miss, never disambiguate two documents — the same reasoning that dropped AppID from agent and persona.
func (*Store) GetOrchestrationRun ¶
func (s *Store) GetOrchestrationRun(ctx context.Context, runID id.OrchestrationID) (*orchestration.Run, error)
GetOrchestrationRun returns an orchestration run by ID within the caller's scope.
func (*Store) GetOverlay ¶
GetOverlay reads one overlay by id within the caller's scope.
func (*Store) GetOverlayForAgent ¶
func (s *Store) GetOverlayForAgent(ctx context.Context, agentID id.AgentID) (*prompt.Overlay, error)
GetOverlayForAgent reads the overlay an agent has at the caller's exact scope. See prompt.Store for why this one read matches exactly rather than by prefix.
func (*Store) GetOverlayForAgentAt ¶
func (s *Store) GetOverlayForAgentAt(ctx context.Context, agentID id.AgentID, scope cortex.Scope) (*prompt.Overlay, error)
GetOverlayForAgentAt reads the overlay an agent has at exactly the given scope. See prompt.Store for why inheritance is an ancestor walk rather than a prefix match, and why the scope argument is bounded to the caller's own ancestry.
func (*Store) GetPersona ¶
GetPersona returns a persona by ID within the caller's scope.
func (*Store) GetPersonaByName ¶
GetPersonaByName returns a persona by name within the caller's scope.
func (*Store) GetProgress ¶ added in v1.10.0
func (s *Store) GetProgress(ctx context.Context, runID id.AgentRunID) (*suspension.Progress, error)
GetProgress reads a run's snapshot at the exact context scope.
func (*Store) GetSession ¶
GetSession returns a session by ID within the caller's scope.
func (*Store) GetSkillByName ¶
GetSkillByName returns a skill by name within the caller's scope.
func (*Store) GetSuspension ¶
func (s *Store) GetSuspension(ctx context.Context, runID id.AgentRunID) (*suspension.Suspension, error)
GetSuspension reads a run's suspension within the caller's scope without changing anything. Callers that intend to resume must use ClaimSuspension instead.
func (*Store) GetTraitByName ¶
GetTraitByName returns a trait by name within the caller's scope.
func (*Store) HoldLease ¶ added in v1.10.0
HoldLease sets or extends a running run's lease in one conditional update. The owner filter is what keeps two workers from both holding the run: only an unowned lease or the caller's own matches.
func (*Store) InspectScopes ¶
InspectScopes streams invalid stored identities to an operator callback. This administrative scan crosses all scopes and never changes data.
func (*Store) LinkOrchestrationChild ¶
func (s *Store) LinkOrchestrationChild(ctx context.Context, team id.OrchestrationID, child id.AgentRunID) error
LinkOrchestrationChild atomically admits one child while its parent is running.
func (*Store) List ¶
List returns agent configurations within the caller's scope, optionally filtered.
func (*Store) ListAgentReplyRuns ¶
func (s *Store) ListAgentReplyRuns(ctx context.Context, after id.AgentRunID, limit int) ([]id.AgentRunID, error)
ListAgentReplyRuns includes saved pauses and running admissions whose pause was removed.
func (*Store) ListBehaviors ¶
func (s *Store) ListBehaviors(ctx context.Context, filter *behavior.ListFilter) ([]*behavior.Behavior, error)
ListBehaviors returns behaviors within the caller's scope, optionally filtered.
func (*Store) ListContinuableAcrossScopes ¶ added in v1.10.0
func (s *Store) ListContinuableAcrossScopes(ctx context.Context, notifiedBefore time.Time, limit int) ([]*run.Run, error)
ListContinuableAcrossScopes reads ready and reclaimable runs nobody was told about since notifiedBefore, from every scope, with no scope guard and no scope filter. Like ListLapsedAcrossScopes it deliberately bypasses scope, for the sweeper only.
func (*Store) ListConversations ¶
func (s *Store) ListConversations(ctx context.Context, f *a2a.ConversationListFilter) ([]*a2a.Conversation, error)
func (*Store) ListDeferredRecipients ¶
func (s *Store) ListDeferredRecipients(ctx context.Context, after id.DeliveryID, limit int) ([]id.DeliveryID, error)
ListDeferredRecipients projects bound pending delivery IDs in the exact scope.
func (*Store) ListExpired ¶
func (s *Store) ListExpired(ctx context.Context, at time.Time, limit int) ([]*suspension.Suspension, error)
ListExpired returns suspensions whose deadline has passed, oldest first, within the caller's scope.
func (*Store) ListExpiredAcrossScopes ¶
func (s *Store) ListExpiredAcrossScopes(ctx context.Context, at time.Time, limit int) ([]*suspension.Suspension, error)
ListExpiredAcrossScopes reads expired suspensions from every scope, with no scope guard and no scope filter. That is deliberate and it is why the method is named for it: the expiry sweeper runs without a request scope, and a sweep that filtered would silently sweep nothing. See the suspension.Store doc for the full argument.
func (*Store) ListExpiredAsks ¶
func (s *Store) ListExpiredAsks(ctx context.Context, at time.Time, limit int) ([]*a2a.PendingAsk, error)
ListExpiredAsks returns unclaimed asks past their deadline. Claimed documents are excluded, which is what makes sweeping the same backlog twice safe.
func (*Store) ListInbox ¶
func (s *Store) ListInbox(ctx context.Context, agentName string, f a2a.InboxFilter) ([]*a2a.Delivery, error)
ListInbox returns messages that have ARRIVED for an agent. A queued delivery is deliberately excluded: it has not reached anyone yet, and an inbox that showed it would be showing mail still in transit.
func (*Store) ListLapsedAcrossScopes ¶ added in v1.10.0
func (s *Store) ListLapsedAcrossScopes(ctx context.Context, now time.Time, limit int) ([]*run.Run, error)
ListLapsedAcrossScopes reads running runs whose lease has lapsed from every scope, with no scope guard and no scope filter. That is deliberate and it is why the method is named for it: the sweeper runs without a request scope, and a sweep that filtered would silently sweep nothing. It is for the sweeper only, which acts on each run under that run's own scope.
func (*Store) ListMessages ¶
func (s *Store) ListMessages(ctx context.Context, f *a2a.MessageListFilter) ([]*a2a.Envelope, error)
ListMessages returns a conversation's messages oldest first, because a conversation is read as a transcript.
func (*Store) ListOrchestrationRuns ¶
func (s *Store) ListOrchestrationRuns(ctx context.Context, filter *orchestration.RunListFilter) ([]*orchestration.Run, error)
ListOrchestrationRuns returns orchestration runs within the caller's scope, optionally filtered.
func (*Store) ListOrchestrations ¶
func (s *Store) ListOrchestrations(ctx context.Context, filter *orchestration.ConfigListFilter) ([]*orchestration.Config, error)
ListOrchestrations returns orchestration configs within the caller's scope, optionally filtered.
func (*Store) ListOverlays ¶
func (s *Store) ListOverlays(ctx context.Context, filter *prompt.ListFilter) ([]*prompt.Overlay, error)
ListOverlays returns overlays within the caller's scope, oldest first.
func (*Store) ListPending ¶
func (s *Store) ListPending(ctx context.Context, filter *checkpoint.ListFilter) ([]*checkpoint.Checkpoint, error)
ListPending returns pending checkpoints within the caller's scope, optionally filtered.
func (*Store) ListPendingAcrossScopes ¶ added in v1.10.0
func (s *Store) ListPendingAcrossScopes(ctx context.Context, after id.CheckpointID, limit int) ([]*checkpoint.Checkpoint, error)
ListPendingAcrossScopes reads pending checkpoints from every scope, in id order, with no scope guard and no scope predicates. That is deliberate: the sweeper has no request scope, and it acts on each checkpoint under that checkpoint's own scope.
func (*Store) ListPendingAsksByConversation ¶
func (s *Store) ListPendingAsksByConversation(ctx context.Context, convID id.ConversationID) ([]*a2a.PendingAsk, error)
func (*Store) ListPersonas ¶
func (s *Store) ListPersonas(ctx context.Context, filter *persona.ListFilter) ([]*persona.Persona, error)
ListPersonas returns personas within the caller's scope, optionally filtered.
func (*Store) ListQueuedDeliveries ¶
ListQueuedDeliveries discovers work within the selected routing partition. Roster-bound buses also select their exact captured scope. Other dispatchers discover across scopes and restore each delivery's scope before claiming it.
func (*Store) ListSessions ¶
func (s *Store) ListSessions(ctx context.Context, filter *session.ListFilter) ([]*session.Session, error)
ListSessions returns sessions within the caller's scope, optionally filtered.
func (*Store) ListSkills ¶
ListSkills returns skills within the caller's scope, optionally filtered.
func (*Store) ListSteps ¶
ListSteps returns all steps for a run, ordered by index ascending, within the caller's scope.
func (*Store) ListToolCalls ¶
ListToolCalls returns all tool calls for a step, ordered by creation time, within the caller's scope.
func (*Store) ListTraits ¶
ListTraits returns traits within the caller's scope, optionally filtered.
func (*Store) LoadConversation ¶
func (s *Store) LoadConversation(ctx context.Context, agentID id.AgentID, sessionID id.SessionID, limit int) ([]memory.Message, error)
LoadConversation returns conversation messages for an agent's session within scope. LoadConversation returns the NEWEST `limit` messages in chronological order, not the oldest. The query sorts created_at/_id DESCENDING and takes LIMIT off the front -- the recent end of the conversation -- then the loop below walks the result backwards to hand callers chronological order again. Sorting ASCENDING and limiting (the old behavior) always returns the SAME oldest prefix once a conversation grows past the limit: every later turn is written but never read back into context, and an install that had already accumulated duplicate rows from the pre-fix re-save bug stayed pinned on that stale prefix even after the duplication itself was fixed upstream. _id breaks ties within a batch that shares one created_at timestamp -- id.New's TypeID suffix is a ULID, so it sorts chronologically the same as created_at -- and DESCENDING on both keeps the reversal a stable chronological order rather than an arbitrary one.
func (*Store) LoadSummaries ¶
LoadSummaries returns all summaries for an agent within scope.
func (*Store) LoadWorking ¶
LoadWorking returns a working memory value by key within the caller's scope.
func (*Store) MarkDeliveryRead ¶
func (*Store) MarkNotified ¶ added in v1.10.0
MarkNotified records when the host was last told about a waiting run.
func (*Store) ReclaimStaleDeliveries ¶
func (s *Store) ReclaimStaleDeliveries(ctx context.Context, olderThan time.Time, limit int) (int, error)
ReclaimStaleDeliveries requeues abandoned deliveries without a bound run. It uses the same partition and optional exact scope as queue discovery. The cutoff and claim token are rechecked on each update.
func (*Store) Resolve ¶
func (s *Store) Resolve(ctx context.Context, cpID id.CheckpointID, decision checkpoint.Decision) error
Resolve resolves a pending checkpoint with a decision, within the caller's scope.
func (*Store) SaveConversation ¶
func (s *Store) SaveConversation(ctx context.Context, agentID id.AgentID, sessionID id.SessionID, messages []memory.Message) error
SaveConversation appends messages to conversation memory and updates the owning session's message_count/last_message inside one multi-document transaction. The counter is derived from the rows this call actually writes (len(messages), not a flat +1 per call), so it always matches the physical row count even when a caller's batch size varies from call to call. If the session document can't be found — a session id that doesn't correspond to a real session — the whole write rolls back rather than leaving orphaned message rows a reader can never reach through GetSession/ListSessions.
func (*Store) SaveSummary ¶
SaveSummary appends a summary to the agent's memory.
func (*Store) SaveWorking ¶
SaveWorking stores a working memory key-value pair, upserting if the key already exists, within the caller's scope. A run ID is a bearer capability, not an isolation boundary — anyone who learns it could otherwise read or clobber another tenant's scratch state — so this is guarded the same as SaveConversation.
func (*Store) SupportsOrchestrationRouting ¶
SupportsOrchestrationRouting reports durable A2A partition support.
func (*Store) SupportsScopedOrchestrationDiscovery ¶
SupportsScopedOrchestrationDiscovery reports exact-scope background routing.
func (*Store) Update ¶
Update modifies an existing agent configuration's mutable fields within the caller's scope. Scope is immutable after creation: the context scope is used only as an authorization predicate (the caller must be at or above the agent's stored scope to touch it), and is never written back. grove's NewUpdate(model).Exec defaults to a full-field $set built from the model struct when no explicit update document is given (confirmed by reading mongodriver's query_update.go), which would otherwise blank scope_l0/l1/l2/extra/canon on every call.
app_id is deliberately absent from set too, for the same reason: agentToModel always writes AppID as "" now (Config carries no such field to draw from), so including it here would blank whatever a pre-v1.8.0 document's app_id field still holds on its very first Update. The field itself is vestigial but intentionally left in place; erasing its content belongs to whatever change finally drops the column.
func (*Store) UpdateBehavior ¶
UpdateBehavior modifies an existing behavior's mutable fields within the caller's scope. Scope is immutable after creation: the context scope is used only as an authorization predicate (the caller must be at the exact scope of the behavior's stored scope to touch it), and is never written back. grove's NewUpdate(model).Exec defaults to a full-field $set built from the model struct when no explicit update document is given, which would otherwise blank scope_l0/l1/l2/extra/canon on every call.
app_id is deliberately absent from set too, for the same reason: behaviorToModel always writes AppID as "" now (Behavior carries no such field to draw from), so including it here would blank whatever a pre-v1.8.0 document's app_id field still holds on its very first Update. The field itself is vestigial but intentionally left in place; erasing its content belongs to whatever change finally drops the column.
func (*Store) UpdateConversation ¶
func (*Store) UpdateDelivery ¶
func (*Store) UpdateOrchestration ¶
UpdateOrchestration modifies an existing orchestration config's mutable fields within the caller's scope. Scope is immutable after creation: the context scope is used only as an authorization predicate (the caller must be at the exact scope of the config's stored scope to touch it), and is never written back. grove's NewUpdate(model).Exec defaults to a full-field $set built from the model struct when no explicit update document is given, which would otherwise blank scope_l0/l1/l2/extra/canon on every call. app_id is excluded from set too, mirroring persona: orchestration.Config dropped its AppID field (fix round 1), so orchestrationConfigToModel always writes AppID as "" now, and including it here would blank whatever a pre-fix document's app_id field still holds. created_at is included, matching mutableOrchestrationConfigColumns on postgres/sqlite — a Config built fresh rather than reloaded before Update must not zero it here only.
func (*Store) UpdateOrchestrationRun ¶
UpdateOrchestrationRun modifies an existing orchestration run's mutable fields within the caller's scope. Scope is immutable after creation, same as UpdateOrchestration above. app_id is excluded from set for the same reason as UpdateOrchestration's: orchestration.Run dropped its AppID field (fix round 1). created_at is included, matching mutableOrchestrationRunColumns on postgres/sqlite.
func (*Store) UpdateOverlay ¶
UpdateOverlay rewrites an overlay's mutable fields within the caller's scope. Scope is immutable after creation: the context scope is used only as an authorization predicate (the caller must be at the exact scope of the overlay's stored scope to touch it), and is never written back. grove's NewUpdate(model).Exec defaults to a full-field $set built from the model struct when no explicit update document is given, which would otherwise blank scope_l0/l1/l2/extra/canon on every call.
agent_id and created_at are absent from set for a different reason: repointing an overlay at a different agent is a create, not an edit, and it would move the document into a uniqueness slot another overlay may already hold.
temperature and max_tokens are $set unconditionally, including when they are nil. Skipping a nil would make "clear this override" impossible to express, since the stored value would survive every update that tried to remove it.
func (*Store) UpdatePersona ¶
UpdatePersona modifies an existing persona's mutable fields within the caller's scope. Scope is immutable after creation: the context scope is used only as an authorization predicate (the caller must be at or above the persona's stored scope to touch it), and is never written back. grove's NewUpdate(model).Exec defaults to a full-field $set built from the model struct when no explicit update document is given, which would otherwise blank scope_l0/l1/l2/extra/canon on every call.
app_id is deliberately absent from set too, for the same reason: personaToModel always writes AppID as "" now (Persona carries no such field to draw from), so including it here would blank whatever a pre-v1.8.0 document's app_id field still holds on its very first Update. The field itself is vestigial but intentionally left in place; erasing its content belongs to whatever change finally drops the column.
func (*Store) UpdateRun ¶
UpdateRun modifies an existing run's mutable fields within the caller's scope. Scope is immutable after creation: the context scope is used only as an authorization predicate (the caller must be at the exact scope of the run's stored scope to touch it), and is never written back. grove's NewUpdate(model).Exec builds $set from every field on the model by default (confirmed by reading mongodriver's query_update.go), so this builds an explicit $set instead of passing the model through — leaving out scope_l0/l1/l2/extra/canon rather than relying on them happening to already match. principal is left out too: it is written once, when the run is created, and a resume decodes it to find the run's caller. reply_route is left out for the same reason: the engine writes a directive's reply route when it creates the run. The lease, readiness, reclaim count and notification time belong to run.ContinuationStore; UpdateRun only clears the lease when the run leaves running.
func (*Store) UpdateSession ¶
UpdateSession modifies an existing session's mutable fields within the caller's scope. Scope is immutable after creation: the context scope is used only as an authorization predicate (the caller must be at the exact scope of the session's stored scope to touch it), and is never written back — scope_l0/l1/l2/extra/canon are deliberately absent from set below.
func (*Store) UpdateSkill ¶
UpdateSkill modifies an existing skill's mutable fields within the caller's scope. Scope is immutable after creation: the context scope is used only as an authorization predicate (the caller must be at or above the skill's stored scope to touch it), and is never written back. grove's NewUpdate(model).Exec defaults to a full-field $set built from the model struct when no explicit update document is given, which would otherwise blank scope_l0/l1/l2/extra/canon on every call.
app_id is deliberately absent from set too, for the same reason: skillToModel always writes AppID as "" now (Skill carries no such field to draw from), so including it here would blank whatever a pre-v1.8.0 document's app_id field still holds on its very first Update. The field itself is vestigial but intentionally left in place; erasing its content belongs to whatever change finally drops the column.
func (*Store) UpdateTrait ¶
UpdateTrait modifies an existing trait's mutable fields within the caller's scope. Scope is immutable after creation: the context scope is used only as an authorization predicate (the caller must be at or above the trait's stored scope to touch it), and is never written back. grove's NewUpdate(model).Exec defaults to a full-field $set built from the model struct when no explicit update document is given, which would otherwise blank scope_l0/l1/l2/extra/canon on every call.
app_id is deliberately absent from set too, for the same reason: traitToModel always writes AppID as "" now (Trait carries no such field to draw from), so including it here would blank whatever a pre-v1.8.0 document's app_id field still holds on its very first Update. The field itself is vestigial but intentionally left in place; erasing its content belongs to whatever change finally drops the column.
Source Files
¶
- a2a.go
- a2a_recipient_discovery.go
- a2a_reply.go
- a2a_reservation.go
- a2a_resolution.go
- agent.go
- agent_reply_discovery.go
- assurance.go
- behavior.go
- budget.go
- checkpoint.go
- doc.go
- learning_retention.go
- memory.go
- migrations.go
- models.go
- orchestration.go
- orchestration_children.go
- overlay.go
- persona.go
- plan_transaction.go
- preparation.go
- private_candidate.go
- progress.go
- rescope.go
- result_commit.go
- run.go
- run_continuation.go
- scope_inventory.go
- session.go
- skill.go
- store.go
- submission.go
- suspension.go
- suspension_version.go
- task_run.go
- trait.go