protocol

package
v0.42.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Overview

Package protocol carries Peen's private, session-bound worker protocol.

One worker talks to its controller over one Unix socket. It registers with the credential its controller issued, asks for the durable records it needs, submits every event and state transition, and receives accepted work and cancellation. The controller validates the session and generation on every frame, writes each record to SQLite before publishing it, and answers with the durable result.

The worker has no generic control API credential. It cannot read, write, or affect another session, because its socket is bound to one session and every frame is checked against the generation that registered on it.

Index

Constants

This section is empty.

Variables

View Source
var ErrWorkerRejected = errors.New("worker registration rejected")

ErrWorkerRejected reports a registration the controller refused. A worker that sees it must exit rather than retry: the credential, session, or generation it was launched with is not one the controller will accept.

Functions

func WorkflowInstanceID added in v0.25.0

func WorkflowInstanceID(sessionID, executionID uuid.UUID) string

WorkflowInstanceID scopes an execution's stable identity to its session.

Types

type Ack

type Ack struct{}

Ack answers an operation that succeeded and carries no value.

It exists so a successful write is a real result rather than a nil pair, which would read the same as a handler that forgot to answer.

type AgentRunCancellationResult

type AgentRunCancellationResult struct {
	Run       *models.AgentRun `json:"run"`
	Requested bool             `json:"requested"`
}

AgentRunCancellationResult answers a child-run cancellation request.

type BoolResult

type BoolResult struct {
	Value bool `json:"value"`
}

BoolResult answers an operation whose only outcome is whether it happened.

type CancelAgentRun added in v0.21.0

type CancelAgentRun struct {
	AgentRunID uuid.UUID `json:"agentRunId"`
}

CancelAgentRun names one child agent the controller wants stopped.

type CancelResult

type CancelResult struct {
	CancelRequested bool `json:"cancelRequested"`
}

CancelResult is the worker's answer to a cancel command.

type CheckpointRequest

type CheckpointRequest struct {
	Lease    session.Lease          `json:"lease"`
	Messages []session.MessageInput `json:"messages"`
	Events   []session.EventInput   `json:"events"`
}

CheckpointRequest appends transcript records under one lease.

type ChildInputRequest

type ChildInputRequest[T any] struct {
	SessionID uuid.UUID `json:"sessionId"`
	ChildID   uuid.UUID `json:"childId"`
	Input     T         `json:"input"`
}

ChildInputRequest addresses one child record with a write payload.

type ChildOptionsRequest

type ChildOptionsRequest[T any] struct {
	SessionID uuid.UUID `json:"sessionId"`
	ChildID   uuid.UUID `json:"childId"`
	Options   T         `json:"options"`
}

ChildOptionsRequest addresses one child record with read options.

type ChildRequest

type ChildRequest struct {
	SessionID uuid.UUID `json:"sessionId"`
	ChildID   uuid.UUID `json:"childId"`
}

ChildRequest addresses one record inside a session, such as a job, a model run, an agent run, or a compaction.

type Code

type Code string

Code is the transport-neutral error class carried on a result frame.

It exists so a failure keeps its meaning across the socket. Without it a worker would see every controller refusal as one opaque string and could not tell a busy session from a missing record.

const (
	CodeUnknown          Code = "unknown"
	CodeNotFound         Code = "notFound"
	CodeAlreadyExists    Code = "alreadyExists"
	CodeConflict         Code = "conflict"
	CodeInvalidState     Code = "invalidState"
	CodeValidation       Code = "validationFailed"
	CodePermissionDenied Code = "permissionDenied"
	CodeLockHeld         Code = "lockHeld"
	CodeCancelled        Code = "cancelled"
	CodeNotImplemented   Code = "notImplemented"

	CodeRunningTurnSettingsChange Code = "runningTurnSettingsChange"
	CodeUserMessageQueueFull      Code = "userMessageQueueFull"
	CodeUnknownSkill              Code = "unknownSkill"
	CodeAgentRunFinished          Code = "agentRunFinished"
	CodeAgentRunNotFound          Code = "agentRunNotFound"
	CodeExecutionInboxPending     Code = "executionInboxPending"
	CodePromptBudgetExceeded      Code = "promptBudgetExceeded"
	CodeImagesNotAccepted         Code = "imagesNotAccepted"
	CodeHistoryImagesNotAccepted  Code = "historyImagesNotAccepted"
	CodeImagesNeedNewTurn         Code = "imagesNeedNewTurn"
	CodeTooManyImages             Code = "tooManyImages"
	CodeImageTooLarge             Code = "imageTooLarge"
	CodeImageType                 Code = "imageType"
	CodeTurnLeaseInactive         Code = "turnLeaseInactive"
)

type Command

type Command string

Command names the controller-initiated operations.

const (
	// CommandRunTurn hands the worker one accepted user message to run.
	CommandRunTurn Command = "runTurn"
	// CommandCancel asks the worker to cancel its session's active turn.
	CommandCancel Command = "cancel"
	// CommandSignalJob asks the worker to signal one of its running jobs. The
	// job's process group lives in the worker, so the controller cannot reach
	// it and can only record what the worker reports back.
	CommandSignalJob Command = "signalJob"
	// CommandCancelAgentRun asks the worker to stop one running child agent.
	// The child runs in the worker, so the controller's durable request
	// alone never reaches it.
	CommandCancelAgentRun Command = "cancelAgentRun"
	// CommandShutdown asks the worker to finish and exit.
	CommandShutdown Command = "shutdown"
)

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn is one multiplexed protocol connection.

Both sides send and receive on the same socket, so each runs one read loop that answers inbound frames and completes outbound ones. A call and a command can therefore be in flight at once, which is what lets a controller cancel a turn while the worker is still asking for durable records.

func NewConn

func NewConn(socket net.Conn, handler Handler) *Conn

NewConn wraps one socket. The caller starts the read loop with Serve.

func (*Conn) Call

func (c *Conn) Call(
	ctx context.Context,
	kind Kind,
	method string,
	params any,
) (json.RawMessage, error)

Call issues one request and waits for its answer.

func (*Conn) Close

func (c *Conn) Close()

Close ends the connection once. Closing an already-closed connection is not an error, because both the read loop and its owner may reach it.

func (*Conn) Done

func (c *Conn) Done() <-chan struct{}

Done closes when the connection ends.

func (*Conn) Receive

func (c *Conn) Receive() (Frame, error)

Receive reads exactly one frame. Registration uses it directly, before the read loop starts.

func (*Conn) Send

func (c *Conn) Send(frame Frame) error

Send writes one frame. Writes are serialized because two goroutines may answer a command and issue a call at the same moment.

func (*Conn) Serve

