Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofplugin dotbot.plugin·originates fromworld abf1a532-5…

view

What the DotBot panel says, apart from how it is drawn.

byzero-proxy @ DESKTOP-DB3UJOJ·posted 2mo ago
What it does

view

What the DotBot panel says, apart from how it is drawn.

Every function here is pure: it takes readings from modules.dotbot.source and returns the words and the state the panel renders.

FunctionAnswers
emptyState(availability)The title and detail shown when no DotBot surface is present.
hintLine(agent, usage)The line under the composer naming what pays and what is left, or nil when there is nothing honest to say.
usageNotice(agent, usage, models)The banner above the composer: a notice under 25% left, a warning under 10% offering a cheaper model only when that model is one the agent can run, and a used-up state naming the reset and that a message sent now is answered once it resets.
contextGauge(answer, preview?)The context gauge of a conversation from the plugin's context answer: the fill (its context against its model's window), where the auto-compact handle stands and the range it can move in (the least a threshold may be, to the most it takes effect at, never past the window), 184K / 1M or 184K / max unknown, and compacts at 600K. gaugeTokensAt(gauge, fraction) is the threshold a press or a drag at a share of the bar sets (to 1,000 tokens); gaugeKey(gauge, from, key, shift?) is where an arrow (10,000, Shift 100,000), Page Up / Down, Home or End moves it. gaugeCount(n) writes a size the way the gauge does.
continuationNotice(continuation)The banner while the conversation's turn waits for a usage window to reset: when it continues, with Continue now and Cancel.
problemNotice(agent)The banner a failed sign-in puts above the composer.
composerState(availability, agent, usage)Whether the field takes typing, what it says while empty, and whether it carries the model and thinking chips. A spent window keeps the field open and says which limit is used up and when it resets: the provider decides.
connectSheet(agent, flow)The sheet a disconnected, expired or unlinked agent shows in place of a conversation.
connectedNotice(agent, account)The line a freshly-connected agent shows above its first turn.
metaLine(meta) / metaWho(meta)The per-turn meta line: model, thinking level, tokens, tool calls, duration — and who paid.
pickerSubtitle(agent) / pickerAction(agent)What an agent's row in the picker says, and the word on its button when it needs one.
rowKey(row) / mergeRows(history, live)A transcript row's identity (a tool row is its call, a thinking row or usage line is itself) and the merge of stored history with the live rows, which shows the overlap once. A live row the history does not hold (a turn's usage line is never stored) is drawn after the stored row the live row before it matched, so it stays with its own turn; live rows nothing of which is stored yet follow the history. A history list is keyed once, when it first reaches mergeRows, so a merge on every redraw costs the live rows.
palette() / MONO / MESSAGEDotBot's own look: the editor's palette with DotBot's colours and corner radii laid over it, the font code and figures are set in, and the surfaces of a person's message and an opened thought.
groupCarrierRows(rows, toolsRunIn)Runs of tool_exec calls collapsed into one row naming the tools they ran.
thinkingLabel(row, now) / finishThinking(row, now) / foldThinking(rows, from) / thinkingRow(...) / toggleOpen(state, key)Thinking as a folded row: its header, its clock, the fold of one turn's phases into one row, and the open/closed state.
splitMarkdown(md) / tableNode(...) / tableWeights(...) / codeNode(...) / markSelectable(node)An answer's tables and fenced code lifted out of the markdown and drawn so they wrap, and every piece of an answer marked selectable.
imageNode(P, key, path, exists)A tool's picture, or the line saying it is no longer available.
linkText(id, label, onClick)Text that looks like a link and acts like one, its callback keyed by id.
agentStateWord(state) / agentActive(run)How an agent's state reads (Queued, Starting, Working, Waiting, Done, Failed, Cancelled), and whether it still works.
agentElapsed(run, nowMs) / agentWaited(run, nowMs) / duration(seconds)How long an agent has worked, counting from its start while it works (none while queued), how long a queued agent has waited to start, and a span as 8s, 1m 05s, 1h 02m.
oneLine(text, limit)Text as one line, its line breaks made spaces, cut at limit.
agentDoing(run, nowMs?)What an agent is doing now and what kind of line that is: the tool it is in, a phase, "Waiting for your answer: <tool>" while a call waits on the person, "Waiting for engine work" once its loop has ended and engine work it started has not, its answer once done, or why it failed.
agentUsage(run)What an agent has used: tool calls, input, output and cache hit rate.
agentsHeading(runs) / agentsHeadingParts(runs)The line over a conversation's agents, naming how many are in each state, e.g. Agents · 1 queued · 2 working · 1 done, and its pieces, each with the state it counts.
agentsUsageLine(totals)The line under the composer naming what the agents used, from subagentUsage: how many, their input, output and cache hit rate, and the credits they were charged.
USAGE_PENDINGWhat usageLine says before a provider has reported a window.
workflowStatus(run)How a workflow run's state reads and the state its hue comes from: Working while an agent holds one of its requests, Waiting while requests wait for one, Running, Finished, Failed, Cancelled.
requestStateWord(state)How a workflow request's state reads (Waiting, Claimed, Answered, Failed, Cancelled).
workflowElapsed(run, nowSec) / workflowProgress(run)How long a run has taken, and { answered, asked, failed, text } with text such as 2 of 5 answered · 1 failed.
phaseName(name) / workflowPhaseLine(run, phases)A phase's name (Start for the unnamed one), and the phases as Plan 1/1 · ▸Build 1/3, the one the run is in marked.
workflowStarter(run, title?, agentName?, address?)Who started a run: in “<conversation>” (or in DotBot conversation <first 8 of its id> when the list names it by its id alone), by agent <name> in ..., or by <caller> from what the engine recorded.
requestTiming(req, nowSec, agent?)A request's line: the agent working it or the runner holding its claim, how long it has been claimed or waited or took, the claims that ran out and its corrections.
answerText(answer, limit?)An answer as text: a string as it is, a table of named string, number or boolean fields as one name: value line each, anything else as indented JSON, cut at limit.
workflowsRunningText(count)1 workflow running, 3 workflows running.
waitingOn(runs, args)The Working row while wait_for_agents runs: the agents it waits on, by name, newest first as the cards stand, and whether it waits for the first of them; once they have all ended, that they have.

