Documentation
¶
Index ¶
- Constants
- Variables
- func IsID(id string) bool
- func Messages(msgs []Message) []history.Message
- func Reply(msgs []Message, id string) (string, bool)
- func Steps(msgs []Message) []outputs.Step
- func Transcript(s Session, msgs []Message) history.Transcript
- func Usage(msgs []Message) usage.Stats
- type Answer
- type Ask
- type Backend
- func (b *Backend) All(ctx context.Context, sid string) ([]Message, error)
- func (b *Backend) Attach(sid string) *exec.Cmd
- func (b *Backend) Dir(ctx context.Context, sid string) string
- func (b *Backend) Find(ctx context.Context, sid string) (history.Transcript, bool)
- func (b *Backend) Live(ctx context.Context, ids []string) (live []Live, gone []string)
- func (b *Backend) Outputs(ctx context.Context, sid, home string) ([]outputs.File, []outputs.Link, map[string]time.Time, error)
- func (b *Backend) Page(ctx context.Context, sid string) (history.Page, error)
- func (b *Backend) Reply(sid, id string) (string, error)
- func (b *Backend) Respond(ctx context.Context, sid, id string, a Answer) error
- func (b *Backend) Root(ctx context.Context, sid string) bool
- func (b *Backend) Send(ctx context.Context, sid string, p Prompt) error
- func (b *Backend) Start(ctx context.Context, dir, title string, p Prompt) (string, error)
- func (b *Backend) Stop(ctx context.Context, sid string) error
- func (b *Backend) Transcripts(ctx context.Context, max int) []history.Transcript
- type Client
- func (c *Client) Abort(ctx context.Context, sid, dir string) error
- func (c *Client) Answer(ctx context.Context, dir, id string, a Answer) error
- func (c *Client) Asks(ctx context.Context, dir string) (map[string][]Ask, error)
- func (c *Client) Branch(ctx context.Context, dir string) string
- func (c *Client) Busy(ctx context.Context, dir string) (map[string]bool, error)
- func (c *Client) Create(ctx context.Context, dir, title string) (Session, error)
- func (c *Client) Messages(ctx context.Context, sid string, limit int) ([]Message, error)
- func (c *Client) Prompt(ctx context.Context, sid, dir string, p Prompt) error
- func (c *Client) Session(ctx context.Context, sid string) (Session, error)
- func (c *Client) Sessions(ctx context.Context, max int) ([]Session, error)
- func (c *Client) Watch(ctx context.Context, on func(Event))
- type Event
- type Live
- type Message
- type Part
- type Prompt
- type Question
- type Session
Constants ¶
View Source
const Harness = "opencode"
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
func Transcript ¶
func Transcript(s Session, msgs []Message) history.Transcript
Types ¶
type Ask ¶
type Ask struct {
ID string `json:"id"`
SessionID string `json:"sessionID"`
Questions []Question `json:"questions,omitempty"`
Permission string `json:"permission,omitempty"`
Patterns []string `json:"patterns,omitempty"`
Key string `json:"key,omitempty"`
}
func (Ask) Fingerprint ¶
type Backend ¶
func (*Backend) Transcripts ¶
type Client ¶
type Client struct {
URL string
// contains filtered or unexported fields
}
type Message ¶
type Message struct {
Info struct {
ID string `json:"id"`
Role string `json:"role"`
ModelID string `json:"modelID"`
ProviderID string `json:"providerID"`
Model struct {
ProviderID string `json:"providerID"`
ModelID string `json:"modelID"`
} `json:"model"`
Time struct {
Created int64 `json:"created"`
Completed int64 `json:"completed"`
} `json:"time"`
Tokens struct {
Input int `json:"input"`
Output int `json:"output"`
Cache struct {
Read int `json:"read"`
Write int `json:"write"`
} `json:"cache"`
} `json:"tokens"`
} `json:"info"`
Parts []Part `json:"parts"`
}
type Part ¶
type Part struct {
ID string `json:"id"`
Type string `json:"type"`
Text string `json:"text"`
Synthetic bool `json:"synthetic"`
Ignored bool `json:"ignored"`
Tool string `json:"tool"`
State struct {
Status string `json:"status"`
Input json.RawMessage `json:"input"`
Output string `json:"output"`
Time struct {
Start int64 `json:"start"`
} `json:"time"`
} `json:"state"`
}
type Session ¶
type Session struct {
ID string `json:"id"`
ParentID string `json:"parentID,omitempty"`
Directory string `json:"directory"`
Title string `json:"title"`
Model struct {
ID string `json:"id"`
ProviderID string `json:"providerID"`
} `json:"model"`
Time struct {
Created int64 `json:"created"`
Updated int64 `json:"updated"`
Archived *int64 `json:"archived,omitempty"`
} `json:"time"`
}
Click to show internal directories.
Click to hide internal directories.