func (c *Conn) Serve(ctx context.Context) error

Serve runs the read loop until the socket ends or the context is cancelled.

It returns nil on a clean peer close, because a worker exiting after its final transition is the normal end of a connection, not a failure.

type Connection

type Connection struct {
	Ack HelloAck
	// contains filtered or unexported fields
}

Connection is a registered worker's side of the protocol.

func Dial

func Dial(
	ctx context.Context,
	document worker.LaunchDocument,
	handler Handler,
) (*Connection, error)

Dial connects one worker to its controller and registers it.

The handler answers controller commands. Registration is the first thing on the wire and the only place the credential appears; a refusal means this worker must exit rather than retry, because its controller will not accept the launch it was given.

func (*Connection) Close

func (c *Connection) Close()

Close ends the connection.

func (*Connection) Done

func (c *Connection) Done() <-chan struct{}

Done closes when the connection ends.

func (*Connection) Serve

func (c *Connection) Serve(ctx context.Context) error

Serve runs the worker's read loop until the controller disconnects or the context ends.

func (*Connection) Store

func (c *Connection) Store() *Store

Store is the worker's durable surface over this connection.

func (*Connection) Workflows added in v0.25.0

func (c *Connection) Workflows() *WorkflowBackend

Workflows binds the registered session to the existing private transport.

type ContentBlobHashesRequest added in v0.26.3

type ContentBlobHashesRequest struct {
	SessionID uuid.UUID `json:"sessionId"`
	Hashes    []string  `json:"hashes"`
}

ContentBlobHashesRequest reads stored strings back by hash.

type ContentBlobsRequest added in v0.26.3

type ContentBlobsRequest struct {
	SessionID uuid.UUID          `json:"sessionId"`
	Blobs     []contentblob.Blob `json:"blobs"`
}

ContentBlobsRequest stores the long strings of a compacted payload.

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller answers one registered worker's durable calls.

It is constructed per connection and holds that worker's session and generation. Every request is checked against them, so a worker asking for a session it was not launched for is refused rather than served.

func NewController

func NewController(
	store *session.Store,
	sessionID uuid.UUID,
	generationID uuid.UUID,
) *Controller

NewController binds one worker connection to its session.

func (*Controller) BindWorkflows added in v0.25.0

func (c *Controller) BindWorkflows(
	ctx context.Context,
	storage *db.WorkflowStorage,
) error

BindWorkflows attaches controller-owned storage to this authenticated generation. A borrowed backend never opens another database connection.

func (*Controller) HandleCall

func (c *Controller) HandleCall(
	ctx context.Context,
	method string,
	payload json.RawMessage,
) (any, error)

HandleCall serves one durable request from the worker.

func (*Controller) HandleCommand

func (c *Controller) HandleCommand(
	_ context.Context,
	command Command,
	_ json.RawMessage,
) (any, error)

HandleCommand is never called on the controller side. A worker does not send commands to its controller, so a command frame arriving here is a protocol violation rather than work to do.

type CreateOrResumeRequest

type CreateOrResumeRequest struct {
	SessionID uuid.UUID                  `json:"sessionId"`
	Options   session.OpenSessionOptions `json:"options"`
}

CreateOrResumeRequest opens the worker's own session. The controller ignores any other session ID here, because a worker opens only what it was launched for.

type EndTurnRequest added in v0.30.0

type EndTurnRequest struct {
	SessionID uuid.UUID       `json:"sessionId"`
	TurnID    uuid.UUID       `json:"turnId"`
	End       session.TurnEnd `json:"end"`
}

EndTurnRequest ends one running turn of the worker's session without its lease, for a turn Stop or a failed workflow ended.

type Error

type Error struct {
	Code Code `json:"code"`
	// Message is operator-facing text. It never carries a credential, because
	// the controller only ever puts its own wrap messages here.
	Message string `json:"message"`
}

Error is one failure as it crosses the socket.

func NewError

func NewError(err error) *Error

NewError converts a controller-side failure into a wire error.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap rebuilds a Go error from a wire error, restoring the sentinel so errors.Is still answers correctly on the receiving side. A detailed failure comes back matching both its detail and its class.

type Frame

type Frame struct {
	Kind Kind `json:"kind"`

	// ID correlates a call or command with its answer. It is empty on hello.
	ID string `json:"id,omitempty"`

	// Method names the durable operation on a call frame, and the command on a
	// command frame.
	Method string `json:"method,omitempty"`

	Payload json.RawMessage `json:"payload,omitempty"`

	// Error is set on a result frame the operation failed.
	Error *Error `json:"error,omitempty"`
}

Frame is one message in either direction.

type Handler

type Handler interface {
	// HandleCall answers a worker's durable request.
	HandleCall(
		ctx context.Context,
		method string,
		payload json.RawMessage,
	) (any, error)

	// HandleCommand answers a controller's command.
	HandleCommand(
		ctx context.Context,
		command Command,
		payload json.RawMessage,
	) (any, error)
}

Handler answers the frames one side receives. The controller implements the call side, the worker implements the command side, and each returns a nil payload for a frame kind it does not serve.

type HashRequest

type HashRequest struct {
	SessionID uuid.UUID `json:"sessionId"`
	Hash      string    `json:"hash"`
}

HashRequest reads one content-addressed snapshot.

type Hello

type Hello struct {
	SessionID    uuid.UUID         `json:"sessionId"`
	GenerationID uuid.UUID         `json:"generationId"`
	Credential   worker.Credential `json:"credential"`
	AgentSpace   string            `json:"agentSpace"`
}

Hello is the worker's registration payload.

The credential is the only secret on the wire, and it travels once. A worker that names a session or generation its controller did not issue is refused and the connection is closed.

type HelloAck

type HelloAck struct {
	SessionID  uuid.UUID `json:"sessionId"`
	Workspace  string    `json:"workspace"`
	AgentSpace string    `json:"agentSpace"`
}

HelloAck confirms registration and tells the worker what its session already looks like, so it does not need a second round trip to start.

type InputRequest

type InputRequest[T any] struct {
	SessionID uuid.UUID `json:"sessionId"`
	Input     T         `json:"input"`
}

InputRequest addresses one session with a write payload.

type Kind

type Kind string

Kind is the frame type. Both directions share one envelope so a single read loop on each side can dispatch every message.

const (
	// KindHello is the worker's first frame. Nothing else is accepted before
	// it.
	KindHello Kind = "hello"
	// KindHelloAck answers a registration attempt.
	KindHelloAck Kind = "helloAck"
	// KindCall is a worker request for a durable operation.
	KindCall Kind = "call"
	// KindResult answers a call.
	KindResult Kind = "result"
	// KindCommand is controller-initiated work or control for the worker.
	KindCommand Kind = "command"
	// KindCommandResult answers a command.
	KindCommandResult Kind = "commandResult"
)

