What the DotBot panel says, apart from how it is drawn.
Every function here is pure: it takes readings from the panel's data source
and returns the words and the state the panel renders. The hint line under
the composer, the usage notice above it, whether the field takes typing and
what its placeholder says, the per-turn meta line, and what the panel says
when there is no data source at all — each is a value a test can read,
rather than a string buried in a widget tree.
palette( ) → any
The palette the DotBot panel draws with: the editor's, with DotBot's look
laid over it. One table for as long as the editor's palette is one table,
so a row whose drawing stamp holds the palette reads as unchanged between
two renders; a new editor palette (a theme change) lays the look over it
again.
isReady(availability: any) → boolean
Whether `availability` (the source's `available()`) says DotBot can be
used now.
| arg | type | description |
|---|
| availability | any | |
emptyState(availability: any) → void
What the panel shows in place of a conversation while DotBot cannot be
used, for each reason it cannot: still loading, failed (with the reason,
and `action`, the label of the button that tries again), or absent from
this build. `availability` is the source's `available()`.
| arg | type | description |
|---|
| availability | any | |
usageLine(agent: any, usage: any) → string
**How much is left, permanently, under the composer.**
The AMOUNT and nothing else. It used to open with "Runs on your ChatGPT
plan", which every turn's own meta line already says, so who pays was on
screen twice; this carries the figure and lets the meta line carry the
payer. Removing the whole row instead was the wrong half to cut: the
figure is the part somebody wants standing there, and the duplicate was
the sentence around it.
Nil when there is nothing honest to say: an agent nobody connected, or one
with a problem in front of it, has no reading to report.
| arg | type | description |
|---|
| agent | any | |
| usage | any | |
tokenCount(n: number) → string
A token count a person reads at a glance: `9829`, `43.2k`, `1.4M`.
| arg | type | description |
|---|
| n | number | |
gaugeCount(n: number) → string
A size on the gauge as a person reads it beside another: `850`, `184K`,
`1M`, `1.05M`.
| arg | type | description |
|---|
| n | number | |
contextGauge(answer: any, preview: number?) → Gauge
The context gauge of a conversation, from the plugin's `context` answer:
what fills the bar, where the auto-compact handle stands and how far it
can go. `preview` is a threshold the person is dragging, drawn in place of
the plugin's until it is set. Nil when the answer carries no threshold
(no model is connected yet).
The handle never passes the model's window, nor the most a threshold takes
effect at (`autoCompact.limit`); where the model states no window, the bar
says so and spans the handle's own range.
| arg | type | description |
|---|
| answer | any | |
| preview | number? | |
share(n: number) → number
| arg | type | description |
|---|
| n | number | |
gaugeTokensAt(gauge: Gauge, fraction: number) → number
The threshold a press or a drag at `fraction` (0..1 along the bar) sets:
rounded to `GAUGE_ROUND` tokens and held between the gauge's least and
most.
| arg | type | description |
|---|
| gauge | Gauge | |
| fraction | number | |
gaugeKey(gauge: Gauge, from: number, key: string, shift: boolean?) → number
The threshold a key moves the handle to from `from`: Arrow Right / Up by
`GAUGE_STEP` (Shift, Page Up: `GAUGE_STEP_LARGE`), Arrow Left / Down and
Page Down back, Home to the least, End to the most. Nil for any other key.
| arg | type | description |
|---|
| gauge | Gauge | |
| from | number | |
| key | string | |
| shift | boolean? | |
usageFigures(figures: any) → string
One set of usage figures as a person reads them: the uncached input, the
output, and the share of input read from the prompt cache. A provider that
states no cache figures is said to state none.
| arg | type | description |
|---|
| figures | any | |
conversationUsageLines(summary: any) → void
What a conversation's turns used, as the lines under the composer: the
latest turn, then the conversation's running total. Empty when nothing is
recorded for it.
| arg | type | description |
|---|
| summary | any | |
scalarText(v: any) → string
isArray(t: any) → boolean
summaryOf(v: any) → string
What a table is worth saying when there is no room to open it: a count,
never a stringified table.
describeInto(value: any, depth: number, out: { DataLine }, label: string?) → void
Render a decoded value as lines a person reads.
**JSON pretty-printed is still JSON.** The braces, the quotes and the
commas are three quarters of the characters and none of the content, and a
grey block of them is unreadable however neatly it is indented. So nothing
here prints punctuation: a record is its name and then its fields, a list
is its items and then how many were not shown, and a nested table too deep
to open says how big it is instead of being flattened into a string.
| arg | type | description |
|---|
| value | any | |
| depth | number | |
| out | { DataLine } | |
| label | string? | |
describeValue(value: any) → void
A decoded tool answer as lines a person reads.
The panel's entry point: one call, one list of lines. Exported from here
rather than kept in the panel so it can be tested against the shapes the
engine really answers with, which is the only way a claim about how a
result READS can be checked at all.
| arg | type | description |
|---|
| value | any | |
usageNotice(agent: any, usage: any, models: { any }?, alternatives: { any }?) → Notice
The banner above the composer, or nil when the reading warrants none.
`models` is the agent's model list; a cheaper model is offered only when it
is one of them, so the panel never points at a model it cannot run.
`alternatives` are the connected accounts with room left (the source's
`alternativesTo`): a spent window names them and offers the first.
| arg | type | description |
|---|
| agent | any | |
| usage | any | |
| models | { any }? | |
| alternatives | { any }? | |
composerState(availability: any, agent: any, usage: any) → Composer
Whether the composer takes typing, what it says while empty, and whether it
carries the model and thinking chips.
| arg | type | description |
|---|
| availability | any | |
| agent | any | |
| usage | any | |
continuationNotice(continuation: any, now: number?) → Notice
The banner above the composer while the conversation's turn waits for a
usage window to reset, or nil when nothing waits. `continuation` is the
source's `continuationOf`. It carries two actions: continue now (the
provider decides whether the window has room) and cancel.
| arg | type | description |
|---|
| continuation | any | |
| now | number? | |
cutOffNotice(continuation: any) → Notice
The banner above the composer while a build the platform cut off waits to
be continued: when and why it was interrupted, and whether it carries on
on its own or waits for the person's Continue. `continuation` is the
source's `continuationOf`, carrying `cut`.
| arg | type | description |
|---|
| continuation | any | |
problemNotice(agent: any) → Notice
The banner a problem puts above the composer, or nil when there is none.
| arg | type | description |
|---|
| agent | any | |
metaLine(meta: any) → string
The per-turn meta line's left half: model, thinking level, tokens, tool
calls and duration, separated by middle dots.
| arg | type | description |
|---|
| meta | any | |
metaWho(meta: any) → string
Who paid for a turn — the right half of the meta line.
| arg | type | description |
|---|
| meta | any | |
pickerSubtitle(agent: any) → string
What the picker shows under an agent's name.
| arg | type | description |
|---|
| agent | any | |
pickerAction(agent: any) → string
The word on an agent's picker row when it needs an action, or nil.
| arg | type | description |
|---|
| agent | any | |
linkPlace(url: any) → string
The sheet a disconnected or blocked agent shows in place of a conversation:
a heading, the paragraphs under it, and the button that moves it on. Nil
when the agent has a conversation to show instead.
Where a link code is entered, as a person would type it: the URL's host
and path, with no scheme and no query.
linkText(id: string, label: string, onClick: () → void
Text that looks like a link and acts like one.
There is one of these rather than an `edui.text` in link blue at each site,
because the two halves drifted apart the moment they were written
separately: the sign-in sheet painted "Open sign-in again" in `#3794ff` and
attached no handler, so the only way back out of a stale paste step was a
blue word that did nothing. Taking the callback as a required argument is
what stops that shape existing: there is no way to ask for the colour
without saying what the click does.
`flexShrink = 0` so it keeps its width beside a growing sibling — a link
crushed to "Open sig…" is the other way this reads as broken.
| arg | type | description |
|---|
| id | string | |
| label | string | |
| onClick | ( | |
codeBox(text: string, size: number, spacing: string, pad: number) → any
The box a sign-in code is drawn in. Selectable, because the code is
copied into another page: highlighted and copied with Ctrl+C.
| arg | type | description |
|---|
| text | string | |
| size | number | |
| spacing | string | |
| pad | number | |
connectSheet(agent: any, flow: any, link: any?) → any
| arg | type | description |
|---|
| agent | any | |
| flow | any | |
| link | any? | |
connectedNotice(agent: any, account: any) → string
The line a freshly-connected agent shows above its first turn, or nil.
| arg | type | description |
|---|
| agent | any | |
| account | any | |
trimmed(text: string) → string
One row's identity, for deciding whether two lists hold the same row.
**A row is not its text.** The key was the kind, the tool's name and the
trimmed text, which for a tool row, a meta line and a thinking row is
nothing at all: two `tool_exec` calls, or two turns' usage lines, had the
same key. Merged against the stored history they collapsed into one, so the
second turn's tool rows and usage line simply did not appear. A row that
carries an identity of its own is keyed by it:
* a tool row by the call's id, which the live event and the stored
`tool_use` block both carry;
* a live-only row (thinking, the usage line) by the `uid` it was given
when it was made.
Everything else is what a person would call the same message: its kind and
its text.
`text` without the whitespace at either end, read once from each end.
| arg | type | description |
|---|
| text | string | |
rowKey(row: any) → string
bareThought(row: any) → string
A thinking row's text with its whitespace taken out, made once per text.
historyIndex(history: { any }) → void
| arg | type | description |
|---|
| history | { any } | |
mergeRows(history: { any }, live: { any }) → void
What the plugin has stored, then what this session watched run, WITHOUT
showing the overlap twice.
History keeps its order, and a live row is shown only if history does not
already hold one with the same identity (`rowKey`). Two identical messages a
person really did send both survive, because both are in the history by
then.
**A live row the history does not hold stays beside the turn it came
with.** A turn's usage line (`meta`) is never stored, so it is always a
live row. Appended after the whole history, every earlier turn's line
piled up together above the next message, the moment the history caught
up with the turns they belonged to. So each such row is drawn after the
stored row the live row before it matched: walking the live rows, a row
the history holds moves the place forward to its own position there (the
first match past the current place, so a repeated message anchors to its
own turn), and a row it does not hold is drawn at the current place. Rows
before any match, a turn nothing of which is stored yet, still land after
the history.
| arg | type | description |
|---|
| history | { any } | |
| live | { any } | |
groupCarrierRows(messages: { any }, toolsRunIn: (any) → void
Collapse runs of carrier calls into one row that names what actually ran.
**Six rows saying `tool_exec` tell a person nothing.** Each one is a script
that called real tools, and the answer carries the trace of which. So a run
of consecutive carrier rows becomes a single row carrying every tool those
calls ran, in order, and every other row is passed through untouched.
A carrier call that ran no tools, or whose answer cannot be read, keeps its
own row and its own name: there is nothing better to call it than what the
model called it, and inventing a label for an unreadable answer would be
inventing the contents of the answer.
`toolsRunIn` is the source's reader of an answer's trace, passed in so this
stays pure.
| arg | type | description |
|---|
| messages | { any } | |
| toolsRunIn | (any | |
thinkingLabel(row: any, now: number?) → string
What a thinking row's header says.
**Thinking is never hidden, only folded.** While the model is thinking the
row says so (`Thinking…`, with how long it has been going, when the row knows
when it started); once it has finished it says how long it thought. The text
itself is behind the chevron either way.
`now` is a clock reading in seconds from the same clock as `row.startedAt`.
| arg | type | description |
|---|
| row | any | |
| now | number? | |
finishThinking(row: any, now: number) → void
Close a thinking row: stop it streaming and fix how long it took.
| arg | type | description |
|---|
| row | any | |
| now | number | |
toggleOpen(state: { [string]: boolean }, key: string) → boolean
Flip one entry of an open/closed table and answer the new state.
The panel keeps which rows are open OUTSIDE the rows, keyed by a stable
identity, because a transcript is recomposed from history plus live events
on every redraw and a flag stored on a row is lost the moment anything
streams.
| arg | type | description |
|---|
| state | { [string]: boolean } | |
| key | string | |
foldThinking(rows: { any }, from: number?) → void
A turn's thinking rows folded into ONE, once the turn has ended.
What it thought is worth watching while it thinks and worth little
afterwards: a turn with eight tool calls has up to eight thinking phases,
and eight "Thought for 2 s" rows between the question and the answer are
clutter. They become a single row at the place the first one stood, carrying
ALL of the thoughts (joined with a blank line) and the total time spent
thinking, so folding loses nothing and the row stays unfoldable. It keeps
the first row's `uid`, so a row the reader had open is still the one that is
open.
**Only the turn that ended is folded.** The live rows hold every turn this
session watched, one after another, so folding "the thinking rows" folded
every turn's thinking into the first turn's row and left the later turns
with none. `from` is where the ended turn's rows begin (the row after the
previous turn's usage line); rows before it are left exactly as they were.
Returns the new list and the uids of the rows that were merged away.
| arg | type | description |
|---|
| rows | { any } | |
| from | number? | |
isTableLine(line: string) → boolean
| arg | type | description |
|---|
| line | string | |
isTableSeparator(line: string) → boolean
A table's separator line: `|---|:---:|`. Only dashes, colons, pipes and
spaces, with at least one dash.
| arg | type | description |
|---|
| line | string | |
tableCells(line: string) → void
The cells of one table line, without the outer pipes.
| arg | type | description |
|---|
| line | string | |
splitMarkdown(md: string) → void
An answer's markdown split into the parts the panel draws itself and the
prose the shared renderer draws.
**The shared renderer cannot be left to draw these two.** It draws a table
as raw `| a | b |` lines in monospace that run past the panel's right edge,
and a fenced code block as one unwrapped run that is clipped or overflows.
Neither can wrap, and neither can be selected. So they are lifted out here:
* `{ kind = "prose", text }`: handed to the renderer as it was;
* `{ kind = "code", lang, text }`: a fenced block, an unterminated one
(an answer still streaming) included;
* `{ kind = "table", header = {cells}?, rows = {{cells}} }`: a run of
lines that start with a pipe. The header is the first row when the
second is a separator; a run with no separator is all rows.
| arg | type | description |
|---|
| md | string | |
tableWeights(header: { string }?, rows: { { string } }) → void
How much of a table's width each column asks for.
Proportional to the longest cell in it, within bounds: a column of one-word
labels does not take as much as a column of sentences, and a column of long
sentences cannot take the table whole. Every column can shrink to nothing,
so the table is never wider than the panel whatever its cells hold.
| arg | type | description |
|---|
| header | { string }? | |
| rows | { { string } } | |
see(cells: { string }?) → void
| arg | type | description |
|---|
| cells | { string }? | |
tableNode(P: any, header: { string }?, rows: { { string } }, inline: (string) → void
A table as a widget: one wrapping row per table row, every cell a box that
may grow and may shrink and starts from nothing (`flexBasis = 0`), so the
row is exactly the panel's width however long a cell's text is and a long
cell wraps inside its own column.
| arg | type | description |
|---|
| P | any | |
| header | { string }? | |
| rows | { { string } } | |
| inline | (string | |
rowNode(cells: { string }, isHeader: boolean, striped: boolean) → any
| arg | type | description |
|---|
| cells | { string } | |
| isHeader | boolean | |
| striped | boolean | |
markSelectable(node: any) → void
Mark every piece of text under `node` selectable: styled runs (`richText`)
and plain labels (headings, quotes) alike.
The shared markdown renderer builds an answer out of those widgets, and each
takes part in text selection only when it says so with `props.selectable`. Selection then reaches every piece of an answer —
paragraphs, list items, headings — the way it reaches a plain label, and
one drag can cross from one to the next. Walks `children`, so a list item's
run inside its row is marked too.
| arg | type | description |
|---|
| node | any | |
codeNode(P: any, text: string) → any
A fenced code block as a widget: monospace text that WRAPS at the panel's
edge and can be selected and copied. A block of code is the thing a person
most often copies out of an answer.
| arg | type | description |
|---|
| P | any | |
| text | string | |
agentStateWord(state: any) → string
The word a run's `state` reads as: the table's, else the state itself
with its first letter raised.
| arg | type | description |
|---|
| state | any | |
agentActive(run: any) → boolean
Whether a run still works: any state but `done`, `failed` and `cancelled`.
agentElapsed(run: any, nowMs: number) → number
How long a run has worked, in whole seconds, read against `nowMs` (host
epoch milliseconds, the clock its snapshot's times are on). A run that has
ended took what it states; a running one has taken at least that and keeps
counting from its start; a queued one has not started and has worked none.
| arg | type | description |
|---|
| run | any | |
| nowMs | number | |
agentWaited(run: any, nowMs: number) → number
How long a queued run has waited to start, in whole seconds, read against
`nowMs`: from when it was made. Zero for a run in any other state.
| arg | type | description |
|---|
| run | any | |
| nowMs | number | |
oneLine(text: any, limit: number) → string
`text` as one line: every run of white space, line breaks included, made
one space, and the whole cut at `limit` characters.
| arg | type | description |
|---|
| text | any | |
| limit | number | |
duration(seconds: number) → string
A span of seconds as a person reads it: `8s`, `1m 05s`, `1h 02m`.
| arg | type | description |
|---|
| seconds | number | |
firstLine(text: string, limit: number) → string
The first line of `text`, at most `limit` characters.
| arg | type | description |
|---|
| text | string | |
| limit | number | |
agentDoing(run: any, nowMs: number?) → void
What a run is doing right now, and what kind of line that is: `"tool"`
for the tool call it is in (the line is the tool's name), `"status"` for
a phase, `"attention"` for a call that waits on the person's answer,
`"result"` for a finished run's answer, `"error"` for why a run failed.
With `nowMs`, a queued run says how long it has waited to start.
| arg | type | description |
|---|
| run | any | |
| nowMs | number? | |
agentUsage(run: any) → string
What a run has used: its tool calls, its uncached input and output, and
the share of its input read from the prompt cache. Nil before it has used
anything.
agentsHeadingParts(runs: { any }) → void
The pieces of the line over a conversation's agents: `Agents`, then
how many are in each state, each `{ text, state }`, in the order
`HEADING_STATES` names them.
| arg | type | description |
|---|
| runs | { any } | |
agentsHeading(runs: { any }) → string
The line over a conversation's agents: how many are in each state, e.g.
`Agents · 1 queued · 2 working · 1 done`.
| arg | type | description |
|---|
| runs | { any } | |
agentsUsageLine(totals: any) → string
What the agents a conversation's turns started used, as the Agents
heading states it, from the totals their statuses added up
(`subagentUsage`): how many there were, their uncached input and their
output, the share of their input read from the prompt cache as each card
states it, and the credits they were charged where the plugin states any.
Nil for no totals, and for agents that have used nothing yet, the way a
card says nothing of an agent's use until it has some.
| arg | type | description |
|---|
| totals | any | |
waitArgs(args: any) → void
The names `wait_for_agents` was asked to wait on, and whether it waits for
the first of them (`until = "any"`), read from the call's input as the
transcript carries it (its JSON text).
| arg | type | description |
|---|
| args | any | |
waitingOn(runs: { any }, args: any) → string
What the Working row says while the running tool is `wait_for_agents`:
the agents it waits on, by name, newest first as the cards stand. Those
are the running agents the plugin marks `awaited`, else the running ones
the call named, else every running agent of the conversation.
| arg | type | description |
|---|
| runs | { any } | |
| args | any | |
imageNode(P: any, key: string, path: string, exists: boolean) → any
What a tool row shows for a picture its answer named.
The picture is a file, and the file may be gone: a capture from an earlier
session, written under a scratch folder that was cleared since. Drawn as an
image the transcript showed a broken tile and said nothing. When the file is
not there the row says so instead.
| arg | type | description |
|---|
| P | any | |
| key | string | |
| path | string | |
| exists | boolean | |
workflowStatus(run: any) → void
How a workflow run's state reads, and the state its hue is drawn from:
a run still going is `Working` while an agent holds one of its requests,
`Waiting` while it waits on requests nobody holds yet, and `Running`
while it asks nothing; an ended one is `Finished`, `Failed` or
`Cancelled`.
requestStateWord(state: any) → string
| arg | type | description |
|---|
| state | any | |
workflowElapsed(run: any, nowSec: number) → number
How long a workflow run has taken, in whole seconds: to its end once it
has ended, to `nowSec` (wall-clock seconds, the clock its times are on)
while it runs.
| arg | type | description |
|---|
| run | any | |
| nowSec | number | |
workflowProgress(run: any) → void
How many of a run's requests are answered, of how many it has asked:
`{ answered, asked, failed, text }`, `text` reading `2 of 5 answered`
(and `1 failed` when one has).
phaseName(name: any) → string
A phase's name as the panel shows it: a request asked before the
workflow named any phase is in the unnamed one.
| arg | type | description |
|---|
| name | any | |
workflowPhaseLine(run: any, phases: { any }) → string
The phases a run went through, each as `Name answered/asked`, in order,
the one it is in marked with `▸`: `Plan 1/1 · ▸Build 1/3`. A phase that
asked nothing reads by its name alone.
| arg | type | description |
|---|
| run | any | |
| phases | { any } | |
workflowStarter(run: any, title: string?, agentName: string?, address: string?) → string
Who started a run, as its card says it: the conversation a DotBot turn
started it in, by `title` (its name in the conversation list) or, when
the list names it by nothing but its id, by the first part of `address`'s
id; and the agent that turn started when one of those did. Otherwise the
caller the engine names as its starter; nil when nobody is named.
| arg | type | description |
|---|
| run | any | |
| title | string? | |
| agentName | string? | |
| address | string? | |
requestTiming(req: any, nowSec: number, agent: any?) → string
What a request's line says about who holds it and for how long, read
against `nowSec`: the agent a turn started that works it (`agent`, its
name), else the runner whose claim holds it, how long since it was claimed
or has waited, or how long it took once settled.
| arg | type | description |
|---|
| req | any | |
| nowSec | number | |
| agent | any? | |
answerText(answer: any, limit: number?) → string
A request's answer as text a person reads: a string as it is; a table of
named fields that each hold a string, a number or a boolean as one
`name: value` per field (a string's line breaks kept); anything else as
indented JSON. Cut at `limit` characters.
| arg | type | description |
|---|
| answer | any | |
| limit | number? | |
workflowsRunningText(count: number) → string
The toolbar's word for the runs still running: `1 workflow running`,
`3 workflows running`.
| arg | type | description |
|---|
| count | number | |