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) (map[string]any, 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)
- type ClientOption
- type Event
- type EventType
- type HealthResponse
- type ModelInfo
- type ModelsResponse
- type Session
- 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 retrieves session details by 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.
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.
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"`
}
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.