type LeaseInputRequest

type LeaseInputRequest[T any] struct {
	Lease session.Lease `json:"lease"`
	Input T             `json:"input"`
}

LeaseInputRequest addresses one turn lease with a write payload.

type LeaseRequest

type LeaseRequest struct {
	Lease session.Lease `json:"lease"`
}

LeaseRequest addresses one turn lease.

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

Listener is one session's private worker socket.

It accepts exactly the worker its controller launched. A second connection on the same socket is refused while one is live, because one generation is one process.

func Listen

func Listen(
	ctx context.Context,
	socketPath string,
	sessionID uuid.UUID,
	registrar Registrar,
	store *session.Store,
	options ...ListenerOption,
) (*Listener, error)

Listen opens one session's private socket.

A stale socket file from a controller that died is removed first, because a Unix socket is not cleaned up by the kernel and the new controller owns this path by construction: it is named for the session and lives under the controller's own private root.

func (*Listener) Close

func (l *Listener) Close()

Close stops accepting and removes the socket file.

func (*Listener) Connected

func (l *Listener) Connected() (*Worker, bool)

Connected returns the live worker, if one has registered.

func (*Listener) Path

func (l *Listener) Path() string

Path is the socket a worker launch document points at.

func (*Listener) Serve

func (l *Listener) Serve(ctx context.Context) error

Serve accepts worker connections until the context ends or the listener is closed.

type ListenerOption added in v0.25.0

type ListenerOption func(*Listener)

func WithWorkflowStorage added in v0.25.0

func WithWorkflowStorage(storage *db.WorkflowStorage) ListenerOption

WithWorkflowStorage lends controller storage to authenticated generations. The listener never closes the storage.

type Method

type Method string

Method names one durable operation a worker may ask its controller to perform. The set is closed: a worker cannot reach a store method the controller did not publish here, which is what keeps the protocol from becoming a generic database connection.

const (
	MethodGetSession        Method = "session.get"
	MethodGetDirectoryState Method = "session.directoryState"
	MethodCreateOrResume    Method = "session.createOrResume"
	MethodCompletedHistory  Method = "session.completedHistory"

	MethodAcquireTurn      Method = "turn.acquire"
	MethodAppendCheckpoint Method = "turn.appendCheckpoint"
	MethodFinalizeTurn     Method = "turn.finalize"
	MethodReleaseTurn      Method = "turn.release"
	MethodEndRunningTurn   Method = "turn.endRunning"
	MethodRecordTurnWorker Method = "turn.recordWorkerGeneration"
	MethodCancelSession    Method = "turn.cancel"
	MethodListTurns        Method = "turn.list"

	MethodListMessages Method = "message.list"
	MethodListEvents   Method = "event.list"

	MethodCreateModelRun         Method = "modelRun.create"
	MethodFinalizeModelRun       Method = "modelRun.finalize"
	MethodGetModelRun            Method = "modelRun.get"
	MethodListModelRuns          Method = "modelRun.list"
	MethodCreateModelCall        Method = "modelCall.create"
	MethodFinalizeModelCall      Method = "modelCall.finalize"
	MethodRecordModelCallRetries Method = "modelCall.recordRetries"
	MethodListModelCalls         Method = "modelCall.list"

	MethodCreateJob             Method = "job.create"
	MethodFinalizeJob           Method = "job.finalize"
	MethodGetJob                Method = "job.get"
	MethodListJobs              Method = "job.list"
	MethodAppendJobOutput       Method = "job.appendOutputLines"
	MethodListJobOutput         Method = "job.listOutput"
	MethodRecordJobSignal       Method = "job.recordSignal"
	MethodListJobSignalRequests Method = "job.listSignalRequests"

	MethodCreateAgentRun          Method = "agentRun.create"
	MethodClaimAgentRun           Method = "agentRun.claim"
	MethodPrepareAgentRunRecovery Method = "agentRun.prepareRecovery"
	MethodFinalizeAgentRun        Method = "agentRun.finalize"
	MethodGetAgentRun             Method = "agentRun.get"
	MethodListAgentRuns           Method = "agentRun.list"
	MethodAppendAgentRunEvent     Method = "agentRun.appendEvent"
	MethodListAgentRunEvents      Method = "agentRun.listEvents"
	MethodCancelAgentRun          Method = "agentRun.requestCancellation"

	MethodOpenAgentRunQuestions Method = "agentRun.openQuestions"

	MethodAppendAgentRunMessages   Method = "agentRun.appendMessages"
	MethodListAgentRunMessages     Method = "agentRun.listMessages"
	MethodAgentRunHistory          Method = "agentRun.history"
	MethodCreateAgentRunCompaction Method = "agentRun.createCompaction"
	MethodLatestAgentRunCompaction Method = "agentRun.latestCompaction"
	MethodListAgentRunCompactions  Method = "agentRun.listCompactions"
	MethodGetAgentRunCompaction    Method = "agentRun.getCompaction"

	MethodCreateCompaction Method = "compaction.create"
	MethodGetCompaction    Method = "compaction.get"
	MethodListCompactions  Method = "compaction.list"
	MethodLatestCompaction Method = "compaction.latest"

	MethodSaveContextSnapshot Method = "snapshot.saveContext"
	MethodGetContextSnapshot  Method = "snapshot.getContext"
	MethodSavePromptSnapshot  Method = "snapshot.savePrompt"
	MethodGetPromptSnapshot   Method = "snapshot.getPrompt"

	MethodCreateSessionNotice Method = "notice.create"
	MethodListSessionNotices  Method = "notice.list"
	MethodDrainSessionNotices Method = "notice.drain"

	MethodPutContentBlobs Method = "contentBlob.put"
	MethodGetContentBlobs Method = "contentBlob.get"
)

type NestedChildInputRequest

type NestedChildInputRequest[T any] struct {
	SessionID uuid.UUID `json:"sessionId"`
	ChildID   uuid.UUID `json:"childId"`
	NestedID  uuid.UUID `json:"nestedId"`
	Input     T         `json:"input"`
}

NestedChildInputRequest addresses a record inside a child record, which is only the model call inside a model run.

type NestedChildRequest added in v0.11.0

type NestedChildRequest struct {
	SessionID uuid.UUID `json:"sessionId"`
	ChildID   uuid.UUID `json:"childId"`
	NestedID  uuid.UUID `json:"nestedId"`
}

NestedChildRequest addresses a record inside a child record for a read, which is a compaction inside one agent run.

type OptionsRequest

type OptionsRequest[T any] struct {
	SessionID uuid.UUID `json:"sessionId"`
	Options   T         `json:"options"`
}

