Documentation
¶
Index ¶
- Constants
- func IsAPIError(err error, code string) bool
- func NormalizeBaseURL(value string) (string, error)
- type Account
- type Capability
- type CapabilityList
- type Client
- func (c *Client) CancelTask(ctx context.Context, daemonID, taskID, idempotencyKey string) (TaskEnvelope, error)
- func (c *Client) Capabilities(ctx context.Context) (CapabilityList, error)
- func (c *Client) CreateDeviceAuthorization(ctx context.Context, scopes []string, lifetime string) (DeviceAuthorization, error)
- func (c *Client) CreateTask(ctx context.Context, daemonID string, task TaskRequest, idempotencyKey string) (TaskEnvelope, error)
- func (c *Client) DestroyDaemon(ctx context.Context, daemonID, etag, idempotencyKey string) (OperationEnvelope, error)
- func (c *Client) LifecycleDaemon(ctx context.Context, daemonID, action, idempotencyKey string) (OperationEnvelope, error)
- func (c *Client) ListDaemons(ctx context.Context) (DaemonList, error)
- func (c *Client) ListFiles(ctx context.Context, daemonID, workspacePath, cursor string, limit int) (FileList, error)
- func (c *Client) ListLogs(ctx context.Context, daemonID, source, level, cursor string, limit int) (LogList, error)
- func (c *Client) ListOperations(ctx context.Context, limit int) (OperationList, error)
- func (c *Client) ListServers(ctx context.Context) (ServerList, error)
- func (c *Client) ListTasks(ctx context.Context, daemonID string, limit int) (TaskList, error)
- func (c *Client) Logout(ctx context.Context, idempotencyKey string) error
- func (c *Client) Me(ctx context.Context) (Me, error)
- func (c *Client) MintTicket(ctx context.Context, daemonID, session string, cols, rows int) (Ticket, error)
- func (c *Client) PollDeviceAuthorization(ctx context.Context, code string) (DeviceAuthorizationStatus, error)
- func (c *Client) Preflight(ctx context.Context) error
- func (c *Client) ResolveDaemon(ctx context.Context, value string) (Daemon, error)
- func (c *Client) ResolveServer(ctx context.Context, value string) (Server, error)
- func (c *Client) ShowDaemon(ctx context.Context, daemonID string) (DaemonEnvelope, error)
- func (c *Client) ShowOperation(ctx context.Context, operationID string) (OperationEnvelope, error)
- func (c *Client) ShowServer(ctx context.Context, serverID string) (ServerEnvelope, error)
- func (c *Client) ShowTask(ctx context.Context, daemonID, taskID string) (TaskEnvelope, error)
- func (c *Client) SpawnDaemon(ctx context.Context, spawn SpawnRequest, idempotencyKey string) (DaemonSpawnEnvelope, error)
- func (c *Client) Upload(ctx context.Context, daemonID, filename string, file *os.File) (UploadResponse, error)
- type Daemon
- type DaemonEnvelope
- type DaemonList
- type DaemonSpawnEnvelope
- type DeviceAuthorization
- type DeviceAuthorizationStatus
- type FileEntry
- type FileList
- type LogLine
- type LogList
- type Me
- type Operation
- type OperationEnvelope
- type OperationList
- type Option
- type Server
- type ServerEnvelope
- type ServerList
- type SpawnRequest
- type Task
- type TaskEnvelope
- type TaskList
- type TaskRequest
- type Ticket
- type TokenInfo
- type UploadResponse
- type WireInt
Constants ¶
const ( APIVersion = 1 DefaultBaseURL = "https://daemons.run/api/v1" )
Variables ¶
This section is empty.
Functions ¶
func IsAPIError ¶
func NormalizeBaseURL ¶
Types ¶
type Capability ¶
type CapabilityList ¶
type CapabilityList struct {
Data []Capability `json:"data"`
Meta map[string]any `json:"meta"`
Raw json.RawMessage `json:"-"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CancelTask ¶
func (*Client) Capabilities ¶
func (c *Client) Capabilities(ctx context.Context) (CapabilityList, error)
func (*Client) CreateDeviceAuthorization ¶
func (*Client) CreateTask ¶
func (c *Client) CreateTask(ctx context.Context, daemonID string, task TaskRequest, idempotencyKey string) (TaskEnvelope, error)
func (*Client) DestroyDaemon ¶
func (c *Client) DestroyDaemon(ctx context.Context, daemonID, etag, idempotencyKey string) (OperationEnvelope, error)
DestroyDaemon sends the conditional delete. The caller supplies the ETag captured from ShowDaemon; an empty ETag sends no If-Match and lets the server reject the unconditional request.
func (*Client) LifecycleDaemon ¶
func (*Client) ListDaemons ¶
func (c *Client) ListDaemons(ctx context.Context) (DaemonList, error)
func (*Client) ListFiles ¶
func (c *Client) ListFiles(ctx context.Context, daemonID, workspacePath, cursor string, limit int) (FileList, error)
ListFiles reads one page of a workspace directory listing. The cursor is opaque and comes from the previous page's meta.next_cursor.
func (*Client) ListLogs ¶
func (c *Client) ListLogs(ctx context.Context, daemonID, source, level, cursor string, limit int) (LogList, error)
ListLogs reads one bounded, server-redacted log snapshot. The source is validated by the caller against the closed set the server accepts.
func (*Client) ListOperations ¶
func (*Client) ListServers ¶
func (c *Client) ListServers(ctx context.Context) (ServerList, error)
func (*Client) MintTicket ¶
func (*Client) PollDeviceAuthorization ¶
func (*Client) ResolveDaemon ¶
func (*Client) ResolveServer ¶
ResolveServer accepts a server UUID or exact name. Names are matched exactly against the account's server list; there is no prefix matching.
func (*Client) ShowDaemon ¶
func (*Client) ShowOperation ¶
func (*Client) ShowServer ¶
func (*Client) SpawnDaemon ¶
func (c *Client) SpawnDaemon(ctx context.Context, spawn SpawnRequest, idempotencyKey string) (DaemonSpawnEnvelope, error)
type Daemon ¶
type Daemon struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
PrimaryAgent string `json:"primary_agent"`
Server struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
} `json:"server"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type DaemonEnvelope ¶
type DaemonList ¶
type DaemonList struct {
Data []Daemon `json:"data"`
Meta map[string]any `json:"meta"`
Raw json.RawMessage `json:"-"`
}
type DaemonSpawnEnvelope ¶
type DaemonSpawnEnvelope struct {
Data Daemon `json:"data"`
Meta struct {
Operation Operation `json:"operation"`
} `json:"meta"`
Raw json.RawMessage `json:"-"`
}
DaemonSpawnEnvelope is the 202 document returned by POST /daemons: the new daemon plus the spawn Operation carried in meta.
type DeviceAuthorization ¶
type DeviceAuthorization struct {
Data struct {
DeviceCode string `json:"device_code"`
VerificationURL string `json:"verification_url"`
ExpiresAt string `json:"expires_at"`
IntervalSeconds WireInt `json:"interval_seconds"`
} `json:"data"`
Meta map[string]any `json:"meta"`
Raw json.RawMessage `json:"-"`
}
type FileList ¶
type FileList struct {
Data []FileEntry `json:"data"`
Meta struct {
NextCursor *string `json:"next_cursor"`
} `json:"meta"`
Raw json.RawMessage `json:"-"`
}
type LogList ¶
type LogList struct {
Data []LogLine `json:"data"`
Meta struct {
NextCursor *string `json:"next_cursor"`
} `json:"meta"`
Raw json.RawMessage `json:"-"`
}
type Operation ¶
type Operation struct {
ID string `json:"id"`
Type string `json:"type"`
Status string `json:"status"`
Resource *struct {
Type string `json:"type"`
ID string `json:"id"`
} `json:"resource"`
Result map[string]any `json:"result"`
ErrorCode *string `json:"error_code"`
Retryable bool `json:"retryable"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type OperationEnvelope ¶
type OperationList ¶
type OperationList struct {
Data []Operation `json:"data"`
Meta map[string]any `json:"meta"`
Raw json.RawMessage `json:"-"`
}
type Option ¶
type Option func(*Client)
func WithHTTPClient ¶
func WithRequestID ¶
func WithVersion ¶
func WithWarningSink ¶
type Server ¶
type Server struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
Region string `json:"region"`
Capacity struct {
Cores WireInt `json:"cores"`
MemoryGB WireInt `json:"memory_gb"`
DiskGB WireInt `json:"disk_gb"`
DaemonCount WireInt `json:"daemon_count"`
EligibleForDaemon bool `json:"eligible_for_daemon"`
} `json:"capacity"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type ServerEnvelope ¶
type ServerEnvelope struct {
Data Server `json:"data"`
Meta map[string]any `json:"meta"`
Raw json.RawMessage `json:"-"`
}
type ServerList ¶
type ServerList struct {
Data []Server `json:"data"`
Meta map[string]any `json:"meta"`
Raw json.RawMessage `json:"-"`
}
type SpawnRequest ¶
type Task ¶
type Task struct {
ID string `json:"id"`
DaemonID string `json:"daemon_id"`
Agent string `json:"agent"`
Model *string `json:"model"`
PermissionMode string `json:"permission_mode"`
WorkingDirectory string `json:"working_directory"`
TimeoutSeconds WireInt `json:"timeout_seconds"`
Status string `json:"status"`
Result map[string]any `json:"result"`
ErrorCode *string `json:"error_code"`
CancelRequestedAt *string `json:"cancel_requested_at"`
StartedAt *string `json:"started_at"`
FinishedAt *string `json:"finished_at"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
Task is the Control Plane task resource returned by the nested /daemons/{daemon}/tasks routes. Tasks are always addressed through their parent daemon; there is no top-level task route.
type TaskEnvelope ¶
type TaskEnvelope struct {
Data Task `json:"data"`
Meta map[string]any `json:"meta"`
Raw json.RawMessage `json:"-"`
}
type TaskList ¶
type TaskList struct {
Data []Task `json:"data"`
Meta map[string]any `json:"meta"`
Raw json.RawMessage `json:"-"`
}
type TaskRequest ¶
type TaskRequest struct {
Prompt string
Agent string
Model string
PermissionMode string
WorkingDirectory string
TimeoutSeconds int
}
TaskRequest carries the fields POST /tasks accepts. Only Prompt is required; empty optional fields are omitted so the server applies its own defaults (primary agent, /workspace, yolo, default timeout).
type UploadResponse ¶
type WireInt ¶
type WireInt int64
WireInt is an integer-valued API number. Laravel models may serialize a decimal-backed value as either 4, 4.0, or "4.00", so response structs use this type at every numeric resource field while still rejecting fractions.