Documentation
¶
Overview ¶
Package adapter holds what the session runtimes share: a turn's auth on the session's mount recipes, tool outcomes kept by call key, and host state encoding. Hosts use a session.Client, not these functions.
Index ¶
- func ApplyAuth(recipes []session.MountRecipe, auth session.AuthContext) []session.MountRecipe
- func BindingsForTurn(recipes []session.MountRecipe, auth session.AuthContext) []mount.Binding
- func EncodeState(state map[string]any) (map[string]any, error)
- func ForSession(ctx context.Context, agent tacklr.AgentOptions, id session.ID) (tacklr.AgentOptions, error)
- func ForgetMessages(ctx context.Context, agent tacklr.AgentOptions, id session.ID) error
- func LoadBodies(ctx context.Context, store session.Store, id session.ID, calls []tacklr.Call) error
- func OverlaySpecialist(parent tacklr.AgentOptions, specialist string) (tacklr.AgentOptions, error)
- func RunCall(ctx context.Context, store session.Store, id session.ID, h *tacklr.Harness, ...) (tacklr.Call, error)
- type Snapshot
- func (s *Snapshot) Commit(ctx context.Context, store session.Store, id session.ID, h *tacklr.Harness, ...) (session.Revision, error)
- func (s *Snapshot) Current(ctx context.Context, store session.Store, id session.ID) (bool, error)
- func (s *Snapshot) Stale() bool
- func (s *Snapshot) Sync(ctx context.Context, store session.Store, id session.ID, h *tacklr.Harness) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyAuth ¶ added in v0.5.0
func ApplyAuth(recipes []session.MountRecipe, auth session.AuthContext) []session.MountRecipe
ApplyAuth updates cached recipes from a work-item AuthContext. Drop is applied first. Bindings with an alias upsert that recipe. Tokens are not stored on the returned recipes.
func BindingsForTurn ¶ added in v0.5.0
func BindingsForTurn(recipes []session.MountRecipe, auth session.AuthContext) []mount.Binding
BindingsForTurn builds the secret-bearing mounts for one turn. Each cached recipe is included when a token for its provider is on auth.
func EncodeState ¶ added in v0.5.0
EncodeState JSON-roundtrips host session state so checkpoint types are stable (numbers become float64) and values JSON cannot hold fail now.
func ForSession ¶ added in v0.5.1
func ForSession(ctx context.Context, agent tacklr.AgentOptions, id session.ID) (tacklr.AgentOptions, error)
ForSession is agent as session id runs it: when the agent has a SessionScope, its Namespace and Principals for id replace SearchNamespace and SearchPrincipals.
func ForgetMessages ¶ added in v0.5.1
ForgetMessages deletes the messages that session id saved in the agent's brain, in the session's own namespace. An agent without a brain saved none.
func LoadBodies ¶ added in v0.5.0
LoadBodies puts back from store the body of each call that ran.
func OverlaySpecialist ¶
func OverlaySpecialist(parent tacklr.AgentOptions, specialist string) (tacklr.AgentOptions, error)
OverlaySpecialist is parent with the named specialist on it: the agent a specialist session runs.
func RunCall ¶ added in v0.5.0
func RunCall(ctx context.Context, store session.Store, id session.ID, h *tacklr.Harness, c tacklr.Call, out chan session.Event) (tacklr.Call, error)
RunCall is the Tool step on h. A call that ran before gets its body back from store first. After the run its body goes to store under its key and leaves the call, so the call a runtime keeps (in its history or its journal) stays small.
Types ¶
type Snapshot ¶ added in v0.5.0
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot is what a runtime knows of one harness's committed state: the store revision it holds, the digest of the rows it last saved or loaded, and whether a failed Commit left it ahead of the store. Both runtimes keep one per harness, so committed state stays the store's: a step loads it into the harness only when the store's revision moved past the one the harness holds, and a Commit writes only the rows it changed. The caller serializes its use.
func (*Snapshot) Commit ¶ added in v0.5.0
func (s *Snapshot) Commit(ctx context.Context, store session.Store, id session.ID, h *tacklr.Harness, base session.Revision, in tacklr.CommitIn, out chan session.Event) (session.Revision, error)
Commit is the Commit step on h: it brings h to the store's revision, then applies in and saves the rows it changed, unless the checkpoint is already past base (an earlier attempt of this Commit saved). It returns the checkpoint's revision.
func (*Snapshot) Current ¶ added in v0.5.0
Current reports whether the harness holds the store's revision.