OptionsRequest addresses one session with read options.

type RecordTurnWorkerRequest

type RecordTurnWorkerRequest struct {
	Lease        session.Lease `json:"lease"`
	GenerationID uuid.UUID     `json:"generationId"`
}

RecordTurnWorkerRequest names the worker generation that ran one turn.

type Registrar

type Registrar interface {
	AcceptWorker(ctx context.Context, hello Hello) (HelloAck, error)

	// WorkerConnected reports an accepted worker once Connected returns it
	// and its hello ack is sent. AcceptWorker runs before the listener
	// installs the worker, so it cannot be the readiness signal.
	WorkerConnected(sessionID, generationID uuid.UUID)
}

Registrar verifies one worker's registration.

The supervisor implements it against the durable generation record, so a worker is accepted only when the controller itself recorded that session, that generation, and that credential hash.

type RunTurn

type RunTurn struct {
	ExpectedStopRevision *int64 `json:"expectedStopRevision,omitempty"`

	RequestID       uuid.UUID `json:"requestId"`
	Message         string    `json:"message"`
	Model           string    `json:"model,omitempty"`
	ReasoningEffort string    `json:"reasoningEffort,omitempty"`
	SystemPrompt    string    `json:"systemPrompt,omitempty"`
	PromptMode      string    `json:"promptMode,omitempty"`

	// Images follow Message in the turn's first user message.
	Images []session.MessageImage `json:"images,omitempty"`

	// Origin is set only for a turn a session event started. The worker runs
	// it as a woken turn, so its prompt is stored as injected rather than as
	// something a person typed.
	Origin *TurnOrigin `json:"origin,omitempty"`

	// To names a running child agent. The worker puts the message in that
	// child's inbox and starts no turn.
	To *uuid.UUID `json:"to,omitempty"`
}

RunTurn is the payload of a runTurn command.

The controller has already recorded the accepted user message, so this carries the routing identity and the text, never a session the worker may choose.

type SessionRequest

type SessionRequest struct {
	SessionID uuid.UUID `json:"sessionId"`
}

SessionRequest addresses one session.

Every envelope carries the session ID even though the socket is already bound to one session. The controller checks the two agree and refuses the frame when they do not, so a worker that guesses another session's ID still gets nowhere.

type SignalJob

type SignalJob struct {
	JobID  uuid.UUID `json:"jobId"`
	Signal string    `json:"signal"`
}

SignalJob names one job the controller wants signalled.

type SignalJobResult

type SignalJobResult struct {
	Handled bool `json:"handled"`

	// Signalled is true when the worker found the job running and signalled it.
	Signalled bool `json:"signalled"`

	// State is the job's state at the moment it was signalled.
	State string `json:"state"`
}

SignalJobResult is the worker's answer to a signal command.

Handled is false when this worker holds no such running job, which is not an error: the job may have exited between the read the caller acted on and this command arriving.

type SnapshotRequest

type SnapshotRequest[T any] struct {
	SessionID uuid.UUID `json:"sessionId"`
	Snapshot  T         `json:"snapshot"`
}

SnapshotRequest stores one immutable snapshot. The session ID travels beside it so the controller can check ownership before writing.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is a worker's durable surface.

Every record goes to the controller, which writes it to SQLite and publishes it. The worker holds no database handle and no generic control credential. The lease and its cancellation stay in the worker's own memory, because the worker is the only process that runs turns for its session and cancellation has to reach a live goroutine rather than a row.

func NewStore

func NewStore(
	conn *Conn,
	sessionID uuid.UUID,
	generationID uuid.UUID,
) *Store

NewStore builds a worker's durable surface over one registered connection.

func (*Store) AcceptChildExecutionMessage added in v0.25.0

func (s *Store) AcceptChildExecutionMessage(
	ctx context.Context,
	sessionID, executionID uuid.UUID,
	input session.AcceptExecutionMessageInput,
) (*session.ExecutionInboxAcceptance, error)

func (*Store) AcceptExecutionMessage added in v0.25.0

func (s *Store) AcceptExecutionMessage(
	ctx context.Context,
	executionID uuid.UUID,
	lease session.Lease,
	input session.AcceptExecutionMessageInput,
) (*session.ExecutionInboxAcceptance, error)

func (*Store) AcquireDeferredExecutionTurn added in v0.25.0

func (s *Store) AcquireDeferredExecutionTurn(
	ctx context.Context,
	sessionID, inboxID uuid.UUID,
	input session.StartTurnInput,
) (*session.DeferredTurnAdmission, error)

func (*Store) AcquireTurn

func (s *Store) AcquireTurn(
	ctx context.Context,
	sessionID uuid.UUID,
	input session.StartTurnInput,
) (session.Lease, error)

AcquireTurn reserves the durable lease on the controller, then records it locally so cancellation can reach this process.

func (*Store) AgentRunHistory added in v0.11.0

func (s *Store) AgentRunHistory(
	ctx context.Context,
	sessionID uuid.UUID,
	agentRunID uuid.UUID,
) (*session.AgentRunHistoryResult, error)

func (*Store) AppendAgentRunEvent

func (s *Store) AppendAgentRunEvent(
	ctx context.Context,
	sessionID uuid.UUID,
	agentRunID uuid.UUID,
	input session.AgentRunEventInput,
) (*models.AgentRunEvent, error)

func (*Store) AppendAgentRunMessages added in v0.11.0

func (s *Store) AppendAgentRunMessages(
	ctx context.Context,
	sessionID uuid.UUID,
	agentRunID uuid.UUID,
	inputs []session.AgentRunMessageInput,
) ([]*models.AgentRunMessage, error)

func (*Store) AppendCheckpoint

func (s *Store) AppendCheckpoint(
	ctx context.Context,
	lease session.Lease,
	messages []session.MessageInput,
	events []session.EventInput,
) error

func (*Store) AppendJobOutput

func (s *Store) AppendJobOutput(
	ctx context.Context,
	sessionID uuid.UUID,
	jobID uuid.UUID,
	inputs []session.AppendJobOutputInput,
) ([]*models.JobOutputLine, error)

func (*Store) BeginExecutionActivity added in v0.25.0

func (s *Store) BeginExecutionActivity(
	ctx context.Context,
	sessionID, executionID, generationID uuid.UUID,
	input session.ScheduleActivityInput,
) (*session.ActivityClaim, error)

func (*Store) Cancel

func (s *Store) Cancel(
	ctx context.Context,
	sessionID uuid.UUID,
) (bool, error)

func (*Store) ClaimAgentRun added in v0.24.0

func (s *Store) ClaimAgentRun(
	ctx context.Context,
	sessionID, runID uuid.UUID,
	input session.ClaimAgentRunInput,
) (*models.AgentRun, error)

