Documentation
¶
Overview ¶
Package temporal is the Temporal adapter for session.Runtime. Hosts use Dial and Open. Zero Snapshots and Secrets use in-memory stores kept on the runtime. StartWorker registers SessionWorkflow and the turn activities against those stores.
Index ¶
- func Dial(opts client.Options) (client.Client, error)
- func SessionWorkflow(ctx workflow.Context, in workflowInput) (string, error)
- type Config
- type Runtime
- func (r *Runtime) Cancel(ctx context.Context, sessionID session.SessionID) error
- func (r *Runtime) Children(ctx context.Context, parent session.SessionID) ([]session.SessionID, error)
- func (r *Runtime) Close(ctx context.Context, sessionID session.SessionID) error
- func (r *Runtime) CreateSession(ctx context.Context, req session.CreateSession) (session.SessionID, error)
- func (r *Runtime) Head(ctx context.Context, sessionID session.SessionID) (session.Seq, error)
- func (r *Runtime) Jobs(ctx context.Context, parent session.SessionID) ([]session.SessionStatus, error)
- func (r *Runtime) Prompt(ctx context.Context, sessionID session.SessionID, msg session.Prompt) error
- func (r *Runtime) Resume(ctx context.Context, sessionID session.SessionID, resume session.Resume) error
- func (r *Runtime) StartWorker() worker.Worker
- func (r *Runtime) Status(ctx context.Context, id session.SessionID) (session.SessionStatus, error)
- func (r *Runtime) Subscribe(ctx context.Context, sessionID session.SessionID, after session.Seq) (session.Subscription, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Agent is the one agent this runtime runs. Specialists on Agent are
// assistants it can spawn. Jobs are named handlers, not agents.
Agent tacklr.AgentOptions
TaskQueue string
// Snapshots is the session record. Zero uses an in-memory store.
// Tokens never go here. StartWorker uses this same store.
Snapshots session.SnapshotStore
Fallback session.EventLog
// Projection mounts the turn tree on the host kernel.
// Nil leaves the MountSession in-process.
Projection vfs.Projection
// DisableStreams uses the fallback EventLog instead of Workflow Streams.
DisableStreams bool
// TurnLocality, when > 0, pins a turn's activities to one worker.
TurnLocality time.Duration
// ActivityTimeout is Inference/Tool StartToCloseTimeout. Zero is 10 minutes.
ActivityTimeout time.Duration
// HeartbeatTimeout is the activity heartbeat timeout. Zero is 30 seconds.
HeartbeatTimeout time.Duration
// ActivityAttempts is Temporal MaximumAttempts for a wrapped network
// error, a model refusal, or a stale checkpoint. Zero is 3. 1 means no
// retry. Any other activity error stops on the first attempt.
ActivityAttempts int32
// Secrets holds work-item credentials for activities. Zero uses an
// in-memory store. StartWorker uses this same store. Tokens never
// enter event history.
Secrets session.SecretStorage
// Jobs are named background workers Schedule can start. A specialist
// of the same name takes precedence.
Jobs map[string]session.JobHandler
}
Config is the host config for Open. StartWorker uses the stores Open kept.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime implements session.Runtime with one Temporal workflow per session.
func Open ¶
Open constructs a Temporal Runtime. Zero Snapshots and Secrets use in-memory stores kept on the runtime. StartWorker registers the worker against those same stores.
func (*Runtime) Children ¶
func (r *Runtime) Children(ctx context.Context, parent session.SessionID) ([]session.SessionID, error)
Children implements session.Runtime.
func (*Runtime) CreateSession ¶
func (r *Runtime) CreateSession(ctx context.Context, req session.CreateSession) (session.SessionID, error)
CreateSession implements session.Runtime.
func (*Runtime) Head ¶
Head implements session.Runtime. When Workflow Streams is on, this is the stream's next offset so Subscribe(after Head) skips prior-turn events.
func (*Runtime) Jobs ¶
func (r *Runtime) Jobs(ctx context.Context, parent session.SessionID) ([]session.SessionStatus, error)
Jobs implements session.Runtime.
func (*Runtime) StartWorker ¶
StartWorker returns a Temporal worker for this runtime. It registers SessionWorkflow and the turn activities against the runtime's snapshot store, secret store, and agent.