Documentation
¶
Index ¶
- Constants
- Variables
- func Diff(prev CheckpointDigest, next []CheckpointEntry) ([]CheckpointChange, CheckpointDigest)
- func Merge(ctx context.Context, log, live <-chan Event) <-chan Event
- type AESGCM
- type AuthContext
- type CheckpointChange
- type CheckpointDigest
- type CheckpointEntry
- type CheckpointRow
- type Client
- type CreateSession
- type Event
- type EventLog
- type EventType
- type FailKind
- type ID
- type JobEnd
- type JobHandler
- type JobResult
- type Live
- type MCPClient
- type MCPCredentialResolver
- type MCPCredentials
- type MCPEnv
- type MCPHeader
- type MCPServer
- type MCPTool
- type MemoryEventLog
- func (l *MemoryEventLog) Append(_ context.Context, sessionID ID, topic string, ev Event) error
- func (l *MemoryEventLog) CloseSession(_ context.Context, sessionID ID) error
- func (l *MemoryEventLog) Head(_ context.Context, sessionID ID) (Seq, error)
- func (l *MemoryEventLog) Subscribe(ctx context.Context, sessionID ID, after Seq) (<-chan Event, error)
- func (l *MemoryEventLog) Trim(_ context.Context, sessionID ID, through Seq) error
- type MemorySecretStorage
- type MemoryStore
- func (s *MemoryStore) Calls(_ context.Context, sessionID ID, callKeys []string) (map[string][]byte, error)
- func (s *MemoryStore) ClearCalls(_ context.Context, sessionID ID) error
- func (s *MemoryStore) Delete(_ context.Context, sessionID ID) error
- func (s *MemoryStore) Load(_ context.Context, sessionID ID) ([]CheckpointEntry, Revision, error)
- func (s *MemoryStore) PutCall(_ context.Context, sessionID ID, callKey string, body []byte) error
- func (s *MemoryStore) Revision(_ context.Context, sessionID ID) (Revision, error)
- func (s *MemoryStore) Save(_ context.Context, sessionID ID, changes []CheckpointChange, expected Revision) (Revision, error)
- type MountRecipe
- type Prompt
- type Resume
- type Revision
- type Sealer
- type SecretStorage
- type Secrets
- type Seq
- type State
- type Status
- type Store
- type Subscription
- type Wake
Constants ¶
const ( // MCPStdio launches the MCP server as a subprocess and communicates // over stdin/stdout. It is the default when Type is empty. MCPStdio = "stdio" // MCPHTTP connects to a remote MCP server over streamable HTTP. MCPHTTP = "http" // MCPSSE connects to a remote MCP server over server-sent events. // Deprecated by the MCP spec; prefer MCPHTTP. MCPSSE = "sse" )
MCP transports for MCPServer.Type. The set mirrors the transports an ACP client may specify in session lifecycle requests.
const ( WakePrompt = "prompt" WakeResume = "resume" WakeCancel = "cancel" WakeClose = "close" // WakeJob is a job's end: its result. WakeJob = "job" // WakeSuspend stops a parent session so the runtime can restart it with // the same state (on Temporal, continue-as-new to keep history small): // when idle, or during a turn that waits on jobs. The session's state is // plain data; the runtime carries it to the next run. WakeSuspend = "suspend" )
Wake kinds from the Driver mailbox. A prompt or resume is also the turn-span kind.
const ( // SessionKindSpecialist is Status.Kind for spawn_specialist children. KindSpecialist = "specialist" // SessionKindWorker is Status.Kind for a named job-handler child. KindWorker = "worker" )
const ( TopicEvents = "events" TopicRetry = "retry" )
EventLog topics.
Variables ¶
var ( // ErrNotFound is a session that is unknown, closed, or already torn down. ErrNotFound = errors.New("session not found") // ErrExists is CreateSession with an id that is already live. ErrExists = errors.New("session already exists") // ErrInvalid is a request a Client rejects before it reaches a session: // state JSON cannot hold, or a specialist and a worker together. ErrInvalid = errors.New("invalid session request") // ErrStaleCheckpoint is Store.Save when expected Revision does not // match the row (another writer already saved). Reload and retry. ErrStaleCheckpoint = errors.New("stale checkpoint") )
var ( ErrModelRefused = errors.New("model refused") ErrMaxTokens = errors.New("max tokens reached") // ErrContextLength is a request the provider refused because it is over // the model's context window. It is also ErrMaxTokens. ErrContextLength = fmt.Errorf("%w: the request is over the context window", ErrMaxTokens) )
ErrModelRefused, ErrMaxTokens and ErrContextLength are why a turn ended that a client acts on (a refusal, the token limit); its error event names them.
Functions ¶
func Diff ¶ added in v0.5.0
func Diff(prev CheckpointDigest, next []CheckpointEntry) ([]CheckpointChange, CheckpointDigest)
Diff is the changes that take a checkpoint whose digest is prev to next: a put of each row that is new or changed, in next's order, then a delete of each row next does not have, in row order. It returns next's digest.
func Merge ¶ added in v0.5.0
Merge is one stream of a session's events: the events of its log, and its live deltas between them. Of each message's deltas, it sends only the one that starts where the text sent so far ends, and none after the message's complete event: a reader gets each byte once, in order, and the complete event has the rest. The stream ends when log closes or ctx ends. live may be nil.
Types ¶
type AESGCM ¶ added in v0.5.0
type AESGCM struct {
// contains filtered or unexported fields
}
AESGCM is a Sealer: AES-256-GCM with a random nonce per seal, written before the ciphertext.
type AuthContext ¶
type AuthContext struct {
// Bindings are this slice's mounts and/or provider tokens. A binding with
// an alias upserts the recipe. A binding with only provider+token refreshes
// every cached recipe for that provider.
Bindings []mount.Binding `json:"bindings,omitempty"`
// Drop removes cached recipes by alias or provider. Applied before Bindings.
Drop []string `json:"drop,omitempty"`
}
AuthContext is credentials and mount intent for one work item (Prompt, Resume, or a child session). Protocols map their wire auth into this type. Autonomous hosts set it on the payload that queues the work. Tokens are not stored in the snapshot or the durable history. The runtime writes them to SecretStorage before the work item runs.
func (AuthContext) WithoutSecrets ¶
func (a AuthContext) WithoutSecrets() AuthContext
WithoutSecrets returns a copy with Credential Token and ExpiresAt cleared. Binding metadata (provider, alias, params, writable) is kept. The input is not modified.
type CheckpointChange ¶ added in v0.5.0
type CheckpointChange struct {
CheckpointEntry
Delete bool `json:"delete,omitempty"`
}
CheckpointChange is one change of a Save: a put of the entry, or with Delete the removal of the row its Kind and Key name.
type CheckpointDigest ¶ added in v0.5.0
type CheckpointDigest map[CheckpointRow][sha256.Size]byte
CheckpointDigest is what a runtime keeps of the checkpoint it last saved or loaded: a hash of each row's value, so the next commit can tell which rows changed without holding their bytes.
func DigestOf ¶ added in v0.5.0
func DigestOf(entries []CheckpointEntry) CheckpointDigest
DigestOf is the digest of entries.
type CheckpointEntry ¶ added in v0.5.0
type CheckpointEntry struct {
Kind string `json:"kind"`
Key string `json:"key,omitempty"`
Value []byte `json:"value"`
}
CheckpointEntry is one row of a session's checkpoint: one message of the window, one todo, the plan, one user-state key, one permission decision or one search rest. Kind names what it is and Key which one; only the harness reads Value. A commit writes only the rows it changed.
type CheckpointRow ¶ added in v0.5.0
type CheckpointRow struct {
Kind, Key string
}
CheckpointRow names one row of a checkpoint.
type Client ¶ added in v0.5.0
type Client interface {
CreateSession(ctx context.Context, req CreateSession) (ID, error)
// Close destroys the session and recursively stops children.
Close(ctx context.Context, sessionID ID) error
// Status is running, complete, failed, or unknown. A child waiting on HITL
// stays running until that interrupt is resolved.
Status(ctx context.Context, id ID) (Status, error)
// Head is the current EventLog offset. Protocol pumps pass it to Subscribe
// to tail from now (skip events from prior turns).
Head(ctx context.Context, sessionID ID) (Seq, error)
Subscribe(ctx context.Context, sessionID ID, after Seq) (Subscription, error)
// Prompt while a turn is running or parked steers; it does not cancel
// the in-flight model call. Cancel aborts that turn and stops child
// sessions. The parent session stays open.
Prompt(ctx context.Context, sessionID ID, msg Prompt) error
Resume(ctx context.Context, sessionID ID, resume Resume) error
Cancel(ctx context.Context, sessionID ID) error
// Jobs is the status of each job the session runs (its id in
// SessionStatus.ID), in start order. The agent starts and cancels jobs
// through tools; hosts read them here.
Jobs(ctx context.Context, parent ID) ([]Status, error)
}
Client is the host session API: a runtime (Temporal, Durable Objects) implements it and runs one session per id. The open-round and HITL rules live in package session/orchestrator.
Prompt and Resume deliver work to the session. They do not return a harness. Subscribe yields Event values (message, tool, yield, error, complete). VFS credentials travel on Prompt, Resume, and CreateSession.Mounts. Protocols map wire auth into AuthContext.
type CreateSession ¶
type CreateSession struct {
SessionID ID
MCPServers []MCPServer
// Mounts seeds the session recipe cache (no secrets). Tokens arrive on Prompt.
Mounts []MountRecipe
// Parent, when set, makes this a child session of that parent. The child
// reuses the same wait loop. Empty MCPServers/Mounts inherit from parent.
Parent ID
// Specialist selects an assistant on the agent's Specialists list.
// Required with Parent for spawn_specialist children.
Specialist string
// Worker selects a named job handler. Exclusive with Specialist.
// The child session runs that handler instead of a model.
Worker string
// State is host values for the session's user state
// (JSON-serializable). The first step writes them into the checkpoint;
// tools read them with CallContext.StateGet. No tokens or clients.
// Child sessions do not inherit this map.
State map[string]any
}
CreateSession is the typed input for Runtime.CreateSession.
type Event ¶ added in v0.5.0
type Event struct {
Type EventType
TurnID string
MessageID string
Content string
Data []byte
ToolCalls []message.ToolCall
// Delta marks a piece of a message or reasoning text as the model
// streams it. A delta goes live to the subscribers that listen now and
// is never stored: the message's complete event, which is stored,
// carries its full text. Offset is where the delta's Content starts in
// that text, in bytes, so a reader sees a gap or a repeat.
Delta bool `json:"delta,omitempty"`
Offset int `json:"offset,omitempty"`
// Streamed is how many bytes of a complete event's Content the reader
// already got as deltas. A protocol server's follow (server.Peer) sets
// it, so a protocol sends only the rest. It is not on the wire.
Streamed int `json:"-"`
// Error is in-process only. Workflow Streams cannot encode error values;
// Fail is the durable stand-in (the error's text) and FailKind names the
// sentinel a client acts on: encoding the event writes them from Error,
// and decoding it rebuilds Error (MarshalJSON, UnmarshalJSON).
Error error `json:"-"`
Fail string `json:"fail,omitempty"`
FailKind FailKind `json:"failKind,omitempty"`
}
Event is the harness interior event bus. Protocols map these events to wire formats; the harness does not own protocol framing.
func FailureEvent ¶ added in v0.5.0
FailureEvent is the error event that reports a turn ended with err. It carries err for the readers in this process, and its text and kind for the ones after a wire, which get it back when they decode the event.
func (Event) Live ¶ added in v0.5.0
Live reports whether ev goes only to the subscribers that listen now and is never stored: a delta, or a tool's progress update.
func (Event) MarshalJSON ¶ added in v0.5.0
MarshalJSON encodes an event; a failure's Error goes as its text (Fail) and its kind (FailKind), since an error value cannot cross a log, a store or a wire. UnmarshalJSON gives it back. The event type owns both directions, so no writer or reader converts on its own. (A struct that embeds Event gets these methods for itself: name the field instead.)
func (*Event) UnmarshalJSON ¶ added in v0.5.0
UnmarshalJSON decodes an event and gives a failure back its Error, which errors.Is finds the kind's sentinel in.
type EventLog ¶
type EventLog interface {
Append(ctx context.Context, sessionID ID, topic string, ev Event) error
// Subscribe sends the events after after, then each new one. When
// after is before the oldest event kept, it starts at that event.
Subscribe(ctx context.Context, sessionID ID, after Seq) (<-chan Event, error)
Head(ctx context.Context, sessionID ID) (Seq, error)
// Trim deletes the events up to and including through. The numbers of
// the events that stay, and of later ones, do not change.
Trim(ctx context.Context, sessionID ID, through Seq) error
CloseSession(ctx context.Context, sessionID ID) error
}
EventLog is the session progress stream. Topics are TopicEvents and TopicRetry (a repeated attempt). It holds durable events only, never a Delta, and only the session's current turn: the runtime trims the turns before it when a new turn starts.
type EventType ¶ added in v0.5.0
type EventType string
EventType categorizes events sent to the caller.
const ( EventMessage EventType = "message" EventReasoning EventType = "reasoning" EventFunctionCall EventType = "function_call" EventToolResult EventType = "tool_result" EventComplete EventType = "complete" EventError EventType = "error" EventInterrupt EventType = "yield" EventToolUpdate EventType = "tool_update" EventPlanUpdate EventType = "plan_update" )
type FailKind ¶ added in v0.5.0
type FailKind string
FailKind names a turn failure a client acts on: a refusal, the token limit, a request over the context window, or a cancel. Empty is any other failure.
type JobHandler ¶
JobHandler runs a named background job: the body of a job session that a tool starts with CallContext.Schedule. A runtime's worker registers handlers by name (its Config.Jobs).
type JobResult ¶ added in v0.5.0
ChildResult is a blocking specialist's output for the call that waited on it. Failed is a child that failed: Output is then its error.
type Live ¶ added in v0.5.0
type Live struct {
// contains filtered or unexported fields
}
Live sends a session's deltas to the readers that listen now. It stores nothing: a reader that was not listening, or fell behind, misses deltas, and the complete event it reads from the session's log has the full text. A runtime keeps one Live where its model calls run.
type MCPClient ¶ added in v0.5.0
type MCPClient interface {
// Connect connects to each server and returns the tools of those that
// answered, and a func that closes the connections. A server that
// fails is logged and skipped.
Connect(ctx context.Context, servers []MCPServer) ([]MCPTool, func())
}
MCPClient connects a harness to its MCP servers. Package mcp is the implementation; a harness with MCP servers requires one.
type MCPCredentialResolver ¶ added in v0.5.0
type MCPCredentialResolver interface {
ResolveMCP(context.Context, string) (MCPCredentials, error)
}
MCPCredentialResolver resolves host-owned MCP credential references immediately before an MCP connection. Implementations should return short-lived credentials.
type MCPCredentials ¶ added in v0.5.0
MCPCredentials are ephemeral values returned for a durable CredentialRef.
type MCPHeader ¶ added in v0.5.0
MCPHeader is a single HTTP header sent with requests to an HTTP-based MCP server.
type MCPServer ¶ added in v0.5.0
type MCPServer struct {
// Name is a human-readable identifier for the server. It is used as the
// tool namespace so that tools from this server are grouped together and
// disambiguated from tools provided by other servers or the harness itself.
Name string `json:"name"`
// Type selects the MCP transport: MCPHTTP ("http") or
// MCPSSE ("sse"). When empty or MCPStdio ("stdio"), the
// server is launched as a subprocess over stdio.
Type string `json:"type,omitempty"`
// Command is the path to the MCP server executable (stdio transport).
Command string `json:"command,omitempty"`
// Args are command-line arguments passed to the server (stdio transport).
Args []string `json:"args,omitempty"`
// Env are explicit environment variables set when launching the server.
// Host process variables are inherited only through host-only policy.
Env []MCPEnv `json:"env,omitempty"`
// URL is the endpoint URL (http and sse transports).
URL string `json:"url,omitempty"`
// Headers are HTTP headers included in requests to the server (http and
// sse transports). Authorization and other credentials are carried here.
Headers []MCPHeader `json:"headers,omitempty"`
// CredentialRef is a durable opaque reference resolved by the host. Inline
// Env and Headers remain connection-scoped and are never persisted.
CredentialRef string `json:"credentialRef,omitempty"`
// HostEnv is a host-only allowlist of environment variable names inherited
// by a stdio subprocess. It is never accepted from ACP JSON.
HostEnv []string `json:"-"`
// InheritHostEnv is a host-only trusted escape hatch. Client-supplied JSON
// cannot enable full process environment inheritance.
InheritHostEnv bool `json:"-"`
}
MCPServer is one MCP server a session connects to, for the harness or the ACP session lifecycle. It matches the ACP mcpServers wire shape: a stdio server sets Command/Args/Env with no Type, while HTTP and SSE servers set Type plus URL/Headers. The harness connects through AgentOptions.MCP.
func DurableMCPServers ¶ added in v0.5.0
DurableMCPServers copies MCP server topology while removing inline credentials.
func (MCPServer) Durable ¶ added in v0.5.0
Durable returns the non-secret topology safe for a wire session store.
type MCPTool ¶ added in v0.5.0
type MCPTool struct {
// Server is the name of the server, the tool's namespace.
Server string
Name string
Description string
// Schema is the tool's JSON Schema for its arguments.
Schema map[string]any
// Call runs the tool on the server and returns its text result.
Call func(ctx context.Context, args map[string]any) (string, error)
}
MCPTool is one tool an MCP server offers.
type MemoryEventLog ¶
type MemoryEventLog struct {
// contains filtered or unexported fields
}
MemoryEventLog is a channel EventLog with topics events/retry/close.
func NewMemoryEventLog ¶
func NewMemoryEventLog() *MemoryEventLog
NewMemoryEventLog returns an empty EventLog.
func (*MemoryEventLog) CloseSession ¶
func (l *MemoryEventLog) CloseSession(_ context.Context, sessionID ID) error
CloseSession implements EventLog. It drops the log, ending its tails, so a later session can reuse the id and closed history does not stay in process memory.
func (*MemoryEventLog) Head ¶
Head implements EventLog. An unknown session is at 0, and gets no log.
func (*MemoryEventLog) Subscribe ¶
func (l *MemoryEventLog) Subscribe(ctx context.Context, sessionID ID, after Seq) (<-chan Event, error)
Subscribe implements EventLog. It replays seq > after, then tails: each subscriber reads the log at its own pace, so a slow one misses nothing and never blocks Append. Retry entries are not sent.
type MemorySecretStorage ¶
type MemorySecretStorage struct {
// contains filtered or unexported fields
}
MemorySecretStorage is an in-memory SecretStorage for tests and single-process workers. Client and worker must share the same instance.
func NewMemorySecretStorage ¶
func NewMemorySecretStorage() *MemorySecretStorage
func (*MemorySecretStorage) Delete ¶
func (s *MemorySecretStorage) Delete(_ context.Context, sessionID ID) error
type MemoryStore ¶ added in v0.5.0
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore is an in-memory Store.
func NewMemoryStore ¶ added in v0.5.0
func NewMemoryStore() *MemoryStore
NewMemoryStore returns an empty Store.
func (*MemoryStore) Calls ¶ added in v0.5.0
func (s *MemoryStore) Calls(_ context.Context, sessionID ID, callKeys []string) (map[string][]byte, error)
Calls implements Store.
func (*MemoryStore) ClearCalls ¶ added in v0.5.0
func (s *MemoryStore) ClearCalls(_ context.Context, sessionID ID) error
ClearCalls implements Store.
func (*MemoryStore) Delete ¶ added in v0.5.0
func (s *MemoryStore) Delete(_ context.Context, sessionID ID) error
Delete implements Store.
func (*MemoryStore) Load ¶ added in v0.5.0
func (s *MemoryStore) Load(_ context.Context, sessionID ID) ([]CheckpointEntry, Revision, error)
Load implements Store.
func (*MemoryStore) Save ¶ added in v0.5.0
func (s *MemoryStore) Save(_ context.Context, sessionID ID, changes []CheckpointChange, expected Revision) (Revision, error)
Save implements Store. expected must equal the revision from the last Load (zero if the row does not exist).
type MountRecipe ¶
type MountRecipe struct {
Provider string `json:"provider"`
Alias string `json:"alias"`
Params map[string]string `json:"params,omitempty"`
SourceIDs []string `json:"sourceIds,omitempty"`
Writable bool `json:"writable,omitempty"`
}
MountRecipe is secret-free VFS context remembered across turns. It records where a mount came from (provider, alias, backend ids). File contents are never stored; providers lazy-load on open/read.
type Prompt ¶
type Prompt struct {
Text string
UserMessage *message.Message
// MCPServers, when non-nil, replaces session-scoped MCP configs for this turn.
MCPServers []MCPServer
Auth AuthContext
// State is host values the turn's first step writes into the
// session's user state. JSON-serializable values only. No tokens or
// clients.
State map[string]any
}
Prompt is the typed input for Runtime.Prompt.
type Resume ¶
type Resume struct {
Responses map[string][]byte
Auth AuthContext
// State is host values the resumed step writes into the session's
// user state.
State map[string]any
}
Resume is the typed input for Runtime.Resume (HITL answer plus optional auth).
type Revision ¶
type Revision string
Revision is the Store compare-and-swap token for one session row. The zero value means no row exists yet; the next Save creates it.
type Sealer ¶ added in v0.5.0
type Sealer interface {
Seal(ctx context.Context, plaintext, associated []byte) ([]byte, error)
Open(ctx context.Context, ciphertext, associated []byte) ([]byte, error)
}
Sealer encrypts the secrets a SecretStorage writes. Seal binds the ciphertext to associated data (the session id), and Open fails unless it gets the same associated data back, so one session's secrets cannot be read as another's. A host can implement it over its KMS (envelope encryption), which is why it gets the caller's context; AESGCM is one built from a key.
type SecretStorage ¶
type SecretStorage interface {
// Put replaces Auth when secrets.Auth.Bindings is non-empty.
// Empty Bindings (including drop-only) is a no-op on the bag.
Put(ctx context.Context, sessionID ID, secrets Secrets) error
// Get returns the last Put bag. Missing session: zero Secrets, nil error.
Get(ctx context.Context, sessionID ID) (Secrets, error)
Delete(ctx context.Context, sessionID ID) error
}
SecretStorage holds Secrets for the workers that run a turn. The runtime client and the worker must share one instance. It is not Store.
type Secrets ¶
type Secrets struct {
Auth AuthContext
}
Secrets is the session-scoped secret bag. It is not stored in the snapshot or the durable history. Auth holds VFS credentials. Add fields here when more work-item secrets need the same path.
type State ¶ added in v0.5.0
type State string
SessionState is parent-facing session/job state. Child HITL does not change this from running until the interrupt is resolved and the child completes, fails, or is cancelled.
type Status ¶ added in v0.5.0
type Status struct {
ID ID
Parent ID
State State
Specialist string
Kind string
Result string
// Waiting is true while the session is parked for HITL. Parent-facing
// State stays running until that interrupt is resolved.
Waiting bool
}
SessionStatus is a value type returned by Runtime.Status. Not an interface.
type Store ¶ added in v0.5.0
type Store interface {
// Save applies changes to the checkpoint, all of them or none, when it
// is at expected, and returns its new revision.
Save(ctx context.Context, sessionID ID, changes []CheckpointChange, expected Revision) (Revision, error)
// Load is the checkpoint's rows, in no set order, and its revision.
Load(ctx context.Context, sessionID ID) ([]CheckpointEntry, Revision, error)
// Revision is the snapshot's current revision, "" when none exists. A
// worker reads it to learn whether the committed state it holds is
// current, without loading the snapshot.
Revision(ctx context.Context, sessionID ID) (Revision, error)
// PutCall keeps the body of one tool call (tacklr.CallBody) under its
// session and call key, so the durable runtime's history holds only
// that the call ran. A Put of a key replaces it: a step that runs again
// leaves one. Bodies stay until ClearCalls or Delete, so a Subscribe in
// the turn can read every result.
PutCall(ctx context.Context, sessionID ID, callKey string, body []byte) error
// Calls returns the bodies kept under callKeys; a key with none is
// absent from the map.
Calls(ctx context.Context, sessionID ID, callKeys []string) (map[string][]byte, error)
// ClearCalls removes the session's call bodies. The runtime calls it
// when a new turn starts: the turns before it committed their rounds,
// so no step reads their calls again.
ClearCalls(ctx context.Context, sessionID ID) error
// Delete removes the session's snapshot and its call bodies.
Delete(ctx context.Context, sessionID ID) error
}
Store keeps each session's checkpoint: what the harness needs to think again after a park or a worker recycle, as rows (CheckpointEntry), so a commit writes only the rows it changed. Tokens, file bytes, MCP env and headers, the session's identity, and child handles are not in it.
Save's expected Revision must match the last Load (zero if no row). Mismatch means another writer already saved — reload and retry.
type Subscription ¶
type Subscription interface {
Events() <-chan Event
// Err is why Events closed: nil when the subscriber closed it, else the
// error that stopped delivery (a stream or decode failure, or a tool
// result that could not be read back). Call it after Events closes.
Err() error
Close() error
}
Subscription is one consumer of a session EventLog.
type Wake ¶
type Wake struct {
Kind string
Prompt Prompt
Resume Resume
Job JobEnd
// Trace is the trace context of the request that sent the wake (the
// client's span), so the turn it starts or resumes is part of that
// request's trace. A session.Client sets it from its context.
Trace telemetry.Carrier `json:",omitempty"`
}
Wake is one mailbox event. Job is set when Kind is WakeJob. A zero Wake (empty Kind) is Next's answer when nothing is queued and it must not block.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package durableobject runs Tacklr sessions as durable objects: one object per session, each with its own ordered storage, alarm and address, as a Cloudflare Durable Object has.
|
Package durableobject runs Tacklr sessions as durable objects: one object per session, each with its own ordered storage, alarm and address, as a Cloudflare Durable Object has. |
|
cloudflare
Package cloudflare runs Tacklr sessions on Cloudflare Workers: each session is a SQLite-backed Durable Object that runs a durableobject.Object, and the Worker serves the host's own routes over a session.Client of those objects.
|
Package cloudflare runs Tacklr sessions on Cloudflare Workers: each session is a SQLite-backed Durable Object that runs a durableobject.Object, and the Worker serves the host's own routes over a session.Client of those objects. |
|
dotest
Package dotest runs durable object sessions in memory, for tests: a host's tests of its agent on the durable object runtime, and the runtime's own.
|
Package dotest runs durable object sessions in memory, for tests: a host's tests of its agent on the durable object runtime, and the runtime's own. |
|
internal/inproc
Package inproc serves an http.Handler in this process, without a network: the response streams through a pipe as the handler writes it.
|
Package inproc serves an http.Handler in this process, without a network: the response streams through a pipe as the handler writes it. |
|
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.
|
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. |
|
Package orchestrator decides each step of a session, the same way on every runtime.
|
Package orchestrator decides each step of a session, the same way on every runtime. |
|
Package postgres keeps sessions durable in Postgres: the session Store (checkpoints and tool-call bodies), SecretStorage (the users' delegated tokens, sealed before they are written) and the EventLog.
|
Package postgres keeps sessions durable in Postgres: the session Store (checkpoints and tool-call bodies), SecretStorage (the users' delegated tokens, sealed before they are written) and the EventLog. |
|
Package storetest is the contract every session Store, SecretStorage and EventLog must meet.
|
Package storetest is the contract every session Store, SecretStorage and EventLog must meet. |
|
Package temporal is the client side of the Temporal runtime: Client implements session.Client with one Temporal workflow per session.
|
Package temporal is the client side of the Temporal runtime: Client implements session.Client with one Temporal workflow per session. |
|
internal/protocol
Package protocol is how a Temporal client and worker talk about one session: the workflow's type name and input, its signal and query names, and the item its event stream carries.
|
Package protocol is how a Temporal client and worker talk about one session: the workflow's type name and input, its signal and query names, and the item its event stream carries. |
|
worker
Package worker runs tacklr sessions on Temporal: it registers the session workflow and its turn activities, and keeps each session's harness (VFS, MCP connections, tools) between steps.
|
Package worker runs tacklr sessions on Temporal: it registers the session workflow and its turn activities, and keeps each session's harness (VFS, MCP connections, tools) between steps. |