The thresholds the usage ladder turns on are noticeThreshold (25) and warnThreshold (10).

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

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.

argtypedescription
availabilityany

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()`.

argtypedescription
availabilityany

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.

argtypedescription
agentany
usageany

tokenCount(n: number) → string

A token count a person reads at a glance: `9829`, `43.2k`, `1.4M`.

argtypedescription
nnumber

gaugeCount(n: number) → string

A size on the gauge as a person reads it beside another: `850`, `184K`, `1M`, `1.05M`.

argtypedescription
nnumber

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.

argtypedescription
answerany
previewnumber?

share(n: number) → number

argtypedescription
nnumber

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.

argtypedescription
gaugeGauge
fractionnumber

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.

argtypedescription
gaugeGauge
fromnumber
keystring
shiftboolean?

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.

argtypedescription
figuresany

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.

argtypedescription
summaryany

scalarText(v: any) → string

argtypedescription
vany

isArray(t: any) → boolean

argtypedescription
tany

summaryOf(v: any) → string

What a table is worth saying when there is no room to open it: a count, never a stringified table.

argtypedescription
vany

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.

argtypedescription
valueany
depthnumber
out{ DataLine }
labelstring?

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.

argtypedescription
valueany

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.

argtypedescription
agentany
usageany
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.

argtypedescription
availabilityany
agentany
usageany

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.

argtypedescription
continuationany
nownumber?

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`.

argtypedescription
continuationany

problemNotice(agent: any) → Notice

The banner a problem puts above the composer, or nil when there is none.

argtypedescription
agentany

metaLine(meta: any) → string

The per-turn meta line's left half: model, thinking level, tokens, tool calls and duration, separated by middle dots.

argtypedescription
metaany

metaWho(meta: any) → string

Who paid for a turn — the right half of the meta line.

argtypedescription
metaany

pickerSubtitle(agent: any) → string

What the picker shows under an agent's name.

argtypedescription
agentany

pickerAction(agent: any) → string

The word on an agent's picker row when it needs an action, or nil.

argtypedescription
agentany

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.

argtypedescription
urlany

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.

argtypedescription
idstring
labelstring
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.

argtypedescription
textstring
sizenumber
spacingstring
padnumber

