Skip to content

zidane/chat/pure

The Node-free subset of zidane/chat, safe to import from a browser renderer.

import { … } from 'zidane/chat/pure'src/chat/pure.ts

Use this entry point in a browser renderer (an Electron window, a Vite web build) that needs the chat engine's pure logic. It re-exports only modules with no node:* imports, React hooks or OpenTUI components: formatters, todo edits, diff builders, color helpers, transcript reducers, the picker cache hints (cacheHintText), the settings catalog and their types. Disk access and agent runs stay in the Node build of zidane/chat. Its browser build adds the React contexts and hooks to this logic.

It also holds the model of the setup wizard. The terminal app, the desktop app and zidane-ui/onboarding all run on it. planOnboarding returns the steps of a run, and createOnboardingFlow and onboardingReducer move through them. TRANSCRIPT_PRESETS, CONNECTORS and NATIVE_EXTENSIONS are its catalogs. onboardingSettingsChange returns the settings that a run writes, and needsOnboarding decides when the wizard opens. createOnboardingRun runs a whole wizard without a UI: the reducer, plus the imports and installs that its steps start.

TypeScript
import { addTodo, ageString, formatCostLabel, planOnboarding, transcriptPresetOf } from 'zidane/chat/pure'

const todos = addTodo(addTodo([], 'Write tests'), 'Update docs')
console.log(todos.map(todo => todo.content))
console.log(ageString(Date.now() - 5 * 60_000), formatCostLabel(0.0421))

// The setup wizard: the steps of a Quick start, and the preset that some settings match.
console.log(planOnboarding({ mode: 'quick', surface: 'desktop', importAvailable: false, installsAvailable: true }))
console.log(transcriptPresetOf({ showThinking: false }))

Functions#

accentColorFunction#

Resolve a profile's accent token to a concrete hex color via the caller's color palette. Renderer-agnostic — accepts the four-role subset of ThemeColors that's relevant to accent surfaces, so this helper composes against either useColors() (TUI) or a CSS-variable lookup (GUI). Omitted / unknown tokens fall back to accent.

actionIssuesFunction#

The problems of an action.

activePlanSummaryFunction#

The plan worth a glance: the session scope's applying plan, else its most recent stopped one. null when neither exists.

activeSnapshotForFunction#

The snapshot the footer indicator shows for a provider: the one probed with the credential requests use — the session's pinned account when it has one, else the provider's active credential — else the first reported. null when none.

activeSpaceOfFunction#

The space to show: the remembered one when it still exists, else the first space in the list (Default unless the user moved it).

ageStepFunction#

The relative-age ladder every "how long ago" label climbs: under a minute, then whole minutes, hours and days, then (from dateAfterDays) a date. Only a duration reads with "ago" in a sentence: "Updated 5m ago", but "Updated now" and "Updated Mar 4".

ageStringFunction#

Compact relative-time formatter — "just now / 5m ago / 3h ago / 2d ago".

ansiLineTextFunction#

The visible text of a line.

appendMarkdownDeltaFunction#

Coalesce a markdown delta into owner's open streaming block, or open one.

appendThinkingLinesFunction#

Coalesce a thinking delta into owner's open lane, one row per line.

applyEditPayloadFunction#

Apply the payload's hunks against priorContent and return the resulting file body, with exact string matching only:

  • replaceAll === true → String.replaceAll
  • otherwise → first-occurrence String.replace

Hunks are applied in order — a multi_edit later hunk operates on the output of the earlier ones, just like the actual tool. The tool's lenient matching (curly quotes, line-number prefixes) is not applied here; see previewEditPayload.

applyingPlanFunction#

The scope's applying plan, if any.

applyInsertFunction#

Replace [span.start, span.end) in text with insertText. Returns the mutated text and the new cursor position (end of insertion).

applyPlanEventFunction#

Applies one event to a bag. Pure: the input bag is never mutated. An event whose id was already applied changes nothing; a refused event returns error and the input bag.

applySettingsPatchFunction#

Settings with a change applied. A setting that turns on also turns on the one that it needs, so Session titles turns on Decisions, and a feature turns on what it includes, so Browser tab turns on Agent can use the browser. A setting that turns off also turns off the ones that need it.

authFailureHeadlineFunction#

The card's one-line headline, in plain English (the TUI's words; the GUI words it through labels with the same shape).

authOffersSignInFallbackFunction#

Whether the card also offers signing in again next to its retry: a retry that keeps failing on a stuck refresh is fixed by a fresh sign-in.

authPrimaryActionFunction#

The card's main action. A refresh stuck in another process or one that could not reach the provider is retried first; anything else (expired, revoked, missing, rejected) needs a new sign-in.

authProviderKeysFunction#

The provider key a failure is about, for matching it against the host's provider list (a descriptor's key, or its credentials key).

autoTextModelIdFunction#

The automatic text model among one provider's models; undefined when nothing qualifies (the caller then uses the main model).

bindingAlternativesFunction#

The chords one binding lists. A binding may name several, any of which fires the action: "ctrl+w | cmd+w" (or, in keybindings.json, an array). A | right after a + / - is the key itself (ctrl+|).

blendHslFunction#

Blend two hex colors in HSL space with shortest-path hue interpolation. t ∈ [0, 1]; t=0 returns from, t=1 returns to.

blockRunCommandFunction#

The command that runs a block in the session's folder, with no input, for Run here.

blockRunKeyFunction#

The key of a block's run: its reply and its code. An edited or regenerated reply is a new turn, so its blocks start without a run. Two identical blocks in one reply share their run.

blockTerminalInputFunction#

What is typed in a terminal to run a block there, ending with its Enter. The command keeps the terminal's input, so it can ask for some.

buildContextBreakdownFunction#

Shape a ContextSnapshot into a render-ready ContextBreakdown.

Live categories (system prompt, rules, tools, MCP tools/instructions, skills, searchable-tools catalog, conversation) sum to snapshot.used — conversation absorbs the remainder so the bar matches the provider-reported total (the remainder is floored at 0). Deferred + autocompact + free-space buckets follow.

When snapshot.exact carries provider counts, the matching categories use them (system, tools) and drop their estimated flag; everything else stays on the heuristic.

buildContextSegmentsFunction#

Shape assembled-prompt pieces into a flat, render-ready segment list.

Order is prompt order — base doctrine, then instruction files (broadest scope first, as discoverAgentsMd returns them), then the appended catalogs. Empty / whitespace-only pieces are dropped so the list never shows a zero-byte row.

buildContextualDiffFunction#

Like buildUnifiedDiff but operating against the full file content so the diff carries real file line numbers and configurable surrounding context.

Strategy:

  1. Apply the payload to priorContent → newContent.
  2. Run computeLineDiff over the whole file.
  3. Group non-context ops into hunks, padding each with up to contextLines of context above and below. Adjacent hunks whose context regions touch are merged so we don't emit two @@ headers separated by zero context lines.

The output line numbers in the @@ header are 1-based and reflect the change's position in the actual file — what the user expects when reading a diff alongside their editor.

For write_file creating a new file (priorContent === ''), this falls back to the same --- /dev/null convention as buildUnifiedDiff.

buildLinearRampFunction#

Static gradient ramp of length n going from from (index 0) to to (index n-1) in HSL space. For the cycling A→B→A→B ramp the throbber uses, see buildCycleRamp in src/tui/crush-throbber.tsx.

buildModelCatalogFunction#

Build the unified catalog from a list of available providers.

Provider order is preserved (callers typically pass the picker order — alphabetical, auth-detection order, etc.); model order inside each provider matches whatever modelsFor returns. The current selection (when set) is bubbled to the top of its provider's section so it shows first without disturbing relative ordering elsewhere.

modelsFor is injected (not imported from ./providers) so the same helper works with hosts that supply their own model resolver via ResolvedConfig.modelsFor.

include guarantees a pair is listed even when the provider stopped serving it. Persisted picks outlive catalogs (a provider retires an id, a user typed one by hand), and an entry that isn't in the list can't be selected away from, and the picker would keep re-persisting it. Synthesized entries carry offCatalog: true and a stub ModelInfo.

buildOnboardingResultFunction#

What a finished run writes: the settings change, the provider pick, the look and the records.

buildPanelCatalogFunction#

Built-ins first, then extension panels in registry (load) order.

buildPlanResumeMessageFunction#

The message the Resume button sends: the agent continues the plan by writing its step ids, which reopens it (the gate's resume rule).

buildSessionSearchIndexFunction#

Builds a SessionSearchIndex, skipping turns with no searchable text.

buildSessionSearchIndexAsyncFunction#

Yielding index builder for TUI callers — never monopolizes a frame.

buildStepRetryMessageFunction#

The message a step's Retry sends (a steer mid-run, a prompt when idle). Quotes the step so the agent matches it against its own list, and names the status: retrying a completed step differs from reviving a cancelled one.

buildUnifiedDiffFunction#

Builds a unified diff for an edit payload. Line numbers in each @@ header are synthetic, since hunks carry only snippets. A write_file that creates a file uses --- /dev/null. The result ends with a newline.

buildVisibleAuthRowsFunction#

Flatten the provider list plus the expanded set into the visible-row list.

  • providers — filtered / ordered provider list (post-search).
  • expanded — keys of providers whose sources are open. Keys for providers that are no longer expandable are ignored rather than cleaned up, so stale expansion state (a credential removed while the modal is open) can't desync the cursor.

buildVisibleInstructionRowsFunction#

Filter segments by the active query and resolve each one's expanded state.

Deliberately does NOT auto-expand matches the way the Extensions tab does: the search corpus includes each segment's full text, so a query typically matches deep inside a long document — auto-expanding every hit would dump thousands of lines into the viewport on a keystroke. The user expands the row they care about.

cacheBreakChipFunction#

Build the chip for a cache break.

costUsd is OPTIONAL and omitted entirely on a rate miss — never rendered as $0.00. A fabricated zero would read as "this was free", which is the opposite of what the chip exists to say. When present it is prefixed ~ because it is an estimate (registry rates × re-billed prefix), and clamped to <0.01 rather than rounding a real charge down to nothing.

cacheHintTextFunction#

The hint for an option: re-reads ~452k tokens when picking it would re-read a long prompt. Nothing for the current option, a switch that keeps the cache, a cache already expired (it is gone anyway), a short prompt, or an unknown estimate.

calibrationFactorFunction#

The factor that corrects this project's estimates: the median of actual / estimated over its recent finished runs, kept within CALIBRATION_MIN..CALIBRATION_MAX. null with too few runs.

canonicalKeyNameFunction#

A key name as the parser canonicalizes it ('Enter' → 'return', 'ArrowLeft' → 'left').

canSkipOnboardingStepFunction#

Whether the user can skip the current step. Welcome and Ready have nothing to skip, and the TUI cannot run without a provider.

capabilityTagsFunction#

The short tags a host's row shows: the tools found and the cloud kinds available, at most max.

capBlockOutputFunction#

output cut to its last BLOCK_RUN_OUTPUT_CAP characters.

capTranscriptEventsFunction#

Bound a transcript event array for display. Identity below the cap (no re-render churn on the hot append path); above it, drops the oldest events down to TRANSCRIPT_TRIM_TO_EVENTS — extended to the next turn boundary — and prepends a cumulative hidden-count marker. Callers: the stream buffer's drain commit and every eventsFromTurns replay site.

chainAccountConflictFunction#

Whether entry may join a chain led by chain[0] (one account per provider; see filterChainFallbacks).

chainEntryKeyFunction#

Identity of a chain entry — provider, account and model, not object identity.

chainPositionOfFunction#

1-based chain position of a provider+model(+account) pick, or null when not in the chain.

chainsEqualFunction#

Compares two chains element by element using chainEntryKey.

chainsEqualKeyedFunction#

Same entries in the same order.

chatReferenceTokensFromTextFunction#

Extracts the #token chat references from text. A token starts after whitespace or at the start of the text. Trailing punctuation is stripped, tokens are lowercased and duplicates are dropped.

chunkMarkdownForRenderFunction#

Split a large markdown document into render-safe chunks at blank-line boundaries outside code fences, each roughly targetBytes long.

Rendering the chunks as SIBLING markdown renderables (with a one-row gap standing in for the consumed blank line) is visually equivalent to one renderable, but sidesteps the quadratic lexer cost documented on MARKDOWN_RENDER_CHUNK_TARGET_BYTES. Chunk boundaries are prefix-stable: appending text (streaming) can only ever change the LAST chunk, so keyed-by-index consumers reconcile cheaply.

Returns [text] untouched for anything at or under the target.

classifyMcpTestFunction#

Classifies a connection attempt. HTTP servers that required auth or answered 401/403 become token-rejected when the config sends its own headers, else needs-auth. Any other error becomes error. A clean connection is ok.

clipAnsiLineFunction#

A line cut to max visible characters, the last one an ellipsis when it is cut.

clockOrDateTextFunction#

"14:05" when at falls on now's day, "Oct 12" in the same year, else "Oct 12, 2025".

clockTextFunction#

"14:05", local time, 24-hour.

closePanelFunction#

Closes the panel and keeps the active tab.

collectReferencesFunction#

Collect every provider's references in one pass. Convenience wrapper — the TUI textarea component calls this on every keystroke to highlight in-prompt mentions.

commandGistFunction#

Ran <gist> for a shell command: heredoc bodies dropped, setup steps (cd, export, set -e) skipped, env and wrappers peeled off, program plus subcommand kept. Further meaningful steps read as +N.

compactingLabelFunction#

compactingParts as one plain string, for a slot that cannot hold badges: Compacting... ~12k, 8s.

compactingPartsFunction#

Footer readout while a compaction summary is being generated: the label, then ~12k once the loop reports a token estimate, then 8s once a second has passed, one badge each. Same rule on every surface so a minutes-long compaction of a large transcript reads as progress, not a hang, in the TUI and the GUI alike.

now is injectable so callers driving a 1 Hz tick don't have to re-read the clock, and so tests are deterministic.

compactPathFunction#

Compact an absolute path for display: replace the user's $HOME prefix with ~ (so /Users/yael/Code/zidane → ~/Code/zidane), and optionally left-truncate with an ellipsis when the result still exceeds maxWidth (so the path's tail — the part the user recognizes — stays visible: …/zidane rather than /Users/yaeluil…).

maxWidth is the maximum display width in cells. Omit to skip truncation. Paths outside $HOME are returned verbatim modulo truncation. The ellipsis (…) counts as one cell.

home overrides the home directory read from HOME / USERPROFILE for tests; production callers leave it undefined.

compareModelVersionFunction#

Numeric, segment by segment; a longer version wins a tie on the shared prefix (5.5 > 5).

compareValuesFunction#

Orders two present values: numbers, then strings (natural order, case ignored, then exact), then booleans (false first), then anything else by its JSON text.

compileQueryFunction#

Compiles a query into a predicate. Relative bounds ('-7d') resolve against options.now each time the predicate runs, so a long-lived predicate stays current. Throws SessionQueryError for an invalid query.

computeInlineDiffFunction#

Computes word-level segments for a paired removed and added line. Both segment lists keep the same order. Tokens that differ have changed: true. Very long lines fall back to one fully changed segment.

computeLineDiffFunction#

Computes a line diff between two strings with an LCS table. Common leading and trailing lines are trimmed first. When the changed core is too large for the table budget, the result is all removals followed by all additions.

connectorAuthTextFunction#

How a connector signs in, when it is not the usual browser sign-in.

connectorByIdFunction#

A connector by id, or undefined.

connectorInputErrorFunction#

Why zidane cannot add a connector with this input, or undefined when it can. The one reason is a missing token that the connector needs.

connectorInstalledFunction#

Whether a connector is already installed: a server with its name, its endpoint, or its command and arguments.

connectorServerConfigFunction#

The MCP server a connector writes to mcps.json.

connectorsFromImportFunction#

The connectors that an import brings over: the MCP servers that it copies and that have the id of a connector. The Connectors step marks them, and the run does not add them twice.

copyNamesFunction#

The names a copy of name tries, in order: itself, a copy.ts, a copy 2.ts, … (a folder or a dotfile keeps no extension apart).

countNeighborsFunction#

Count turns before / after the one identified by turnId in the given list. Returns null when the id is missing. Used to label the turn-details modal with N before, M after.

countOnceCallSitesFunction#

How many calls a script makes, when every call can run once at most: each tools.<name>(…) or sh(…) sits outside loops and functions (callbacks, helpers, methods). undefined when one may run more than once, when the script reaches tools or sh another way (a reference, a computed name), or when it makes no call. A call in a branch that does not run makes the count high, never low, so a percent from it never runs ahead.

createAnsiLinesFunction#

Creates an incremental AnsiLines reader. The style carries across chunks and lines, as in a terminal.

createChatsCompletionProviderFunction#

Creates a completion provider for # chat references. Each chat gets the shortest id prefix, at least 6 characters, that identifies it in the catalog. Suggestions are fuzzy-matched on title, token and project folder.

createCommandsCompletionProviderFunction#

Build a commands completion provider against a live command list. The getter is re-evaluated per suggest so registry toggles / cwd rebuilds take effect without re-instantiating the provider.

createEntryOpsFunction#

