Documentation
¶
Overview ¶
Deprecated: Use github.com/axsh/arctic-tern/client/v1 instead.
Deprecated: Use github.com/axsh/arctic-tern/client/v1 instead.
Deprecated: Use github.com/axsh/arctic-tern/client/v1 instead.
Deprecated: Use github.com/axsh/arctic-tern/client/v1 instead.
Deprecated: Use github.com/axsh/arctic-tern/client/v1 instead.
Deprecated: Use github.com/axsh/arctic-tern/client/v1 instead.
Index ¶
- type Agent
- type Client
- func (c *Client) CreateSession(ctx context.Context, req SessionRequest) (*Session, error)
- func (c *Client) GetSession(ctx context.Context, sessionID string) (*SessionInfo, error)
- func (c *Client) Health(ctx context.Context) (*HealthResponse, error)
- func (c *Client) ListAgents(ctx context.Context) ([]Agent, error)
- func (c *Client) ListModels(ctx context.Context) (*ModelsResponse, error)
- func (c *Client) UpdateSessionConfigDir(ctx context.Context, sessionID, configDir string) (*SessionInfo, error)
- type ClientOption
- type Event
- type EventType
- type HealthResponse
- type ModelInfo
- type ModelsResponse
- type Session
- type SessionInfo
- type SessionRequest
- type Stream
- func (s *Stream) Events() <-chan Event
- func (s *Stream) OnError(fn func(err string)) *Stream
- func (s *Stream) OnResult(fn func(ev Event)) *Stream
- func (s *Stream) OnText(fn func(text string)) *Stream
- func (s *Stream) OnToolUse(fn func(toolName string)) *Stream
- func (s *Stream) Output(w io.Writer) error
- func (s *Stream) Run() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
Name string `json:"name"`
}
Agent describes an available coding agent.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a tern API client.
func New ¶
func New(baseURL string, opts ...ClientOption) *Client
New creates a new Client for the given server URL.
func (*Client) CreateSession ¶
CreateSession creates a new session and returns a Session object.
func (*Client) GetSession ¶
GetSession fetches session details by ID. Does not change work_dir, session_dir, or agent_session_id.
func (*Client) Health ¶
func (c *Client) Health(ctx context.Context) (*HealthResponse, error)
Health checks if the server is healthy.
func (*Client) ListAgents ¶
ListAgents returns the available coding agents.
func (*Client) ListModels ¶
func (c *Client) ListModels(ctx context.Context) (*ModelsResponse, error)
ListModels returns the available models.
func (*Client) UpdateSessionConfigDir ¶ added in v0.1.8
func (c *Client) UpdateSessionConfigDir(ctx context.Context, sessionID, configDir string) (*SessionInfo, error)
UpdateSessionConfigDir sets config_dir on an existing session via PATCH. Pass an empty configDir to clear (disable overlay on subsequent launches; for Codex this restores --ignore-user-config on later launches).
Semantics:
- Does not change work_dir, session_dir, or agent_session_id.
- Overlay applies on the next SendMessage / SendText / Send, not immediately.
- Do not Terminate between turns merely to switch config_dir; terminate is only for forced teardown / cleanup after the demo.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption configures the Client.
func WithHTTPClient ¶
func WithHTTPClient(hc *http.Client) ClientOption
WithHTTPClient sets a custom HTTP client.
func WithNoTimeout ¶ added in v0.1.1
func WithNoTimeout() ClientOption
WithNoTimeout disables the HTTP client timeout. This is required for SSE streaming connections that may run for extended periods. Without this, the default 30s timeout will terminate long-running SSE streams.
type EventType ¶
type EventType string
EventType identifies the type of streaming event.
const ( EventText EventType = "text" EventToolUse EventType = "tool_use" EventToolResult EventType = "tool_result" EventToolResultPart EventType = "tool_result_part" EventSystem EventType = "system" EventResult EventType = "result" EventError EventType = "error" EventNodeStart EventType = "node_start" EventNodeComplete EventType = "node_complete" EventNodeFailed EventType = "node_failed" EventProgress EventType = "progress" )
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"`
}
HealthResponse is the response from the health endpoint.
type ModelsResponse ¶
type ModelsResponse struct {
Models []ModelInfo `json:"models"`
DefaultModel *ModelInfo `json:"default_model"`
}
ModelsResponse is the response from the models endpoint.
type Session ¶
type Session struct {
ID string
// contains filtered or unexported fields
}
Session represents an active coding agent session.
func ResumeSession ¶
ResumeSession creates a Session handle for an existing session ID. No server call is made; this merely wraps the ID for subsequent operations.
func (*Session) SendMessage ¶
SendMessage sends a message to the session and returns a Stream.
func (*Session) UpdateConfigDir ¶ added in v0.1.8
UpdateConfigDir updates config_dir for this session (see UpdateSessionConfigDir).
type SessionInfo ¶ added in v0.1.8
type SessionInfo struct {
ID string `json:"id"`
AgentName string `json:"agent_name"`
Model string `json:"model"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
WorkDir string `json:"work_dir"`
AgentSessionID string `json:"agent_session_id"`
SessionDir string `json:"session_dir"`
ConfigDir string `json:"config_dir,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
SessionInfo is the typed session record returned by GetSession and UpdateSessionConfigDir. Field names match the CAWA JSON (snake_case tags).
type SessionRequest ¶
type SessionRequest struct {
Agent string `json:"agent"`
Model string `json:"model,omitempty"`
WorkDir string `json:"work_dir"`
SessionDir string `json:"session_dir,omitempty"`
ConfigDir string `json:"config_dir,omitempty"`
}
SessionRequest is the request to create a session.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream processes SSE events from a session message.