Documentation
¶
Overview ¶
Package console is the connector's console: one full-screen view, in the terminal, of what a profile's connector listens to, what it is working on, what it did, and whether it is well, with a line to talk to its orchestrator.
What it is beside the connector ¶
The console is a process of its own. It reads what `basecamp connect status` reads, the same way, and so it runs beside a connector, before one has started, and after one has stopped: a connector that starts while the console is open shows as it comes up. Closing the console leaves the connector as it was.
Who can open it ¶
Whoever can run the command as the person the connector runs as. It listens on nothing: what it shows is read from files only that person can read, and what it tells the orchestrator goes over the runner's socket, in a directory only that person can enter.
What it shows is not trusted ¶
A recording's title is whatever someone in Basecamp wrote, and a worker's report is whatever a coding agent wrote. Every such string is stripped of terminal control sequences before it is drawn (plain, text), so neither can move the cursor, restyle the screen or write to the terminal's title.
Index ¶
Constants ¶
const ( StatusPass = "pass" StatusWarn = "warn" StatusFail = "fail" StatusSkip = "skip" )
Check statuses, as `basecamp connect doctor` reports them.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Connector ¶
type Connector struct {
// Running says a connector holds this profile's lock.
Running bool
PID int
// StartedAt is when the running connector started, as it wrote.
StartedAt string
// Hold is the standing hold, under which nothing is handed off.
Hold *connector.HoldStatus
// LastChange is the last run's own record of itself.
LastChange *connector.ConnectionStatus
}
Connector is the connector's process and its own record of itself.
type Health ¶
Health is what reading it costs a request to Basecamp or a process started: doctor's checks and the coding agents installed. It is read when the console opens and when the person asks again, not with every snapshot.
type Options ¶
type Options struct {
// Snapshot reads the connector's state as it stands. It is called
// about once a second, one call at a time.
Snapshot func(ctx context.Context) *Snapshot
// Health runs doctor's checks and asks each coding agent its version.
// It is called when the console opens and when the person asks again.
Health func(ctx context.Context) *Health
// Say gives the orchestrator a message from the person and waits for
// its answer.
Say func(ctx context.Context, message string) (string, error)
// Open opens an address in the person's browser.
Open func(url string) error
// Theme is the palette it is drawn in.
Theme tui.Theme
}
Options are what a console reads and where it sends.
type Person ¶
Person is someone connect.json names: by id, and by name once Basecamp has been asked.
type PingGuests ¶
PingGuests are the people let into one Ping.
type Pings ¶
type Pings struct {
// Hears is nil when it cannot be told.
Hears *bool
Because string
// Twice says another connector on this computer answers them too.
Twice bool
// Guests are the people let into one Ping each, as participants.
Guests []PingGuests
Error string
}
Pings is whether this profile's connector answers the agent's Pings.
type Project ¶
type Project struct {
ID int64
Name string
URL string
WatchCompletions bool
// Campfires counts the chats it answers without being mentioned.
Campfires int
}
Project is a project the connector serves.
type Request ¶
type Request struct {
EventID int64
Trigger string
EventType string
ProjectID int64
ProjectName string
URL string
State string
Reason string
At time.Time
}
Request is one request the connector let in and what became of it.
type Rule ¶
Rule is one runner.json rule: the conditions a request must meet, in words, and the worker it then gets.
type Runner ¶
type Runner struct {
// Live says a connector is running with an orchestrator now.
Live bool
Orchestrator runner.Spec
Worker runner.Spec
Permissions string
// MaxWorkers is the cap on workers running at once, zero for none: the
// one a running connector started with, and otherwise runner.json's.
// KeptMaxWorkers is runner.json's, which a running connector takes up
// at its next start.
MaxWorkers int
KeptMaxWorkers int
// Rules are runner.json's, in the order they are tried.
Rules []Rule
// Turns, Waiting and SetAside are the orchestrator's: the turns it has
// finished, the messages it has not handled, and those it gave up on.
Turns int
Waiting int
SetAside int
// Process is the process group the orchestrator's session still names.
Process int
// ConfigError is why runner.json cannot be read as written. No agent
// is started until it can.
ConfigError string
}
Runner is the connector doing the work itself: its settings as runner.json has them and its orchestrator.
type Snapshot ¶
type Snapshot struct {
At time.Time
Profile string
AccountID string
Agent Person
Connector Connector
Projects []Project
Pings Pings
Trust Trust
// Runner is nil when the connector hands requests to the session that
// started it and no runner has been set up or has run.
Runner *Runner
// Now and Done are the runner's workers: those running or waiting, and
// those that ended, each newest first.
Now []runner.WorkerActivity
Done []runner.WorkerActivity
// Requests are the latest requests the connector let in, from its
// ledger, and Held those waiting for a person.
Requests []Request
Held []connector.HeldStatus
// Notes are the parts that could not be read, and why.
Notes []string
}
Snapshot is everything the console shows that is read from this computer: ids, states, names and timestamps, as `basecamp connect status` shows, and for the runner's workers the title of what each was asked on and what the worker reported. It holds no feed position and no credential, and not the body of any request.