The entry actions over port, whose paths are relative to the folder (the caller's port maps them where they live).

createFilesCompletionProviderFunction#

Build an @-prefixed files completion provider against a live catalog.

The factory captures a getter so the catalog can be re-scanned (cwd change, manual refresh) without re-instantiating the provider — the App keeps one provider for the lifetime of the prompt block and just mutates the underlying state.

limit caps the result list so the popover stays bounded on huge monorepos. Filtering is substring on path + name, case-insensitive, with an fzf-scored basename fuzzy fallback so small typos / omissions (lop.ts → loop.ts) still surface results; ranking prefers (in order): exact name match, name prefix, name substring, path substring, basename fuzzy match, alphabetical.

createHostIndexFunction#

Creates an empty index of which host holds each id.

createOnboardingFlowFunction#

A new run at its first step.

createOnboardingRunFunction#

Starts a run of the setup wizard.

createOutputTailFunction#

Creates an empty OutputTail.

createPaletteRankerFunction#

rankPaletteItems for a palette being typed into: it remembers the last query, and when the next one only adds to it (one more character, one more word) it searches just what matched before. A longer query never matches an item the shorter one missed, so the result is the same.

createPresenceMergeFunction#

Creates an empty presence merge that keeps the last snapshot of each host.

createRunStopMarkerFunction#

The run-stop pass for one surface. It returns its input itself when no run stopped early, so memoised consumers stay put.

It runs on every stream drain tick, where only the tail changes. Items are immutable, so both caches key on identity: the failure scan reads each reply once, and a segment whose items are unchanged hands back its previous output (without that, a session with one old failed run minted fresh stop items every tick, so they re-rendered on every streamed token).

createScriptProgressTrackerFunction#

Creates an empty ScriptProgressTracker.

createSkillsCompletionProviderFunction#

Build a slash-command completion provider against a live skills catalog. The factory captures a getter so the catalog can change across renders (toggles, reload) without re-instantiating the provider.

Pass getEnabled to additionally hide skills the user has toggled off — when undefined, every catalog entry is offered.

cronProblemFunction#

Schedules: the wire shapes, the checks and the time math that the host, the TUI and the UI share. The cron math (./cron, on croner) and the scheduler (./scheduler) are imported by path, so this entry stays free of them. See docs/SCHEDULES.md.

currentModelKeysFunction#

Keys (provider\0model) of the current models: per provider and family, the newest version, one entry per size. keep entries (the active model, fallback chain, off-catalog ids) are always included.

currentModelsFunction#

entries in their original order, current models only (see currentModelKeys).

currentOnboardingStepFunction#

The current step.

customModelTargetsFunction#

Every route for a typed model id, one per provider: the provider the query names first (xai grok-9), then fallbackProviderKey (the current pick), then the rest in the given order. Lets a picker offer "use this id via…" for each signed-in provider instead of guessing one. Empty when the query names no model id.

cycleTabFunction#

Cycle to the next / previous tab (wraps). Counts as a user pick.

dayOfYearFunction#

The day of the year (1-366) of d: a seed stable within a day.

daysEndingAtFunction#

The count days ending at end (inclusive), oldest first, as local YYYY-MM-DD.

decisionsEnabledFunction#

Whether the agent gets decisions: the user turned them on, or Model decision approvals (approvalMode: 'decide') need their answers.

defaultCatchUpFunction#

The default catchUp of a trigger: a missed reminder still arrives, a missed recurring fire does not.

defaultExtensionSourceFunction#

The default source pinned to a release, Tahul/zidane#v<version>: the native extensions that match the running app's API.

defaultImportSelectionFunction#

The selection that Bring your setup starts on. It has every piece with something new to copy. It has the sessions of this project, or of every project when this project has none.

defaultSessionAgentFunction#

The agent a new session in spaceId starts on: the space's (spaces on), else the global one (Settings.defaultAgent), else undefined (Build). An id the registry doesn't hold is the caller's to resolve (resolveAgentId).

defaultSessionKnobsFunction#

The effort and options a new session in spaceId starts with, whatever its model: each the space's own (spaces on), else the global one (Settings.defaultEffort / defaultModelOptions), else absent (the last used with the model). A pick in the composer wins over these.

defaultSessionModelFunction#

The model a new session in spaceId starts on: the space's default (spaces on), else the global one (Settings.defaultModel), else undefined (the caller's last used), with the effort and options new sessions start with (defaultSessionKnobs). A pick in the composer wins over this (newSessionModel).

defineFeatureGateFunction#

Creates a FeatureGate from its setting key, kill-switch env var, and CLI flag.

deleteTurnSafelyFunction#

Delete — remove the turn with turnId and any tool blocks left orphaned by the removal. Returns null when turnId doesn't exist.

Strategy:

  1. Drop the target turn.
  2. Scan the remaining turns for tool_calls without a matching tool_result (orphaned by removing the user turn that carried the result), and tool_results without a matching tool_call (orphaned by removing the assistant turn that issued the call). Strip both sides.
  3. Drop turns whose content is now empty.

This guarantees the resulting history is protocol-clean — a follow-up agent.run() against the modified session can post turns without the provider rejecting the history.

describeDurationFunction#

A duration in words: 90 min → 1 h 30 min.

describeSpawnEndFunction#

A worker's end from its spawn-end marker. Reads spawn.end, or parses the text of a marker recorded before it existed (done · 42s · $0.01 · in 3100 / 400 out), whose facts become badges verbatim.

describeTimeFunction#

A time for lists: today 09:00, tomorrow 09:00, else Mon 3 Nov 09:00.

describeTriggerFunction#

A trigger in words, for lists: once at 09:00 tomorrow, every 30 min, cron 0 9 * * 1-5 (Europe/Paris).

discardThinkingFunction#

Drop one owner's streamed output for a turn: the reasoning, and the text, of a provider attempt the loop abandoned (a stalled stream retried, a connection that dropped mid-answer, or a move to the next model), which the next attempt replaces and the saved turn never holds. The loop only abandons an attempt whose turn has no other output, so nothing kept is lost. Returns the same array when there is nothing to drop.

displayHostUrlFunction#

Scheme, host, port and path of a URL (token-looking path segments redacted): what is safe to show or log.

displayNameForFunction#

Resolve the display verb for a tool. Native tools use their curated entry from TOOL_DISPLAY; everything else gets a sentence-case version of the raw name (my_host_tool → My host tool) so an MCP / host tool still reads cleanly in the transcript without shouting Title Case at every word.

MCP convention: every tool surfaced by mcp/connectMcpServers is namespaced as mcp_<server>_<tool> (see src/mcp/index.ts). The mcp_ prefix is plumbing — strip it before casing so the label reads as Github create issue instead of Mcp github create issue. The server name leads, which doubles as a free visual grouping affordance ("everything starting with Github came from the github MCP server").

editableTurnTextFunction#

The text an edit of turn starts from: its text blocks one paragraph apart, after rejoining a cited Claude reply's fragments (mergeReplyText), so a cited answer edits as the one text it is and, saved unchanged through replaceTurnTextBlocks, stays exactly as written.

effectiveOnboardingModeFunction#

The mode a run ends in: Quick start turns a full run into a quick one.

enabledMcpsWithFunction#

The list with name turned on, or undefined when it already is.

enabledMcpsWithoutFunction#

The list without name, or undefined when it isn't listed.

enforceSettingsInvariantsFunction#

Cross-setting invariants, applied at EVERY write: resets every toggle whose requires setting is off.

Settings are a shared file with three writers (the TUI, the GUI main process, the daemon) and no lock; a rule enforced in one client is a rule the others break. So this is the single definition, derived from the requires declarations on the toggle rows themselves — adding a dependency is one field on one row, and the UI hint and the write-time guarantee follow from it together.

Pure and idempotent: returns the same object when nothing changes, so React state and file writers can short-circuit on identity.

engagedKillSwitchesFunction#

The kill-switch env vars engaged in env, sorted. The GUI main process hands this to its renderer (which has no process.env) so settings rows can say why they are inert.

entryNameFunction#

The last segment of path.

entryParentFunction#

The folder holding path ('': the root).

entryPathFunction#

path as the rules take it (no trailing /), or null when it is not a valid entry path.

environmentLabelFunction#

A session's environment as its header shows it: local@laptop, worktree@laptop ⎇ feat, ⎇ feat, or the kind.

escapeTemplateFunction#

text as a template that renders to itself: each brace doubled. Use it for user text inside a template (`${escapeTemplate(bot.name)} · {modelId}`).

estimateLevelLabelFunction#

One level's label, as the decision model reads it.

estimateReadoutFunction#

What view says at now.

estimateViewAtFunction#

When view was made: its estimate's time, or its failure's.

extensionMarkFunction#

