Versions in this module Expand all Collapse all v0 v0.0.4 Nov 26, 2026 Changes in this version + var ErrEmptyCWD = ErrEmptyWorkspace + var ErrEmptySessionID = errors.New("client: session ID must not be empty") + var ErrEmptySubscriberID = errors.New("client: subscriber ID must not be empty") + var ErrEmptyWorkspace = errors.New("client: workspace path must not be empty") + var ErrInvalidSocketPath = errors.New("client: socket path must not be empty") + var ErrNeedSync = errors.New("client: stream out of sync") + var ErrSSEIdle = errors.New("client: sse stream idle") + var SpawnWaitTimeout = 15 * time.Second + func DaemonVersionSkewed(h *api.HealthResponse) bool + func DefaultLockPath() (string, error) + func DefaultSocketPath() (string, error) + func HasActiveSessions(sessions []api.Session) bool + func IsCapabilityMismatch(err error) (*api.APIError, bool) + func IsDaemonHealthy(ctx context.Context, c *Client) bool + func IsNeedSync(err error) bool + func LockPathForSocket(socketPath string) string + func NewCursor() string + func SpawnLogHint() string + func WaitForSocketHealthy(ctx context.Context, socketPath string, spawned *SpawnedDaemon, ...) (*api.HealthResponse, error) + func WaitForSocketLockRelease(ctx context.Context, socketPath string) error + type Client struct + func ConnectOrStart(ctx context.Context, socketPath string, spawnArgs ...string) (*Client, []string, error) + func New(socketPath string, opts ...Option) (*Client, error) + func (c *Client) AddPermissionRule(ctx context.Context, req api.PermissionRuleRequest) (*api.PermissionsResponse, error) + func (c *Client) AllowMCPPolicy(ctx context.Context, server string, req api.MCPAllowPolicyRequest) (api.MCPServer, error) + func (c *Client) AssignModelAliases(ctx context.Context, req api.AssignModelAliasesRequest) (api.AssignModelAliasesResponse, error) + func (c *Client) AuthenticateMCP(ctx context.Context, name string) (api.MCPAuthResponse, error) + func (c *Client) CWD() string + func (c *Client) Cancel(ctx context.Context, sessionID string) error + func (c *Client) Changes(ctx context.Context, sessionID string) ([]api.FileChange, error) + func (c *Client) CompleteMCPAuth(ctx context.Context, name string, req api.MCPAuthCallbackRequest) error + func (c *Client) CompleteProviderAuth(ctx context.Context, provider string, req api.ProviderAuthCallbackRequest) (*api.ProviderAuthResponse, error) + func (c *Client) CreateProvider(ctx context.Context, req api.CreateProviderRequest) (api.WorkspaceProvider, error) + func (c *Client) CreateSession(ctx context.Context, req api.CreateSessionRequest) (*api.Session, error) + func (c *Client) DeleteSession(ctx context.Context, sessionID string) error + func (c *Client) DiffChange(ctx context.Context, sessionID, filePath, entryID string) (string, error) + func (c *Client) Events(ctx context.Context, subscriberID, since string, topics ...string) iter.Seq2[api.Event, error] + func (c *Client) EventsWithReady(ctx context.Context, subscriberID, since string, ...) iter.Seq2[api.Event, error] + func (c *Client) ForkSession(ctx context.Context, sessionID string, req api.ForkSessionRequest) (*api.Session, error) + func (c *Client) GetAgent(ctx context.Context, name string) (*api.Agent, error) + func (c *Client) GetCommand(ctx context.Context, name string) (*api.Command, error) + func (c *Client) GetMCPPrompt(ctx context.Context, server, prompt string, req api.MCPPromptRequest) (api.MCPPromptResponse, error) + func (c *Client) GetModel(ctx context.Context, id string) (*api.Model, error) + func (c *Client) GetModelQuota(ctx context.Context, model string) (*api.ModelQuota, error) + func (c *Client) GetProviderAuthStatus(ctx context.Context, provider string) (*api.ProviderAuthResponse, error) + func (c *Client) GetQuotaSnapshots(ctx context.Context) (*api.QuotaSnapshotResponse, error) + func (c *Client) GetSandbox(ctx context.Context) (*api.SandboxResponse, error) + func (c *Client) GetSession(ctx context.Context, sessionID string) (*api.Session, error) + func (c *Client) GetSkill(ctx context.Context, name string) (*api.Skill, error) + func (c *Client) GetTrustStatus(ctx context.Context) (*api.TrustStatus, error) + func (c *Client) GetWorkspace(ctx context.Context) (*api.Workspace, error) + func (c *Client) GetWorkspaceStatus(ctx context.Context) (*api.WorkspaceStatus, error) + func (c *Client) Health(ctx context.Context) (*api.HealthResponse, error) + func (c *Client) InitWorkspace(ctx context.Context, req api.InitWorkspaceRequest) error + func (c *Client) InitWorkspaceWithResult(ctx context.Context, req api.InitWorkspaceRequest) (api.InitWorkspaceResponse, error) + func (c *Client) KillTask(ctx context.Context, sessionID, taskID string) error + func (c *Client) LatestSession(ctx context.Context) (*api.Session, error) + func (c *Client) ListAgents(ctx context.Context) ([]api.Agent, error) + func (c *Client) ListAliasAssignments(ctx context.Context) ([]api.AliasAssignment, error) + func (c *Client) ListCommands(ctx context.Context) ([]api.Command, error) + func (c *Client) ListMCPs(ctx context.Context) ([]api.MCPServer, error) + func (c *Client) ListModels(ctx context.Context) ([]api.Model, error) + func (c *Client) ListProviderCatalog(ctx context.Context, name string) ([]api.ProviderCatalogEntry, error) + func (c *Client) ListProviders(ctx context.Context) ([]api.ProviderSummary, error) + func (c *Client) ListRules(ctx context.Context) ([]api.Rule, error) + func (c *Client) ListSessions(ctx context.Context) ([]api.Session, error) + func (c *Client) ListSkills(ctx context.Context) ([]api.Skill, error) + func (c *Client) ListTools(ctx context.Context, agent string) ([]api.Tool, error) + func (c *Client) ListWorkspaceFiles(ctx context.Context, req api.ListFilesRequest) ([]api.WorkspaceFile, error) + func (c *Client) ListWorkspaceProviders(ctx context.Context) ([]api.WorkspaceProvider, error) + func (c *Client) LogoutProviderAuth(ctx context.Context, provider string) (*api.ProviderAuthResponse, error) + func (c *Client) Permissions(ctx context.Context) (*api.PermissionsResponse, error) + func (c *Client) PreviewSession(ctx context.Context, req api.PreviewSessionRequest) (*api.SessionPreview, error) + func (c *Client) QueryMetrics(ctx context.Context, q api.MetricsQuery) (api.MetricsResult, error) + func (c *Client) ReadMCPResource(ctx context.Context, server string, req api.MCPResourceRequest) (api.MCPResourceResponse, error) + func (c *Client) ReloadWorkspace(ctx context.Context) error + func (c *Client) RemovePermissionRule(ctx context.Context, req api.PermissionRuleRequest) (*api.PermissionsResponse, error) + func (c *Client) RestartMCP(ctx context.Context, name string) (api.MCPServer, error) + func (c *Client) Revert(ctx context.Context, sessionID string, req api.RevertRequest) error + func (c *Client) RevokeTrust(ctx context.Context) error + func (c *Client) Send(ctx context.Context, sessionID string, req api.SendRequest) error + func (c *Client) SessionUsage(ctx context.Context, sessionID string) (api.SessionUsage, error) + func (c *Client) SetMCPEnabled(ctx context.Context, name string, enabled bool) ([]api.MCPServer, error) + func (c *Client) SetProviderEnabled(ctx context.Context, name string, enabled bool) ([]api.WorkspaceProvider, error) + func (c *Client) SetToolEnabled(ctx context.Context, name string, enabled bool) ([]api.Tool, error) + func (c *Client) Shutdown(ctx context.Context) error + func (c *Client) SocketPath() string + func (c *Client) StartProviderAuth(ctx context.Context, provider string) (*api.ProviderAuthResponse, error) + func (c *Client) StreamTaskOutput(ctx context.Context, sessionID, taskID string) iter.Seq2[string, error] + func (c *Client) Subscribe(ctx context.Context, subscriberID, since string, topics ...string) (*api.SubscriptionResponse, error) + func (c *Client) Tasks(ctx context.Context, sessionID string) ([]api.Task, error) + func (c *Client) Timeline(ctx context.Context, sessionID string) ([]api.TimelineEntry, error) + func (c *Client) TrustWorkspace(ctx context.Context, scope string) error + func (c *Client) Unsubscribe(ctx context.Context, subscriberID string, topics ...string) (*api.SubscriptionResponse, error) + func (c *Client) UpdateProviderModels(ctx context.Context, name string, req api.UpdateProviderModelsRequest) ([]api.WorkspaceProvider, error) + func (c *Client) UpdateSandbox(ctx context.Context, req api.UpdateSandboxRequest) (*api.SandboxResponse, error) + func (c *Client) UpdateSession(ctx context.Context, sessionID string, req api.UpdateSessionRequest) (*api.Session, error) + func (c *Client) UploadMedia(ctx context.Context, sessionID string, data []byte, mimeType, filename string) (*api.Media, error) + func (c *Client) Usage(ctx context.Context, req api.UsageRequest) (api.UsageSummary, error) + func (c *Client) VerifyProvider(ctx context.Context, req api.VerifyProviderRequest) (*api.VerifyProviderResponse, error) + func (c *Client) Watch(ctx context.Context, since string, topics ...string) iter.Seq2[api.Event, error] + func (c *Client) WithCWD(cwd string) *Client + type Option func(*Client) + func WithCWD(cwd string) Option + func WithHTTPClient(hc *http.Client) Option + func WithSSEIdleTimeout(d time.Duration) Option + type SpawnedDaemon struct + Done <-chan struct{} + PID int + func SpawnDetached(socketPath string, spawnArgs ...string) (*SpawnedDaemon, error) + func SpawnDetachedWithLog(socketPath, stderrPath string, spawnArgs ...string) (*SpawnedDaemon, error)