client

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package client is the Go client of the daemon's API, over its Unix socket.

Index

Constants

View Source
const (

	// ReadTimeout outlasts the daemon's start-up reconcile, which holds
	// UserAPI for up to 30 seconds.
	ReadTimeout = 45 * time.Second
)

Variables

View Source
var DaemonLabel = brand.LaunchAgent()

DaemonLabel is the launchd label of the daemon's LaunchAgent.

View Source
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.

View Source
var ErrNoDraft = errors.New("no such draft")

ErrNoDraft is a draft id the daemon does not know.

Functions

func Kickstart

func Kickstart() string

Kickstart is the command that starts the installed daemon.

func UnixTransport

func UnixTransport(socket string) *http.Transport

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 New

func New(socket string) *Client

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) Actions

func (c *Client) Actions(ctx context.Context) (api.ActionsResponse, error)

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) Catalog

func (c *Client) Catalog(ctx context.Context) (api.CatalogResponse, error)

Catalog is the served views, facets and situations.

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

func (c *Client) Counters(ctx context.Context, area, query string) (api.Counters, error)

Counters are the counters of area, "" for every area, of the tasks the lens query keeps, every task when "".

func (*Client) CreateDraft

func (c *Client) CreateDraft(ctx context.Context, req api.DraftCreate) (api.Draft, error)

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

func (c *Client) CreateTask(ctx context.Context, req api.TaskCreate) (api.TaskView, error)

CreateTask creates a task: a title alone captures it in the Inbox.

func (*Client) Digest

func (c *Client) Digest(ctx context.Context, day string) (api.Digest, error)

Digest is the daily digest of day, "YYYY-MM-DD".

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) Draft

func (c *Client) Draft(ctx context.Context, id int64) (api.Draft, error)

Draft is draft id, with its gate.

func (*Client) Drafts

func (c *Client) Drafts(ctx context.Context, states ...string) ([]api.Draft, error)

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) EndTurn

func (c *Client) EndTurn(ctx context.Context, handle string, req api.TurnEndRequest) (api.TurnEnded, error)

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) Explore

func (c *Client) Explore(ctx context.Context, query string) (api.ExploreResult, error)

Explore runs query through the plugin that serves the explore view.

func (*Client) Facts

func (c *Client) Facts(ctx context.Context, address string) (api.Facts, error)

Facts are what the guide of the unit at address is matched against.

func (*Client) Gates added in v0.3.0

func (c *Client) Gates(ctx context.Context) ([]api.GateView, error)

Gates are the open gates.

func (*Client) Health

func (c *Client) Health(ctx context.Context) (api.Health, error)

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) IntakeCancel

func (c *Client) IntakeCancel(ctx context.Context, seq int64) error

func (*Client) IntakeWithout

func (c *Client) IntakeWithout(ctx context.Context, seq int64) error

IntakeWithout starts a waiting intake without the brief.

func (*Client) Keys

func (c *Client) Keys(ctx context.Context, surface string) (api.KeysResponse, error)

Keys is the keyboard map of surface: web, tui or menubar.

func (*Client) MatchTasks added in v0.4.0

func (c *Client) MatchTasks(ctx context.Context, text, except string) ([]api.TaskView, error)

MatchTasks are the open tasks whose title holds text, for a picker of another task than except.

func (*Client) Meter

func (c *Client) Meter(ctx context.Context) (api.MeterReport, error)

Meter is the metered cost of every scope since the daemon started.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

func (*Client) Plan

func (c *Client) Plan(ctx context.Context, q api.PlanQuery) (api.PlanResponse, error)

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

func (c *Client) PluginAction(ctx context.Context, id, action string, args, out any) error

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) Plugins

func (c *Client) Plugins(ctx context.Context) ([]api.Plugin, error)

Plugins is every compiled-in plugin the daemon serves, enabled or not.

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) Prompt

func (c *Client) Prompt(ctx context.Context, handle string, req api.PromptRequest) error

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

func (c *Client) ReadDraft(ctx context.Context, handle string, id int64) (api.AgentDraft, error)

ReadDraft reads draft id on behalf of the agent session handle.

func (*Client) RecordGitAccess

func (c *Client) RecordGitAccess(ctx context.Context, r api.GitAccessRecord) error

RecordGitAccess has the daemon keep a git access outcome this process saw.

func (*Client) ReportApp

func (c *Client) ReportApp(ctx context.Context, st api.AppStatus) error

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

func (c *Client) ResolveUnit(ctx context.Context, address string) (u unit.Unit, ok bool, err error)

ResolveUnit is the unit address lands in; ok is false when no plugin reads it.

func (*Client) Review

func (c *Client) Review(ctx context.Context) (api.Review, error)

Review is the current Review.

func (*Client) ReviewStepDone

func (c *Client) ReviewStepDone(ctx context.Context, step string) (api.Review, error)

ReviewStepDone marks step done in the current Review.

func (*Client) Rows

func (c *Client) Rows(ctx context.Context) ([]api.Row, error)

Rows is every row.

func (*Client) RowsSince

func (c *Client) RowsSince(ctx context.Context, since api.Since) (api.RowsPage, error)

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 (c *Client) SessionStart(ctx context.Context, handle string, req api.SessionStartRequest) error

func (*Client) SetPause

func (c *Client) SetPause(ctx context.Context, req api.PauseRequest) error

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

func (c *Client) Strings(ctx context.Context) (api.Strings, error)

Strings are the client strings in the daemon's interface language.

func (*Client) Task added in v0.3.0

func (c *Client) Task(ctx context.Context, id string) (api.TaskView, error)

Task is task id with its cards and items.

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

func (c *Client) TaskDrafts(ctx context.Context, task string) ([]api.Draft, error)

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) Timings

func (c *Client) Timings(ctx context.Context, days int) (api.TimingsReport, error)

Timings is what the loop recorded over the last days.

func (*Client) Trigger

func (c *Client) Trigger(ctx context.Context, job string) error

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

func (c *Client) TurnBook(ctx context.Context, address string) (api.TurnBook, error)

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

func (c *Client) Views(ctx context.Context) (api.ViewsCatalog, error)

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.

type TaskQuery added in v0.3.0

type TaskQuery struct {
	View     string
	Area     string
	Contexts []string
	Units    []unit.Unit
}

TaskQuery selects a view's tasks; Contexts must all match, and the Inbox ignores Area. Units are the units changes named since the page asked from, whose tasks a page since it holds too.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL