Documentation
¶
Overview ¶
Package temporal is the Temporal adapter for durable.Runtime. Hosts use Dial, New, and NewWorker with the same Config (including Snapshots and Secrets). NewWorker registers SessionWorkflow and the turn activities.
Index ¶
- func Dial(opts client.Options) (client.Client, error)
- func NewWorker(c client.Client, cfg Config) worker.Worker
- func SessionWorkflow(ctx workflow.Context, in workflowInput) (string, error)
- type Config
- type Runtime
- func (r *Runtime) Cancel(ctx context.Context, sessionID durable.SessionID) error
- func (r *Runtime) Children(ctx context.Context, parent durable.SessionID) ([]durable.SessionID, error)
- func (r *Runtime) Close(ctx context.Context, sessionID durable.SessionID) error
- func (r *Runtime) CreateSession(ctx context.Context, req durable.CreateSession) (durable.SessionID, error)
- func (r *Runtime) Head(ctx context.Context, sessionID durable.SessionID) (durable.Seq, error)
- func (r *Runtime) Prompt(ctx context.Context, sessionID durable.SessionID, msg durable.Prompt) error
- func (r *Runtime) Resume(ctx context.Context, sessionID durable.SessionID, resume durable.Resume) error
- func (r *Runtime) Status(ctx context.Context, id durable.SessionID) (durable.SessionStatus, error)
- func (r *Runtime) Subscribe(ctx context.Context, sessionID durable.SessionID, after durable.Seq) (durable.Subscription, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
Dial is client.Dial with Temporal's OpenTelemetry v2 plugin prepended. Call telemetry.Init first so the global TracerProvider is ReplaySafe; NewPlugin reads otel.GetTracerProvider() and otel.GetMeterProvider(). Default: context propagation only (no SDK auto-spans). SessionWorkflow starts tacklr.turn via temporalotel.Tracer.
Types ¶
type Config ¶ added in v0.2.1
type Config struct {
Catalog durable.Catalog
TaskQueue string
// Snapshots is the session record. Required. New and NewWorker must share
// the same instance. Tokens never go here.
Snapshots durable.SnapshotStore
Fallback durable.EventLog
Projection vfs.Projection
// DisableStreams uses the fallback EventLog instead of Workflow Streams.
// Tests that use the Temporal testsuite mock must set this.
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. Zero is 3. 1 means no retry.
ActivityAttempts int32
// Secrets holds work-item credentials for activities. Required. New and
// NewWorker must share the same instance. Tokens never enter event history.
Secrets durable.SecretStorage
}
Config is the single Temporal host config for New and NewWorker.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime implements durable.Runtime with one Temporal workflow per session.
func New ¶
New constructs a Temporal Runtime. The host must also run NewWorker on the same Config, including the same Snapshots and Secrets stores.
func (*Runtime) Children ¶
func (r *Runtime) Children(ctx context.Context, parent durable.SessionID) ([]durable.SessionID, error)
Children implements durable.Runtime.
func (*Runtime) CreateSession ¶
func (r *Runtime) CreateSession(ctx context.Context, req durable.CreateSession) (durable.SessionID, error)
CreateSession implements durable.Runtime.
func (*Runtime) Head ¶
Head implements durable.Runtime. When Workflow Streams is on, this is the stream's next offset so Subscribe(after Head) skips prior-turn events.