Documentation
¶
Overview ¶
Package client is the Go client of the daemon's API, over its Unix socket.
Index ¶
- Constants
- Variables
- func Kickstart() string
- func UnixTransport(socket string) *http.Transport
- type Client
- func (c *Client) ActOnPlan(ctx context.Context, req api.PlanActRequest) (api.PlanResponse, error)
- func (c *Client) Action(ctx context.Context, u unit.Unit, action string, req api.ActionRequest) ([]string, error)
- func (c *Client) Actions(ctx context.Context) (api.ActionsResponse, error)
- func (c *Client) Ask(ctx context.Context, u unit.Unit, action string, req api.ActionRequest) (api.ActionResult, error)
- func (c *Client) Attach(ctx context.Context, handle, id string, req api.AttachRequest) (api.ByHandResult, error)
- func (c *Client) Catalog(ctx context.Context) (api.CatalogResponse, error)
- func (c *Client) Chat(ctx context.Context, id string, req api.ChatRequest) (api.TaskResult, error)
- func (c *Client) Counters(ctx context.Context, area, query string) (api.Counters, error)
- func (c *Client) CreateDraft(ctx context.Context, req api.DraftCreate) (api.Draft, error)
- func (c *Client) CreateTask(ctx context.Context, req api.TaskCreate) (api.TaskView, error)
- func (c *Client) Digest(ctx context.Context, day string) (api.Digest, error)
- func (c *Client) Doctor(ctx context.Context, q api.DoctorQuery) (api.DoctorReport, error)
- func (c *Client) Draft(ctx context.Context, id int64) (api.Draft, error)
- func (c *Client) Drafts(ctx context.Context, states ...string) ([]api.Draft, error)
- func (c *Client) DryRunTurn(ctx context.Context, req api.DryRunTurnRequest) (api.DryRunTurn, error)
- func (c *Client) EndTurn(ctx context.Context, handle string, req api.TurnEndRequest) (api.TurnEnded, error)
- func (c *Client) Events(ctx context.Context, client string, since api.Since) (<-chan api.Change, error)
- func (c *Client) Explore(ctx context.Context, query string) (api.ExploreResult, error)
- func (c *Client) Facts(ctx context.Context, address string) (api.Facts, error)
- func (c *Client) Gates(ctx context.Context) ([]api.GateView, error)
- func (c *Client) Health(ctx context.Context) (api.Health, error)
- func (c *Client) Intake(ctx context.Context, seq int64, after int, wait time.Duration) (api.Intake, error)
- func (c *Client) IntakeCancel(ctx context.Context, seq int64) error
- func (c *Client) IntakeWithout(ctx context.Context, seq int64) error
- func (c *Client) Keys(ctx context.Context, surface string) (api.KeysResponse, error)
- func (c *Client) MatchTasks(ctx context.Context, text, except string) ([]api.TaskView, error)
- func (c *Client) Meter(ctx context.Context) (api.MeterReport, error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) Plan(ctx context.Context, q api.PlanQuery) (api.PlanResponse, error)
- func (c *Client) PluginAction(ctx context.Context, id, action string, args, out any) error
- func (c *Client) PluginRun(ctx context.Context, id string, args []string, stdout, stderr io.Writer) (int, error)
- func (c *Client) Plugins(ctx context.Context) ([]api.Plugin, error)
- func (c *Client) Probe(ctx context.Context, req api.ProbeRequest) (api.ProbeResult, error)
- func (c *Client) Prompt(ctx context.Context, handle string, req api.PromptRequest) error
- func (c *Client) ProposeDraft(ctx context.Context, handle string, req api.AgentDraftProposal) (api.AgentDraft, error)
- func (c *Client) ReadDraft(ctx context.Context, handle string, id int64) (api.AgentDraft, error)
- func (c *Client) RecordGitAccess(ctx context.Context, r api.GitAccessRecord) error
- func (c *Client) ReportApp(ctx context.Context, st api.AppStatus) error
- func (c *Client) ResolveGate(ctx context.Context, id int64, intent string, req api.TaskRequest) (api.GateView, error)
- func (c *Client) ResolveUnit(ctx context.Context, address string) (u unit.Unit, ok bool, err error)
- func (c *Client) Review(ctx context.Context) (api.Review, error)
- func (c *Client) ReviewStepDone(ctx context.Context, step string) (api.Review, error)
- func (c *Client) Rows(ctx context.Context) ([]api.Row, error)
- func (c *Client) RowsSince(ctx context.Context, since api.Since) (api.RowsPage, error)
- func (c *Client) SessionStart(ctx context.Context, handle string, req api.SessionStartRequest) error
- func (c *Client) SetPause(ctx context.Context, req api.PauseRequest) error
- func (c *Client) StartTurn(ctx context.Context, handle string, req api.TurnStartRequest) (api.TurnText, error)
- func (c *Client) Stop(ctx context.Context, handle string, req api.StopRequest) (api.StopAnswer, error)
- func (c *Client) Strings(ctx context.Context) (api.Strings, error)
- func (c *Client) Task(ctx context.Context, id string) (api.TaskView, error)
- func (c *Client) TaskDo(ctx context.Context, id, verb string, req api.TaskRequest) (api.TaskResult, error)
- func (c *Client) TaskDrafts(ctx context.Context, task string) ([]api.Draft, error)
- func (c *Client) TasksSince(ctx context.Context, q TaskQuery, since api.Since) (api.TasksPage, error)
- func (c *Client) Timings(ctx context.Context, days int) (api.TimingsReport, error)
- func (c *Client) Trigger(ctx context.Context, job string) error
- func (c *Client) TurnAnswer(ctx context.Context, handle, arg string, gate int64) (api.TurnText, error)
- func (c *Client) TurnBook(ctx context.Context, address string) (api.TurnBook, error)
- func (c *Client) TurnByHand(ctx context.Context, handle string, req api.ByHandRequest) (api.ByHandResult, error)
- func (c *Client) UpdateDraft(ctx context.Context, handle string, req api.AgentDraftUpdate) (api.AgentDraft, error)
- func (c *Client) Views(ctx context.Context) (api.ViewsCatalog, error)
- func (c *Client) Window(ctx context.Context, req api.WindowRequest) (api.WindowResult, error)
- func (c *Client) WithdrawDraft(ctx context.Context, handle string, req api.AgentDraftWithdrawal) (api.AgentDraft, error)
- type TaskQuery
Constants ¶
const ( // ReadTimeout outlasts the daemon's start-up reconcile, which holds // UserAPI for up to 30 seconds. ReadTimeout = 45 * time.Second )
Variables ¶
var DaemonLabel = brand.LaunchAgent()
DaemonLabel is the launchd label of the daemon's LaunchAgent.
var ErrDown = fmt.Errorf(brand.Name+"'s daemon is not running; start it with `%s` (installed by `"+brand.Command+" app install`), or run `"+brand.Command+" serve` in a terminal", Kickstart())
ErrDown is a daemon that does not listen on the socket.
var ErrNoDraft = errors.New("no such draft")
ErrNoDraft is a draft id the daemon does not know.
Functions ¶
func UnixTransport ¶
UnixTransport sends every request to the daemon's Unix socket.
Types ¶
type Client ¶
type Client struct {
// Manager names the workspace manager of the agent session the client
// calls for, "" when unknown; it goes with every call that names a handle.
Manager string
// Handle is the agent session handle every call names when it names
// none of its own, "" for a person's.
Handle string
// contains filtered or unexported fields
}
Client talks to the daemon over its Unix socket.
func (*Client) ActOnPlan ¶
func (c *Client) ActOnPlan(ctx context.Context, req api.PlanActRequest) (api.PlanResponse, error)
ActOnPlan acts on plan items and returns them as the action left them, with an error line per item it could not act on.
func (*Client) Action ¶
func (c *Client) Action(ctx context.Context, u unit.Unit, action string, req api.ActionRequest) ([]string, error)
Action returns the lines the action reported.
func (*Client) Ask ¶
func (c *Client) Ask(ctx context.Context, u unit.Unit, action string, req api.ActionRequest) (api.ActionResult, error)
Ask runs the action and returns the daemon's answer whole: the intake that accepted it, for a review, an address or a run.
func (*Client) Attach ¶ added in v0.3.0
func (c *Client) Attach(ctx context.Context, handle, id string, req api.AttachRequest) (api.ByHandResult, error)
Attach makes the session of handle a run of task id.
func (*Client) Chat ¶ added in v0.3.0
func (c *Client) Chat(ctx context.Context, id string, req api.ChatRequest) (api.TaskResult, error)
Chat writes req on task id's chat, as the person: its live session is told, else a turn starts with it.
func (*Client) Counters ¶
Counters are the counters of area, "" for every area, of the tasks the lens query keeps, every task when "".
func (*Client) CreateDraft ¶
CreateDraft holds a draft the user wrote in the Outbox, or approves it at once with req.Send.
func (*Client) CreateTask ¶ added in v0.3.0
CreateTask creates a task: a title alone captures it in the Inbox.
func (*Client) Doctor ¶
func (c *Client) Doctor(ctx context.Context, q api.DoctorQuery) (api.DoctorReport, error)
Doctor runs doctor's checks that read the loop's state.
func (*Client) Drafts ¶
Drafts are the drafts in states, newest first; no state lists the proposed and failed ones.
func (*Client) DryRunTurn ¶
func (c *Client) DryRunTurn(ctx context.Context, req api.DryRunTurnRequest) (api.DryRunTurn, error)
DryRunTurn has the daemon store the review turn of a profile try.
func (*Client) Events ¶
func (c *Client) Events(ctx context.Context, client string, since api.Since) (<-chan api.Change, error)
Events delivers each change the daemon publishes, those not yet received merged into one, and closes the channel when the stream ends, goes silent or ctx is done. A non-zero since resumes from there: the first change says what was missed. The daemon knows the subscriber by client.
func (*Client) Intake ¶
func (c *Client) Intake(ctx context.Context, seq int64, after int, wait time.Duration) (api.Intake, error)
Intake reads intake seq with its log lines past after, waiting up to wait for a new line or its end.
func (*Client) IntakeWithout ¶
IntakeWithout starts a waiting intake without the brief.
func (*Client) MatchTasks ¶ added in v0.4.0
MatchTasks are the open tasks whose title holds text, for a picker of another task than except.
func (*Client) Plan ¶
Plan is the workflows' plan: with q.Trigger, what an evaluation of that trigger would decide now, changing nothing; without it, the stored plan.
func (*Client) PluginAction ¶ added in v0.3.0
PluginAction runs plugin id's action with args and decodes the plugin's answer into out; a nil out discards it.
func (*Client) PluginRun ¶ added in v0.3.0
func (c *Client) PluginRun(ctx context.Context, id string, args []string, stdout, stderr io.Writer) (int, error)
PluginRun runs the command line args of running plugin id, copying what it writes to stdout and stderr as it writes it, and answers its exit code.
func (*Client) Probe ¶
func (c *Client) Probe(ctx context.Context, req api.ProbeRequest) (api.ProbeResult, error)
Probe has the daemon send a probe turn; it waits on the loop like an action.
func (*Client) ProposeDraft ¶ added in v0.5.0
func (c *Client) ProposeDraft(ctx context.Context, handle string, req api.AgentDraftProposal) (api.AgentDraft, error)
ProposeDraft proposes req on behalf of the agent session handle.
func (*Client) ReadDraft ¶ added in v0.5.0
ReadDraft reads draft id on behalf of the agent session handle.
func (*Client) RecordGitAccess ¶
RecordGitAccess has the daemon keep a git access outcome this process saw.
func (*Client) ResolveGate ¶ added in v0.3.0
func (c *Client) ResolveGate(ctx context.Context, id int64, intent string, req api.TaskRequest) (api.GateView, error)
ResolveGate resolves gate id with intent, its args carrying an answer, or a draft gate's text and rev.
func (*Client) ResolveUnit ¶ added in v0.3.0
ResolveUnit is the unit address lands in; ok is false when no plugin reads it.
func (*Client) ReviewStepDone ¶
ReviewStepDone marks step done in the current Review.
func (*Client) RowsSince ¶
RowsSince is the page of rows since: every row when since is zero or the daemon answers Full, else the rows changed after it and the units that left.
func (*Client) SessionStart ¶
func (*Client) StartTurn ¶
func (c *Client) StartTurn(ctx context.Context, handle string, req api.TurnStartRequest) (api.TurnText, error)
StartTurn starts the stored turn of a round on the handle's session and returns its instructions.
func (*Client) Stop ¶
func (c *Client) Stop(ctx context.Context, handle string, req api.StopRequest) (api.StopAnswer, error)
func (*Client) Strings ¶ added in v0.4.0
Strings are the client strings in the daemon's interface language.
func (*Client) TaskDo ¶ added in v0.3.0
func (c *Client) TaskDo(ctx context.Context, id, verb string, req api.TaskRequest) (api.TaskResult, error)
TaskDo runs verb on task id.
func (*Client) TaskDrafts ¶ added in v0.3.0
TaskDrafts are the drafts made for task in any state, newest first.
func (*Client) TasksSince ¶ added in v0.3.0
func (c *Client) TasksSince(ctx context.Context, q TaskQuery, since api.Since) (api.TasksPage, error)
TasksSince is q's page since: every task when since is zero or the daemon answers Full, else the tasks changed after it and the ids that left the view.
func (*Client) TurnAnswer ¶
func (c *Client) TurnAnswer(ctx context.Context, handle, arg string, gate int64) (api.TurnText, error)
TurnAnswer reads the answers to the caller's gates on the unit arg names (a pull request URL or "<provider>:<key>"): the unread ones, or every answer that resolved gate when it is not 0.
func (*Client) TurnBook ¶
TurnBook is the turns of the unit at address with their instructions and events.
func (*Client) TurnByHand ¶
func (c *Client) TurnByHand(ctx context.Context, handle string, req api.ByHandRequest) (api.ByHandResult, error)
TurnByHand has the daemon run a turn the user asked for in the handle's session; it waits on the loop like an action.
func (*Client) UpdateDraft ¶ added in v0.5.0
func (c *Client) UpdateDraft(ctx context.Context, handle string, req api.AgentDraftUpdate) (api.AgentDraft, error)
UpdateDraft revises a draft on behalf of the agent session handle.
func (*Client) Views ¶ added in v0.3.0
Views is the views, areas, contexts and verbs the daemon serves.
func (*Client) Window ¶ added in v0.4.0
func (c *Client) Window(ctx context.Context, req api.WindowRequest) (api.WindowResult, error)
Window relays req to the native window, if one listens.
func (*Client) WithdrawDraft ¶ added in v0.5.0
func (c *Client) WithdrawDraft(ctx context.Context, handle string, req api.AgentDraftWithdrawal) (api.AgentDraft, error)
WithdrawDraft withdraws a draft on behalf of the agent session handle.