The mark of an extension: icon.gui (unless it is the native catalog's own icon and the catalog has a logo), then brand, then the native catalog's brand, then its icon.gui, then the first letter or digit of the display name.

extensionSpaceFunction#

An extension's space as a Space: read-only, its newSession defaults as the space's own (agent, model, effort).

extractEditPayloadFunction#

Extracts an EditPayload from a tool call's raw input. Supports the edit, multi_edit and write_file tools. Returns undefined for other tools or when the input is malformed.

fieldCategoryFunction#

The category a field belongs to.

filetypeFromPathFunction#

Maps a file path to a tree-sitter filetype name. Query strings and fragments are ignored, and the extension match is case-insensitive. Returns undefined for unknown or missing extensions.

filterLogRecordsFunction#

Retain only records at or above minLevel. Preserves order.

filterModelCatalogFunction#

Filter catalog by a user query. Empty / whitespace-only queries pass every entry through (a copy of catalog). Multi-term queries (space-separated) require EVERY term to appear somewhere in the entry's search corpus — so "claude opus" matches claude-opus-4 regardless of how the words are interleaved with provider names.

Match is case-insensitive (the corpus is pre-lowercased; the query is lowercased once per call).

Generic over the entry shape so the GUI renderer filters its flat IPC wire rows (which carry the same main-built searchCorpus) with this one implementation.

filterRowsFunction#

The rows that match where, in input order. now is read once for the whole list.

filterSessionSearchCatalogFunction#

contentMatches are keyed by keyOf(meta): the bare id by default, a (host, id) session key for a list across hosts (twins are two rows).

finalizeStreamingMarkdownFunction#

Flip any trailing streaming markdown blocks (any owner) to finalized.

finalizeStreamingMarkdownForOwnerFunction#

Flip the trailing streaming markdown block for one specific owner.

findActiveTriggerFunction#

Resolve the provider trigger active at cursor, or null when none fits.

Rules:

  • The trigger character must sit at position 0 of the buffer OR be preceded by whitespace. This prevents http:// from triggering the /-bound skills provider mid-URL.
  • The cursor must be at or past the trigger position.
  • Nothing between the trigger and the cursor may be whitespace (the query is one contiguous token), unless a provider sets allowSpacesInQuery. A newline always closes the query.
  • The query length is bounded — maxQueryLength defaults to 64 — so a runaway buffer scan can't pin the renderer.

findSpaceFunction#

One space looked up by id or name (both case-insensitive), the id match first. undefined for a blank query.

fitRunReceiptCellsFunction#

Fit cells to width columns for a renderer that draws them two blank columns apart (the TUI's badge rows): returns the cells that fit whole. A cut cell is truncated with …; anything after it is dropped. Never wraps. prefix is the columns the renderer already spent (glyph + space).

flattenQueryFunction#

query with nested all in all and any in any merged into their parent, and a one-element all / any replaced by its element. Matches the same rows.

fmtCostFunction#

USD cost, dollar-prefixed — 2 decimals, 4 below a cent so tiny spends stay visible (a haiku worker's $0.0007 must not render as $0.00).

fmtTokensFunction#

Compact token formatter — 12_415 → "12.4k", 1_234_567 → "1.23M".

foldsInCompactShapeFunction#

Compact density: does this item fold into its exchange's one row? Thinking, tool traffic, worker lifecycle, a / command's details and everything a worker produced fold; the prompt, the assistant's prose, errors, notices, the user's own ! runs and session events stay.

foldSummaryFunction#

A settled fold's header: its own calls in the shared words (Read a file, ran a command +2), with the workers after them when no spawn call already says so (, 1 worker: a script started it). Exchanges without calls say what they did: Delegated to a worker, Thought, Worked.

formatBalanceFunction#

20.00 / 25.00, or just the remainder when no total is reported.

formatBytesFunction#

Byte counts for people: 512 B, 1.5 KB, 2.0 MB.

formatCostFunction#

USD: formatCostLabel below $10 ($0.004, never $0.00), whole dollars below $10k, then $12.3k.

formatCostLabelFunction#

Live cost, readable: sub-dollar runs keep a tenth of a cent (so the figure visibly moves while a cheap run streams), then cents with grouping: $0.123, $4.56, $1,646.17. null for nothing spent, never $0.00.

formatCostUsdFunction#

$0.04, or four decimals under a cent so a cheap run is not shown as $0.00. Same as fmtCost.

formatCountFunction#

A count at a glance: 950, 1.2k, 12.4k, 120k, 4.6M, 1.2B. One decimal (a trailing .0 dropped) below wholeFrom of a unit, whole numbers from there. A value that rounds up to 1000 of a unit reads in the next one (999_999 → 1M, never 1000k).

formatCreditsFunction#

Balances are dollars for OpenRouter and opaque units elsewhere.

formatDurationFunction#

Compact human-readable duration formatter shared by background-task surfaces (the <task-notification> summary, the TUI banner, the shell_kill tool result, etc.).

Format ladder:

  • < 1s → "Nms"
  • < 10s → "N.Ns" (one decimal)
  • < 1m → "Ns" (whole seconds)
  • < 1h → "NmNs" / "Nm" when the remaining seconds are 0
  • ≥ 1h → "NhNm" / "Nh" when the remaining minutes are 0

Single source of truth so a 60s task renders the same across the model-facing XML summary and the user-facing banner. Separate formatters would disagree (XML "60.0s", banner "1m"), which is confusing to a user reading both side by side.

formatElapsedFunction#

Run time as a person reads it: 42s, 1m 05s, 2h 03m.

formatEstimateFunction#

A remaining time as a chip says it: ~45s, ~11m, ~1h 20m, ~12h, and 24h+ past a day (the open-ended last step: no number pretends to know).

formatHourFunction#

0-23 → "9 am" / "2 pm" / "12 pm".

formatLogLineFunction#

Render a record as a single human-readable line (no trailing newline): <ISO timestamp> <LEVEL> <message> <attrs as kv pairs>. Shared by the console + file sinks, the TUI logs viewer, and the GUI Logs tab so every surface presents a byte-identical line.

Lives here rather than in logger.ts because that module imports node:fs for its file sink; this one function is pure and is the only part the renderer needs.

formatModelSettingFunction#

The settings string for a pick (inverse of parseModelSetting).

formatRunDurationFunction#

2m18s / 48s / <1s / 1h05m. Compact — this is a receipt, not a profiler.

formatRunReceiptCellsFunction#

The receipt's cells, in display order. Renderers show each as a badge, tint it by kind, and truncate to their own width; the CONTENT is fixed here. modelName names the model as the surface's picker does.

formatRunReceiptLineFunction#

The plain-text receipt for slots that cannot hold badges (the event's text, a copy): cells comma-joined, ellipsized to width columns. Never wraps.

formatTaskStatusFunction#

Status label for a terminated background task — "exited <code>" for natural exits, "killed" (with the signal name when known) for our-issued SIGTERMs.

Pulled out as its own function so the <task-notification> XML summary, the TUI banner header, the shell_kill tool result, and future surfaces all read the same string.

formatTaskSummaryFunction#

One-line summary of a terminated background task: the model-facing <summary> of the persisted <task-notification> XML, which replay copies into the event's text. Three dot-separated segments:

<command preview · status · duration>

A wire format, not display copy: renderers build their badges from the event's structured task (formatTaskStatus, formatDuration).

formatTokenCountFunction#

1.2k / 48k / 1.3M — token counts are read at a glance, not counted.

formatTokensFunction#

12.3k / 4.6M / 1.2B — one decimal below 100 of a unit, whole above (formatCount).

formatTokensPerSecondFunction#

42 tk/s; one decimal under 10 so a slow model is not shown as 0 tk/s.

formatToolCallFunction#

Run a tool's curated formatter and return the result, or null when no formatter is registered / the input shape doesn't match. Renderer decides what to do with null — typically: show ↳ <displayName> with no target / meta tail.

formatUsagePercentFunction#

Percent for display: integers print bare, fractions keep one decimal (so a status bar never reads 100% for 99.9).

freeEntryNameFunction#

The first free name for name in folder dir, compared without case (a case-insensitive disk sees A.ts and a.ts as one).

fuzzyMatchFunction#

Subsequence match of query in text with the usual bonuses: word starts and the very beginning score higher, gaps cost, runs of adjacent hits are rewarded, and the query found whole (as one run) beats the same letters scattered. Returns null when not every query character appears in order. Case-insensitive; query must already be lower-cased.

gatherCommandNotesFunction#

One receipt line per exchange: every command-note in an exchange moves to its end and joins into a single event (committed 83dfea7, pushed to origin/main). Returns events itself when there is nothing to merge; the merged event keeps its identity while its notes do not change, so memoised rows stay put.

generateSessionTitleFunction#

Drive the provider's stream() once and return a concise title for the conversation represented by turns. Throws when:

  • turns contains no text-bearing content (nothing to summarize),
  • the provider stream completes with no output text,
  • the model answered the transcript instead of labeling it (see cleanTitle) — a failed generation the caller retries,
  • signal is aborted (rethrown verbatim).

Output is trimmed, single-line, with surrounding quotes / trailing punctuation stripped, and truncated to TITLE_MAX_CHARS.

groupKeysOfFunction#

The group keys of a value: one for a scalar, one per distinct element for a list, none for a missing value or an empty list.

groupPaletteRowsFunction#

Sections for display. With a query the ranking already interleaves providers, so groups follow the order of their best row. Without a query the recents (ids in recents, present in ranked) form a leading Recent section and the rest keeps provider order.

groupRowsFunction#

Groups rows by groupBy.field. Rows keep their input order inside each group, so sort first. Groups are ordered by groupBy.order; the group of rows without a value (key null) comes last. Throws SessionQueryError for an invalid grouping.

hasAnsiFunction#

Whether text holds anything parseAnsi changes: an escape, a carriage return, a backspace.

hasRunReceiptFunction#

Anything to show? A run with no record data renders no line at all.

hasToolFunction#

Whether name is on the host's PATH; undefined while unknown.

heatmapLevelFunction#

A value's level against heatmapThresholds.

heatmapThresholdsFunction#

The quartile bounds of the values above 0.

highlightSegmentsFunction#

Splits text into highlighted and plain runs along ranges.

humanBytesFunction#

formatBytes with whole kilobytes (2 KB), for short notices and attachment labels.

importEntriesFunction#

Brings items into folder dir through create (one call per entry, so no call carries more than one file): each top-level item takes a free name, what is inside a dropped folder keeps its own. The limits are checked before anything is written; a failure on the way stops the import and says what was made.

importsSomethingFunction#

Whether a selection brings anything over.

indexOfEntryFunction#

Find a catalog entry's index by its {providerKey, modelId} tuple. Returns -1 when not present. Useful when re-rendering the picker (a query just narrowed the list, where did the selection land?).

indexOfProviderRowFunction#

Index in rows of the header for the given provider key, or -1.

Collapse handlers snap the cursor up to the parent BEFORE the row list shrinks; without that the cursor keeps its flat index and silently lands on whichever sibling row slid into that slot.

inferPromptRefsFunction#

File-mention refs recovered from a prompt's text: @<path> at the start or after whitespace, where the path looks like one (has a / or a .), trailing punctuation excluded (the files completion's own rule).

Refs are known only to the client that sent the prompt, which typed the mention through a completion. The persisted turn and the send echo other windows receive carry the text alone, so without this a prompt's chips existed in the sender's live transcript only: gone after a reload, never shown in another window or the TUI. Replay and the echo fill refs from this when the event has none, so every client paints the same prompt. Skills and chats mentions are not inferred: their tokens (/name, #token) are ordinary text too often to guess without the catalogs.

instructionOriginBadgeFunction#

Short badge for a segment's origin — the "where does this come from" column. 'file' is intentionally the only one that reads like a location, since it's the only origin the user can act on.

instructionPreviewLinesFunction#

Split a segment's text into renderable preview lines, clamped to INSTRUCTION_PREVIEW_LINE_CAP.

hidden is how many lines were dropped off the tail, so the view can render an honest "+N more lines" marker instead of silently truncating. Tabs are expanded to two spaces because the terminal text renderable doesn't interpret \t, and \r is stripped so CRLF files don't leave artefacts at every line end.

isAllowedBrowserUrlFunction#

Only http(s) pages (and the blank page) ever load in the dev browser.

isCacheNoticeFunction#

Whether a notice is one showCacheNotices hides: a prompt-cache break or expiry, or dropped reasoning (the same prefix churn, seen from the thinking side).

isEditErrorResultFunction#

Recognize a tool-result body as carrying NON-success information so the renderer doesn't suppress it under showEditDiffs. Categories:

  • edit → "Edit error: …"
  • write_file permission errors wrapped by the loop → "Tool failed: …"
  • multi_edit → single-line error multi_edit error: …, OR a result carrying an <edit-outcomes>…</edit-outcomes> annotation block. The host only appends the annotation when at least one hunk was NOT applied, so its mere presence is the signal — the result body needs to stay visible next to the diff so the user can read denial / skip / failure reasons longer than the per-hunk badge.
  • Fully-denied gate emit ([fully denied] <edit-outcomes>…) likewise stays visible.

Exported for unit-testability of the visibility matrix.

isExistingInstallFunction#

Whether the install existed before the wizard: it has stored settings, credentials, sessions or a last-used provider.

isExpandableProviderFunction#

A provider earns a chevron only when there is a real choice to reveal.

isExtensionSpaceIdFunction#

Whether spaceId names an extension space (<extension>/<id>).

isFenceCloseFunction#

line closes the fence opened with fenceChar × fenceLen: the same character, at least as many, and nothing but spaces after (an info string makes it a line of code, as in CommonMark).

isKillSwitchEngagedFunction#

name is set to '1' in env: the kill-switch test, for a row that only knows the variable.

isLocalBrowserUrlFunction#

A loopback address: the dev servers the browser exists for.

isMainSessionFunction#

Type guard over untrusted metadata.

isMethodNotFoundFunction#

The host predates the method (models.list, catalog.*, …): callers degrade, never fail.

isMouseTrackingFunction#

Whether the program asked for mouse reports.

isolationLabelFunction#

The isolation a kind gives, named without its machine (the picker names the place apart): In the folder for local kinds, New worktree for worktree kinds, else the kind's own label.

isPaletteContextFunction#

Type guard hosts use before forwarding a payload from an untrusted provider.

isRelativeTimeFunction#

Whether value is a relative time: 'now', or a sign, a count and a unit (s, m, h, d, w), such as '-7d'.

isRunEstimatedFunction#

Whether view has a timing to count down (not a problem).

isSecretAnswerFunction#

Whether value is a SecretAnswer: a value or a decline sent by a client.

isSecretNameFunction#

Whether name is a valid secret name (SECRET_NAME_PATTERN).

isSecretReferenceFunction#

Whether value is a SecretReference.

isSecretTtlFunction#

Whether value is a SecretTtl.

isShellFenceFunction#

Whether a fence of language runs.

isTurnHighlightedFunction#

Render-time check: should event paint with the selection accent?

true when the event's own turn is selected, OR when the selected turn owns the event's turn via turnSelectionOwnership (the call and its tool-result rows highlight together), OR when the event's turn owns the selected turn (a result-only turn selected highlights its call). false when nothing is selected or the relationship doesn't apply.

Pure. Renderer-agnostic — the TUI's <Transcript> uses it; a GUI's equivalent walks the same rule.

isUserBashEventFunction#

Is this event a user-initiated ! bash exchange (vs. a model-driven shell call)?

isValidMachineNameFunction#

A machine name: one path-safe segment, so local@<name> is unambiguous.

isVisibleFunction#

Whether event shows in the transcript under the user's toggles, including hideSubagentOutput, showEditDiffs, showThinking and showToolResults. When subagent output is hidden:

  • Child-agent events are filtered down to the spawn-start / spawn-end markers so the user still sees "🌱 working… 🌳 done".
  • The parent's tool-result for spawn is hidden too. Its body duplicates spawn-end's stats line and the parent's next markdown turn; showing it again produces an extra ┃ [sub-agent child-1] Completed … block users just want gone.

Renderer-agnostic — returns plain boolean so TUI / GUI consumers can filter events identically.

joinEntryFunction#

name in folder dir.

joinFewNamesFunction#

Up to two names, then a count: "A and B", "A, B and 3 more".

joinNamesFunction#

A list of names as a sentence reads it: "A", "A and B", "A, B and C".

lastSeenTextFunction#

"seen 5 min ago" for a machine's lastSeen.

lentServerMachinesFunction#

The machine names of the saved servers a local host uses as machines (machines.links.status uses): pickers list those servers once, as servers, not again as local@<server>.

liveSessionCostFunction#

Session cost while a turn streams: settled figure plus the running estimate for the in-flight turn. estimated tells the surface to render it dimmed (the number will move, then snap to the settled value at turn end). null when there is nothing to show — never $0.00.

localTimeZoneFunction#

The IANA time zone of this process (UTC when it has none).

longDayLabelFunction#

"Monday, Oct 26" for a YYYY-MM-DD day.

machineBlockedReasonFunction#

Why a machine kind can't be picked now (its machine is offline), else undefined.

machineDirListingFunction#

machines.listDirs as a folder listing: the parent stops at the root the folder is in.

machineKindFunction#

A machine-qualified environment kind: <base>@<machine name>.

machineSetupCommandFunction#

The command a machine runs to join a main server with a join string (formatJoinString).

machineVersionDiffersFunction#

Whether a machine runs another zidane version than its main server. false when either is unknown.

machineWaitingFunction#

The machine a session's run is paused on, from its notices (waiting for laptop… until laptop is back. or laptop stayed offline … run stopped), null when none. online: machines known to be back since (a machine:status the window saw), which clear the wait at once.

maskScriptSourceFunction#

code with the text of strings, comments and regular expressions replaced by spaces (newlines kept), so a scan sees only code. Template literals keep their ${…} expressions.

mayHaveStreamFailureFunction#

Cheap pre-check before splitting: the text may end in a stop marker.

mediaTypeOfPathFunction#

The media a path names, by its extension; null for everything else.

mergeOnboardingStateFunction#

Stored records with new ones merged in. A finished run (any record) clears the in-progress marker.

mergePresenceMapsFunction#

base with every other host's rows laid over it, by session id.

mergeReferencesFunction#

Merge reference lists from multiple providers into one ordered list with earlier-start-wins disambiguation when spans overlap. Ties broken by insertion order. Spans are sorted ascending so renderers can walk them sequentially with a cursor through the source string.

mergeSuggestionsFunction#

Flatten several providers' suggestion lists into one, stamping providerId on every item (for provider-aware row styling) and defaulting section to the producing provider's label so the popover can render group headers.

section is stamped only when the TRIGGER hosts ≥2 providers (see groupCount), not when ≥2 happen to return items — so a query that filters a shared trigger (/) down to one group still shows that group's header, while a genuinely single-provider trigger (@ files) renders flat (the header would just duplicate the popup's border title). Items that already carry a value keep it.

mergeTargetIndexFunction#

Index of the event owner's next delta may coalesce into, or -1 when the owner has no open lane at the tail.

Walks backwards over events owned by OTHER subagents — concurrent siblings whose rows carry no ordering relation to this owner's output, and which a per-owner drain interleaves at ~60Hz — and stops at the first event that is either this owner's or a real ordering boundary (parent output, user prompts, banners). The caller decides whether the event found is mergeable for its kind. A tail-only check splits every concurrent child's message into fragments braided with its siblings'.

messagePreviewFunction#

A message as a person skims it: its words, markdown syntax and code blocks dropped, whitespace folded. For the compact stacks of earlier messages.

messageSelectionOwnershipFunction#

Ownership for "one selection stop per message": result-only turns fold into their assistant turn (turnSelectionOwnership), and turns that only did work (thinking, tool calls, worker markers) fold into the answer that follows them in the same exchange. "Read three files, then answered" is one stop, so ↑ moves one visible message at a time. An exchange that ends in work alone stops on its first work turn. Same rule as the GUI's computeSelectStops.

migratedOnboardingRecordsFunction#

The records an install that predates the wizard gets, so it never opens on its own.

modelConcernFunction#

Why the decision model handed a call to the user, for the approval card.

modelDisplayNameFunction#

Builds the picker name for a model: the catalog name when given, else the id made readable, with a vendor prefix split off and the provider's own brand word removed.

modelPickKeyFunction#

Identity of a model pick on any shape: the same model on two accounts of a provider is two picks. The one key every picker and chain edit compares by.

modePrefixFunction#

Sequences that put a fresh terminal in state's modes.

modePrefixLengthFunction#

Length of the mode sequences text starts with: at least the modePrefix put in front of a snapshot. Output that itself starts with mode sequences counts too, so this errs towards less output, never more.

mostConstrainedWindowFunction#

The window closest to its ceiling, which is the one that will bite first and the only one a single-line indicator has room for. null when the snapshot carries no windows.

moveTabFunction#

Move one visible tab delta slots within the visible strip (keyboard reorder), clamped at the ends. Hidden pinned ids keep their slots.

nativeExtensionByNameFunction#

A native extension by name, or undefined.

nativeExtensionEntryFunction#

The listing row of a native extension, from the catalog shipped in the app.

nativeExtensionListingFunction#

The native extensions as a listing of the default source pinned to version, built from the catalog shipped in the app (NATIVE_EXTENSIONS): what an app shows when the repository cannot be read. No network.

nativeExtensionNeedTextFunction#

What a native extension needs, in words: "gh (optional)", "the Linear connector".

nativeExtensionSourceFunction#

The install source of a native extension, pinned to a release tag: Tahul/zidane#v<version>:extensions/<name>, the grammar installExtensionFromSpec takes.

needsOnboardingFunction#

What an app does at launch about the wizard (docs/ONBOARDING.md, When it opens).

nestedCallShownFunction#

Whether a script's nested call shows in the transcript: a call that runs a subagent (its worker attaches to it), a plan or a question, or any call with codemodeShowCalls on. Every surface (the host's live rows, isVisible, the kit's rows) applies this one rule.

nestedRecordEventsFunction#

A persisted record as the events the live run emitted for it.

nestedResultEventFunction#

The tool-result row for a nested call as it ends; the output is cut to a preview.

nestedToolEventFunction#

The tool row for a nested call as it starts.

newSessionModelFunction#

The model a new session starts on: an explicit pick wins, else the space's default. fallbacks is set only when the result IS the space default (a different pick must not inherit the space's chain); undefined fallbacks leave the caller's usual seeding (lastModelChain) in place.

newSpaceIdFunction#

A fresh, unused space id (space-<n>).

nextFireAfterFunction#

Schedules: the wire shapes, the checks and the time math that the host, the TUI and the UI share. The cron math (./cron, on croner) and the scheduler (./scheduler) are imported by path, so this entry stays free of them. See docs/SCHEDULES.md.

nextLogLevelFunction#

Next min-level in LOG_LEVEL_CYCLE, wrapping around.

normalizeBrowserUrlFunction#

Normalize address-bar input to a loadable URL, or null when it is not one.

normalizeMarkdownCodeFencesFunction#

Lift indented fenced code blocks to column 0 while preserving the code body's relative indentation.

OpenTUI's markdown renderNode hook only receives top-level code tokens. A common assistant shape is:

  • Run this:
    Text
    command
    

Marked parses that as code inside a list token, so the TUI loses the code-panel wrapper and copy affordance. Normalizing just the fence's list indentation keeps the prose readable while routing the snippet through the same top-level renderer as ordinary fences.

normalizePaletteItemsFunction#

Coerce whatever a provider returned into well-formed items: entries without an id or title are dropped, strings are capped, unknown kinds fall back to action, and source is stamped with the provider id. Never throws.

normalizePaletteRunResultFunction#

Same guard for a run result: anything malformed becomes undefined (nothing to do).

normalizeSpacesFunction#

The stored list made safe to use: malformed entries and duplicate ids dropped, and the Default space always present (first when it was missing). Order is kept: it is the switcher order.

noteLabelFunction#

A / command's details line: its label, capitalised, or "Details".

oauthAccountLabelFunction#

Trimmed user-given account name, or DEFAULT_OAUTH_ACCOUNT_LABEL.

offlineSinceTextFunction#

"offline since 14:05" (a date when not today) for an offline machine's lastSeen; "offline" when never seen.

onboardingFeatureCopyFunction#

The label and description of a feature, from the settings catalog.

onboardingFeaturesFunction#

The features that a run offers: the ones of its app. An extras run offers only the ones that no other app offers, because the other app set the shared ones.

onboardingImportPartsFunction#

The parts of an import that the user picked, in words, in the order of the step.

onboardingProgressFunction#

How far a run is.

onboardingRecordFunction#

A record for a run that just ended.

onboardingRecordsFunction#

The records that a finished run writes. A full, quick or repeated run writes the shared record and the record of this app. An extras run writes only the record of this app. Connect alone writes none.

onboardingReducerFunction#

The next state of a run.

onboardingSettingsChangeFunction#

The settings that a run writes. Only the keys that the run changed count. A value that equals the default is not stored, so it keeps following the default. If the key is stored, the run resets it instead of pinning it. A setting that is off only because the one it needs is off is not written: it comes back as it was when that one turns on again.

onboardingStepFunction#

The display data of a step.

onboardingSwitchedFeaturesFunction#

The features that a run switched on and off. Only the ones it changed: the defaults are not news.

oneLineTitleFunction#

text on one line: line breaks, tabs and runs of spaces become one space.

openForAttentionFunction#

The agent is blocked on the user (a plan to approve, a question to answer): show the tab regardless of earlier picks. Costs at most a tab switch, and nothing in that tab decides implicitly. Not a user pick, so it does not lock out later proactive opens.

openProactiveFunction#

Agent / extension asked to show a tab. Honoured only until the user has picked a tab themselves (a badge that flipped must never steal the tab); otherwise the request is dropped and the state returned unchanged.

orchestratedByFunction#

The main session id a worker reports to, or null for an ordinary session.

orderByMachineFunction#

Environment kinds in picker order: this host's own first, then each machine's together (local@ before worktree@), machines by name.

otherDeliveryFunction#

The delivery that is not delivery: what Alt+Enter does while a run works.

ownerOfFunction#

Returns the owner of an event: its childId, or parent.

paginateFunction#

One page of rows. Pass the page's cursor back for the next one. A cursor resumes at the first row that sorts after the row it ended on, comparing sort keys then id, so rows that moved, appeared or went away in between never shift the page. Throws SessionQueryError for a bad limit, a bad cursor, or a cursor made for another sort, filter or scope.

parentProviderKeyFunction#

Provider key a row "belongs to" — its own for a provider header, the parent's for a source row.

parseAnsiFunction#

text as lines of styled spans. A text without a closing newline still yields its last line; an empty text yields one empty line.

parseBindingSpecFunction#

The spec's first valid chord (callers that pre-parse one binding). Use parseBindingSpecs to honour every alternative.

parseBindingSpecsFunction#

Every chord of spec that parses (see bindingAlternatives).

parseCommandInvocationFunction#

Parse a prompt as a command invocation, but only when the command token is the LEADING token of the whole prompt and names a known command. This is what keeps mid-prompt /skill mentions routed to the skills provider: "summarize /research" is not a command, "/research foo" is.

known is matched case-insensitively; entries may be bare names or { name, aliases } records — an alias hit canonicalizes to the entry's name (registered casing), so dispatch-by-name downstream just works.

parseCustomModelQueryFunction#

Read a query that matched nothing as "use this model id anyway".

A bare id is meaningless without a provider, so the first term is checked against every provider's key and label (case-insensitive): xai grok-9 and Anthropic claude-next name their provider explicitly, anything else is attributed to fallbackProviderKey (the picker's current pick). Returns null when nothing usable is left, including when the whole query is just a provider name.

parseFenceOpenFunction#

The fence line opens, or null: three or more backticks or tildes, and a backtick fence's info string holds no backtick. Every markdown scanner that must agree on where code blocks are (here, and the desktop app's chunker) reads fences through this and isFenceClose.

parseFieldPathFunction#

Reads a field path apart, or undefined when it names no field and no well-formed facet.

parseKeyValueLinesFunction#

Parse one key/value pair PER LINE. Line-based (not whitespace-split) because values legitimately contain spaces — Authorization: Bearer abc123 is the canonical headers case, and env values like GREETING=hello world are equally valid. The first separator found (the separator that appears first in the line) splits. The rest of the line is the value, trimmed. Blank lines skipped.

parseMachineKindFunction#

{ base, name } of a machine-qualified kind, null for any other.

parseModelIdFunction#

Splits a model id into vendor, family, version, size, snapshot and routing variant. Parsing is lowercase and never throws.

parseModelSettingFunction#

Parse a model setting; undefined for unset or malformed.

parseRemoteHostUrlFunction#

Validate and normalize a host URL (no trailing slash); throws RemoteHostError.

parseRepoInputFunction#

Reads a git or forge URL (or owner/repo) as what git clone would clone; null when it is not one.

parseSessionKeyFunction#

The pair key names (a bare id: This computer's).

parseWhenFunction#

Reads the time phrase at the start of text. null when the text does not start with one of the forms above.

patchInlineGhostFunction#

Optimistically transform the current ghost across a buffer edit so it stays visible while the debounced provider re-query is in flight — without this, every keystroke inside a completable token blinks the ghost (hide → 120 ms → reshow).

Two edits are reconcilable (everything else returns null and waits for the authoritative result):

  • typing FORWARD along the suggestion (bi → bin with ghost n/): candidates are filtered to those starting with the typed chars and trimmed;
  • deleting BACKWARD within the token (bin → bi with ghost /): the deleted chars are re-prepended to every candidate. Guarded to non-whitespace so crossing a token boundary drops the ghost.

The patched ghost is provisional — the provider's answer replaces it (and may add candidates the patch couldn't know about).

percentileMsFunction#

The duration below which the answer puts probability p (0..1), from the per-level probabilities. null when they don't add up to anything.

pickChainPrimaryFunction#

Moves entry to position 0, adding it when absent.

pickPrimaryKeyedFunction#

Make entry the primary (position 0), keeping the rest in order. Inserts when absent, promotes when present; no-op when it already leads.

This is ↵ in the picker. It exists because toggling APPENDS: with a chain of [current], toggling a new model gives [current, new], so the pick would become a fallback and the active model would not change. "Highlight and ↵" means "use this one", so that gesture promotes; building a fallback list is the secondary gesture (⇥) and keeps toggle semantics.

pickTabFunction#

The user clicked a tab (or a keybinding cycled to it). Always honoured, always opens.

pinTabFunction#

Add a tab to the host's pinned strip (idempotent, keeps order).

planAttachmentFunction#

Decide how a file is attached. Images go by type (or extension); PDFs by type, extension or their %PDF- signature; anything else is text when its first bytes read as text, sent as text/plain unless its type already names text (a .ts file the browser types video/mp2t is text).

planFoldFunction#

The steps of one exchange in order, and its counts. Consecutive thoughts are one step; each worker is one step holding its lane's items, merged with the spawn call that started it (the call's line opens onto the worker's progress). A worker's state is its own structured end: failed only when it errored (core describeSpawnEnd), stopped reads done.

planOnboardingFunction#

The steps that a run shows, in order. It starts from the steps of the mode. It leaves out Bring your setup when zidane found no other agent, and Connectors, Skills and Extensions when installs do not run on this computer. It also leaves out the steps that the host excludes. A connect run always has Connect.

planProgressFunction#

Counts a plan's steps.

planProgressLabelFunction#

Position label for compact surfaces: the active step's position, else the completed count ("3/7"). null for a plan with no steps.