func (*Store) CompleteExecutionActivity added in v0.25.0

func (s *Store) CompleteExecutionActivity(
	ctx context.Context,
	sessionID uuid.UUID,
	lease session.ActivityLease,
	input session.CompleteActivityInput,
) (*models.ExecutionActivity, error)

func (*Store) CompletedHistory

func (s *Store) CompletedHistory(
	ctx context.Context,
	sessionID uuid.UUID,
) (*session.History, error)

func (*Store) CreateAgentRun

func (s *Store) CreateAgentRun(
	ctx context.Context,
	sessionID uuid.UUID,
	input session.StartAgentRunInput,
) (*models.AgentRun, error)

func (*Store) CreateAgentRunCompaction added in v0.11.0

func (s *Store) CreateAgentRunCompaction(
	ctx context.Context,
	sessionID uuid.UUID,
	agentRunID uuid.UUID,
	input session.AgentRunCompactionInput,
) (*models.AgentRunCompaction, error)

func (*Store) CreateCompaction

func (s *Store) CreateCompaction(
	ctx context.Context,
	sessionID uuid.UUID,
	input session.CompactionInput,
) (*models.Compaction, error)

func (*Store) CreateExecution added in v0.25.0

func (s *Store) CreateExecution(
	ctx context.Context,
	sessionID uuid.UUID,
	input session.CreateExecutionInput,
) (*models.Execution, error)

func (*Store) CreateJob

func (s *Store) CreateJob(
	ctx context.Context,
	sessionID uuid.UUID,
	input session.CreateJobInput,
) (*models.Job, error)

func (*Store) CreateModelCall

func (s *Store) CreateModelCall(
	ctx context.Context,
	sessionID uuid.UUID,
	modelRunID uuid.UUID,
	input session.CreateModelCallInput,
) (*models.ModelCall, error)

func (*Store) CreateModelRun

func (s *Store) CreateModelRun(
	ctx context.Context,
	sessionID uuid.UUID,
	input session.CreateModelRunInput,
) (*models.ModelRun, error)

func (*Store) CreateOrResume

func (s *Store) CreateOrResume(
	ctx context.Context,
	_ *uuid.UUID,
	options session.OpenSessionOptions,
) (*session.OpenSessionResult, error)

func (*Store) CreateSessionNotice

func (s *Store) CreateSessionNotice(
	ctx context.Context,
	sessionID uuid.UUID,
	input session.CreateSessionNoticeInput,
) (*models.SessionNotice, error)

func (*Store) CreateWorkerGeneration

func (s *Store) CreateWorkerGeneration(
	_ context.Context,
	_ uuid.UUID,
	_ session.CreateWorkerGenerationInput,
) (*models.WorkerGeneration, error)

func (*Store) DeferExecutionMessage added in v0.25.0

func (s *Store) DeferExecutionMessage(
	ctx context.Context,
	executionID uuid.UUID,
	lease session.Lease,
	input session.AcceptExecutionMessageInput,
) (*session.ExecutionInboxAcceptance, error)

func (*Store) DeliverChildExecutionMessages added in v0.25.0

func (s *Store) DeliverChildExecutionMessages(
	ctx context.Context,
	sessionID uuid.UUID,
	lease session.ActivityLease,
	requestIDs []uuid.UUID,
) (*session.ExecutionInboxDelivery, error)

func (*Store) DeliverExecutionMessages added in v0.25.0

func (s *Store) DeliverExecutionMessages(
	ctx context.Context,
	sessionID uuid.UUID,
	input session.DeliverExecutionMessagesInput,
) (*session.ExecutionInboxDelivery, error)

func (*Store) DrainSessionNotices

func (s *Store) DrainSessionNotices(
	ctx context.Context,
	sessionID uuid.UUID,
) ([]*models.SessionNotice, error)

func (*Store) EndRunningTurn added in v0.30.0

func (s *Store) EndRunningTurn(
	ctx context.Context,
	sessionID, turnID uuid.UUID,
	end session.TurnEnd,
) (bool, error)

Cancel records the request durably, then reaches the running turn in this process. EndRunningTurn asks the controller to end a running turn and store its terminal frame.

func (*Store) FinalizeAgentRun

func (s *Store) FinalizeAgentRun(
	ctx context.Context,
	sessionID uuid.UUID,
	agentRunID uuid.UUID,
	input session.FinalizeAgentRunInput,
) (*models.AgentRun, error)

func (*Store) FinalizeJob

func (s *Store) FinalizeJob(
	ctx context.Context,
	sessionID uuid.UUID,
	jobID uuid.UUID,
	input session.FinalizeJobInput,
) (*models.Job, error)

func (*Store) FinalizeModelCall

func (s *Store) FinalizeModelCall(
	ctx context.Context,
	sessionID uuid.UUID,
	modelRunID uuid.UUID,
	modelCallID uuid.UUID,
	input session.FinalizeModelCallInput,
) (*models.ModelCall, error)

func (*Store) FinalizeModelRun

func (s *Store) FinalizeModelRun(
	ctx context.Context,
	sessionID uuid.UUID,
	modelRunID uuid.UUID,
	input session.FinalizeModelRunInput,
) (*models.ModelRun, error)

func (*Store) FinalizeTurn

func (s *Store) FinalizeTurn(
	ctx context.Context,
	lease session.Lease,
	input session.FinalizeTurnInput,
) error

FinalizeTurn writes the turn's terminal state and ends it locally, matching the controller's store, which releases its lease on finalize. Nothing else in a worker releases a finished turn, so without this the session would look busy here forever and no event could wake it.

func (*Store) GenerationID

func (s *Store) GenerationID() uuid.UUID

GenerationID is the worker generation this store records turns under.

func (*Store) Get

func (s *Store) Get(
	ctx context.Context,
	sessionID uuid.UUID,
) (*models.Session, error)

func (*Store) GetAgentRun

func (s *Store) GetAgentRun(
	ctx context.Context,
	sessionID uuid.UUID,
	agentRunID uuid.UUID,
) (*models.AgentRun, error)

func (*Store) GetAgentRunCompaction added in v0.11.0

func (s *Store) GetAgentRunCompaction(
	ctx context.Context,
	sessionID uuid.UUID,
	agentRunID uuid.UUID,
	compactionID uuid.UUID,
) (*models.AgentRunCompaction, error)

func (*Store) GetCompaction

func (s *Store) GetCompaction(
	ctx context.Context,
	sessionID uuid.UUID,
	compactionID uuid.UUID,
) (*models.Compaction, error)

func (*Store) GetContentBlobs added in v0.26.3