connectSheet(agent: any, flow: any, link: any?) → any

argtypedescription
agentany
flowany
linkany?

connectedNotice(agent: any, account: any) → string

The line a freshly-connected agent shows above its first turn, or nil.

argtypedescription
agentany
accountany

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.

argtypedescription
textstring

rowKey(row: any) → string

argtypedescription
rowany

bareThought(row: any) → string

A thinking row's text with its whitespace taken out, made once per text.

argtypedescription
rowany

historyIndex(history: { any }) → void

argtypedescription
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.

argtypedescription
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.

argtypedescription
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`.

argtypedescription
rowany
nownumber?

finishThinking(row: any, now: number) → void

Close a thinking row: stop it streaming and fix how long it took.

argtypedescription
rowany
nownumber

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.

argtypedescription
state{ [string]: boolean }
keystring

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.

argtypedescription
rows{ any }
fromnumber?

isTableLine(line: string) → boolean

argtypedescription
linestring

isTableSeparator(line: string) → boolean

A table's separator line: `|---|:---:|`. Only dashes, colons, pipes and spaces, with at least one dash.

argtypedescription
linestring

tableCells(line: string) → void

The cells of one table line, without the outer pipes.

argtypedescription
linestring

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.

argtypedescription
mdstring

flushProse( ) → void

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.

argtypedescription
header{ string }?
rows{ { string } }

see(cells: { string }?) → void

argtypedescription
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.

argtypedescription
Pany
header{ string }?
rows{ { string } }
inline(string

rowNode(cells: { string }, isHeader: boolean, striped: boolean) → any

argtypedescription
cells{ string }
isHeaderboolean
stripedboolean

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.

argtypedescription
nodeany

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.

argtypedescription
Pany
textstring

agentStateWord(state: any) → string

The word a run's `state` reads as: the table's, else the state itself with its first letter raised.

argtypedescription
stateany

agentActive(run: any) → boolean

Whether a run still works: any state but `done`, `failed` and `cancelled`.

argtypedescription
runany

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.

argtypedescription
runany
nowMsnumber

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.

argtypedescription
runany
nowMsnumber

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.

argtypedescription
textany
limitnumber

duration(seconds: number) → string

A span of seconds as a person reads it: `8s`, `1m 05s`, `1h 02m`.

argtypedescription
secondsnumber

firstLine(text: string, limit: number) → string

The first line of `text`, at most `limit` characters.

argtypedescription
textstring
limitnumber

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.

argtypedescription
runany
nowMsnumber?

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.

argtypedescription
runany

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.

argtypedescription
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`.

argtypedescription
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.

argtypedescription
totalsany

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

argtypedescription
argsany

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.

argtypedescription
runs{ any }
argsany

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.