positionKeyedFunction#

1-based position of key in the chain, or null when absent.

previewEditPayloadFunction#

Previews an edit payload the way the edit tool would apply it. Hunks are resolved with the tool's lenient matcher, so recoverable old_string mismatches still render. The result reports a resolution for each hunk.

previewLineFunction#

Single-line preview of a multi-line string, capped at max chars and ellipsis-terminated when truncated.

Whitespace runs (newlines, tabs, multiple spaces) collapse into one space so the rendered output stays on a single visual row no matter how the input was shaped. Used by every transcript "preview" surface (spawn-start task, tool: shell (background): <command>, <task-notification> summary line, etc.) — without the whitespace collapse, a 60-char slice on a string with an inline \n\n paints the second paragraph below the first, producing the visible "preview text spills onto multiple lines" bug (and, downstream, misaligned spawn markers when the wrapped lines collide with other events).

Reserves one slot for the … so the displayed width is exactly max when truncation kicks in.

projectNameOfFunction#

The folder name of a row's project: the last segment of projectRoot, or of cwd without one (/ and \\ both separate). undefined when neither is set.

promptSegmentLinesFunction#

The segments cut into the lines the user typed. A flex-wrap row cannot break on a newline inside one of its items, so each line renders as its own row; an empty array is a blank line.

promptTurnRefsFunction#

Reduce persisted turns to the prompt refs the retag needs, dropping non-prompt turns (assistant, tool results, loop-injected) entirely.

Shared by the in-process path and the daemon broadcast so both select the same turns as "prompts" — a divergence here would make a prompt selectable on one surface and not the other.

providerBrandFunction#

The setup wizard's model: React-free and Node-free, re-exported by zidane/chat/pure and zidane/chat. docs/ONBOARDING.md describes it.

pushPaletteRecentFunction#

Most-recent-first list of ids, deduplicated and capped.

querySessionsFunction#

Filters rows by where, sorts them by sort, then cuts one page. Paged results (a limit or a cursor) break ties by id, so the order is total and a cursor resumes at one place. Throws SessionQueryError for an invalid input.

rankPaletteItemsFunction#

Rank every item against query. Terms are AND-ed: tog sid needs both tog and sid somewhere in the text, each with its letters in order. A title that holds every term as one run gets a large bonus; description, keywords and group are fallbacks. On an empty query recents come first (most recent on top), then the catalog in provider order. Returns at most 200 rows.

readBlockRunsFunction#

The saved runs of a session, by key. What does not read as a run is left out.

readFieldFunction#

The value of a field path in row (see readParsedField), or undefined for a path that names nothing.

readParsedFieldFunction#

The value of a parsed field path in row. Missing and null both read undefined; a missing boolean field reads false; environment.kind reads 'local' without an environment.

readSessionAccountFunction#

The account a session's primary model runs on, when one is pinned.

readSessionFacetsFunction#

A session's stored facet values: {} when it has none or the stored value is not a record.

readSessionSpaceIdFunction#

The raw space id stamped on a session's metadata, if any.

recentSessionsContentFunction#

The recent sessions block's content.

recentSessionsHomeBlockFunction#

The recent sessions block.

reconcileEventsFunction#

next, with every event structurally equal to one of prev replaced by that object (matched one to one, so an event repeated twice keeps two objects). Hands back prev itself when the result is positionally identical, so a store keyed on the array sees no change at all.

rememberableChainFunction#

What of a model pick a window remembers as its default (lastModelChain: the next new session's model, the next launch's). One rule for the TUI and the GUI. A session on a server runs with the server's credentials, so its pickers list the server's providers: a pick there is remembered only when this computer can run its primary too (a provider only the server has would leave the next local session without a usable model), and the fallbacks this computer can't run are dropped. A pick on This computer is remembered as made. null: nothing to remember.

renderTemplateFunction#

The template with each placeholder replaced by the row's value: text as is, numbers and booleans as written, lists joined with ', ', anything else (and missing values) empty. Runs of spaces collapse; the result is trimmed.

reorderKeyedFunction#

Move the entry with key by one priority slot; boundary or missing = identity.

reorderTabsFunction#

Apply a user reorder of the VISIBLE strip to the pinned list. pinned can hold ids the catalog no longer shows (an extension disabled for this cwd); they keep their slots, and the visible ids fill the remaining slots in the new order, so re-enabling the extension brings its tab back where it was. Ids in visible that aren't pinned are ignored. Returns pinned itself when nothing moved.

replaceTurnTextBlocksFunction#

Replace a turn's text with newText, keeping every non-text block (tool calls, tool results, thinking, images) where it was. All text blocks collapse into one, placed where the first text block was; an empty or whitespace-only newText removes the text and keeps the rest.

Returns null when the turn is missing or has no text to edit, so callers can report it. Untouched turns keep their identity (a store can rewrite only the edited row).

requirementMetFunction#

Whether a toggle's requires setting is on. decisions is also on while approvals use Model decision (decisionsEnabled).

resetLabelFunction#

Time to reset, worded like a provider error's (resets in 1 h 45 min, see formatResetDelay), so the panel and a rate-limit line agree. null when the provider reported no reset, resetting once it is due.

resolveActiveTabFunction#

Resolve the tab to render: the active one when it still exists, else the first tab, else null (empty catalog). Keeps state stable when an extension is disabled and its tab vanishes.

resolveSessionSpaceFunction#

The space a session is shown in: its stamped id when that space exists, else Default (unstamped, Default itself, or a deleted space).

resolveTimeFunction#

A bound as epoch ms: a number as is, a relative time from now, an ISO date parsed (UTC without a zone). undefined for anything else.

retagUserPromptEventsFunction#

Retro-tag live user-prompt events with the id of their persisted turn.

Live prompt echoes are appended to the stream BEFORE agent.run() mints and persists the user turn, so they carry no turnId — which makes them invisible to select-turn navigation, hover, and click (all keyed on turnId), while the SAME prompt becomes selectable after a session reload (replay tags every event). Hosts call this when the seeded turns land (e.g. the session:turns hook, which fires right after the prompt turn persists, before the first model turn).

Matching rule, per prompt-bearing turn: the NEWEST user-prompt event that has no turnId yet and whose text equals one of the turn's text blocks — or the turn's display echo when the caller supplies one (run-minted prompt turns never carry display themselves; the TUI's command runAgent path injects the origin display onto a copy after the sub-run resolves, since the echo event's text is the short display line, not the full prompt). A prompt turn qualifies with at least one non-blank text block, OR — the attachment-only submit — with media blocks (document/image/audio/video) and no tool plumbing; the latter matches the newest untagged blank-text event that carries attachment chips. Tool- result-only user turns contribute nothing, and loop-injected turns (SessionTurn.injected) are not prompts, so neither is ever matched.

Pure — returns the SAME array instance when nothing matched, so hosts can cheaply skip a re-render.

retagUserPromptEventsFromRefsFunction#

Attach persisted turn ids to the live user-prompt events they correspond to, so a just-sent prompt becomes selectable (hover, click, edit, delete) without waiting for a session reload.

Matching is newest-first and one-to-one: identical prompt text sent twice must bind to two different turns, so each ref consumes exactly one untagged event.

retryLabelFunction#

Provider-retry label — retrying 2/5, or retrying 2/5 (child-3) when the stalled stream belongs to a subagent rather than the parent.

Naming the source matters: with subagents in flight, an unattributed "retrying" leaves the user unable to tell whether their own turn is stuck or a delegated worker is.

runEstimateViewFunction#

A run record's estimate as a RunEstimateView: its timing when it has one, else its lasting failure; undefined for neither (never asked, or a failure the next attempt may not hit).

runFoldStatusFunction#

The live work row's status: a retry wins, then a wait that has lasted RUN_WAITING_DELAY_MS, else working.

runningEstimateViewsFunction#

The estimates of a session's runs in progress, the session's own first: what a session row carries.

runReceiptFromRunFunction#

Build the receipt for a run record. now stands in for endedAt when the record is not finalized yet (run:end is broadcast a beat before it is).

runRetryingLabelFunction#

The header text while a provider call is retried: Retrying 2/3, naming the subagent when it is not the session's own stream. Both apps show these words.

runStatusCellsFunction#

The live run readout as cells, one badge each: 1m 15s ↓1.2k 41 tok/s. Time runs from the run's start, the count covers the whole run (settled turns plus the one streaming), and the rate is the honest windowed figure from stepStreamRate (null until it has one). ↓~ marks a count that is still the character heuristic. A tool-only stretch shows just the time. Same model as formatRunReceiptCells, the receipt the run ends with.

detail drops the least useful cell first when space runs out: 'full' → 'count' (no rate) → 'time'.

runStatusKeyFunction#

The status a surface times, as a key: one per retry attempt and one per wait, null while nothing is timed. A surface restarts its clock when the key changes.

runTailActivityFunction#

Classify the tail of a live transcript. Only meaningful while a run is in flight: an idle transcript reads as waiting too.

Reasoning that is only whitespace counts as nothing (transcripts hide it), and a tool call counts as running until its result arrives, back to the run's prompt.

sameAuthTargetFunction#

The same sign-in: the failure is fixed once this one signs in again, so every earlier card for it can say so.

scanModesFunction#

The mode state after text, which starts at stream offset base. Returns state itself when nothing changed.

scheduleLabelFunction#

A schedule's name for lists and the transcript: its own, else the start of its prompt, else its handler.

scheduleTargetSessionFunction#

The session that a schedule's prompt goes to, or undefined (a newSession or an extension action).

scoreToMsFunction#

A score (a level index, possibly between levels) as a duration: the marks are on a log scale, so a score between two levels is interpolated on it.

scriptErrorOfFunction#

The error a failed script threw and the line it names, out of its result (Script error: … then the 12 | source excerpt the sandbox writes).

scriptLoopsFunction#

The loops of a script, by the lines they span, outer ones first (by start, then the longest): bodies of for, while and do, and callbacks of array methods (.map, .forEach, .filter, …). A helper function is not a loop.

scriptProgressByCallFunction#

The latest tool-progress state of each script, by call id (childId + NUL + callId).

scriptProgressFromRecordsFunction#

The final progress of a script from its saved call records, or undefined when none carries a line (the script ran without live progress).

scriptProgressKeyFunction#

Key of a script in scriptProgressByCall.

scriptProgressViewFunction#

The view of a script: its lines with their states, the counts, and the percent when it is exact (see countOnceCallSites).

searchableTurnTextFunction#

Search-specific serializer. Unlike turnAsText, it never serializes media, document attachments, encrypted reasoning, or base64-looking payloads.

searchHighlightRangesFunction#

Finds the ranges of text that match query: the whole phrase, else each term, else fuzzy term matches.

searchSessionHistoryFunction#

Searches turns and aggregates the matches into one SessionHistoryMatch.

searchSessionHistoryIndexFunction#

Searches a prebuilt index and aggregates the matches into one SessionHistoryMatch.

searchSessionHistoryIndexAsyncFunction#

Like searchSessionHistoryIndex, but yields to the event loop while it searches.

searchSessionIndexFunction#

Searches an index and returns the best matching turns.

searchSessionIndexAsyncFunction#

Yielding matcher for very large indexes; progress is checked per chunk.

searchSessionTurnsFunction#

Searches turns and returns every match as a SearchSessionResult.

searchTurnsFunction#

Builds a throwaway index over turns and searches it.

selectableSourcesFunction#

Stored credentials, i.e. the ones a user can actually choose between.

env is excluded: it is observed rather than stored, and is usually just the mirror applyApiKeyEnv wrote from the stored API key, so counting it would advertise a choice that does not exist.

selectableTurnIdsFunction#

Deduplicated, in-order list of parent-conversation turn ids that appear in a rendered transcript — the navigation index for the TUI's select-turn mode. Three classes of turns are deliberately skipped:

  • Subagent turns (childId set). Nested execution detail; the user's mental model of a "message" is the conversational exchange, not each spawn turn. Also filtered out by isVisible under hideSubagentOutput: true — selecting them would highlight nothing.
  • Result-only turns — see turnSelectionOwnership. These get coalesced into the assistant turn that emitted their tool_calls.
  • Settings-hidden turns (when settings is supplied). A turn whose every event fails isVisible would render no rows — landing the cursor there hides it from the user entirely. The check is opt- in so SDK callers without a Settings object get the "everything visible" behavior.

Synthetic events (separator, spawn-start, spawn-end) have no turnId and are skipped naturally.

sessionDirLabelFunction#

The directory name a session lives in — the same basename label the sidebar groups by. undefined for a directory-less session (the main) or no cwd.

sessionEventExcerptFunction#

The dimmed second line: the last thing the session said, collapsed to one paragraph and capped. Renderers may clamp further (line-clamp in the GUI, width in the TUI); this is the upper bound and the shared ellipsis rule.

sessionEventLabelFunction#

The short label a transcript row shows: api-refactor finished. Status words are chosen to read as a verb phrase after the title.

sessionEventMetaFunction#

The header's metadata cells, in display order, omitting anything unknown. Renderers join them with their own separator; the CONTENT is fixed here so both surfaces show the same receipt for the same run.

The session id is deliberately NOT a cell: it is the least legible datum and exists only to disambiguate. Renderers append shortSessionId LAST and dimmer than the rest.

sessionKeyFunction#

The key of sessionId on hostKey (null / absent / LOCAL_HOST_KEY: a local session).

sessionSpaceFilterFunction#

The predicate a sessions list filters by, or null (no filtering) while the feature is off. Rows with isMain (the orchestration main) belong to every space and are always kept.

settingFieldFunction#

Builds the sync field name for a setting.

settingKeywordsFunction#

A row's search keywords (SETTINGS_KEYWORDS), empty when it has none.

settingOfFieldFunction#

The setting a field names, if it is one.

shellBlockPlanFunction#

What runs for a block, or null when nothing does (another language, no command, too long). A block with $ lines runs those lines only, without the prompt, and the lines a trailing `` continues them onto: the other lines are output.

shortAgeFunction#

"now" / "5m" / "3h" / "2d" / "6w": the sidebar's age words.

shortDayLabelFunction#

"Jun 12" for a YYYY-MM-DD day.

shortestGapFunction#

Schedules: the wire shapes, the checks and the time math that the host, the TUI and the UI share. The cron math (./cron, on croner) and the scheduler (./scheduler) are imported by path, so this entry stays free of them. See docs/SCHEDULES.md.

shortIdFunction#

Six-char short form of a session id for headers and lists.

shortSessionIdFunction#

Short, stable id fragment for the header — enough to disambiguate, not to read.

showsAccountFunction#

Whether a snapshot should show its account name: only when another snapshot in the same list belongs to the same provider. One account is the provider.

sideSessionParentFunction#

The parent a side session answers about, or null for any other session.

sliceEndFunction#

End of a slice of at most size chars from from, never between the halves of a surrogate pair.

smoothCharsForTickFunction#

Number of characters to drain on the next smooth-mode tick + the fractional remainder to carry into the next tick.

Combining the CPS curve with a fractional accumulator means the effective draining rate matches the target CPS exactly. Rounding up on every tick (Math.ceil(cps * dt)) would give 4 chars/tick at 200 CPS / 16ms (= 250 CPS effective), a 25 % speed-up, and visible step transitions (4 → 5 → 7 → 8 → 10 as backlog grew) that read as the typewriter cadence jumping.

smoothCpsForBacklogFunction#

Target chars-per-second for the next smooth-mode tick given the current bucket backlog. Two linear segments (base→burst over the first 400 chars, burst→max over the rest of the ramp) so the function is continuous everywhere and plateaus (rather than cliffs) once backlog passes SMOOTH_MAX_BACKLOG_CHARS.

sortRowsFunction#

A sorted copy of rows. Stable: rows equal on every key keep their input order. Rows without a value for a key sort after those with one, whatever the direction. Throws SessionQueryError for an invalid sort.

spaceIdForNewSessionFunction#

The space id to stamp on a session created while activeSpaceId is shown, or undefined (feature off, or Default) — pass it to spaceMetadata.

spaceMetadataFunction#

The metadata entries stamping a session into spaceId: none for Default (an absent id IS Default), so creating in Default writes nothing new.

spaceModelDefaultFunction#

The default model a new session in spaceId starts on, or undefined (feature off, unknown space, or no default set) — the caller then falls back to its usual last-used model.

spaceOfSwitchItemFunction#

The space a spaceSwitchItems entry switches to; undefined for any other id.

spacesEnabledFunction#

Feature on? Off by default.

spaceSwitchItemsFunction#

The command palette's "Switch to space" entries: one per space but the shown one. The GUI and the TUI list these same entries, and each runs them through its own switch (spaceOfSwitchItem).

spawnLaneFunction#

The worker childId's rows belong under: its outermost ancestor that is itself one of the present workers (the ones owning rows in this view). A view that already re-based its owner's rows (a worker opened in a fold) leaves that owner out of present, so the owner's direct children become the lanes there. childId itself when no ancestor is present.

spawnLaneResolverFunction#

Lane resolver over one view's rows: precomputes the parent map and the present-worker set, then maps a row's childId to its lane.

spawnParentsFunction#

Worker id → the worker that spawned it, from nested spawn markers.

spawnStartPartsFunction#

A worker's start from its spawn-start marker: the task preview, and the child-N it resumes, if any (a badge). Reads spawn.resumes, or parses the resumes child-2 · <task> text of a marker recorded before it existed.

splitCommandLineFunction#

Split a command line into tokens, honoring single/double quotes so npx -y my-server --root "/path with spaces" round-trips. No escape processing beyond quote grouping — this is a form field, not a shell.

splitLinesFunction#

Split a string into lines preserving empty lines but dropping the implicit trailing "" produced by a final \n. Exported only for its tests — callers should use computeLineDiff.

splitMarkdownCodeBlocksFunction#

Split markdown text into alternating prose / fenced-code segments.