func (s *Store) GetContentBlobs(
	ctx context.Context,
	hashes []string,
) (map[string][]byte, error)

GetContentBlobs reads stored blobs by hash.

func (*Store) GetContextSnapshot

func (s *Store) GetContextSnapshot(
	ctx context.Context,
	sessionID uuid.UUID,
	hash string,
) (*models.ContextSnapshot, error)

func (*Store) GetDirectoryState added in v0.24.0

func (s *Store) GetDirectoryState(
	ctx context.Context,
	sessionID uuid.UUID,
) (*session.DirectoryState, error)

func (*Store) GetExecution added in v0.25.0

func (s *Store) GetExecution(
	ctx context.Context,
	sessionID, executionID uuid.UUID,
) (*models.Execution, error)

func (*Store) GetExecutionActivity added in v0.25.0

func (s *Store) GetExecutionActivity(
	ctx context.Context,
	sessionID, activityID uuid.UUID,
) (*models.ExecutionActivity, error)

func (*Store) GetExecutionMessageByRequest added in v0.25.0

func (s *Store) GetExecutionMessageByRequest(
	ctx context.Context,
	sessionID, executionID, requestID uuid.UUID,
) (*models.ExecutionInboxMessage, error)

func (*Store) GetExecutionRootTurn added in v0.25.0

func (s *Store) GetExecutionRootTurn(
	ctx context.Context,
	sessionID, executionID uuid.UUID,
) (*models.Turn, error)

func (*Store) GetExecutionTurnLease added in v0.25.0

func (s *Store) GetExecutionTurnLease(
	ctx context.Context,
	sessionID, executionID uuid.UUID,
) (*models.ExecutionTurnLease, error)

func (*Store) GetJob

func (s *Store) GetJob(
	ctx context.Context,
	sessionID uuid.UUID,
	jobID uuid.UUID,
) (*models.Job, error)

func (*Store) GetPromptSnapshot

func (s *Store) GetPromptSnapshot(
	ctx context.Context,
	sessionID uuid.UUID,
	hash string,
) (*models.PromptSnapshot, error)

func (*Store) InterruptExecutionActivity added in v0.25.0

func (s *Store) InterruptExecutionActivity(
	ctx context.Context,
	sessionID uuid.UUID,
	lease session.ActivityLease,
) error

func (*Store) IsActive

func (s *Store) IsActive(sessionID uuid.UUID) bool

func (*Store) LatestAgentRunCompaction added in v0.11.0

func (s *Store) LatestAgentRunCompaction(
	ctx context.Context,
	sessionID uuid.UUID,
	agentRunID uuid.UUID,
) (*models.AgentRunCompaction, error)

func (*Store) LatestCompaction

func (s *Store) LatestCompaction(
	ctx context.Context,
	sessionID uuid.UUID,
) (*models.Compaction, error)

func (*Store) ListAgentRunCompactions added in v0.11.0

func (s *Store) ListAgentRunCompactions(
	ctx context.Context,
	sessionID uuid.UUID,
	agentRunID uuid.UUID,
	options session.ListAgentRunCompactionsOptions,
) (*session.AgentRunCompactionPage, error)

func (*Store) ListAgentRunEvents

func (s *Store) ListAgentRunEvents(
	ctx context.Context,
	sessionID uuid.UUID,
	agentRunID uuid.UUID,
	options session.ListAgentRunEventsOptions,
) (*session.AgentRunEventPage, error)

func (*Store) ListAgentRunMessages added in v0.11.0

func (s *Store) ListAgentRunMessages(
	ctx context.Context,
	sessionID uuid.UUID,
	agentRunID uuid.UUID,
	options session.ListAgentRunMessagesOptions,
) (*session.AgentRunMessagePage, error)

func (*Store) ListAgentRuns

func (s *Store) ListAgentRuns(
	ctx context.Context,
	sessionID uuid.UUID,
	options session.ListAgentRunsOptions,
) (*session.AgentRunPage, error)

func (*Store) ListCompactions

func (s *Store) ListCompactions(
	ctx context.Context,
	sessionID uuid.UUID,
	options session.ListCompactionsOptions,
) (*session.CompactionPage, error)

func (*Store) ListDeferredExecutionMessages added in v0.25.0

func (s *Store) ListDeferredExecutionMessages(
	ctx context.Context,
	sessionID uuid.UUID,
	options session.ListEventsOptions,
) (*session.ExecutionInboxPage, error)

func (*Store) ListEvents

func (s *Store) ListEvents(
	ctx context.Context,
	sessionID uuid.UUID,
	options session.ListEventsOptions,
) (*session.EventPage, error)

func (*Store) ListExecutionActivities added in v0.25.0

func (s *Store) ListExecutionActivities(
	ctx context.Context,
	sessionID, executionID uuid.UUID,
	options session.ListEventsOptions,
) (*session.ExecutionActivityPage, error)

func (*Store) ListExecutionEvents added in v0.25.0

func (s *Store) ListExecutionEvents(
	ctx context.Context,
	sessionID, executionID uuid.UUID,
	options session.ListEventsOptions,
) (*session.ExecutionEventPage, error)

func (*Store) ListExecutionMessages added in v0.25.0

func (s *Store) ListExecutionMessages(
	ctx context.Context,
	sessionID, executionID uuid.UUID,
	options session.ListExecutionInboxOptions,
) (*session.ExecutionInboxPage, error)

func (*Store) ListJobOutput

func (s *Store) ListJobOutput(
	ctx context.Context,
	sessionID uuid.UUID,
	jobID uuid.UUID,
	options session.ListJobOutputOptions,
) (*session.JobOutputPage, error)

func (*Store) ListJobSignalRequests

func (s *Store) ListJobSignalRequests(
	ctx context.Context,
	sessionID uuid.UUID,
	jobID uuid.UUID,
	options session.ListJobSignalRequestsOptions,
) (*session.JobSignalRequestPage, error)

func (*Store) ListJobs

func (s *Store) ListJobs(
	ctx context.Context,
	sessionID uuid.UUID,
	options session.ListJobsOptions,
) (*session.JobPage, error)

func (*Store) ListMessages

func (s *Store) ListMessages(
	ctx context.Context,
	sessionID uuid.UUID,
	options session.ListMessagesOptions,
) (*session.MessagePage, error)

func (*Store) ListModelCalls

func (s *Store) ListModelCalls(
	ctx context.Context,
	sessionID uuid.UUID,
	modelRunID uuid.UUID,
	options session.ListModelCallsOptions,
) (*session.ModelCallPage, error)

func (*Store) ListModelRuns

func (s *Store) ListModelRuns(
	ctx context.Context,
	sessionID uuid.UUID,
	options session.ListModelRunsOptions,
) (*session.ModelRunPage, error)

