client

package
v0.20.3 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 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) 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) 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) 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.

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