Recognizes both ``` and ~~~ fences, with arbitrary length ≥ 3, matching CommonMark's "fence indicator must be at least as long to close" rule. Info-strings (the bit after the opening fence) are kept as the lang hint; any trailing whitespace is trimmed. Closing fences are detected on a line of their own (whitespace tolerated).

Unclosed fences fall back to emitting the would-be-code body as a trailing prose segment so no content is dropped — finalized markdown isn't expected to ship one, but the fallback keeps the renderer truthful when the model produces malformed output.

Exported for unit tests.

splitPromptSegmentsFunction#

Split a prompt buffer into word-sized atomic segments suitable for a flex-row + flex-wrap renderer (TUI) or a display: inline flow with inline-block chips (GUI). Each chip becomes one segment (atomic — never broken across rows); each plain run is split into "word + trailing space" units so wraps land at clean word boundaries.

Robust to:

  • Overlapping refs — sorted by start; later refs that overlap are dropped via the first-wins rule.
  • Out-of-bounds refs — dropped entirely when end > text.length or start >= text.length. Partial clipping would silently truncate a chip's label; the caller is in a better position to surface the mismatch (typically a stale refs array referencing a previous text).
  • Whitespace-only plain runs — emitted as their own plain segment so chip-adjacent-to-chip cases keep the original spacing.

Word splitter rationale: \S+\s* keeps trailing whitespace attached to its preceding word so wrap boundaries land between words (cleanly). A leading-whitespace-only segment is captured by \s+ so we don't drop it entirely when the plain run starts with a space.

splitStreamFailureFunction#

Split a reply into what the model wrote and the stop marker at its end, if any.

stepStreamRateFunction#

Folds one output token reading into the rate state. Returns a new state, or the same one for an out-of-order or duplicate sample.

streamRateValueFunction#

Whole tokens per second for display, or null when there is no honest reading.

stripAnsiFunction#

text without its escapes, as a terminal would show it.

summarizeEditPayloadFunction#

Build a per-hunk digest used by the compact diff view.

Strategy:

  • When priorContent is present and the payload describes a real file transformation, compute the contextual diff once, then walk the LCS ops splitting at runs of add / remove to anchor each summary entry to the real file line. This guarantees the summary's L<n> matches what the user sees in their editor.
  • Otherwise, fall back to per-hunk LCS over the (oldString, newString) snippet pair. Line numbers are absent because the snippet has no file position.

summarizeOutcomesFunction#

Aggregate counts for the transcript's summary badges (3 applied, 1 denied, 1 skipped). Exported so renderers don't reimplement the tally. Pure / O(n).

summarizeToolsFunction#

"Ran a command, read a file +2" for a run of calls. Adjacent identical phrases merge, so three reads in a row say "read a file" once. overflow: false leaves the +N off, for a header that counts its calls another way.

syncAgoFunction#

When a server last received a push, as the sync status line says it: 12s ago, 5 min ago, then a date.

syncMarkerOfFunction#

The marker a server's settings UI shows next to a setting, if any.

takeCharsFunction#

Slice n chars off the front of buf without splitting a UTF-16 surrogate pair. Most LLM text is ASCII and never trips this; the guard matters for emoji / extended planes where halving the pair would emit an isolated half-character.

templateFieldsFunction#

The field paths a template reads, in order, once each.

thoughtLabelFunction#

A thought's line: "Thinking" while it streams, "Thought" once settled.

tidyPromptTextFunction#

Collapses runs of three or more newlines to one blank line, trims trailing whitespace and remaps the chip spans.

titleFromTextFunction#

A title from typed text (a first message): one line, clipped with …. Null when it holds nothing.

toggleAppliesFunction#

Whether a toggle does anything under the other settings: showToolAttachments only in compact density, the only one with a "Working" row. Renderers leave the row out while it does not.

toggleChainEntryFunction#

Adds entry to the end of the chain, or removes it when already present.

toggleHeldOnFunction#

Why a toggle is on whatever its own value says: decisions while approvals use Model decision, which needs its answers. Renderers show the row on and inert with this note. undefined when the row's value applies.

toggleKeyedFunction#

Toggle entry: absent → appended, present → removed. Pure.

togglePanelFunction#

Opens the panel when closed and closes it when open.

tokenComparisonFunction#

seed selects the comparison deterministically (day-of-year keeps it stable within a day but rotating across days). null when the total is too small for the multiple to land (< 2× the work).

tokenizeFunction#

Tokenize on word / non-word boundaries. Each run of \w+ is one token; each run of \W+ (whitespace, punctuation) is another. This gives the right granularity for renames (oldName → newName) and for symbol swaps (+ → -) without exploding into per-char segments.

Exported only for its tests.

toMachineNameFunction#

A machine name from a free-form one (a server's display name): the valid characters kept, the rest dashed.

toolInputCodeFunction#

The source code a tool call runs, for renderers that show it highlighted instead of the raw JSON input: Codemode's script as JavaScript, a shell / bash command as bash (the command alone: the label carries the description, the rest is plumbing). null for every other tool and for calls without the code field. language is a fence-style name both highlighters accept (Shiki in the GUI, OpenTUI's tree-sitter in the TUI).

toolInstallFunction#

How to install name on the host capabilities describe: without root when it can (bun's script, ripgrep's release into ~/.local/bin, Homebrew), else a root command to copy, else the tool's page. undefined for a tool that is not in HOST_TOOLS.

toolOverviewFunction#

The overview line for one tool call.

toolPhraseFunction#

Returns the lowercase verb phrase for a tool in a batch summary, such as read a file.

transcriptPresetFunction#

A preset by id.

transcriptPresetNoticeFunction#

The line that the palette shows once a preset applies.

transcriptPresetOfFunction#

The preset a set of settings matches, or custom when it matches none. Keys left out take their default value.

transcriptPresetOfPaletteItemFunction#

The preset that a row of transcriptPresetPalettePicker applies.

transcriptPresetPaletteItemFunction#

The palette entry for the conversation preset. It names the preset in effect, and running it opens the presets (transcriptPresetPalettePicker).

transcriptPresetPalettePickerFunction#

The list that the palette entry opens: the three presets, the one in effect checked.

triggerIssuesFunction#

The problems of a trigger.

truncateTitleFunction#

Ellipsize a title to max characters; titles are user text and can be a paragraph.

truncateTurnsAtFunction#

Cut the history at turnId (a fork, a rewind, an edited prompt), then strip any tool_call blocks left without a matching tool_result in the slice.

Semantics:

  • inclusive keeps the selected turn ("branch from HERE": the selected message is the latest one); exclusive ends the history just before it, so an edited prompt can be sent again in its place.
  • If the last kept turn is an assistant turn with unresolved tool_call blocks (their tool_results live in turns AFTER the slice), strip those calls. Otherwise the next provider call would post an assistant turn with no matching tool results.
  • Drop turns that become empty (all blocks stripped). The result may be empty.

Returns null when turnId doesn't exist in turns — caller should surface a "turn not found" error rather than silently no-op.

turnAsTextFunction#

Serialize a turn's content to a clean text representation suited for the clipboard. Joins text + thinking blocks verbatim; tool calls and tool results get bracketed labels so the user can paste a readable record of what happened without losing structure.

Empty turns return ''.

turnContextSizeFunction#

Effective context size for a single turn.

usage.input is misleading on its own when prompt caching is active: providers (Anthropic, OpenRouter→Anthropic, Gemini) report input as the new uncached tokens only — the cached prefix shows up in cacheRead, and newly-cached tokens in cacheCreation. The model still saw all three buckets, so the real context-window utilization is their sum.

Non-caching providers leave cacheRead/cacheCreation undefined, so this collapses to plain input for them.

turnSelectionOwnershipFunction#

Build the resultTurnId → owningAssistantTurnId map used by the select- turn mode to coalesce a tool-call's surrounding turns into ONE navigation stop.

Protocol shape: every tool_call block in an assistant turn is closed by a matching tool_result block in the next user turn (the agent loop's history validator depends on this). When the next user turn's only events are tool-results — i.e. it's pure plumbing for the prior assistant turn — we map it back to that assistant turn here. The select-turn nav index (selectableTurnIds) skips owned turns, and the renderer's highlight gate (isTurnHighlighted) extends the selection accent from the assistant turn to the events of any turn it owns. Net effect:

  • Navigation never lands the cursor on a result-only turn whose own events may be hidden by showToolResults: false — the cursor wouldn't be visible.
  • Selecting an assistant turn highlights the call AND its result as one unit, matching the user's mental model of "one message".

Owner-lookup is conservative: result-only turns with no matching prior assistant turn (orphaned — usually because the parent was deleted) stay selectable so the user can act on them via the turn-details modal.

Subagent (childId set) events are ignored — they live in a separate conversation tree.

tutorialOnServerFunction#

The words of a tutorial on a server's settings page: the lines that name this computer name the server instead.

uniqueChatIdsFromReferencesFunction#

Returns the unique ids of the chats referenced in a reference list. References from other providers are ignored. Order of first appearance is kept.

uniqueFilesFromReferencesFunction#

Walk a reference list and return the deduplicated set of files in first-mention order — input to "attach these files to the prompt" downstream logic.

uniqueSkillNamesFromReferencesFunction#

Walk a parsed prompt for skill references and return the deduplicated list of skill names — input to agent.activateSkill(name) calls on submit.

updatedLabelFunction#

updated 12s ago / updated 3m ago for the newest snapshot in a list, so a refresh that returns identical numbers is still visibly a refresh. null when the list is empty.

upsertToolProgressFunction#

events with event, a tool-progress state, in place of the one it replaces (same call, same subagent), or appended. Other events are appended. A script keeps one progress event, however long it runs.

usageBlockContentFunction#

The usage block's content for a summary: pure, so every host paints the same block.

usageBlockViewFunction#

The usage block's view: its tab and range, from the control values (unknown ones fall back).

usageHomeBlockFunction#

The usage block.

usageToneFunction#

Maps a usage percent to a UsageTone.

validateGroupByFunction#

Every problem in a grouping: { field, labels?, order? }.

validateMcpFormFunction#

Validate + normalize the raw field values into a config entry. Returns the first problem in row order so the dialog can surface it.

validateQueryFunction#

Every problem in a query. Empty when value is a valid SessionQuery.

validateScheduleInputFunction#

Checks a schedules.create input. Throws a ScheduleInputError that names every problem.

validateSchedulePatchFunction#

Checks a schedules.update patch. Throws a ScheduleInputError that names every problem.

validateSortFunction#

Every problem in a sort: a list of { field, dir? }.

validateTemplateFunction#

Every problem in a template: too long, a lone brace, or a placeholder that names no field.

viewQueryFunction#

The query a sidebar view stands for, to save it as a space: the space's membership (see SessionViewSpace), then the project, agent, archive, activity and extension filters, all holding, flattened. Returns the problems instead when the result is not a valid query (too deep, too many nodes or values).

waitedMsFunction#

Time spent waiting on the user up to now, in ms.

withBlockRunFunction#

The saved runs with run in, without runs whose reply is gone, at most BLOCK_RUNS_MAX (the latest kept).

withIdTiebreakFunction#

sort with a last { field: 'id', dir: 'asc' } key, unless it already ends on id: a total order, so a page cut by paginate resumes at one place.

workedMsFunction#

Working time of a run up to now: its time since start, less its waits on the user.

Classes#

AmbiguousHostIdErrorClass#

Several hosts list the id (two hosts can hold the same session id: a server sharing this machine's data dir, a copied store) and the lookup did not say which: refused, never guessed.

BrowserOpErrorClass#

Error thrown when a browser operation fails. code says why.

HostIdentityErrorClass#

A saved host's URL answered with another host id (reinstalled, or the name now points elsewhere). The connection is closed before anything is read from it, and nothing is recorded under the saved id.

HostRegistryErrorClass#

A refused add / rename; code says why.

HostRemovedErrorClass#

The id lived on a host that was removed from this window.

OutputHistoryClass#

One terminal's output by stream offset, capped, replayable into a fresh terminal with its modes.

RemoteHostErrorClass#

Error thrown for a host URL a client refuses.

ScheduleInputErrorClass#

A schedule input that failed the checks. issues names every problem.

SessionQueryErrorClass#

Thrown by the query functions for an invalid query, sort, grouping, page or cursor.

TerminalErrorClass#

Error thrown by terminal operations. code says why.

UnknownHostIdErrorClass#

No host told this client about the id: nothing to route it to.

Constants#

AGENT_MAX_PER_SESSIONConstant#

The most enabled schedules the agent can have on one session.

AGENT_MIN_INTERVAL_MSConstant#

The shortest interval for a recurring schedule that the agent makes.

AGENT_RECURRING_TTL_MSConstant#

How long a recurring schedule that the agent made lives, unless you pin it.

API_KEY_ACCOUNT_LABELConstant#

Name of a provider's API-key credential when listed next to its OAuth accounts.

APPROVAL_MODE_OPTIONSConstant#

The approvalMode options, with what each one does: the one list every settings UI shows.

APPROVAL_MODE_TRADEOFFSConstant#

What each approval mode gives you and guards against.

ARTIFACTS_PANEL_IDConstant#

Id of the artifacts panel.

ATTACHMENT_SNIFF_BYTESConstant#

How much of a file's start planAttachment reads to tell text from binary.

BASH_CALL_ID_PREFIXConstant#

callId prefix minted by the TUI's ! bash mode (see runBashMode in src/tui/commands/run-bash-mode.ts). The prefix is the durable signal — it survives persistence and replay — that a shell tool exchange was USER-initiated, so renderers can keep it visible even when the tool-display settings hide model-driven plumbing: the user typed the command and expects to see it and what it printed.

BLOCK_RUN_OUTPUT_CAPConstant#

Output kept of a run (the end of it), in characters.

BLOCK_RUN_TIMEOUT_MSConstant#

How long a Run here may take.

BLOCK_RUNS_MAXConstant#

Runs kept per session; the oldest go first.

BLOCK_RUNS_METADATA_KEYConstant#

Session metadata key of the saved runs.

BROWSER_ACTION_TIMEOUT_MSConstant#

Default for an action's own wait (element to become actionable, text to appear). A request can raise it up to BROWSER_MAX_WAIT_MS.

BROWSER_EVALUATE_MAX_BYTESConstant#

Largest serialized evaluate result in bytes.

BROWSER_MAX_WAIT_MSConstant#

Longest wait in ms an operation may request.

BROWSER_OPEN_MOUNT_MSConstant#

How long the host waits for a page to mount and register before open gives up.

BROWSER_OPSConstant#

Every browser operation name.

BROWSER_OUTLINE_MAX_ELEMENTSConstant#

Most elements listed in a snapshot outline.

BROWSER_PANEL_IDConstant#

Id of the browser panel.

BROWSER_REQUEST_SLACK_MSConstant#

Transport budget on top of the action's own wait.

BROWSER_TEXT_MAX_CHARSConstant#

Most page text characters in a snapshot.

BROWSER_WAIT_TIMEOUT_MSConstant#

Default wait in ms for wait_for.

BUILTIN_PANEL_TABSConstant#

Built-in panel tabs in display order.

CACHE_HINT_MIN_TOKENSConstant#

Below this many re-read tokens a switch is cheap: short sessions show no hint.

CACHE_NOTICE_LABELConstant#

notice.label the host stamps on prompt-cache break/expiry rows (host/notices/index.ts).

CALIBRATION_MAXConstant#

Largest calibration factor: estimates are at most tripled.

CALIBRATION_MAX_SAMPLESConstant#

Most recent finished runs calibration reads, per project.

CALIBRATION_MINConstant#

Smallest calibration factor: estimates are at most halved.

CALIBRATION_MIN_SAMPLESConstant#

Fewest finished runs before calibration applies.

CHATS_TRIGGERConstant#

Trigger character that starts a chat reference.

CLOSED_PLAN_STATESConstant#

States a plan never leaves. stopped is not one: Resume reopens it.

COMMANDS_TRIGGERConstant#

Trigger character — shared with skills.

CONNECTOR_CATEGORIESConstant#

The step's sections, in display order.

CONNECTORSConstant#

Every connector, in display order within each category.

CONTINUE_PROMPTConstant#

What the "continue" action sends after a run that had done work.

DAEMON_HEALTH_GLYPHConstant#

Glyph drawn for the daemon health dot.

DAEMON_HEALTH_STYLEConstant#

Tone and label to use for each DaemonHealth state.

daemonGateConstant#

The shared daemon runtime. ZIDANE_NO_DAEMON=1 is set by zidane --no-daemon.

DEFAULT_EXTENSION_SOURCEConstant#

The default source of extensions: the zidane repository, whose extensions/ folder holds the native extensions.

DEFAULT_EXTENSION_SOURCE_UNREACHABLEConstant#

What a listing of the default source says when it cannot be read.

DEFAULT_MODEL_PICKConstant#

The model a chat runs on when nothing picks one (no session pick, no descriptor default).

DEFAULT_OAUTH_ACCOUNT_LABELConstant#

Name shown for an OAuth account that was never given one.

Also what a first OAuth login is stored under, so a second account has something to be told apart from. Pre-multi-account files hold unnamed grants; oauthAccountLabel makes them read the same.

DEFAULT_SECRET_TTLConstant#

The TTL a picker selects when the question suggests none.

DEFAULT_SETTINGSConstant#

Default value of every setting.

DEFAULT_SPACE_IDConstant#

Id of the Default space.

DEFAULT_SPACE_NAMEConstant#

Name of the Default space.

DIFFS_PANEL_IDConstant#

Id of the diffs panel.

DURABILITY_OPTIONSConstant#

The durability options, with what each one does.

EDIT_TOOL_NAMESConstant#

Tools whose tool-result event is suppressed when showEditDiffs is on.

EMPTY_MODESConstant#

The modes of a fresh terminal: nothing set or reset yet.

EMPTY_RATEConstant#

Initial rate state, before any sample.

ENTRY_IMPORT_MAX_BYTESConstant#

Most bytes one import brings in, all files together.

ENTRY_IMPORT_MAX_ENTRIESConstant#

Most entries one import brings in.

ENTRY_IMPORT_MAX_FILE_BYTESConstant#

Most bytes of one imported file (one call over a connection).

ESTIMATE_LEVEL_MINUTESConstant#

The score levels, in minutes, lowest first, in 10 steps (the most a score question may have, MAX_SCORE_LEVELS): 1 minute to 24 hours, each about 2.5 times the last, then "more than 24 hours" for runs that go on for days. That last step stands at 48 hours for the math (an answer between two marks reads as the time between them); it shows as 24h+.

ESTIMATE_OPEN_ENDED_MINUTESConstant#

Past this, a run is in the open-ended last step: "more than 24 hours".

ESTIMATE_OVER_FALLBACKConstant#

Without level probabilities, the over point is the estimate times this.

ESTIMATE_OVER_PERCENTILEConstant#

Percentile of the answer's distribution past which a run counts as over its estimate.

EXCLUDED_NATIVE_EXTENSIONSConstant#

Folders of extensions/ left out of the wizard on purpose, with the reason. Every folder is either listed above or here.

FACET_EXTENSION_IDConstant#

An extension id, as facet paths name it. A copy of EXTENSION_ID_PATTERN (src/extensions/runtime/validate-definition.ts), kept here so this module stays a pure leaf; a test keeps the two equal.

FACET_KEYConstant#

A facet key: a letter or _, then up to 63 letters, digits, _ or -. No dots.

FEATURE_GATESConstant#

Every gate, so a client can report which kill switches are engaged.

FILES_PANEL_IDConstant#

Id of the files panel.

FILES_TRIGGERConstant#

Trigger character — @ is the conventional file-mention prefix in chat UIs.

FIRE_HISTORYConstant#

Fires kept per schedule.

HOME_BLOCKS_OWNERConstant#

Owner of the built-in blocks.

HOST_TOOLSConstant#

The tools probed, in the order the UIs list them. versionArgs: what prints the version, when not --version.

INBOX_PANEL_IDConstant#

Id of the inbox panel.

INITIAL_PANEL_STATEConstant#

Panel state at startup: closed, no active tab, no user picks.

INSTRUCTION_PREVIEW_LINE_CAPConstant#

Upper bound on preview lines rendered for one expanded segment. Same idea as the Logs tab's LOGS_RENDER_CAP: the scrollbox can hold arbitrary height, but pasting a runaway 64KB instruction file into the layout pass is a waste of a frame. File-backed segments have $EDITOR as the escape hatch for the remainder.

LASTING_ESTIMATE_FAILURESConstant#

Failure reasons the next attempt would hit again: the request or the setup is wrong. A timeout, a rate limit or a network error is retried at the next trigger instead, and shows nothing.

LOCAL_HOST_KEYConstant#

This computer's key in every host directory (the in-process host, the embedded one, or the daemon).

LOCAL_HOST_NAMEConstant#

This computer's label in lists and pickers.

LOCAL_SERVER_BRANDSConstant#

The logo of each local model server the wizard looks for.

LOCAL_SERVER_NAMESConstant#

The name of each local model server that the wizard finds.

LOG_LEVEL_CYCLEConstant#

The cycle order the l key walks through — coarsest last so it wraps back to "everything".

Display text for each MachineLinkState.

MACHINE_NOTICE_LABELConstant#

The label of the notices a host emits about a session's machine.

MARKDOWN_RENDER_CHUNK_TARGET_BYTESConstant#

Default per-chunk target for chunkMarkdownForRender. Chosen from measurement: marked's lexer (which OpenTUI's <markdown> runs internally) is O(n²) over paragraph-heavy input — ~500ms at 64KiB, ~2s at 128KiB, ~6s at 256KiB on an M-series laptop — while staying comfortably in the linear zone below ~32KiB (≤ ~200ms). Chunking a large document into ≤24KiB pieces keeps the total render linear in document size with a small constant.

MAX_CURSOR_LENGTHConstant#

The longest cursor paginate accepts. Bounds every cursor it makes: up to 9 keys of at most MAX_SORT_TEXT characters.

MAX_FILE_ATTACHMENT_BYTESConstant#

Cap on a PDF's or a text file's bytes.

MAX_IMAGE_ATTACHMENT_BYTESConstant#

Cap on an image's bytes. Base64 inflates ~33%, so this keeps the encoded payload under Anthropic's 5 MB image ceiling while covering essentially every screenshot. A composer scales a bigger image down to fit.

MAX_NAME_CHARSConstant#

Longest name.

MAX_PAGE_SIZEConstant#

The largest page paginate hands out.

MAX_PLAUSIBLE_RATEConstant#

Faster than any served model today (the fastest wafer-scale ones run ~3k): a reading above is a glitch.

MAX_PROMPT_CHARSConstant#

Longest prompt text.

MAX_QUERY_DEPTHConstant#

How deep all / any / not may nest.

MAX_QUERY_LISTConstant#

How many values one in / nin may list.

MAX_QUERY_NODESConstant#

How many nodes (conditions and combinators) one query may hold.

MAX_QUERY_STRINGConstant#

How long a string value may be.

MAX_QUERY_VALUESConstant#

How many in / nin values one query may list in total.

MAX_SCHEDULESConstant#

Most schedules one host stores.

MAX_SESSION_FACETS_BYTESConstant#

The most JSON one session's facet values may take together, in bytes of their JSON text.

MAX_SORT_KEYSConstant#

How many keys a sort may have.

MAX_SORT_TEXTConstant#

How many characters of a text value sort (and travel in a cursor).

MAX_TEMPLATE_LENGTHConstant#

How long a template may be.

MAX_TRANSCRIPT_EVENTSConstant#

Display-layer transcript bounds. Each rendered event holds live React fibers + OpenTUI renderables + native text buffers even when scrolled off-screen — measured at roughly 0.13 MB RSS per markdown-heavy event — so an uncapped multi-thousand-event session (a normal working day with tool calls) climbs into the hundreds of MB and eventually OOM/thrash.

The cap bounds ONLY what is materialized on screen: session turns on disk are complete, and switching sessions / re-activating replays the most recent window again. Trimming happens at TURN boundaries so a turn's rows are never orphaned, and re-caps fold into one cumulative marker rather than stacking markers.

MCP_KEY_REFUSED_HINTConstant#

What to do about a refused key, under the "Key refused" headline.

MCP_OAUTH_NOTEConstant#

Shown with the MCP category: OAuth tokens stay where they were made.

MCP_STATUS_LABELConstant#

The status words both apps show for a server, so the desktop app's badge and the TUI's read the same. idle says nothing.

MCP_TRANSPORTSConstant#

Every McpTransport in the order a form lists them.

MEDIA_BY_EXTENSIONConstant#

The media types by lowercase file extension.

MESSAGE_DELIVERY_OPTIONSConstant#

The messageDelivery options, with what each one does: the one list that settings and the setup wizard show.

MESSAGE_DELIVERY_TRADEOFFSConstant#

What each "Messages during a run" choice of Conversation gives you and guards against.

METHOD_NOT_FOUNDConstant#

JSON-RPC "method not found": the host predates an additive method.

MIN_INTERVAL_MSConstant#

The shortest interval for every, and between two cron times, for a schedule that a person or an extension makes.

nameFromModelIdConstant#

The name from the id alone, for a surface without the provider catalogs.

NATIVE_EXTENSION_GROUPSConstant#

The step's sections, in display order.

NATIVE_EXTENSIONSConstant#

Every native extension, in display order within each group.

NATIVE_EXTENSIONS_REPOConstant#

The GitHub repository native extensions install from.

NOTICE_GLYPHConstant#

Leading glyph per severity. info is deliberately quiet: a plain i, single-width in every terminal.

ONBOARDING_AGENT_BRANDSConstant#

The logo of each agent whose setup the wizard reads. Pi has none.

ONBOARDING_AGENT_NAMESConstant#

The name of each agent whose setup the wizard reads.

ONBOARDING_FEATURE_GROUPSConstant#

The step's sections, in display order.

ONBOARDING_FEATURESConstant#

Every feature the step can offer, in display order.

ONBOARDING_PREVIEW_ATTACHMENTSConstant#

The files attached to the preview prompt: a chart of the traffic and the team's notes. The events carry their names. An app that draws them supplies the bytes, matched by name.

ONBOARDING_PREVIEW_EVENTSConstant#

The preview conversation, as the transcript renders it.

ONBOARDING_SETTING_KEYSConstant#

Every setting the wizard can change.

ONBOARDING_STEP_SETTINGSConstant#

The settings each step edits. Skipping a step puts them back.

ONBOARDING_STEPSConstant#

Every step in flow order, with what it writes and its copy.

ONBOARDING_VERSIONConstant#

Version of the wizard, stored in each record it writes. A record from an older version still counts as done: existing users open new steps from Settings or the palette, never on their own.

ONBOARDING_WORDSConstant#

The sentences that both apps say word for word, in English.

ORCHESTRATED_BY_KEYConstant#

session.metadata.orchestratedBy — the creating orchestrator session's id, on a worker.

PALETTE_LIMITSConstant#

Caps applied by normalizePaletteItems: item count, text length and keyword count.

PALETTE_RECENT_GROUPConstant#

Group name the hosts use for the most-recently-used rows shown on an empty query.

PALETTE_RECENTS_MAXConstant#

Maximum number of recent item ids kept.

PALETTE_RESULT_MAXConstant#

Ranked rows returned for a query; the host virtualises anyway, this bounds the work.

PROVIDER_BRANDSConstant#

The logo of each built-in provider, by provider key.

QUEUE_PANEL_IDConstant#

Id of the queue panel: messages sent during a run, waiting for it to end (the desktop app only).

RECENT_SESSIONS_BLOCK_IDConstant#

The recent sessions block's panel id.

REMINDERS_PANEL_IDConstant#

Reminders: prompts set to reach the session at a set time (only while Settings.schedules is on).

remoteHostsGateConstant#

Remote hosts (zidane-server). The setting ("Remote hosts") gates the saved servers: the Hosts settings, the per-host session groups and picking a host for a new session. Connecting through an explicit --host / ZIDANE_HOST_URL is its own opt-in, but ZIDANE_NO_REMOTE=1 still wins over it (src/tui/host-target.ts). ZIDANE_NO_REMOTE=1 is set by zidane --no-remote.

RUN_RECEIPT_GLYPHConstant#

The glyph that leads the line on every surface.

RUN_RECEIPT_SWITCH_GLYPHConstant#

Leads the agent when the run switched to it from the previous run's.

RUN_RECEIPT_TURN_GLYPHConstant#

Leads the turn count: one cycle = one model round trip.

RUN_STATUS_TIME_MSConstant#

From when a status shows how long it has lasted. Shorter waits are routine (a model's first token often takes a few seconds), so they show no clock.

RUN_WAITING_DELAY_MSConstant#

How long the tail must read waiting before a surface says so, so the gap between a tool call and the next turn never flashes it. The TUI and the desktop app use the same value.

RUN_WAITING_LABELConstant#

The header text while the run waits on the model. Both apps show these words.

SCHEDULE_METADATA_KEYConstant#

Metadata key on a session that a schedule created, and on the queued prompt of a fire.

SCHEDULE_ORIGIN_SOURCEConstant#

TextOrigin.source of a fire's prompt.

SCRIPT_OUTPUT_LINE_CHARSConstant#

Characters kept per output line.

SCRIPT_OUTPUT_TAIL_LINESConstant#

Output lines a progress state keeps.

SECRET_NAME_PATTERNConstant#

A secret name: an env-var style identifier, also the file name in the store.

SECRET_TTLSConstant#

Every SecretTtl, in the order a picker shows them.

SECRETS_PANEL_IDConstant#

The saved secrets of the session's project (only while Settings.secrets is on).

SENDABLE_IMAGE_TYPESConstant#

Image types every provider takes as they are.

SESSION_ACCOUNT_METADATA_KEYConstant#

Session metadata key of the pinned account (next to providerKey / modelId).

SESSION_EVENT_STATUS_STYLEConstant#

Status → how it reads. needs-attention is deliberately the loudest: it is the one status where the human, not the main, has to act.

SESSION_FACETS_METADATA_KEYConstant#

The metadata key holding a session's facet values. Namespaced: the flat session metadata also holds keys like cwd and archived.

SESSION_FIELDSConstant#

Every row field a query can read, with its type.

SESSION_KEY_SEPARATORConstant#

Character that separates the host key from the session id in a session key (U+001F).

SESSION_ROLE_KEYConstant#

session.metadata.role — present and 'main' on the one orchestrating session.

SESSION_SCOPEConstant#

The scope of top-level runs. A sub-agent run's scope is its run id.

SETTING_TRADEOFFSConstant#

What the safety settings of Autonomy and Bring your setup give you and guard against.

SETTINGS_CHOICESConstant#

Every option-valued setting the settings UI lists, in display order.

SETTINGS_TOGGLESConstant#

Every boolean setting the settings UI lists, in display order.

SETUP_PALETTE_ITEMConstant#

"Run setup", the palette entry both apps list to open the wizard again.

SHELL_BLOCK_MAX_CHARSConstant#

Longest block that runs, in characters.

SHELL_FENCE_LANGUAGESConstant#

Fence languages that run.

SIDE_PANEL_IDConstant#

A /side chat about the session (the desktop app only).

SKILLS_TRIGGERConstant#

Trigger character — slash-commands convention.

SMOOTH_BASE_CPSConstant#

Smooth reveal rate (chars a second) while almost nothing waits.

SMOOTH_MAX_BACKLOG_CHARSConstant#

Backlog (chars) at and past which the smooth reveal runs at SMOOTH_MAX_CPS.

SMOOTH_MAX_CPSConstant#

Smooth reveal rate (chars a second) once the backlog reaches SMOOTH_MAX_BACKLOG_CHARS.

SPACE_METADATA_KEYConstant#

Session metadata key holding the space id.

STREAMING_MARKDOWN_SEGMENT_CHARSConstant#

Default segment bound for a growing streaming markdown event. Coalescing copies the ENTIRE accumulated string into fresh state on every drain tick, so one long streamed message costs O(L²) aggregate — past this threshold the event is split and the copy re-bounded. The split reuses chunkMarkdownForRender (blank-line boundaries outside fences, unsafe-continuation guard), so the finalized segments are byte-identical to the chunks the renderer would have produced inside a single event, and the one-row markdown/markdown margin stands in for the consumed blank line exactly like the renderer's inter-chunk gap. When no safe boundary exists (one giant fence/list) the event keeps growing until one arrives.

SYNC_CATEGORIESConstant#

In the order the UIs list them.

SYNC_CATEGORY_INFOConstant#

What each category is called and carries, for both UIs.

SYNC_MODE_LABELConstant#

Display label for each sync mode.

SYNC_MODESConstant#

Every sync mode, in the order the UIs list them.

SYSTEM_MD_FIELDConstant#

Sync field name of the user-scope SYSTEM.md file.

TERMINAL_HISTORY_MAX_CHARSConstant#

History kept per terminal for new views (characters).

TERMINAL_MAX_PER_SCOPEConstant#

Terminals a session, a project or a draft may have open at once (user terminals).

TERMINAL_MAX_PER_SESSIONConstantDeprecated#

Deprecated. Use TERMINAL_MAX_PER_SCOPE.

Terminals a session, a project or a draft may have open at once.

TERMINAL_OUTPUT_WINDOWConstant#

Characters a client may be behind before the host stops sending to it.

TERMINAL_PANEL_IDConstant#

Id of the terminal panel.

TERMINAL_READ_MAX_CHARSConstant#

Most the agent gets from one read (characters).

TERMINAL_TEXT_MAX_LINESConstant#

Plain-text lines kept per terminal for the agent.

TERMINAL_VIEW_MAX_LINESConstant#

Lines a desktop view can show (its scrollback, plus a screen of up to 1000 rows): what it asks terminal.attach for (maxLines) and what it keeps of the output it drew.

TERMINAL_VIEW_SCROLLBACKConstant#

Scrollback lines a desktop terminal view keeps (each mounted view holds its own).

TODO_STATUS_GLYPHSConstant#

Glyph shown for each todo status.

TOOL_DISPLAYConstant#

Display metadata for the built-in tools, keyed by tool name.

TRANSCRIPT_PRESET_KEYSConstant#

Every setting a conversation preset sets, in the order the fine-tuning lists them.

TRANSCRIPT_PRESET_PALETTE_IDConstant#

The id of the palette entry for the conversation preset. Both apps use it.

TRANSCRIPT_PRESETSConstant#

The three presets, from the quietest to the most complete. Built by a pure call, so a bundle that never reads them drops them and the settings they read.

TRANSCRIPT_TRIM_TO_EVENTSConstant#

Post-trim size — the hysteresis gap keeps re-trims O(rare), not per-append.

TUTORIAL_TOPICSConstant#

Every tutorial, in the order the docs list them.

TUTORIALSConstant#

The words of each tutorial.

USAGE_BLOCK_IDConstant#

The usage block's panel id.

WORKER_REPORT_FRAGMENTConstant#

System-prompt fragment appended to every WORKER's agent. A worker's last message becomes the main's summary, so it must be a report, not a sign-off — the main should be able to act on it without reading the transcript.

Interfaces#

ActiveTriggerInterface#

Identified active trigger span. Returned by findActiveTrigger so callers can show the popover, query the provider, and on commit replace the span with the selected item's insertText.

AnsiLinesInterface#

Reads terminal output in chunks, as lines of styled spans.

AnsiSpanInterface#

Text in one style. style is absent for plain text.

AnsiStyleInterface#

How a span of text is drawn. Absent fields are the default.

AttachmentCandidateInterface#

A file a composer was handed, as planAttachment needs it.

AuthMethodInterface#

One credential source detected for a provider.

BlockRunInterface#

The last run of a block, as the session keeps it.

BlockRunRequestInterface#

What a window asks the host to run.

BrowserChangeInterface#

What changed on the page because of an action; the agent reads this instead of re-snapshotting every step.

BrowserConsoleEntryInterface#

One console message or failed request.

BrowserOpInputsInterface#

Input of each browser operation, keyed by operation name.

BrowserOpResultsInterface#

Result of each browser operation, keyed by operation name.

BrowserRequestInterface#

A browser operation sent from the agent to the process that owns the page.

BrowserScreenshotInterface#

A captured image of the viewport or of one element.

BrowserSnapshotInterface#

A readable view of the page: status, element outline and visible text.

BrowserStatusInterface#

Where the page is: its URL, title and loading state.

BrowserTargetInterface#

A target on the page: a snapshot ref (preferred), a CSS selector / text= / role= locator, or a point.

BuildVisibleInstructionRowsOptionsInterface#

Options for buildVisibleInstructionRows.

BuiltinPanelTabInterface#

A tab for a panel the host renders itself.

CacheChipContentInterface#

Content of the prompt-cache chip. Built by cacheBreakChip.

CatalogEntryInterface#

A model entry as displayed in the cross-provider picker.

CatalogItemProvenanceInterface#

What Settings shows about one catalog item.

ChatReferenceDataInterface#

Provider payload for a chat reference.

ChatReferenceEntryInterface#

A chat that can be referenced from a prompt.

CommandInterface#

An extension-contributed / command. Provide EITHER run (one step) or steps.

CommandArgSuggestionInterface#

One argument suggestion returned by Command.completeArgs.

CommandInvocationInterface#

Parsed /<name> [args] invocation.

CompletionContextInterface#

Read-only view of the active prompt buffer + cursor passed to provider callbacks. Kept minimal so providers stay portable across renderers.

CompletionItemInterface#

A discoverable, selectable thing — one row in the autocomplete popover. TItem is provider-specific; consumers can inspect data when they need the originating payload (e.g. the full SkillConfig for tooltips).

CompletionProviderInterface#

Provider contract. Implementations decide their own ranking, fuzzy-match rules, async loading behavior, and reference grammar.

CompletionReferenceInterface#

A reference to a provider item inside arbitrary prompt text. Producers: provider.parseReferences(text). Consumers: the TUI for highlighting, the run flow for "activate every referenced skill before agent.run()".

Spans are half-open [start, end) UTF-16 code unit offsets (string indices) into the source string. Overlapping spans from the same or different providers are caller-resolved — the helpers below ship a "first wins" merger.

ConnectorAuthWordsInterface#

The words that connectorAuthText uses. Each app writes them its own way.

ConnectorCategoryMetaInterface#

A section of the Connectors step.

ConnectorEntryInterface#

A service the Connectors step adds as an MCP server.

ConnectorInputInterface#

What the user typed for a connector.

ConnectorTokenAuthInterface#

Token sign-in of a connector: what to ask for and where it goes.

ContextBreakdownInterface#

The shaped, render-ready breakdown.

ContextBreakdownContributionContextInterface#

Data exposed to extension context-breakdown contributors.

ContextBreakdownOptionsInterface#

Host-supplied options for agent.getContextBreakdown.

ContextCategoryInterface#

One category row in the breakdown.

ContextExactCountsInterface#

Exact per-segment counts from a provider's countTokens, when available. Each field is the count of the cumulative payload up to and including that segment, so categories are derived by differencing (see buildContextBreakdown). Any subset may be present; missing fields fall back to the heuristic for that category.

ContextExtensionRowInterface#

One display row contributed by an extension to the context panel.

ContextExtensionSectionInterface#

Extension-owned context panel section. Core treats rows as opaque display data.

ContextItemInterface#

One expandable child row under a category (e.g. a single MCP tool / rules file).

ContextMcpGroupInterface#

Tools grouped by MCP server, for the expandable per-server rows.

ContextSegmentInterface#

One chunk of text present in the session's default context.

ContextSegmentFileInterface#

A host-discovered instruction file. Structurally compatible with AgentsMdFile from ./agents-md (whose source field is the SCOPE, not the text — contents is the text), so callers can pass those straight in.

ContextSegmentsInputInterface#

The assembled-prompt pieces buildContextSegments shapes. Mirrors the subset of the agent's ContextAssembly that carries text, plus host-side instruction files (which the assembly only knows as paths).

ContextSnapshotInterface#

Raw inputs captured at agent prompt-assembly time. Everything here is what actually went on (or was withheld from) the wire for the last run.

ContextUsageSplitInterface#

Exact last-turn token usage split (provider-reported — always exact). Drives the cache breakdown shown below the categories. cacheRead + cacheCreation + input equals the live context total (used).

CronEngineInterface#

The cron math the host plugs in (cronEngine in ./cron).

CustomModelTargetInterface#

A provider and model id a free-text query resolves to.

DaemonHealthStyleInterface#

How the daemon health dot is styled.

DescribeTimeOptionsInterface#

How describeTime writes a time.

DiffLineInterface#

One line of a line diff.

EditHunkSummaryInterface#

Digest of one changed region, used by the compact diff view.

EditSummaryInterface#

Digest of an edit payload for the compact diff view.

EntryCreateOptionsInterface#

Options of EntryOps.create.

EntryImportLimitsInterface#

Limits of importEntries.

EntryOpsInterface#

The entry actions on one folder. Paths are relative to it; '' is the folder itself.

EstimateReadoutInterface#

What an estimate says at a moment.

ExtensionMarkInputInterface#

What extensionMark reads.

ExtensionPanelTabInterface#

A tab for a panel an extension registered.

ExtensionSourceEntryInterface#

An extension a source holds, read from its package.json (zidane field) or extension.json. Nothing of it ran.

ExtensionSourceInfoInterface#

Where a listing comes from.

ExtensionSourceListingInterface#

The extensions of one source, as listExtensionSource lists them.

ExtensionSpaceSourceInterface#

A space an extension contributes, as its wire form carries it (SpaceWire in zidane/extensions): the fields extensionSpace reads.

FeatureGateInterface#

A feature gate created by defineFeatureGate.

FeatureGateOptionsInterface#

Options for defineFeatureGate.

FenceOpenInterface#

A fenced code block's opening line: its indent, marker character and marker length.

FoldPlanInterface#

planFold's result.

FoldShapeInterface#

What decides whether an item folds: its kind and owner, and two facts only its surface knows.

FoldStatsInterface#

What the header reads. Worker-owned calls and thoughts count under the worker, not here.

FoldStepInterface#

One line of an opened fold: a tool call, consecutive thoughts, a worker, or a command's note.

GenerateSessionTitleOptionsInterface#

Options for generateSessionTitle.

GroupOptionsInterface#

Options of groupRows.

HeatmapThresholdsInterface#

The three quartile bounds a value is placed against.

HighlightRangeInterface#

Half-open character range [start, end) of a match inside a text.

HighlightSegmentInterface#

A run of text that is either all highlighted or not, from highlightSegments.

HostCapabilitiesInterface#

A host's probed capabilities, as host.capabilities returns them.

HostEntryInterface#

One saved host. Tokens are not here: see hostCredentialKey.

HostIdentityInterface#

The identity a host reports (hostRefOf(hello)).

HostIndexInterface#

Keyed by (host, id): the same id may live on several hosts. A lookup that names its host (hostKey) gets exactly that pair; one that doesn't resolves only when one host has the id.

HostToolInterface#

A tool looked up on the host's PATH.

HunkResolutionInterface#

How the edit tool would resolve one hunk.

IndexedSearchTurnInterface#

A turn with its searchable text, prepared once for repeated queries.

InlineDiffInterface#

Word-level segments for the old and new side of a paired line.

InlineGhostInterface#

Inline autocomplete suggestion shown as ghost text after the caret, with the buffer state it was computed for.

InlineSegmentInterface#

A run of text in an inline diff.

InstalledServerRefInterface#

The fields of an installed MCP server a connector is matched on.

LineupEntryInterface#

A provider and model id pair considered for the lineup.

LiveRunStatusInterface#

What a transcript passes its live work row so the row can name the run's status: the provider retry in flight, and whether nothing live is on screen (runTailActivity reads waiting).

MachineDirListingInterface#

A folder listing a folder picker renders (the shape of fs.listDirs).

MachineInfoInterface#

A machine as clients see it (machines.list, environments.list).

MachineLinksStatusInterface#

Status of every machine link of a local host.

MachineRootInterface#

A directory a machine exposes to its host.

MachineShareStatusInterface#

State of this computer's share to one saved server, where it acts as a machine.

MachineStatusChangeInterface#

machine:status payload.

MachineUseStatusInterface#

State of one saved server used as a machine by this host.

MarkdownDeltaOptionsInterface#

Options for appendMarkdownDelta.

MarkdownSegmentInterface#

One block returned by splitMarkdownCodeBlocks. Prose segments carry their original markdown (including blank lines that bracketed the fence) so the surrounding paragraph spacing stays faithful to the original input. Code segments carry the raw body — fence markers and info-string stripped — so a "copy code" action lands what the user actually sees, byte-for-byte.

McpFormResultInterface#

A validated form: the config entry to write and where to write it.

McpFormValuesInterface#

Raw field values of the add-MCP-server form.

McpTestResultInterface#

Classified result of one MCP connection test.

MediaTypeInterface#

A media file's kind and MIME type.

ModelChainEntryInterface#

One provider+model pair in a fallback chain.

ModelDisplayNameInterface#

Display name of a model, with its vendor when the name carried one.

ModelIdPartsInterface#

Parsed shape of a model id. Exported for tests and for pickers that want to show a family label.

ModelNameInputInterface#

Input of modelDisplayName.

ModelSettingPickInterface#

Model choices stored as one settings string (compactionModel, a space's default in the GUI rows): "providerKey/modelId", or "providerKey@account/modelId" for a pinned account (a credential's stable id). Split on the FIRST slash — model ids may contain slashes, provider keys and credential ids never do. Node-free: shared by the hosts and the GUI renderer (zidane/chat/pure).

ModeStateInterface#

The terminal modes a program's output has left set, as scanModes follows them.

NativeExtensionCommandNeedInterface#

A program a native extension runs, looked up on PATH.

NativeExtensionEntryInterface#

An extension of the zidane repository's extensions/ folder, installable in one click.

NativeExtensionGroupMetaInterface#

A section of the Extensions step.

NestedEventTagInterface#

Where nested events sit in the transcript; copied onto each event when set.

OnboardingAppearanceInterface#

The look of the desktop app, as a portable value. It has the mode (light, dark or the system's) and a theme for each mode. It also has an accent that replaces the accent of the theme, and the app icon.

OnboardingCustomFieldInterface#

A setting a provider needs besides its key (a base URL, a cloud project), as the Connect step asks for it.

OnboardingDetectionInterface#

What the wizard found on this machine before its first step.

OnboardingDraftInterface#

Everything a run has picked so far. Settings stay in one map, so they diff against what is stored.

OnboardingFeatureInterface#

A toggle the Features step offers. Its label and description are the setting's own (SETTINGS_TOGGLES).

OnboardingFeatureCopyInterface#

A feature's label and description: the setting's own.

OnboardingFeatureGroupMetaInterface#

A section of the Features step.

OnboardingFlowStateInterface#

Where a run is.

OnboardingGateInputInterface#

What needsOnboarding reads.

OnboardingGithubIdentityInterface#

The GitHub account the gh CLI or a token in the environment uses.

OnboardingImportCategoryInterface#

What an import brings over and what it skips, for one piece.

OnboardingImportPreviewInterface#

What Bring your setup shows before anything is imported.

OnboardingImportSelectionInterface#

What to import from Claude Code. Each piece is skipped when false.

OnboardingImportSessionCountsInterface#

The transcript counts Bring your setup shows.

OnboardingInstallSignalsInterface#

What tells an install that existed before the wizard from a fresh one.

OnboardingLocalServerInterface#

A local OpenAI-compatible model server answering on its default port.

OnboardingPlanContextInterface#

What decides which steps a run shows.

OnboardingProgressInterface#

How far a run is: the current step's position and the number of steps.

OnboardingProviderInterface#

A provider as the Connect step lists it: what it is, how it signs in, and whether it is ready.

OnboardingProviderPickInterface#

The provider, model and effort picked in Connect.

OnboardingReadableInterface#

A value that a UI reads and watches. It has the shape of Readable in zidane-ui.

OnboardingRecordInterface#

The record of one finished run.

OnboardingResultInterface#

What a finished run writes. Installs and imports ran during their steps, and this is the rest.

OnboardingRunInterface#

A run and the work that it starts.

OnboardingRunHostInterface#

The work that a run asks the app to do. If a member is left out, that work does not run.

OnboardingRunOptionsInterface#

Options of createOnboardingRun.

OnboardingRunSetupInterface#

What a run starts from.

OnboardingRunStartInterface#

A run that started and has not finished.

OnboardingSettingsChangeInterface#

What a run does to the stored settings: keys it sets, and keys it returns to their default.

OnboardingStartInterface#

The draft a run starts from.

OnboardingStateInterface#

The wizard's records in the state file: shared for the steps both apps read, and one per app for that app's own steps.

OnboardingStepMetaInterface#

Display data of one step. Renderers style the copy. They never rewrite it.

OnboardingSwitchedFeaturesInterface#

The features a run switched, by their Settings label.

OnboardingTaskInterface#

An import or install that the wizard started. Ready lists them.

OnboardingTradeoffInterface#

What a choice gives you and what it guards against, as the wizard shows them side by side.

OutputHistoryOptionsInterface#

Optional caps for an OutputHistory.

OutputLineInterface#

One line of output.

OutputTailInterface#

The last lines of an output.

PageOptionsInterface#

Options of paginate.

PaletteContextInterface#

JSON-safe snapshot of the host handed to providers. Never holds functions.

PaletteGroupInterface#

A titled section of ranked palette rows.

PaletteItemInterface#

An entry in the command palette.

PaletteProviderInterface#

Source of palette items and the handler that runs them.

PanelCatalogOptionsInterface#

Options for buildPanelCatalog.

PanelStateInterface#

Open state of the side panel.

ParsedBindingInterface#

Parsed shape of a "ctrl+shift+o" spec.

ParsedWhenInterface#

A parsed time phrase: the trigger, and the text after the phrase (the prompt).

PresenceMergeInterface#

Presence across hosts. Each host (This computer, every connected server) answers presence for its own sessions only; a sessions list reads one snapshot. The last snapshot of each host is kept and the union handed out on every change. A host that goes away takes its entries with it. Node-free, shared by the TUI and the GUI main process.

PreviewResultInterface#

Result of previewEditPayload.

PromptSegmentRefInterface#

Highlight span — half-open [start, end) over the source string.

Offsets are JS string indices (UTF-16 code units) — the same convention used everywhere else in the chat layer (text[i], m.index, String.slice). Surrogate pairs that straddle a span boundary would render malformed, but realistic prompts in this surface (terminal text + ASCII triggers) keep that risk theoretical; callers feeding emoji-heavy content should normalize to codepoint walks upstream.

PromptTurnRefInterface#

The minimum a prompt turn must carry to be matched against its live echo.

Exists because the daemon has to send this over a wire: a full SessionTurn carries every content block, including base64 image and document payloads, which would be megabytes per prompt to ship for the sake of attaching an id.

ProviderAccountInterface#

One stored credential of a provider that a session can run on (see ProviderAuth.accounts).

ProviderAuthInterface#

Authentication state of one provider, as listed by detectAuth.

ProviderResetCreditInterface#

One banked reset.

ProviderResetOutcomeInterface#

What redeeming a banked reset did. reset: the windows were emptied; nothing_to_reset: no window had usage, so nothing was spent; no_credit: no reset left; already_redeemed: this request was already applied; failed: the request failed (error says why), possibly before reaching the provider.

ProviderUsageCreditsInterface#

Remaining credits for pay-as-you-go style providers.

ProviderUsageResetsInterface#

Banked rate-limit resets an account holds (Codex): one redeemed empties its windows now.

ProviderUsageSnapshotInterface#

Usage of one credential of a provider, as probed at one moment.

ProviderUsageWindowInterface#

One rate-limit window on a subscription (e.g. "5h", "weekly").

QueryOptionsInterface#

Options of the query functions.

RankedPaletteItemInterface#

A palette item with its match score.

RateSampleInterface#

One stream:progress reading of a turn, as stepStreamRate takes it.

RateStateInterface#

Sliding-window state of the output rate of a streaming turn.

RecentSessionRowInterface#

One session the recent block lists.

RecentSessionsBlockDepsInterface#

What the recent sessions block reads from its host.

ReconcilableEventInterface#

What reconciling reads off an event: a StreamEvent, or a client's wire copy of one.

RepoSpecInterface#

What a pasted "repository" is: the URL git should clone, the folder name it lands in, and a short label for the UI. Pure, shared by main (the clone) and the renderer (the live preview under the field).

Accepted: owner/repo (GitHub shorthand), github.com/owner/repo, https://host/owner/repo(.git), a GitHub web URL deep in the tree (/tree/<branch>/…, /blob/…, /pull/…: the branch is kept when it is in the URL), git@host:owner/repo.git, ssh://…, git://…, file://….

RunEstimateProblemInterface#

A run that could not be estimated for a reason that will not go away by itself (LASTING_ESTIMATE_FAILURES): a window says so, so a setup problem (a rejected request, a missing key) does not look like nothing happening.

RunEstimateTimingInterface#

An estimated run: enough to count down without the run record.

RunReceiptInterface#

What a finished run cost and how long it took, as shown on its receipt row.

RunReceiptCellInterface#

One cell of a formatted receipt line.

RunReceiptSegmentInterface#

One part of a tokens cell, so renderers can color input and output differently.

RunRetryInterface#

A provider retry in flight: the attempt, out of how many, and whose stream (parent or absent for the session's own, else a subagent id).

RunStatusCellInterface#

One value of the live run readout, so a renderer can tint and badge it by meaning.

RunStopInterface#

How a run ended early and how to pick it back up.

RunStopAdapterInterface#

How one surface copies and marks its items.

RunStopItemInterface#

What the classifier reads off an item: stream events and the GUI's rows both carry it.

ScheduleIssueInterface#

One problem in a schedule input.

ScriptLineProgressInterface#

A script line that made calls.

ScriptLoopInterface#

A loop of a script, by its lines.

ScriptOptionsInterface#

What a script's // @options line sets.

ScriptProgressInterface#

A script's progress as a tool-progress event carries it.

ScriptProgressTrackerInterface#

Builds a script's ScriptProgress from its calls and output, in the order they happen.

ScriptProgressViewInterface#

What the GUI and the TUI draw for a script.

ScriptViewLineInterface#

One line of a script as the view draws it.

ScriptViewLoopInterface#

A loop of the script as the view draws it.

SearchExcerptInterface#

A clipped line of a turn around a match.

SearchSessionResultInterface#

A matching turn flattened for a session search list, as returned by searchSessionTurns.

ServerUpdateStatusInterface#

Where a server's self-update stands, as server.update.* reports it.

SessionConditionInterface#

One test on one field. Every operator given must hold. An array value (a facet holding a list) matches eq / in / contains when one of its elements does. A missing value equals null; a missing boolean field reads false.

SessionEventInterface#

A report from a worker session to the orchestrating main session.

SessionEventStatusStyleInterface#

Glyph, tone and verb used to render one SessionEventStatus.

SessionGroupInterface#

One group of groupRows.

SessionGroupByInterface#

Groups rows by the value of a field or facet. Each distinct value is one group; a row whose value is a list is in one group per element. Rows without a value go to a last group with key null.

SessionHistoryMatchInterface#

Aggregated row-level match used by the conversations list.

SessionKeyPartsInterface#

The pair a session key names.

SessionKnobsInterface#

The effort and options a new session starts with, as configured.

SessionPageInterface#

One page of paginate.

SessionQueryAllInterface#

Every sub-query holds. An empty list matches every row.

SessionQueryAnyInterface#

At least one sub-query holds. An empty list matches no row.

SessionQueryEnvironmentInterface#

The environment part of a row.

SessionQueryInputInterface#

What querySessions takes.

SessionQueryIssueInterface#

One problem validateQuery and its siblings found.

SessionQueryNotInterface#

The sub-query does not hold.

SessionQueryRowInterface#

A session row the query reads. The protocol's SessionRow and the extension API's SessionListRow both fit. Facet values sit under facets, keyed <extensionId>.<key>.

SessionSearchExcerptInterface#

An excerpt tagged with the turn it came from.

SessionSearchIndexInterface#

Prebuilt index over a session's turns. Build one with buildSessionSearchIndex and reuse it across queries.

SessionSortInterface#

One sort key. Rows without a value sort last in both directions. Only text, numbers and booleans sort: a facet holding a list or an object sorts as missing, and text sorts on its first 256 characters.

SessionViewInterface#

The filters of a sidebar view. Each one left out keeps every session.

SessionViewSpaceInterface#

The space a view is on.

SettingsChoiceInterface#

String-valued settings that pick between a known set of options. The SettingsModal renders these as one row showing the active label, where enter cycles to the next option (wrapping back to the first). Same shape any GUI settings panel can consume — render the options array as a dropdown or segmented control.

Keep options in stable display order; cycling depends on it.

SettingsToggleInterface#

Static description of every togglable setting, in display order. The TUI's SettingsModal and the GUI settings panel build their row list from this so labels/descriptions stay in one place.

SetupPaletteItemInterface#

The command palette's entry for the wizard.

ShellBlockPlanInterface#

What runs for a block.

SpaceInterface#

A named group of sessions with optional defaults for new ones.

SpaceModelDefaultInterface#

The model a new session in a space starts on.

SpacesSettingsInterface#

The parts of the settings the helpers read.

SpawnEndSummaryInterface#

A worker's end, ready to render: the sentence head, and the facts to show as badges.

SpawnTreeRowInterface#

What the helpers read off a transcript row / event. The slice of a transcript row needed to build the spawn tree.

StoredSessionFacetsInterface#

A session's facets as its metadata holds them.

StreamFailureInterface#

A stop marker split off an assistant reply by splitStreamFailure.

SyncClaimResultInterface#

sync.claim: claimed, or another device is the source (status.source).

SyncPushResultInterface#

sync.push: what happened to each field of the snapshot.

SyncSourceInterface#

The device a server takes its sync from.

SyncStatusInterface#

sync.status: the server's record, no values.

TerminalAdoptResultInterface#

What terminal.adopt moved into the session (ids), and what it could not.

TerminalAttachResultInterface#

What a client needs to start showing a terminal: its history, and where live output resumes.

TerminalInfoInterface#

Description of one terminal, as the host reports it to clients.

TerminalOpenInputInterface#

Opens a terminal in a session.

TerminalProjectOpenInputInterface#

Opens a project / draft terminal: a shell on the host's machine in cwd.

TerminalProjectScopeInterface#

A terminal not bound to a session: a plain shell on the host's machine, in a project's folder (docs/PROJECT-SCOPE-AUDIT.md). draftId ties it to a new-chat draft until terminal.adopt hands it to the session created from that draft (or terminal.releaseDraft gives it back to the project). Agents never see unbound terminals.

TerminalProjectStateInterface#

The terminals of a project or of one draft, and whether this host can run them.

TerminalProjectStateInputInterface#

The terminals of a project (draftId absent) or of one draft. cwd is any folder of the project; the host resolves its root.

TerminalReadResultInterface#

The agent's view: plain text lines, with a cursor for the next read.

TerminalSessionStateInterface#

The terminals of one session and whether this host can run them.

TextModelCandidateInterface#

One model of the session's provider, as the automatic pick reads it (a ModelInfo fits).

TextModelOptionsInterface#

Inputs of textModelChain / resolveTextModel.

TextModelPickInterface#

A text model to run on.

ThinkingDeltaOptionsInterface#

Options for appendThinkingLines.

ToolDisplayMetaInterface#

How one tool is labeled and summarized in the transcript.

ToolFormatLineInterface#

The pieces of a one-line tool call summary.

ToolOverviewInterface#

One-line description of a tool call, built by toolOverview.

ToolOverviewInputInterface#

What a tool call is, independent of how a surface stores it.

TranscriptPresetInterface#

One conversation preset.

TutorialStepInterface#

One step of a tutorial.

TutorialWordsInterface#

The words of a tutorial: its title and its three steps, in order.

UsageBlockDepsInterface#

What the usage block reads from its host.

ViewQueryInputInterface#

What viewQuery takes.

VisibleInstructionRowInterface#

One selectable row: a context segment, plus its resolved open state.

Types#

AgentAccentType#

Theme color token used to accent the active profile in the UI (footer badge, picker highlight). Resolved against ThemeColors via useColors(); falls back to accent when omitted.

AgeStepType#

A step of the relative-age ladder: under a minute, a whole duration, or old enough to show as a date.

AnsiColorType#

A color: one of the 256 palette entries (0 to 15 are the theme's), or #rrggbb.

AttachmentPlanType#

What to do with a file: attach its bytes as they are, typed mediaType; decode and re-encode an image first (a format providers don't take, or over MAX_IMAGE_ATTACHMENT_BYTES); or refuse it.

AttachmentRefusalType#

Why a file is not attached.

AuthPrimaryActionType#

What the card's main button does: sign in again, or retry when signing in would not help (yet).

BlockShellType#

The shell a block runs in, from its fence.

BooleanSettingKeyType#

Keys of Settings whose value type is exactly boolean. Used to type the toggle table so SETTINGS_TOGGLES.key only ever points to a boolean-valued setting — string- and array-valued settings (theme, enabledSkills, …) live in SETTINGS_CHOICES or actions.

-? strips optionality from the mapped output so Settings[K] doesn't silently broaden into T | undefined and short-circuit the extends boolean check via undefined.

BrowserErrorCodeType#

Machine-readable reason a browser operation failed.

BrowserOpType#

Name of a browser operation.

BrowserResponseType#

Answer to a BrowserRequest: the result, or an error code and message.

BrowserWaitUntilType#

Page load milestone a navigation waits for. none returns without waiting.

BuiltinPanelIdType#

Built-in tabs the hosts render with their own components.

CacheChipToneType#

warn = a real cache break (a named dimension changed, so it was avoidable); dim = ordinary TTL expiry, which is not anyone's fault and should not shout.

CatalogKindType#

The catalogs Settings can ask about.

ChatReferenceScopeType#

Whether chat suggestions cover the current project or every project.

ConnectorAuthType#

How a connector signs in.

  • oauth: in the browser, through the server's OAuth (the server registers zidane as a client).
  • token: a token sent in a header (ConnectorTokenAuth).
  • none: no account.

ConnectorCategoryType#

Section a connector is listed under.

ConnectorTransportType#

How a connector reaches its server: an HTTP endpoint, or a command the agent starts and talks to over stdio.

ContextBreakdownContributorType#

Extension hook for adding opaque rows to the context panel.

ContextCategoryIdType#

Stable identifiers for each breakdown category. Drives swatch color + ordering in both UIs. *Deferred buckets are tools/MCP that exist but are NOT currently on the wire (lazy disclosure); autocompactBuffer is the reserved output headroom; freeSpace is the remaining window.

ContextSegmentOriginType#

Where a segment's text came from. Only 'file' segments carry a path.

DaemonHealthType#

Daemon connection health — the one model behind the status dot in both clients' footers.

Three states, because "connected: boolean" cannot express the one users actually want to see: a daemon that is being spawned or reconnected is not DOWN, and painting it red for the seconds that takes teaches people to ignore red. So:

  • connected — handshake done, signals live. green (accent)
  • connecting — spawning / reconnecting / first attempt. amber (warn)
  • disconnected — reachable daemon absent, last attempt failed. red (error)

Tones are theme SLOTS, not colors, so the dot recolors with the palette on both surfaces. Node-free; re-exported from zidane/chat/pure.

DaemonHealthToneType#

Theme tone used to color the daemon health dot.

DiffOpType#

Role of a line in a diff: unchanged context, an addition or a removal.

EntryImportItemType#

One thing dropped from outside: a file (read when its turn comes) or a folder.

EntryImportResultType#

What an import did: the top-level paths it made, and why it stopped when it did.

EntryRefusalType#

Why an entry action was refused.

EntryResultType#

What an entry action did: the path it ended at, or why it was refused.

ExtensionMarkType#

What an app draws for an extension: an icon class, a Simple Icons slug, or a letter.

ExtensionSourceErrorCodeType#

Why a listing is empty or partial.

  • not-found: no such repository, branch, folder or package.
  • private: the source exists but needs access (or GitHub hid it: a private repository answers 404 without a token).
  • rate-limit: GitHub refused more calls without a token.
  • network: the connection failed, or the server answered an error.
  • invalid: the text is not a source this can list.

ExtensionSourceKindType#

The kind of a source: a GitHub repository (or a folder in one), an npm package, another link, a folder on the host.

FacetPathType#

A facet an extension computes for each session: facet.<extensionId>.<key>, optionally followed by .<property> steps into an object value (a number step indexes an array).

FoldStepStateType#

A step's progress: waiting is a spawn call every worker slot is taken for.

FoldUnitType#

One folded item, as the planner reads it. item is the surface's own object, handed back in the steps.

HeatmapLevelType#

0 = no activity … 4 = the top quartile of active days.

HostConnectionStatusType#

auth-refused: the server turned the token down (401/403); identity: a different server answers at a saved host's URL. Neither retries until something changes. version-mismatch: the server speaks another protocol version (the error says which side to upgrade); re-checked every few minutes, so an upgrade heals it.

HostErrorCodeType#

Why a host could not be added or tested:

  • invalid-url: not wss://, or ws:// off loopback; nothing was dialed.
  • invalid-token: empty.
  • invalid-name: an empty name.
  • auth: the server refused the token (401) or the connection (403).
  • unreachable: nothing answered (refused, DNS, timeout, closed).
  • tls: the TLS handshake failed (certificate).
  • protocol: something answered but not a zidane-server this client can talk to (protocol version, no host identity, not a server).
  • identity: a different host answers at the saved URL.
  • unknown-host: no saved host has this id.

HostProbeResultType#

Answer of a host probe: the host's identity and latency, or an error code and message.

HostTestResultType#

test(id): the probe's answer, checked against the saved entry.

InstallScopeChoiceType#

Where a written MCP entry lands.

MachineLinkStateType#

What a local host's machine links are doing (machines.links.status, machine:links): this computer shared with a saved server (it is the machine), and saved servers used as machines (local@<server>, the reverse direction over this host's own client connection).

McpAuthStatusType#

Per-server MCP OAuth status tracking, decoupled from the renderer.

The TUI keeps a Record<serverName, McpAuthStatus> so it can render a "needs-auth" / "authorizing" / "error" badge in the MCP picker. The status map is driven entirely by hooks fired from the agent's MCP bootstrap + the interactive loginMcpServer flow — the reducer below is pure, makes no FS or network calls, and is shared between the live TUI store and the test harness.

Status lifecycle:

needs-auth | authorizing | authed ──mcp:connect──▶ authed (bootstrap succeeded with stored tokens; a server that was never OAuth-tracked stays idle) needs-auth (reason 'refused') ──mcp:connect──▶ idle bootstrap-error | key-refused ──mcp:connect──▶ idle

idle ──mcp:auth:required──▶ needs-auth (bootstrap saw no/invalid tokens)

idle ──401/403, no key of its own──▶ needs-auth (reason 'refused') idle ──401/403 on its own header key──▶ key-refused (see classifyMcpTest)

needs-auth ──login()──▶ authorizing ──mcp:auth:url──▶ authorizing(url) ──mcp:auth:success──▶ authed ──mcp:auth:error──▶ error

any ──logout──▶ idle

Multiple servers progress through the lifecycle independently; the map is keyed by McpServerConfig.name.

McpTestOutcomeKindType#

Classification of an MCP connection attempt.

McpTransportType#

Transport an MCP server is reached over.

MediaKindType#

What a media file is played as.

ModelNamerType#

How a surface names a model: the model picker's name for it (Opus 4.5).

NativeExtensionGroupType#

Section a native extension is listed under.

NativeExtensionNeedType#

Something a native extension needs to work, shown on its card.

  • command: a program on PATH (NativeExtensionCommandNeed).
  • connector: a connector it works through. The step offers to add it.
  • decisions: the decision model, used when available.
  • account: an account with a service, set up after the install.

NativeExtensionNeedWordsType#

The words that nativeExtensionNeedText uses.

NoticeSeverityType#

Severity of a transcript notice.

OnboardingActionType#

What can happen in a run.

  • next / back: move one step. next on the last step finishes the run.
  • goto: jump to a step of the run, such as from Ready's recap.
  • skip: put the current step's picks back, then move on.
  • finish: end the run now, keeping what was picked (Skip setup).
  • choose-path: Welcome's choice. Quick start cuts the run down to Connect, Bring your setup and Ready.
  • set-context: the detection finished. The steps are planned again and the current one kept.
  • set-settings: change settings. Turning a setting on also turns on what it needs and, for a feature, what it includes. Turning one off turns off what needs it.
  • apply-preset: set every transcript setting to a preset's values.
  • set-provider, set-imports, set-appearance: Connect's, Bring your setup's and Look's picks.
  • toggle-connector, toggle-extension: pick or unpick a connector or a native extension.
  • toggle-skills: pick or unpick skills, one or a whole listing at once.
  • task: add or update a background task, matched by id.

OnboardingAgentIdType#

Another coding agent whose configuration the wizard can import or read.

OnboardingCredentialSourceType#

How a provider's credential was found.

OnboardingFeatureBadgeType#

A mark on a feature: still experimental, or billed by the provider on each use.

OnboardingFeatureGroupType#

Section a feature is listed under.

OnboardingGateType#

What an app does at launch about the wizard.

  • run: show it, in mode.
  • migrate: the install predates the wizard. Write its record and show nothing.
  • none: nothing to do.

OnboardingImportPreviewStateType#

What an import from Claude Code brings over.

  • none: the run offers no import, because there is no Claude Code setup or no import.
  • loading: the host is reading it.
  • ready: the preview.
  • failed: the host failed to read it.

OnboardingImportWordsType#

The words that onboardingImportParts uses.

OnboardingModeType#

How much of the wizard runs.

  • full: every step that applies, for a fresh install.
  • quick: Welcome, Connect, Bring your setup (when another agent is found) and Ready.
  • extras: the steps that belong to this app only, after the shared steps ran in the other app.
  • connect: Connect alone, opened from the desktop app's sign-in prompts.
  • rerun: every step but Welcome, prefilled with the current values, opened from Settings or the palette.

OnboardingPhaseType#

Where a run is in its life.

  • running: the user is going through the steps.
  • saving: the last step was passed, and the host is writing the result.
  • saved: the result is written. The app closes the wizard.
  • failed: writing failed. The run is back on its step, and moving on again tries again.

OnboardingSignInStateType#

Where a browser sign-in is, for a provider or a connector. Renderers show the link, the device code or the question. done and error end it.

  • starting: the flow is starting.
  • url: the sign-in page to open. Pasting the redirect URL or the code also finishes it.
  • device: a device flow. The user enters userCode on the page at url.
  • prompt: the provider asks a question, such as a code to paste, or a pick among options.
  • progress: a status line while it finishes.
  • done: signed in, as account when the provider names it.
  • error: it failed, with the reason.

OnboardingStepIdType#

A step of the setup wizard, in flow order.

OnboardingStepScopeType#

What a step writes: files both apps read (shared), state of the app that runs it (surface), or nothing (none).

OnboardingSurfaceType#

The app that runs the wizard.

OnboardingTaskKindType#

What a background task does.

OnboardingTaskStatusType#

Where a background task is. needs-sign-in: added, but the browser sign-in did not finish.

OnboardingWordsType#

The shape of ONBOARDING_WORDS.

OutputStreamType#

Where an output line came from: a printed item (output, console) or a command's stdout / stderr.

PaletteHostType#

Which app renders the palette.

PaletteItemKindType#

toggle shows a checked state; picker opens a nested list on run.

PaletteRunResultType#

What a provider's run may hand back. items opens a nested picker (branches, environments); the host keeps a stack so Backspace on an empty query goes back one level. prompt sends text to the chat, insert puts it in the composer (a / command that takes arguments).

PanelTabType#

A built-in or extension panel tab.

ParsedFieldPathType#

A field path read apart.

PromptSegmentType#

One atomic unit emitted by splitPromptSegments. Plain segments are word-sized so wraps land cleanly between words; chip segments carry the source providerId ('skills', 'files', …) so renderers can pick per-kind colors without re-walking the ref list.

ProviderUsageStatusType#

Outcome of a usage probe: ok, unauthorized when the credential is missing or rejected, or unavailable on any other failure.

QueryBoundType#

A bound of gt / gte / lt / lte: a number (epoch ms on time fields), a relative time ('now', '-7d', '+12h'; units s m h d w), or an ISO date ('2026-01-31', '2026-01-31T09:00:00Z'; a date without a zone is UTC). Strings are accepted on time fields and facets.

QueryValueType#

A value a condition compares against. null stands for "no value".

RunEstimateViewType#

A run's estimate as hosts send it to windows (run:estimate, a session row's runEstimates): its timing, or the lasting problem that keeps it from having one.

RunFoldStatusType#

What the live work row's header says while a run is in flight:

  • retrying: a provider call is being retried.
  • waiting: nothing has moved on screen for RUN_WAITING_DELAY_MS; the run waits on the model.
  • working: anything else. The surface names the work its usual way.

RunReceiptCellKindType#

What a cell IS, so renderers can tint by meaning rather than by position.

RunReceiptSegmentKindType#

Sub-parts of a cell that want their own tint — the two token arrows.

RunTailActivityType#

What the transcript's tail shows during a run:

  • streaming: a reply is streaming in.
  • thinking: reasoning text is streaming in.
  • tool: a tool call (a subagent, a question to the user, a command) is running.
  • waiting: nothing live is on screen; the run is waiting on the model.

ScriptCallStatusType#

How the latest call of a script line stands: waiting is a sleep(ms) in progress.

ScriptLineStateType#

How a script line draws: idle (not reached yet), passed (the script went past it, or it makes no call), running, waiting (a sleep), done or failed (its latest call), previous (in a loop that went round again: it ran in an earlier round, not yet in this one).

ScriptLoopKindType#

What a loop of the script is: a for / while / do, or the callback of an array method (.map, .forEach).

ScriptOutputLineType#

One line of what a script printed or its shell calls wrote.

SearchTurnResultType#

Alias of SearchTurnMatch.

SecretAnswerType#

What a client sends for a secret question: the typed value and the TTL the person picked, or a decline. Never persisted: the host swaps it for a SecretReference first.

SecretReferenceType#

What the model reads for a secret question. Holds no value.

SecretTtlType#

How long a secret stays in the store. never keeps it until the user revokes it.

SessionEventStatusType#

What happened in a worker. needs-attention is a worker blocked on an approval or interaction that no window has answered — the main can steer, but a human still has to decide.

SessionEventToneType#

Semantic tone a renderer maps onto its theme.

SessionFieldNameType#

A session row field a query can read. environment.kind is 'local' for a session without an environment. projectName is computed: the folder name (last path segment) of projectRoot, or of cwd without one.

SessionFieldPathType#

What a condition, a sort or a grouping reads: a row field or a facet.

SessionFieldTypeType#

How a field compares: text, number, time (epoch ms) or boolean.

SessionGroupOrderType#

Group order: by label ascending or descending, or these group keys first (the rest by label after them).

SessionQueryType#

A filter over session rows: a condition, or all / any / not of more queries.

SpaceIconType#

A space's icon: one emoji, or a small image data-URL (the GUI's directory icon shape).

SyncCategoryType#

Settings sync, this computer → a server (one-way, opt-in): the shapes both sides share. Node-free, re-exported from zidane/chat/pure for the GUI renderer.

A server keeps one sync record (<dataDir>/sync.json): the device that syncs to it (one source per server), the categories that device sends, the fields it set ("synced from <device>") and the fields edited on the server since (overrides, which sync leaves alone until reset). The client keeps, per saved server, a mode, the categories, the API keys it opted in and the categories still to push (hosts-sync.json).

Fields are named <kind>:<name>: setting:approvalMode, safelist:/srv/app, system-md, skill:deploy, mcp:github, extension:greeter, environment:e2b, key:anthropic.

SyncModeType#

Off (default), Import once (a snapshot now), or Keep in sync (changes pushed as they happen).

TerminalOwnerType#

Who started it: the user, or the agent (a background shell task).

TerminalStatusType#

paused: not connected right now (the sandbox paused, or the host restarted) but it can be found again; opening it reconnects.

TerminalTargetType#

Where it runs: the session's environment, or this machine in the project.

TextModelSourceType#

Where a resolved text model came from.

ToolInstallType#

How a missing tool gets on a host. run: a command the host may run itself, as its own user, no root (host.installTool). copy: a command that needs root, for the person to run there. link: the tool's install page.

TranscriptPresetIdType#

A conversation preset.

TranscriptPresetKeyType#

The settings a conversation preset sets: how much of the agent's work the transcript shows, and how plain its rows are.

TranscriptPresetSettingsType#

The values of every TranscriptPresetKey.

TutorialTopicType#

What a tutorial explains.

UpdateStateType#

ready: auto-update is off and Check now downloaded and verified latest; server.update.install installs it.

UsageToneType#

Severity tone for a usage percent. error ≥ 85, warn ≥ 60, else ok. Surfaces map tones to their own palette.

ViewQueryResultType#

What viewQuery returns: the query, or the problems that made it invalid.

VisibleAuthRowType#

One row in the flattened Authentication list. Two kinds:

  • 'provider' — provider header with label, configured badge, and (when expandable) the chevron. Always present.
  • 'source' — one credential source belonging to the provider above. Present only while that provider is expanded.

Re-exports#

These names are documented on the entry point that owns them.