func (*Store) ListSessionNotices

func (s *Store) ListSessionNotices(
	ctx context.Context,
	sessionID uuid.UUID,
	options session.ListSessionNoticesOptions,
) (*session.NoticePage, error)

func (*Store) ListTurns

func (s *Store) ListTurns(
	ctx context.Context,
	sessionID uuid.UUID,
	options session.ListTurnsOptions,
) (*session.TurnPage, error)

func (*Store) OpenAgentRunQuestions added in v0.21.0

func (s *Store) OpenAgentRunQuestions(
	ctx context.Context,
	sessionID uuid.UUID,
) (map[uuid.UUID]string, error)

OpenAgentRunQuestions reads the questions the session's running children are waiting on.

func (*Store) OpenWorkspace

OpenWorkspace is a control-plane operation. Only the controller resolves a workspace to a session, because that is where the workspace policy lives.

func (*Store) PauseExecution added in v0.25.0

func (s *Store) PauseExecution(
	ctx context.Context,
	sessionID, executionID uuid.UUID,
	reason string,
) ([]uuid.UUID, error)

func (*Store) PrepareAgentRunRecovery added in v0.24.0

func (s *Store) PrepareAgentRunRecovery(
	ctx context.Context,
	sessionID, generationID uuid.UUID,
) (int, error)

func (*Store) PutContentBlobs added in v0.26.3

func (s *Store) PutContentBlobs(
	ctx context.Context,
	blobs []contentblob.Blob,
) error

PutContentBlobs stores the blobs of a compacted payload.

func (*Store) RecordJobSignal

func (s *Store) RecordJobSignal(
	ctx context.Context,
	sessionID uuid.UUID,
	jobID uuid.UUID,
	input session.RecordJobSignalInput,
) (*models.JobSignalRequest, error)

func (*Store) RecordModelCallRetries

func (s *Store) RecordModelCallRetries(
	ctx context.Context,
	sessionID uuid.UUID,
	modelRunID uuid.UUID,
	modelCallID uuid.UUID,
	input session.RecordModelCallRetriesInput,
) error

func (*Store) RecordTurnWorkerGeneration

func (s *Store) RecordTurnWorkerGeneration(
	ctx context.Context,
	lease session.Lease,
	generationID uuid.UUID,
) error

RecordTurnWorkerGeneration names this worker as the process that ran a turn. The controller refuses any generation but this worker's own.

func (*Store) RecoverInterrupted

func (s *Store) RecoverInterrupted(_ context.Context) (int, error)

func (*Store) RecoverInterruptedAgentRuns

func (s *Store) RecoverInterruptedAgentRuns(
	_ context.Context,
) (int, error)

func (*Store) RecoverInterruptedJobs

func (s *Store) RecoverInterruptedJobs(_ context.Context) (int, error)

func (*Store) RecoverInterruptedModelRuns

func (s *Store) RecoverInterruptedModelRuns(
	_ context.Context,
) (int, error)

func (*Store) RegisterCancellation

func (s *Store) RegisterCancellation(
	lease session.Lease,
	cancel context.CancelFunc,
)

RegisterCancellation attaches this process's cancellation to a live lease. A cancellation that already arrived fires immediately, so a turn cancelled between acquiring the lease and starting work does not run anyway.

func (*Store) ReleaseTurn

func (s *Store) ReleaseTurn(lease session.Lease)

ReleaseTurn drops the local lease and waits for the controller to drop its own, so the next accepted message is not refused as busy.

func (*Store) RequestAgentRunCancellation

func (s *Store) RequestAgentRunCancellation(
	ctx context.Context,
	sessionID uuid.UUID,
	agentRunID uuid.UUID,
) (*models.AgentRun, bool, error)

func (*Store) RequestLocalCancellation

func (s *Store) RequestLocalCancellation(sessionID uuid.UUID) bool

RequestLocalCancellation fires the running turn's cancellation without a durable write. The controller calls it through the cancel command, which it sends after it has already recorded the request.

func (*Store) ReserveExecutionCompletion added in v0.25.0

func (s *Store) ReserveExecutionCompletion(
	ctx context.Context,
	sessionID uuid.UUID,
	lease session.ActivityLease,
) (*session.ExecutionCompletionSeal, error)

func (*Store) ResolveExecutionActivity added in v0.25.0

func (s *Store) ResolveExecutionActivity(
	ctx context.Context,
	sessionID, activityID uuid.UUID,
	input session.ResolveActivityInput,
) (*models.ExecutionActivity, error)

func (*Store) ResolveExecutionActivityFromActivity added in v0.25.0

func (s *Store) ResolveExecutionActivityFromActivity(
	ctx context.Context,
	sessionID, activityID uuid.UUID,
	input session.ResolveExecutionControlInput,
) (*models.ExecutionActivity, error)

func (*Store) RestoreExecutionTurn added in v0.25.0

func (s *Store) RestoreExecutionTurn(
	ctx context.Context,
	sessionID, executionID uuid.UUID,
	input session.RestoreExecutionTurnInput,
) (session.Lease, error)

func (*Store) ResumeExecution added in v0.25.0

func (s *Store) ResumeExecution(
	ctx context.Context,
	sessionID, executionID uuid.UUID,
) ([]uuid.UUID, error)

func (*Store) ResumeExecutionFromActivity added in v0.25.0

func (s *Store) ResumeExecutionFromActivity(
	ctx context.Context,
	sessionID, executionID uuid.UUID,
	input session.ResumeExecutionInput,
) ([]uuid.UUID, error)

func (*Store) SaveContextSnapshot

func (s *Store) SaveContextSnapshot(
	ctx context.Context,
	snapshot *models.ContextSnapshot,
) error

func (*Store) SavePromptSnapshot

func (s *Store) SavePromptSnapshot(
	ctx context.Context,
	snapshot *models.PromptSnapshot,
) error

func (*Store) SearchExecutions added in v0.25.0

func (s *Store) SearchExecutions(
	ctx context.Context,
	sessionID uuid.UUID,
	options session.SearchExecutionsOptions,
) (*session.ExecutionPage, error)

func (*Store) UpdateWorkerGenerationState

func (s *Store) UpdateWorkerGenerationState(
	_ context.Context,
	_ uuid.UUID,
	_ string,
	_ string,
) error

type TurnOrigin added in v0.15.1

type TurnOrigin struct {
	EventID   uuid.UUID `json:"eventId"`
	EventType string    `json:"eventType"`
}

TurnOrigin names the session event that started a turn.

type TurnResult

type TurnResult struct {
	Text   string `json:"text"`
	Queued bool   `json:"queued"`
}

TurnResult is the worker's answer to a runTurn command.

type Worker