argtypedescription
Pany
keystring
pathstring
existsboolean

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`.

argtypedescription
runany

requestStateWord(state: any) → string

argtypedescription
stateany

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.

argtypedescription
runany
nowSecnumber

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

argtypedescription
runany

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.

argtypedescription
nameany

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.

argtypedescription
runany
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.

argtypedescription
runany
titlestring?
agentNamestring?
addressstring?

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.

argtypedescription
reqany
nowSecnumber
agentany?

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.

argtypedescription
answerany
limitnumber?

workflowsRunningText(count: number) → string

The toolbar's word for the runs still running: `1 workflow running`, `3 workflows running`.

argtypedescription
countnumber
⌬ Types
Notice = {Composer = {Gauge = {DataLine = { depth: number, label: string?, text: string, dim: boolean }

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

Showing up to 3 levels deep. Open a part to see what it holds further down.

8+items
▣
module · born here
❒asset
# dotbot_service The DotBot bridge, minus its privileges. `src/lua/trusted/dotbot/` is the layer between the DotBot panel (user-VM Luau, untrusted) and the DotBot plugin (trusted scope, holds a person's ChatGPT / Claude sign-in). Everything in that layer that is a **rule** rather than a **capability** lives in this module: the job table, the consent choreography, the event ring, the mirror the read-only exports answer from, and the scrub every value passes through on its way out. ```lua local Service = require("@builtin::modules.dotbot_service") local service = Service.new({ plugin = function() return rawget(_G, "dotbot") end, await = task.await, spawn = task.spawn, consentRequest = function(o) return consent.request(o) end, consentGranted = function(o) return consent.granted(o) end, openUrl = function(url) return system.openUrl(url) end, newJobId = function() return __crypto.uuid_v4() end, nowMs = function() return os.clock() * 1000 end, }) ``` ## Why the split It is what makes the layer testable. The module is a **factory**: it holds no state of its own and no privileged global, so a test can construct an instance over fakes and drive every rule in it. Being a builtin module, a world script can construct one too — and wins nothing, because its instance talks to its own fakes. The one instance that talks to the real consent gate, the real plugin namespace and the real `system.openUrl` is built in the trusted VM, out of globals only the trusted VM holds, and is reachable only as `trusted.call("dotbot.<method>", …)`. ## The shape, and where it comes from | Constraint | Consequence | |---|---| | A `trusted.call` handler must not yield (`trusted/exports.luau`) | Nothing that awaits is answered in the frame. Awaiting verbs are start/poll **jobs**; reads are answered from a **mirror** a spawned task fills, which stays current until a change marks it stale, so an open panel asks the plugin nothing while nothing changes. | | There is no push from the trusted VM into a user VM | The panel **drains a cursor** (`events(cursor)`) rather than registering a callback — so no trusted code ever calls into a user VM, and a world script cannot install itself as the panel's event handler. | `stop` is the one verb answered in the frame: stopping is always allowed and always cheap, and a stop that needed a confirmation would be a stop that lands after the turn it was meant to end. Its outcome arrives as a turn event. ## Signing in A person's plan is reached by one of two flows, and **the plugin says which**. `connectStart` reads it from the plugin's own account state (`M.signInFlow`) and, when a logged-out account names none, asks the plugin — never the caller, whose choice of flow would be a choice of which endpoint the person is sent to. | Flow | `connect.start` answers | Then | Finished by | |---|---|---|---| | `deviceCode` (ChatGPT) | `{ flow = "deviceCode", state = { userCode, verificationUrl, … } }` | the person types the code on the provider's page | `checkSignIn` until the account connects | | `pasteCode` (Claude) | `{ flow = "pasteCode", state = { authorizeUrl } }` | the person signs in and the browser ends on an address carrying the code, which they paste | `completeSignIn(provider, pasted)` | `cancelSignIn` abandons either. ### Several accounts of one provider Every flow takes an **account key**: the provider's key (`anthropic-claude`) for its first account, the provider and a slot (`anthropic-claude~2`) for each further one. `addAccountStart(provider)` connects a further account beside the ones already connected: behind the same `connect` confirmation, it asks the plugin for the key the new account signs in under (`newAccount`) and starts that account's sign-in, answering what `connect` answers plus the `account` it started. `renameAccountStart(account, label)` keeps a person's name for an account, as they wrote it (one line, at most 64 characters), and asks nobody. A dialog that names an account names which one, by the email its provider stated, once a provider has more than one: the name a person gives an account is set by an ungated call, so the dialog's words stay the plugin's own. Only `connect` asks for a confirmation. The three that continue it do not, for `stop`'s reason: they carry out a `connect` the person has already confirmed and is at that moment completing on the provider's own page, they spend nothing, and `completeSignIn` cannot connect anything on its own — the plugin holds a single-use verifier from the gated `connect` and answers "no pending login" to anything else. A second dialog inside one flow is how a person learns to stop reading the first. ## The agents a turn started A turn starts agents with `start_agents`, and the plugin reports each on its feed as a `subagent` event: `{ kind = "status", status }` on every change, `{ kind = "event", event }` for one event of the run's own transcript, and `{ kind = "tool_image", event }` for a picture one of its calls returned. `subagents(conversation?)` answers the runs held here, oldest first: each the plugin's snapshot with `images`, the newest `SUBAGENT_IMAGES` pictures its calls returned, and `pictures`, how many there have been. A status event puts that run's new record in place; a read answers a frozen copy of the list, made once per change, whose `version` moves when a run in it changes. `subagent(id)` answers one run's record. `subagentUsage(conversation)` answers what a conversation's agents have used, summed from their statuses as they arrive (`runs`, the four token counts, `creditsCharged`), so a run let go keeps what it added. A picture of a run not held here is let go with it. The plugin is asked for its list once; status events keep the runs current, and what a status event said stands over a list the plugin answered before the event arrived. A list asked again (`refresh("subagents")`) lets go of the runs it no longer names, and once more than `SUBAGENT_KEEP` runs have ended the earliest to end is let go. A run that reaches one of `SUBAGENT_ENDS`, and a run event that ends a turn, mark the run's own conversation's history stale. `stopSubagent(id)` asks nobody, for `stop`'s reason, and answers in the frame. ## Turns a usage limit stopped `continuations()` is the plugin's list of the turns a usage limit stopped, each continuing on its own once its window resets, read from the mirror and asked again on a `continuation` event or a turn's end. `cancelContinue` asks nobody and answers in the frame, for `stop`'s reason; `continueNowStart` is a job that starts the turn now, and the provider decides whether the window has room. ## The context gauge `context(conversation)` is the plugin's answer for a conversation's context gauge: how much context it holds, its model's window (nil when the model states none) and the auto-compact threshold with the range it may take. Read from the mirror and asked again on a `context` event (a model call or a compaction measured it, its model changed, or the threshold did), a turn's end, a model, threshold or default account this service set (`setModelStart`, `setAutoCompactStart`, which refills it before it settles, `setDefaultAccountStart`), a sign-in change, or the time its `staleAtUnix` names, which the plugin states while a window is not known and its catalogue may come to state one. ## Which conversation started a workflow run Built with `workflows` (the engine's `@builtin::modules.workflow`), the service states where a workflow run one of DotBot's tool calls started came from, as `{ host = "dotbot", conversation = "<agent>/<id>", agent? }` through `setOrigin`, `agent` naming the agent a turn started when its call did. The engine keeps it with the run's record. It follows every tool call of every conversation, and of every agent a turn started, from its `tool_start` to its `tool_result` (or the turn's end, or the agent's), and listens to the runtime's `onChange`. A run is a call's when the call was running as the engine started it and the call's answer names it; each such run teaches the service the connection DotBot's calls reach the engine over (the run's `started_by.connection`). A run no answer names (the host cuts a long answer) is the calls' when that connection started it and every call running as it started ran in one conversation for one agent. A run read back from its record, one started while no call ran, and one already stated are left as they are. A call with no answer for 15 minutes is taken to have ended. `close()` stops the service listening to the runtime: the engine's service is closed when the one built after it (the plugin loaded again) takes its place, and a test closes its own. ## Spending `sendStart` and `commandStart` both ask for the `spend` grant, keyed by action, plugin and the agent's display name, remembered for the world session. A slash command is gated because a slash command can run a turn — `/compact` summarises a conversation with the model — so it spends the plan exactly as a message does. ## What it will not do - Return a token, a credential id or a header. `M.scrub` drops every credential-named key at every depth, on every value leaving the layer — results and event payloads alike. It is the second line: DotBot's account and event types carry no token by construction. The names it drops are exact, not a substring match on `token`, so the usage counters a person is shown (`tokens`) and a turn's `turnId` survive. - Take a URL. `openSignInStart(provider)` reads the verification URL out of the plugin's own account state for the provider named, checks it is an http(s) page, shows a person its **host** in the dialog, and only then opens it. Account state naming none errors the job. - Answer, dismiss or count a consent dialog. There is nothing here that settles one; the gate is the engine's, and only a person at the keyboard answers it. - Put a caller's own words on a dialog. `detail` is resolved through the plugin's own agent and account lists and the flow **errors when it cannot be named** rather than falling back to the id it was handed. The two arguments a caller does supply beyond a message — a pasted sign-in code and a command line — are shape-checked (`M.pastedCode`, `M.commandLine`) and reach no dialog: the pasted code's flow draws none, and a command's dialog names the agent. - Read a plugin's refusal as an answer. The plugin host **raises** one where the call is awaited, so `call` reports it as a failure and a job never settles `done` on a sign-in that did not happen. ## Constants | Name | Meaning | |---|---| | `RING_CAPACITY` | 512: events held. A cursor older than the tail is answered `dropped = true` with every event the ring still holds and the head as its cursor, so the next read carries on from there. | | `TURN_ENDS_KEPT` | 64: ended turns whose `end` event `turnEnd(turnId)` answers, newest kept. Every `end` is kept as it arrives, so a reader whose cursor fell behind the ring reads the end it never drained. | | `JOB_LIMIT` | 8 — jobs live at once, across every caller. A ninth `start` is `{ ok = false, reason = "busy" }`. | | `JOB_TTL_MS` | 600000 — a job nobody polls is dropped after ten minutes. | | `RETRY_MS` | 2000: how long a read the plugin could not answer waits before it is asked again. A read that has an answer stays current until a change marks it stale: an `account`, `usage`, `continuation`, `context` or turn-ending `turn` event, the time an answer's `staleAtUnix` names (a usage answer, and the agents and default accounts built on the same reading, `LAPSES_WITH`), a turn in a conversation the list does not hold, a job this service ran, or `refresh(name, arg?)` (with `arg`, the one read of `name` it names). A sign-in, a sign-out and an `account` event mark the accounts, the agents, the models and the usage. A new conversation list marks the history of each conversation whose message count or last update it shows moved. A mark made while the plugin is being asked for a read outlasts that ask's answer, which the plugin may have read before the change: the answer is held and the read asks again on its next call, at once also after an ask that failed. | | `MIRRORED` | The reads the mirror holds: `agents`, `accounts`, `models`, `usage`, `conversations`, `history`, `subagents`, `defaultAccounts`, `continuations`, `context`. `refresh(name)` takes one of them. The mirror also holds `toolImage(conversation, image, size)`, where the plugin put one picture a tool call returned for the UI to draw: asked once per picture and size, and kept, because the copy stays where it was put. | | `TURN_ENDS` | The turn event types that end a turn (`end`, `done`, `error`), after which the conversation list, the history, usage, accounts, agents, continuations and context gauges are asked again. | | `SUBAGENT_ENDS` | The states a run ends in: `done`, `failed`, `cancelled`. | | `SUBAGENT_IMAGES` | 8: the pictures kept with each run, newest last. | | `SUBAGENT_KEEP` | 64: the ended runs held, the plugin's own number. | | `PLUGIN_NAME` | `"dotbot"` — the name the consent gate resolves the dialog's display name from. | | `DEVICE_CODE` / `PASTE_CODE` | `"deviceCode"` / `"pasteCode"` — the two sign-in flows, as `connect.start` names them back. | Tested by `src/lua/lib/tests/suites/dotbot_exports.testSuite`.
▲ 0↑ born
·
plugin · born here
❒asset
# dotbot DotBot, the agent in Zero's editor: the component that runs a person's own Claude or ChatGPT plan (or OrigoZero credits) from inside Zero, and the DotBot panel in the editor's right dock that talks to it. This world is where the plugin's published copy lives; the engine's built-in library pins a version of it. ## What is here | Part | What it is | |------|------------| | `plugin.wasm` | The DotBot component (`wasm32-wasip2`), built in the DotBot repo from `crates/dbot-zero-plugin`. | | `plugin.yaml` | The plugin's grants: its scope, the hosts it may reach, its private storage. | | `surface.module` | The plugin's Luau surface, what `require("@builtin::plugins.dotbot")` resolves to. | | `source.module` | What the panel reads: agents, accounts, conversations, history, turns, agents a turn started. | | `service.module` | The trusted service between the panel and the component: calls, the event ring, jobs. | | `panel.editorPanel` | The DotBot panel itself: toolbar, transcript, agents, composer, settings. | | `view.module` | What the panel says and how it looks (`palette()`), apart from how it is drawn. | | `transcript.module` | The transcript and the agents section, drawn as virtual rows. | | `workflows.module` | The Workflows view. | Each module's own README says what it does in detail. ## Seeing a panel change The editor draws its DotBot tab from the built-in library, not from this world, so an edit to the panel here does not show in the real tab. Open the world's own panel code over a fake plugin with example data instead: ```bash luau --lang luau 'require("/source/dotbotPanelPreview.module").open()' ``` It opens a **DotBot preview** tab beside the real one. Run it again after each edit. `dotbotPanelPreview.module/README.md` says what it shows. ## Shipping a change Work on a branch of this world and open a pull request into `main`. How a merged change reaches the engine (publishing `plugin.wasm`, and the engine's pin of this world) is written down in the DotBot repo, in `docs/zero-plugin.md`.
▲ 0↑ born
backing path · dotbot.plugin/view.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.