client

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func Dial

func Dial(socketPath string) (*Client, error)

func (*Client) AnswerPermission

func (c *Client) AnswerPermission(runtimeID, requestID, optionID string) error

AnswerPermission answers a pending permission request.

func (*Client) AnswerPermissionWithMessage added in v0.23.0

func (c *Client) AnswerPermissionWithMessage(runtimeID, requestID, optionID, message string) error

AnswerPermissionWithMessage answers a pending permission request with an optional write-in message. Only non-empty messages are included in the JSON payload, preserving backward compatibility.

func (*Client) Call

func (c *Client) Call(method string, params any, result any) error

func (*Client) Cancel

func (c *Client) Cancel(runtimeID string) error

Cancel cancels the one-shot run or a specific runtime if runtimeID is set.

func (*Client) Close

func (c *Client) Close() error

func (*Client) Events

func (c *Client) Events() <-chan Event

Events returns a channel of server-sent events. Only one subscriber is supported. Call before any Call() to avoid missing events.

func (*Client) Identity added in v0.21.5

func (c *Client) Identity() (string, error)

Identity returns the per-process control-server token, when configured. It is used internally to distinguish a newly spawned supervisor from a replacement that reused its socket path.

func (*Client) InterruptAndPrompt

func (c *Client) InterruptAndPrompt(runtimeID, text string, keepQueue bool) error

InterruptAndPrompt cancels the current turn and starts a new prompt.

func (*Client) List

func (c *Client) List() ([]map[string]any, error)

List returns all active runtimes from the stable supervisor.

func (*Client) Prompt

func (c *Client) Prompt(runtimeID, text string) error

Prompt sends a follow-up prompt to the one-shot session or a runtime.

func (*Client) PromptWithRequestID added in v0.14.0

func (c *Client) PromptWithRequestID(runtimeID, text, requestID string) error

PromptWithRequestID sends a follow-up prompt with an optional child-question request ID.

func (*Client) Result added in v0.21.1

func (c *Client) Result(runtimeID string) (map[string]any, error)

Result returns the complete terminal reply. Unlike Status, this explicit retrieval path is not bounded for lifecycle presentation.

func (*Client) SendToParent added in v0.14.0

func (c *Client) SendToParent(runtimeID, message string) error

SendToParent sends a message from a child runtime to its parent.

func (*Client) Shutdown

func (c *Client) Shutdown(mode string) error

Shutdown shuts down the stable supervisor.

func (*Client) Spawn

func (c *Client) Spawn(params map[string]any) (map[string]any, error)

Spawn creates a new runtime in the stable supervisor.

func (*Client) Status

func (c *Client) Status(runtimeID string) (map[string]any, error)

Status returns the snapshot for the one-shot run or a runtime if runtimeID is set.

func (*Client) SubscribeRuntime added in v0.14.0

func (c *Client) SubscribeRuntime(ctx context.Context, runtimeID string) <-chan Event

SubscribeRuntime returns a channel of events filtered to a specific runtime. The caller must drain the channel. The channel closes when ctx is done or the underlying event channel is closed. Calling SubscribeRuntime ensures the readLoop is started.

func (*Client) WorkflowCommand added in v0.28.0

func (c *Client) WorkflowCommand(workflowID string, command json.RawMessage) (map[string]any, error)

WorkflowCommand sends a raw command payload to a workflow instance.

func (*Client) WorkflowComplete added in v0.28.0

func (c *Client) WorkflowComplete(workflowID string, fields map[string]any) (map[string]any, error)

WorkflowComplete atomically completes a machine/external handoff activation (op "complete").

func (*Client) WorkflowCreate added in v0.28.0

func (c *Client) WorkflowCreate(template json.RawMessage) (map[string]any, error)

WorkflowCreate stores a workflow template given as raw template JSON.

func (*Client) WorkflowEvents added in v0.28.0

func (c *Client) WorkflowEvents(workflowID string, afterSeq int64, limit int) (map[string]any, error)

WorkflowEvents returns log events with Sequence > afterSeq, capped at limit.

func (*Client) WorkflowGate added in v0.28.0

func (c *Client) WorkflowGate(workflowID string, fields map[string]any) (map[string]any, error)

WorkflowGate records a gate decision on a parked awaiting_gate activation (op "gate"); fields carry node_id, activation_id, gate_id, operation, and the operation's required fields (actor/reason/evidence for human ops, the external result envelope for external_result).

func (*Client) WorkflowInspect added in v0.28.0

func (c *Client) WorkflowInspect(workflowID string) (map[string]any, error)

WorkflowInspect returns the full instance detail for a workflow.

func (*Client) WorkflowInstantiate added in v0.28.0

func (c *Client) WorkflowInstantiate(templateID, templateVersion string, metadata map[string]any) (map[string]any, error)

WorkflowInstantiate creates a workflow instance from a stored template.

func (*Client) WorkflowSkip added in v0.28.0

func (c *Client) WorkflowSkip(workflowID string, fields map[string]any) (map[string]any, error)

WorkflowSkip waives every unsatisfied required gate on a parked awaiting_gate activation (op "skip"); fields carry node_id, actor, reason, evidence_ids, and optionally activation_id.

func (*Client) WorkflowStatus added in v0.28.0

func (c *Client) WorkflowStatus(workflowID string) (map[string]any, error)

WorkflowStatus returns the lightweight status for a workflow instance.

func (*Client) WorkflowUnblock added in v0.28.0

func (c *Client) WorkflowUnblock(workflowID string, fields map[string]any) (map[string]any, error)

WorkflowUnblock returns a blocked activation to ready (op "unblock"); fields carry node_id, actor, reason, and optionally activation_id.

func (*Client) WorkflowWait added in v0.28.0

func (c *Client) WorkflowWait(workflowID string, timeout time.Duration) (map[string]any, error)

WorkflowWait polls until the workflow is terminal or timeout elapses. A timeout <= 0 returns after the first poll; the server defaults to 5s.

type Event

type Event struct {
	Event     string         `json:"event"`
	SessionID string         `json:"session_id,omitempty"`
	RuntimeID string         `json:"runtime_id,omitempty"`
	Raw       map[string]any `json:"-"`
}

func (*Event) UnmarshalJSON

func (e *Event) UnmarshalJSON(data []byte) error

type Notification

type Notification struct {
	JSONRPC string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

type Request

type Request struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      any             `json:"id,omitempty"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

type RespError

type RespError struct {
	Code    int             `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data,omitempty"`
}

type Response

type Response struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      any             `json:"id"`
	Result  json.RawMessage `json:"result,omitempty"`
	Error   *RespError      `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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