type Worker struct {
	SessionID    uuid.UUID
	GenerationID uuid.UUID
	// contains filtered or unexported fields
}

Worker is a registered worker as the controller holds it.

func (*Worker) Cancel

func (w *Worker) Cancel(ctx context.Context) (bool, error)

Cancel asks the worker to cancel its session's active turn.

func (*Worker) CancelAgentRun added in v0.21.0

func (w *Worker) CancelAgentRun(
	ctx context.Context,
	agentRunID uuid.UUID,
) (bool, error)

CancelAgentRun asks the worker to stop one running child agent. False means this worker holds no such running child.

func (*Worker) Disconnect

func (w *Worker) Disconnect()

Disconnect drops the connection without waiting for the worker.

func (*Worker) Done

func (w *Worker) Done() <-chan struct{}

Done closes when the worker's connection ends.

func (*Worker) RunTurn

func (w *Worker) RunTurn(
	ctx context.Context,
	request RunTurn,
) (TurnResult, error)

RunTurn hands one accepted user message to the worker and waits for its answer.

func (*Worker) Shutdown

func (w *Worker) Shutdown(ctx context.Context) error

Shutdown asks the worker to finish and exit.

func (*Worker) SignalJob

func (w *Worker) SignalJob(
	ctx context.Context,
	jobID uuid.UUID,
	signal string,
) (SignalJobResult, error)

SignalJob asks the worker to signal one of its running jobs.

A worker that no longer holds the job answers Handled false rather than an error, because the job may have exited between the caller's read and this command.

type WorkflowBackend added in v0.25.0

type WorkflowBackend struct {
	// contains filtered or unexported fields
}

WorkflowBackend runs the native workflow worker over its authenticated controller connection. It never opens or closes controller storage.

func NewWorkflowBackend added in v0.25.0

func NewWorkflowBackend(conn *Conn, sessionID uuid.UUID) *WorkflowBackend

NewWorkflowBackend compacts every payload it encodes, so a turn's history carries each long string once instead of in every event. A history that repeated the turn context in full grew with the square of the turn's rounds and eventually exceeded the frame limit of the history read.

func (*WorkflowBackend) CancelWorkflowInstance added in v0.25.0

func (b *WorkflowBackend) CancelWorkflowInstance(
	ctx context.Context,
	instance *workflow.Instance,
	event *history.Event,
) error

func (*WorkflowBackend) Close added in v0.25.0

func (b *WorkflowBackend) Close() error

func (*WorkflowBackend) CompleteActivityTask added in v0.25.0

func (b *WorkflowBackend) CompleteActivityTask(
	ctx context.Context,
	task *backend.ActivityTask,
	result *history.Event,
) error

func (*WorkflowBackend) CompleteWorkflowTask added in v0.25.0

func (b *WorkflowBackend) CompleteWorkflowTask(
	ctx context.Context,
	task *backend.WorkflowTask,
	state core.WorkflowInstanceState,
	executed, activities, timers []*history.Event,
	targets []*history.WorkflowEvent,
) error

func (*WorkflowBackend) CreateWorkflowInstance added in v0.25.0

func (b *WorkflowBackend) CreateWorkflowInstance(
	ctx context.Context,
	instance *workflow.Instance,
	event *history.Event,
) error

func (*WorkflowBackend) ExtendActivityTask added in v0.25.0

func (b *WorkflowBackend) ExtendActivityTask(
	ctx context.Context,
	task *backend.ActivityTask,
) error

func (*WorkflowBackend) ExtendWorkflowTask added in v0.25.0

func (b *WorkflowBackend) ExtendWorkflowTask(
	ctx context.Context,
	task *backend.WorkflowTask,
) error

func (*WorkflowBackend) FeatureSupported added in v0.25.0

func (b *WorkflowBackend) FeatureSupported(_ backend.Feature) bool

func (*WorkflowBackend) GetActivityTask added in v0.25.0

func (b *WorkflowBackend) GetActivityTask(
	ctx context.Context,
	queues []workflow.Queue,
) (*backend.ActivityTask, error)

func (*WorkflowBackend) GetStats added in v0.25.0

func (b *WorkflowBackend) GetStats(_ context.Context) (*backend.Stats, error)

func (*WorkflowBackend) GetWorkflowInstanceHistory added in v0.25.0

func (b *WorkflowBackend) GetWorkflowInstanceHistory(
	ctx context.Context,
	instance *workflow.Instance,
	lastSequenceID *int64,
) ([]*history.Event, error)

func (*WorkflowBackend) GetWorkflowInstanceState added in v0.25.0

func (b *WorkflowBackend) GetWorkflowInstanceState(
	ctx context.Context,
	instance *workflow.Instance,
) (core.WorkflowInstanceState, error)

func (*WorkflowBackend) GetWorkflowTask added in v0.25.0

func (b *WorkflowBackend) GetWorkflowTask(
	ctx context.Context,
	queues []workflow.Queue,
) (*backend.WorkflowTask, error)

func (*WorkflowBackend) Metrics added in v0.25.0

func (b *WorkflowBackend) Metrics() metrics.Client

func (*WorkflowBackend) Options added in v0.25.0

func (b *WorkflowBackend) Options() *backend.Options

func (*WorkflowBackend) PrepareActivityQueues added in v0.25.0

func (b *WorkflowBackend) PrepareActivityQueues(
	ctx context.Context,
	queues []workflow.Queue,
) error

func (*WorkflowBackend) PrepareWorkflowQueues added in v0.25.0

func (b *WorkflowBackend) PrepareWorkflowQueues(
	ctx context.Context,
	queues []workflow.Queue,
) error

func (*WorkflowBackend) ReleaseClaims added in v0.32.0

func (b *WorkflowBackend) ReleaseClaims(ctx context.Context) error

ReleaseClaims ends this worker's waiting task claims on the controller. Call it once the worker has stopped polling, before it drains, so no claim wakes afterwards and locks a task nobody will run.

func (*WorkflowBackend) RemoveWorkflowInstance added in v0.25.0

func (b *WorkflowBackend) RemoveWorkflowInstance(
	_ context.Context,
	_ *workflow.Instance,
) error

func (*WorkflowBackend) RemoveWorkflowInstances added in v0.25.0

func (b *WorkflowBackend) RemoveWorkflowInstances(
	_ context.Context,
	_ ...backend.RemovalOption,
) error

func (*WorkflowBackend) SignalWorkflow added in v0.25.0

func (b *WorkflowBackend) SignalWorkflow(
	ctx context.Context,
	instanceID string,
	event *history.Event,
) error

func (*WorkflowBackend) Tracer added in v0.25.0

func (b *WorkflowBackend) Tracer() trace.Tracer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL