Documentation
¶
Overview ¶
Package client provides opt-in task-aware calls. It never retries an original tools/call or a failed mutation, and disconnect never means task cancellation.
Index ¶
- Variables
- type Attempt
- type Client
- func (c *Client) CallTool(ctx context.Context, params *schema.CallToolRequestParams) (ToolOutcome, error)
- func (c *Client) Cancel(ctx context.Context, id string) error
- func (c *Client) Discover(ctx context.Context) (*schema.DiscoverResult, error)
- func (c *Client) Get(ctx context.Context, id string) (tasks.GetTaskResult, error)
- func (c *Client) Subscribe(ctx context.Context, ids []string, options SubscriptionOptions) error
- func (c *Client) Update(ctx context.Context, id string, responses tasks.InputResponses) error
- func (c *Client) Wait(ctx context.Context, id string, options WaitOptions) (json.RawMessage, error)
- type Cursor
- type InputHandler
- type InputRequiredError
- type Options
- type SubscriptionOptions
- type ToolOutcome
- type UncertainError
- type WaitOptions
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Attempt ¶
type Attempt struct {
Fingerprint string `json:"fingerprint"`
Stage string `json:"stage"`
Response json.RawMessage `json:"response,omitempty"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CallTool ¶
func (c *Client) CallTool(ctx context.Context, params *schema.CallToolRequestParams) (ToolOutcome, error)
CallTool preserves normal and MRTR results verbatim; a task handle is exposed separately. It sends exactly one original request and never asks for a task.
func (*Client) Subscribe ¶
Subscribe observes full canonical state and never handles inputs or cancels tasks. A dropped transport reconnects at most MaxReconnects times; each new subscription gets a fresh ID and a fresh server snapshot, not cursor replay.
func (*Client) Wait ¶
func (c *Client) Wait(ctx context.Context, id string, options WaitOptions) (json.RawMessage, error)
type Cursor ¶
type Cursor struct {
TaskID string `json:"taskId"`
CreatedAt time.Time `json:"createdAt"`
Attempts map[string]Attempt `json:"attempts"`
}
Cursor must be persisted by SaveCursor before external input handling/update when crash recovery is required. Reuse it to resume; do not replay CallTool.
type InputHandler ¶
type InputHandler func(context.Context, string, tasks.InputRequest) (json.RawMessage, error)
type InputRequiredError ¶
type InputRequiredError struct{ Task tasks.GetTaskResult }
func (*InputRequiredError) Error ¶
func (e *InputRequiredError) Error() string
type SubscriptionOptions ¶
type ToolOutcome ¶
type ToolOutcome struct {
Result json.RawMessage
Task *tasks.CreateTaskResult
}
type UncertainError ¶
func (*UncertainError) Error ¶
func (e *UncertainError) Error() string
func (*UncertainError) Unwrap ¶
func (e *UncertainError) Unwrap() error
type WaitOptions ¶
type WaitOptions struct {
Cursor *Cursor
Initial *tasks.Task
Input InputHandler
SaveCursor func(context.Context, Cursor) error
OnState func(tasks.GetTaskResult)
}