Documentation
¶
Overview ¶
Package adapter is the Runtime wait-loop glue. Hosts use durable.Runtime, not these functions.
Index ¶
- func AbandonTurn(h *tacklr.TurnManager, workspace, skills *vfs.MountSession)
- func AbsorbAll(ctx context.Context, ...) (consumed int, err error)
- func AppendMessages(box []*tacklr.Message, msgs ...*tacklr.Message) []*tacklr.Message
- func ApplyAuth(recipes []durable.MountRecipe, auth durable.AuthContext) []durable.MountRecipe
- func BindingsForTurn(recipes []durable.MountRecipe, auth durable.AuthContext) []vfs.Binding
- func ChildJobMessage(st durable.SessionStatus) *tacklr.Message
- func ChildState(st durable.SessionState) string
- func CloseTurnTrees(workspace, skills *vfs.MountSession)
- func CloseTurnVFS(ms *vfs.MountSession)
- func ConstructTurn(ctx context.Context, spec durable.AgentSpec, threadID string, ...) (*tacklr.TurnManager, *vfs.MountSession, *vfs.MountSession, error)
- func EncodeUserState(state map[string]any) (map[string]any, error)
- func HasSpecialist(cat durable.Catalog, agentID, name string) bool
- func InboxSafe(runnable int, parked bool) bool
- func JobSteer(id, name, body string, failed bool) *tacklr.Message
- func MergeUserState(base, overlay map[string]any) map[string]any
- func NormalizeSpawn(specialist, task string) (string, string, error)
- func OpenSkillsVFS(ctx context.Context, threadID string, spec durable.AgentSpec) (*vfs.MountSession, error)
- func OpenTurnSessions(ctx context.Context, threadID string, spec durable.AgentSpec, ...) (workspace, skills *vfs.MountSession, err error)
- func OpenTurnVFS(ctx context.Context, threadID string, spec durable.AgentSpec, ...) (*vfs.MountSession, error)
- func OverlaySpecialist(parent durable.AgentSpec, specialist string) (durable.AgentSpec, error)
- func RestoreTurn(ctx context.Context, store durable.SnapshotStore, id durable.SessionID, ...) (durable.Revision, error)
- func TakeMessages(box *[]*tacklr.Message) []*tacklr.Message
- func UnknownChild(id string) error
- func UserFromPrompt(text string, msg *tacklr.Message) *tacklr.Message
- type Inbox
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbandonTurn ¶ added in v0.3.3
func AbandonTurn(h *tacklr.TurnManager, workspace, skills *vfs.MountSession)
AbandonTurn closes a harness and its turn-scoped trees after a failed construct.
func AbsorbAll ¶ added in v0.3.3
func AbsorbAll(ctx context.Context, absorb func(context.Context, *tacklr.Message, chan tacklr.StreamEvent) error, msgs []*tacklr.Message, out chan tacklr.StreamEvent) (consumed int, err error)
AbsorbAll writes msgs into the window in order. consumed is how many absorb calls ran (including a failed one). Absorb failure is terminal for the batch: leftover messages are not put back.
func AppendMessages ¶ added in v0.3.3
AppendMessages is the unlocked FIFO append. Temporal wait-loop only.
func ApplyAuth ¶
func ApplyAuth(recipes []durable.MountRecipe, auth durable.AuthContext) []durable.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 ¶
func BindingsForTurn(recipes []durable.MountRecipe, auth durable.AuthContext) []vfs.Binding
BindingsForTurn builds the secret-bearing mounts for one activity/turn. Each cached recipe is included when a token for its provider is on auth.
func ChildJobMessage ¶ added in v0.3.3
func ChildJobMessage(st durable.SessionStatus) *tacklr.Message
ChildJobMessage is JobSteer for a nested session job.
func ChildState ¶
func ChildState(st durable.SessionState) string
ChildState is the tool-facing running/completed/failed for a session.
func CloseTurnTrees ¶
func CloseTurnTrees(workspace, skills *vfs.MountSession)
CloseTurnTrees closes the agent workspace tree and the host-only skills tree.
func CloseTurnVFS ¶
func CloseTurnVFS(ms *vfs.MountSession)
CloseTurnVFS unmounts a turn-scoped MountSession (FUSE telemetry, Close, host dir).
func ConstructTurn ¶ added in v0.3.3
func ConstructTurn(ctx context.Context, spec durable.AgentSpec, threadID string, bindings []vfs.Binding, proj vfs.Projection, extraMCP []mcp.MCPConfig) (*tacklr.TurnManager, *vfs.MountSession, *vfs.MountSession, error)
ConstructTurn opens VFS trees and builds a TurnManager. On NewTurnManager failure the trees are closed.
func EncodeUserState ¶
EncodeUserState JSON-roundtrips host session state so checkpoint types are stable (numbers become float64) and non-serializable values fail now.
func HasSpecialist ¶ added in v0.3.3
HasSpecialist reports whether agentID's catalog spec names a specialist.
func InboxSafe ¶ added in v0.3.3
InboxSafe reports whether queued user and job messages may enter the window. Drain only when this is true. Pass leftover unstarted tools as runnable (they are unpaired function_calls). Parked HITL is never safe.
func JobSteer ¶ added in v0.3.3
JobSteer is the RoleUser inbox text when a non-blocking job reaches complete or failed. It is a new message, not a second RoleTool for the schedule call_id.
func MergeUserState ¶
MergeUserState copies overlay onto a clone of base. Overlay wins on conflict.
func NormalizeSpawn ¶
NormalizeSpawn trims spawn_specialist arguments. Specialist is required; empty task allowed for idempotent retry of the same callID.
func OpenSkillsVFS ¶
func OpenSkillsVFS(ctx context.Context, threadID string, spec durable.AgentSpec) (*vfs.MountSession, error)
OpenSkillsVFS builds the host-only skills MountSession from AgentSpec.OpenSkills. It does not attach a FUSE projection. The agent never receives this session.
func OpenTurnSessions ¶
func OpenTurnSessions(ctx context.Context, threadID string, spec durable.AgentSpec, bindings []vfs.Binding, proj vfs.Projection) (workspace, skills *vfs.MountSession, err error)
OpenTurnSessions opens the agent workspace and the host-only skills tree. On OpenSkills failure the workspace session is closed.
func OpenTurnVFS ¶
func OpenTurnVFS(ctx context.Context, threadID string, spec durable.AgentSpec, bindings []vfs.Binding, proj vfs.Projection) (*vfs.MountSession, error)
OpenTurnVFS builds the turn-scoped MountSession from AgentSpec.OpenVFS. Nil when OpenVFS is nil or the projection is unavailable.
func OverlaySpecialist ¶
OverlaySpecialist copies the parent catalog spec and applies the named Specialist.
func RestoreTurn ¶ added in v0.3.3
func RestoreTurn(ctx context.Context, store durable.SnapshotStore, id durable.SessionID, h *tacklr.TurnManager, state map[string]any) (durable.Revision, error)
RestoreTurn reloads a snapshot (if any) and applies host session state.
func TakeMessages ¶ added in v0.3.3
TakeMessages is the unlocked FIFO take. Temporal wait-loop only.
func UnknownChild ¶
UnknownChild is cancel/wait with an id that is not this session's job.
Types ¶
type Inbox ¶ added in v0.3.3
type Inbox struct {
// contains filtered or unexported fields
}
Inbox is the wait-loop FIFO for steers and auto-collected job results. All methods are safe for concurrent callers. In-process uses this so the session loop (Prompt), the turn goroutine (drain), and Cancel/Close cannot race the slice. Hold sessionProc.mu around terminal checks plus Push so a Cancel Drop cannot lose the ordering with Queue.
Temporal workflows must not use Inbox: replay is single-threaded and must not park on sync.Mutex. Use AppendMessages / TakeMessages on a local slice.
func (*Inbox) Drop ¶ added in v0.3.3
func (b *Inbox) Drop()
Drop discards unread messages (Cancel / Close).