Skip to content

zidane/extensions

The extension API and the registry that discovers, installs and runs extensions in a zidane host.

import { … } from 'zidane/extensions'src/extensions/index.ts

Use defineExtension to write a module whose setup(ctx) registers tools, hooks, commands, settings, catalog edits, integrations and UI in a running host, without changing zidane itself. Every registration returns a Disposable. The registry functions discover extensions on disk, load them into a runtime and report each one's status. Hosts call those through the terminal app, the desktop app, the daemon and the server, so authors need only defineExtension, the UI tokens and the types; see Extensions. In an extension module, import them from zidane: hosts map that specifier to their own copy, while zidane/extensions resolves only where the package is installed.

TypeScript
import { defineExtension, Slot } from 'zidane'

export default defineExtension({
  apiVersion: 1,
  id: 'tool-logger',
  version: '0.1.0',
  description: 'Counts tool calls in the statusbar',
  setup(ctx) {
    let calls = 0
    const status = ctx.add(Slot, { at: 'app.statusbar', text: 'no tool calls yet' })
    ctx.hooks.on('tool:after', ({ name }) => {
      calls += 1
      status.update({ text: `${calls} tool calls, last ${name}` })
    })
  },
})

installExtensionFromSpec installs an extension from GitHub or npm (publishing). The extensions of the zidane repository install from nativeExtensionSource(entry, version). It pins them to the tag of the running version, so they match the API of the host. NATIVE_EXTENSIONS in zidane/chat/pure lists them, and the setup wizard installs each one in one click. zidane/extensions/testing holds createTestHost (testing).

Functions#

applyExtensionsConfigReportFunction#

Applies a report to a live registry, one extension at a time: changed folders through reloadChangedExtensions (loaded, reloaded or unloaded in place), linked folders it does not hold yet loaded, unlinked ones unloaded, each held entry's enabled set to what the config and allowed say (a reload of that extension), and the report's failures listed as inactive rows (config:<scope>). Never rejects for an extension's fault.

artifactBadgeTargetFunction#

The target for an artifact row (Artifacts panel / rail): its kind's badge kind (commit, pull request, file; artifact for the rest), the row's title and link, and what "Add to prompt" inserts: a commit's SHA, a file's path, the link, else the label.

artifactKindLabelFunction#

Human label for a kind (Pull request), falling back to the raw kind string.

badgeMenuFunction#

The full menu: built-ins then extension items, ordered by group (stable within a group). An extension shortcut that collides with an earlier one is dropped, never the item.

badgePromptTextFunction#

What "Add to prompt" inserts for a target.

buildExtensionPresetFunction#

Collapse the extension registry's agent-side surface into a single Preset ready to spread into createAgent(). Hooks bucket per-event (every handler fires, copied into fresh arrays), tools shallow-merge (last extension wins on canonical-name collision), mcpServers concat with name-dedup (latest wins — mirrors composePresets), skills concat. Extension instructions don't land here: the agent reads them from the runtime (ctx.instructions).

buildExtensionRegistryFunction#

Load the extensions and return the live registry over them. loaded typically comes from discoverExtensions() plus any inline ones via inlineLoadedExtension.

Disabled extensions stay in inactive (alongside any load errors) so the Settings panel shows the full picture.

builtinBadgeActionsFunction#

The built-in actions for a target (host-implemented; see builtinBadgeEffect).

builtinBadgeEffectFunction#

The effect of a built-in action; undefined for an id that isn't one (or doesn't apply).

builtinKeymapEntriesFunction#

The built-in key bindings (KEYBINDING_DEFS) as ctx.keymap.list reports them, with the user's keybindings.json applied. What a host passes as CommandHostPort.keybindings.

changeExtensionOriginFunction#

Installs an extension again from another source, in place: the source must hold an extension with the same name (else name-mismatch, with the names found), the folder is replaced only once the new copy fetched, installed its dependencies and validated (the install's transaction), and .install.json records the new source, which later updates follow. Works on any installed folder, with or without a recorded source.

clampExtensionConfigNumberFunction#

Clamp a number to the item's [min, max] and snap to step (when set). Used by the input-row commit paths so a user-typed value is coerced into range before it's persisted.

classifyUiImportFunction#

Decides one import of a ui entry's graph.

  • Host modules (UI_HOST_MODULES) stay external.
  • Other zidane/* entries, @opentui/*, electron, bun:* and Node built-ins are errors: the renderer has none of them.
  • A relative or absolute path from the extension's own files must stay in the extension folder (app internals such as ../../src/chat are refused). Files inside node_modules may import what they like within their package.
  • Everything else (local files, packages) is bundled.

clockTimeFunction#

14:05: a local wall-clock time, the same on every surface.

coerceExtensionConfigInputFunction#

Coerce a raw input string (from a free number / string input row) into a valid persisted value, or undefined when it can't be made valid. Numbers are parsed + clamped; strings are taken verbatim and checked against the pattern; enum / boolean items aren't edited via free input (they use choice / toggle rows) so they return undefined here.

compileReferencePatternFunction#

Compile a pattern, or null when its source doesn't parse.

completionProviderSummariesFunction#

The usable providers as a composer lists them.

composeExtensionPresetFunction#

Compose extension agent-loop contributions under a host/profile preset and apply extension subagent additions/overrides to the winning spawn tool. With a runtime (registry.runtime), the agents catalog's sub-agent edits apply: registered, added and edited sub-agents join the adds, removed ones become deleting overrides.

configSyncFailuresFunction#

The inactive rows of a report's failures: named after the entry's source, carrying the reason.

configuredExtensionsFunction#

Reads both config files and their locks: the folders to load in place and the ids to load disabled. Project entries count only when trustProject. Never throws (a broken file reads as no entries).

coreExtensionHostModulesFunction#

This process's module for every entrypoint of hostModuleSpecifiers, loaded lazily. Typed as a full record, so a specifier added to the list fails to compile until it is mapped here.

createArtifactDetectHookFunction#

undefined when the registration has no detect. The hook never touches result / isError; a throwing detector emits nothing. Entries default kind to the registration's kind; validateMeta applies to entries of that kind only and drops meta, never the entry.

createArtifactsSurfaceFunction#

Build the ctx.artifacts facade over a host-runtime bridge. Read-only; every call re-resolves the scope (session switches swap it). Detached, or a store without artifact support, answers [] — the same honest degradation as ctx.sessions.

createCompletionRunnerFunction#

Creates a CompletionRunner. A provider that ignores its signal can't hold the answer past timeoutMs.

createConfigSettingsLayerFunction#

Builds the layer. Pass the user source first and the project source after: a later source wins per key and for enabled.

createCredentialsAuthStoreFunction#

An AuthStorePort over <dataDir>/credentials.json.

createExtensionHostRuntimeBridgeFunction#

Creates a bridge that hosts attach their runtime implementation to.

createExtensionPromptBridgeFunction#

Creates a bridge with no handler attached. submit returns false until a host attaches one.

createExtensionsConfigSyncFunction#

Creates the coordinator. One per process: scopes are keyed by config file, so every registry of the same user (and project) shares one run.

createFacetRegistryFunction#

Creates an empty facet registry.

createFileStoragePortFunction#

Makes the default file-backed storage port.

createMemorySettingsPortFunction#

An in-memory settings port.

createMemoryStoragePortFunction#

An in-memory storage port. Every save and delete is announced to every subscriber of the location, so two caches in one process stay in sync (the domain drops echoes of its own writes).

createRecordingUiClientPortFunction#

A client port that records each call. Panel, navigate, composer and keymap dispatch calls resolve true; panelState resolves the panels opened so far.

createReferenceResolverFunction#

A cached resolver over the registry's providers.

createRegistryViewFunction#

A live ExtensionRegistry over source, narrowed by filter.

createRegistryViewSourceFunction#

The change feed and disposal of one runtime, shared by every view of it.

createScriptedDialogPortFunction#

A dialog port with one client that answers from queued answers.

createSharedWatchesFunction#

Creates an empty set of shared watches.

createWorkspaceSurfaceFunction#

Build the ctx.workspace facade over a host-runtime bridge. Every call re-resolves the live pair (see ExtensionWorkspacePair); detached calls reject with a message naming the guard.

isAvailable is the host's side-effect-free availability signal, tri-state by design: true/false answer directly, undefined means "no light signal wired" and falls back to resolve() — accepting its side effects (a container spawn, on heavy hosts). Wire it wherever spawning is non-trivial.

defaultExtensionScanPathsFunction#

Default scan roots for extension discovery. Mirrors defaultSkillScanPaths / defaultMcpsConfigPaths; the subPath is 'extensions' so each root expands to <scope>/.<convention>/extensions/.

defineExtensionFunction#

Returns definition unchanged. It anchors type inference for ctx.

discoverAndBuildExtensionRegistryFunction#

Discover disk extensions, fold in the inline ones, compute the allowlist-driven disabled set, and build the merged ExtensionRegistry.

The disabled set honors the allowlist for inline extensions too: the TUI treats inline as toggleable everywhere else (Settings tab, live filtering), so both ride the same inactive-classification path.

discoverExtensionsFunction#

Discover + load every trusted extension reachable from the default scan paths — including ones the user's enable allowlist has toggled OFF. Disabled extensions still import (and later run setup()) so their config schema is browsable in Settings before enabling; the allowlist gates their CONTRIBUTIONS at registry level, not their code. The trust boundary stays with trustProjectExtensions. Returns one LoadedExtension per scan entry: skipped entries have no definition, failed entries carry error. Loaders never throw — the host can decide what to do with load errors (typically: ship them to the Settings panel).

Imports run in parallel: a slow extension can't block the rest. The returned array preserves the original scan order (project-first, then user) so first-found-wins precedence stays intact.

signal is honored opportunistically — if the abort fires BEFORE we dispatch imports, the whole set is skipped. Once Promise.all is in flight, individual imports can't be cancelled (the module system has no abort affordance).

Project-scoped extensions execute arbitrary local code, so they're skipped unless trustProjectExtensions resolves to true — either via the option or the ZIDANE_TRUST_PROJECT_EXTENSIONS=1 env var fallback. User-scoped extensions always load.

Each extension's module graph is evicted from the runtime cache before import, so calling this again (e.g. /reload) re-evaluates the current on-disk code — edits, overwrites, and updates apply without a restart.

disposeExtensionRegistryFunction#

Dispose resources owned by an extension registry. Idempotent per registry.

extensionBadgeActionsFunction#

Extension items for a target, in registration order, after validation: ids and labels must be non-empty strings, ids unique per source, at most eight per source. A throwing actions contributes nothing.

extensionConfigSettingsPortFunction#

A settings port over the host's settings bag (Settings.extensionConfig), which today's Settings UIs write: it is the user layer, and the source of secret strings too. Writes are left to the host, which persists what its Settings UI and action results give it.

extensionRuntimeOfFunction#

The runtime behind registry.runtime (load, unload, reload, settings), or undefined when the registry loaded no extension.

extensionSettingsWireFunction#

One extension's settings wire with its settings pages, or undefined when it has no definition (failed validation) and no page.

extensionSourceLabelFunction#

A short name of an install spec: owner/repo with @ref when one is pinned (the folder in the repository left out), an npm package with @version when one is pinned. A spec that does not parse is returned as is.

fetchExtensionSourceFunction#

Materialize the source into destDir (created by the caller, assumed empty). Returns the provenance string plus, for git clones, the exact commit SHA. See fetchInstallSource for transport details and caps.

fetchGithubPullRequestFunction#

Read one PR. Path segments are validated to the shape a real repo has (callers pass untrusted strings: artifact meta, matched text), so a crafted owner can't steer the token-bearing request elsewhere. 4 s deadline per request, or signal.

filterExtensionRegistryFunction#

Filter the extension registry by the user's enable allowlist. Returns the original registry by reference when enabled is undefined (the fresh-install default — every loaded extension is active) or when it keeps every active extension; otherwise a live view over the same runtime with the others listed as inactive.

The identity check is intentional — callers can compare the result against the input registry to skip recomposing the preset when nothing has changed.

filterRegistryPluginsFunction#

Drop the contributions of Agent Plugins the user has disabled.

filterExtensionRegistry keys on EXTENSION names, so it can't express "this extension runs, but the plugin it loaded does not". Plugin skills and MCP servers are fanned into the loading extension's contributions by ctx.plugins.load, which means without this pass enabledPlugins would render a checkbox that changes nothing for extension-loaded plugins.

Skills are matched by metadata['zidane.plugin'] (stamped by the loader); MCP servers carry no such marker, so they're matched by identity against the server list on each LoadedPluginRecord.

Returns the input registry unchanged when nothing is disabled, so callers can compare identity to skip recomposing.

findReferencesFunction#

Every reference in text for the providers that scan surface, sorted, without overlaps: the earliest start wins, then the longest, then the earlier provider. Zero-length matches are skipped.

githubIssueViewFunction#

An issue as a reference view: its state icon and color, its number, a hover card.

githubPullUrlFunction#

The PR's canonical URL: the uri its pull_request artifact is stored under.

githubPullViewFunction#

A PR as a reference view: GitHub's state icon and color, its number, a hover card.

githubRateLimitTextFunction#

Why GitHub data is stale, in a few words: a pause until a time, or the anonymous limit.

githubRefKeyFunction#

The key an issue or PR number is resolved by: owner/repo#123.

hostModuleSpecifiersFunction#

The specifiers a host must map for installed extensions at runtime, for registerExtensionHostModules. UI modules (react, OpenTUI) are the renderer host's own business and not listed.

inlineLoadedExtensionFunction#

Tag an inline (host-passed) extension into the same shape disk- loaded ones produce, so host-bundled extensions (e.g. those passed via RunTuiOptions.extensions) flow through buildExtensionRegistry identically to disk-discovered ones. The runtime validates the definition and lists it inactive with what is wrong.

installExtensionFromSpecFunction#

The full fetch → enumerate → deps → validate → copy pipeline. See the module doc for invariants. Throws ExtensionInstallError; a throw means nothing was written to the target roots.

integrationMethodFromOAuthProviderFunction#

Adapts a zidane/oauth provider flow to an integration method of type custom. connect runs provider.login with the host's flow UI (links, device codes, prompts and choices go through IntegrationFlowIO); the credential's accessToken is provider.getApiKey(grant), the refresh token is kept by the store, and other grant fields ride in credential.extra. refresh runs provider.refreshToken. The account is the grant's email, account or label when it has one.

isBadgeColorFunction#

Whether value is a color hosts accept (#rgb / #rrggbb).

isExtensionPanelScopeFunction#

Whether v is a valid ExtensionPanelScope.

isJsonFunction#

Whether value is plain JSON: finite numbers, plain objects with safe keys (see isSafeRecordKey), arrays, strings, booleans and null.

isPanelSurfaceFunction#

Whether v is a valid PanelSurface.

isPullFreshFunction#

Whether a stored PR is current: fresh, or in a state that never changes.

isRuntimeLoadedExtensionFunction#

Whether a loaded entry carries a module for the runtime (as opposed to a load error).

isUiHostModuleFunction#

Whether specifier names a module the renderer provides.

isValidExtensionConfigItemFunction#

Whether an authored item is well-formed for its declared type — used by ctx.registerConfigItem to drop malformed declarations (wrong / missing default, an enum without options) before they reach the registry. Cheaper than letting a broken item ride to render time.

isValidExtensionConfigValueFunction#

Whether value is a valid concrete value for item — type match plus the item's constraints (number range, enum membership, string pattern) and the optional author validate. step is intentionally NOT enforced here (it's a UI affordance, not a hard constraint — a persisted value or default that doesn't align to the step is still honored).

listActionSummariesFunction#

The action rows: the counterpart of toWireConfigSchema, which strips them.

listExtensionCandidatesFunction#

List the installable extensions inside a fetched tree. fallbackName seeds the single-extension case when no manifest names it (repo or unscoped package basename).

listExtensionPaletteItemsFunction#

Every provider's items for cwd, normalised and stamped with the provider id. A provider that throws or hangs contributes one disabled row naming the failure, so the user sees why an expected command is missing.

loadableExtensionDirsFunction#

The folders discoverExtensions would import for the same options: a trusted extension's, never an untrusted project's. What a host compiles ahead of a load (precompileExtension).

loadExtensionFolderFunction#

Imports one extension folder fresh from disk, as discovery would (version check, manifest, module graph evicted first). Never rejects: a folder with no entry file or a module that fails to import comes back with error. The caller decides whether the folder may load at all (trust, precedence): loadableExtensionDirs answers that.

loadExtensionPanelFunction#

Runs a panel's load() for a context from across the boundary (known string fields only, bound to cwd). A missing, throwing or hanging panel yields an empty content naming why.

loadExtensionsConfigFunction#

Reads and parses both config files and their locks. Feed [user, project] to createConfigSettingsLayer.

mergeBadgeMenuFunction#

Order items the way badgeMenu does: by group, stable within one, later colliding shortcuts dropped. For hosts that get the built-ins and the extension items separately (the GUI renderer asks main for the latter).

mergeWireSettingsFunction#

Joins the wire settings of several extensions into the one list the Settings UI reads.

missingHostModuleSpecifiersFunction#

Every specifier of hostModuleSpecifiers that is not mapped yet. Hosts check it after their registration (a test, a debug log).

normalizeBadgeEffectFunction#

An effect from extension code, reduced to known, bounded string fields.

normalizeBadgeTargetFunction#

A target from across a boundary (the GUI renderer), reduced to its known, bounded fields; null when unusable.

normalizePanelContentFunction#

Coerce whatever load() returned into a well-formed PanelContent: unknown item kinds and malformed entries are dropped, strings are trimmed to the caps, and the whole thing is size-bounded. Never throws.

normalizePanelHomeLayoutFunction#

A home layout from a registration or across a boundary, kept only when well-formed.

normalizePanelLoadContextFunction#

A load context from across a boundary (the GUI renderer), reduced to its known string fields. Hosts run it before handing the context to load / onAction.

onSettingsPagesChangedFunction#

Calls listener each time a settings page of ui is added, replaced or removed: the settings wire changed, read it again. Protocol clients follow the same extensions:ui changes (ExtensionsClient.settings.onChange).

panelBadgeTextFunction#

Tab badge as shown next to the label; undefined when nothing to show.

panelHostRuntimeFunction#

The host runtime a panel's load / onAction (or a badge action) runs in, read-only: the folder's project (projectRootOf(cwd)), plus the session when one is bound. ctx.artifacts.list() answers that session's artifacts ([] unbound), list({ scope: 'project' }) every session's under the project root. Store-wide queries (scope: 'all', find) answer []; record needs a session, so it answers undefined unbound. Everything else reads as detached, as it does for any extension code outside a run.

panelOnSurfaceFunction#

Whether a panel shows on surface.

panelShowsInFunction#

Whether a panel registered with scope shows in a context bound to bound (absent scope = 'session').

panelSummariesFunction#

Summaries of a folder's panels.

panelSurfacesFunction#

The surfaces a panel registered for (absent or empty: ['side']).

panelViewValueFunction#

A control's value in a view: the picked option id (segmented, select), or fallback when the user picked none or the value is a list.

panelViewValuesFunction#

A multi control's picked options in a view: fallback when the user never touched it.

parseExtensionInstallSourceFunction#

Classify a raw source string. See parseInstallSource for the grammar.

parseExtensionScanPathEnvFunction#

Parse a platform-delimited list of additional extension scan roots. Useful for local dogfooding / host-provided packages:

ZIDANE_EXTENSION_DIRS=/repo/extensions bun run tui

Each path is a scan ROOT whose children are extension dirs/packages (<root>/<name>/index.ts), not a single extension directory.

parseGithubRefKeyFunction#

Parses a key built by githubRefKey. Returns undefined when key does not have the owner/repo#number shape.

parseShortstatFunction#

git show --shortstat --format= → { additions, deletions, changedFiles } ( 4 files changed, 120 insertions(+), 8 deletions(-)). Any missing clause is 0; an empty stat (empty commit) is undefined.

partitionExtensionCatalogFunction#

Partition a registry's loaded + inactive lists into the shape the Settings toggle UIs render. Pure; shared by the TUI's standalone extensions modal and the Settings-modal tab so the rules (and the allowlist-GC key set) stay in one place.

precompileExtensionFunction#

Compiles an extension folder's TypeScript into the cache, as a load would. Files whose entry is current are only checked. A file that does not compile is skipped (the load reports it).

probeActionStatusesFunction#

Every action's passive status(), keyed extension:key. A probe that throws, times out or answers no message is left out.

projectStorageFolderFunction#

The folder that holds one project's extension storage, after moving what an earlier build left in the project (once per process and project).

pruneExtensionCompileCacheFunction#

Drops the entries not rewritten in maxAgeMs.

pullChecksFunction#

A PR's checks line, when it says something (open PRs only).

pullFromMetaFunction#

A PR back from artifact meta, when the meta says enough to draw it (a refresh has filled the title and state); undefined otherwise. Untrusted input: every field is type-checked.

pullMetaFunction#

A fetched PR as pull_request artifact meta (merged over what was there): the one stored copy the session badge, the Artifacts row and the hover card all read.

pullStateLookFunction#

How a PR state reads, GitHub's way. Unknown (not read yet): the plain PR icon, muted.

readExtensionInstallOriginFunction#

Where an installed extension came from (its .install.json), or null for one not installed from a source (hand-written, linked, built in).

readExtensionInstallProvenanceFunction#

Read .install.json provenance from an installed extension dir, or null.

referenceProvidersFunction#

The providers a host offers for a registry: the extensions', then the built-in ones (BUILTIN_REFERENCE_PROVIDERS: GitHub pull requests) whose id no extension took. builtins: false leaves those out.

referenceProviderWiresFunction#

The host's providers (see referenceProviders) as wire data, in order.

refreshArtifactFunction#

Lazy refresh: run the kind's resolve() and return the artifact with the patch applied (updatedAt bumped), or undefined when the kind has no resolver, the resolver declined, or it threw. Callers persist the result through their store / RPC — this never writes.

registerExtensionApiHostModulesFunction#

Maps every zidane entrypoint of hostModuleSpecifiers (zidane, zidane/extensions, zidane/extensions/testing, zidane/providers*, zidane/oauth) to this process's live modules, so an extension installed outside the repo (no node_modules/zidane beside it) can import their runtime values, such as Panel or createTestHost. Lazy, so registering costs nothing until an extension imports one. Every host calls it before its first extension import; idempotent.

registerExtensionHostModulesFunction#

Map bare import specifiers to the host's live module objects for every subsequently-imported module (extensions included). No-op outside Bun and for already-registered specifiers. Call BEFORE the first extension import (the TUI does, at startup).

reloadChangedExtensionsFunction#

Applies folder changes to a runtime: a held folder that changed is imported fresh and reloaded in place; one whose folder or entry file is gone is unloaded (its ctx.storage.memory cleared); a new folder loads when options.classify allows it. Given a registry, a folder it refused at build time (its import failed, an untrusted project folder) counts as new, and leaves the refused list once it loads or is deleted. Folders are handled one at a time, in the order given (duplicates once). Never rejects for an extension's fault: a module that fails to import is listed failed with the error.

removeInstalledExtensionFunction#

Delete an installed extension's directory. Works on any on-disk extension (hand-authored ones too — no provenance required); the containment guard is the safety boundary. The caller owns follow-up (allowlist cleanup, registry reload).

renderArtifactRowFunction#

Row presentation with the guaranteed fallback. A render that throws or returns nothing degrades to label + uri — a stored artifact is never invisible because its kind's extension is gone or buggy.

resolveArtifactKindFunction#

Resolve the registration for a stored artifact's kind: the active registry wins (an extension may refine a built-in's presentation), then built-ins, then undefined — callers fall back to label + uri.

resolveExtensionCompletionSubmitFunction#

Runs the submit hooks of the usable providers that declare one, with the same reference collection as the terminal app (resolveCompletionSubmit).

resolveExtensionConfigFunction#

Convenience read against a merged ExtensionRegistry + the user's Settings. Looks up the item schema (extName → key), reads the persisted value out of settings.extensionConfig, and runs it through resolveExtensionConfigValue. Returns undefined only when the (extName, key) pair names no registered item.

resolveExtensionConfigValueFunction#

Resolve the effective value of a config item from its persisted value. THE single place graceful degradation lives: a persisted that's undefined (never set) OR fails isValidExtensionConfigValue collapses to item.default. Action items hold no value and resolve to undefined — the overloads keep value-item call sites exact.

resolvePanelLoadContextFunction#

Normalise raw and bind it to the host's cwd (which wins over any cwd in raw): the context load / onAction receive. scope follows sessionId.

resolveUiEntriesFunction#

The UI entries of an extension in dir.

A named entry (definition.ui, definition.tui) is resolved against dir; it must stay inside it and exist, otherwise it is reported in errors and left out (the default files are not tried then). Without a named entry the first existing default file is used.

runBadgeActionFunction#

Run one menu item: a built-in resolves locally, an extension item runs its registration's run (8 s deadline). Never throws: failures come back as a notice.

runExtensionActionFunction#

Runs one action. The config patch it returns is sanitized (unknown keys and values failing the schema are dropped) and returned, not written: the app persists it through its settings writer.

runExtensionPaletteItemFunction#

Runs itemId on its provider source.

runExtensionPanelActionFunction#

Runs a panel's onAction as loadExtensionPanel runs its load.

runtimeEntryOfFunction#

A discovered entry as the runtime loads it: its module, or its import error (RuntimeEntry.error).

runtimeLoadedExtensionFunction#

Wraps a definition as a LoadedExtension entry for the runtime.

runtimeSettingsWireFunction#

Every extension's settings wire of a runtime, merged in load order.

sanitizeExtensionConfigActionPatchFunction#

Gate the config patch an action returned before the host persists it. Per-entry, an item is accepted only when it names a registered VALUE item of the declaring extension and passes that item's schema (isValidExtensionConfigValue); everything else lands in rejected for logging. Pure — the host applies accepted through its own settings write path.

scanExtensionDirectoriesFunction#

Walk every scan root, collecting one ExtensionScanEntry per <root>/<name>/index.* hit. First-found per name wins (matches the project-user precedence used elsewhere — see projectUserPaths JSDoc).

Non-existent roots are skipped silently. Stat errors inside a present root are surfaced under ZIDANE_DEBUG only — they shouldn't bring boot to a halt.

sessionBadgesFunction#

A session's badges: its artifacts grouped by kind (newest first within each), each kind's badge() (registry first, then built-ins), ordered by badge.order then kind. A kind without badge, or whose badge throws or answers nothing, contributes none.

badge.panel comes back as a full panel id: a bare one is prefixed with the kind's extension, and, when registry lists its panels, one that no active extension registered is dropped (hosts open Artifacts then).

sessionBadgeTargetFunction#

The target for a session badge (or one row of its card): GUI sidebar, TUI sessions list.

sessionsBadgesFunction#

Several sessions' badges at once (the sidebar rows). One badge per kind, so one registry per session: the one of the project its newest artifact landed in.

settingsSearchIndexFunction#

Every settings row of the given extensions, with the page and section it is on, for the settings search box. Rows of ui pages with a schema are included, on that page; component-only pages have none. Order: the extensions as given, then page and row order.

settingsSidebarFunction#

Builds the settings sidebar from each extension's wire. An extension without pages (no settings, no settings-page items) is left out. Works for disabled extensions too: their wire comes from the definition.

subscribeExtensionPaletteFunction#

Keeps every provider's subscribe on, their emits debounced into one onChange.

subscribeExtensionPanelFunction#

Keeps a panel's subscribe on, its emits debounced into onChange.

suggestCompletionItemsFunction#

Runs one provider's suggest and keeps the well-formed items, at most MAX_COMPLETION_ITEMS. A throwing provider or a non-array result answers []; insertText falls back to the item id.

touchesSettingsPagesFunction#

Whether a UI change adds, replaces or removes a settings page (reset: every item may have gone).

toWireConfigSchemaFunction#

Project the merged registry's config schema into a wire-safe shape: categories as a flat array, items flattened to a single list carrying their extension + category, with the non-serializable validate callback stripped. Action items are omitted entirely — their run callback only exists in the main process, so a remote renderer (the GUI) has nothing it could do with the row. Pure — factored out so its serialization is unit testable without an Electron / IPC harness.

updateInstalledExtensionFunction#

Re-run the recorded install for an extension: re-resolves the original spec (so owner/repo follows the branch and pkg follows latest, while pinned refs/versions stay pinned) and replaces the install IN PLACE (same root the extension currently lives in, even a .agents/extensions one). Requires .install.json provenance — hand-authored extensions have nothing to update from.

When the remote is provably unchanged (recorded commit matches git ls-remote, or the npm version re-resolves identically), the reinstall is skipped entirely and the result carries upToDate: true.

usableCompletionProvidersFunction#

The providers a composer can render: drops invalid ids / triggers / suggest functions and the reserved triggers, first wins on both id and trigger.

viewForIssueReadFunction#

The view for a #N read that found no PR: the issue, or while a rate limit holds a neutral #N that says so (it may be either), or nothing.

viewForReadFunction#

The view for a background read: the PR when GitHub answered; when a rate limit stopped it, the newest copy this process holds with the reason, or a muted #N that says it; nothing when the PR can't be read.

wireWithSettingsPagesFunction#

An extension's wire with its SettingsPage items appended to its pages (after the schema's pages, by order). Hosts call it where they build an extension's settings wire and hold its UI registry.

withSettingsPagesFunction#

Adds an extension's SettingsPage items to its wire, after the schema's pages, by order (default 100; ties keep the given order). Items of other extensions (their id does not start with <extensionId>/) are ignored. Pure.

Classes#

DialogTimeoutErrorClass#

Thrown by a dialog that got no answer within its timeoutMs.

DisposedErrorClass#

Thrown by a ctx call made through a disposed owner.

ExtensionInstallErrorClass#

Error thrown by the extension installer. code says which step failed.

NoUiErrorClass#

Thrown by a dialog when no client can show it.

RpcCallErrorClass#

The error a client call rejects with. type is a declared error name or one of the reserved rpc.* names.

Constants#

ARTIFACT_BADGES_MAXConstant#

The most sessions one read of badges answers (artifacts.badges).

BadgeActionConstant#

Context-menu actions on badges, links, files and artifacts.

branchKindConstant#

Built-in branch kind. Detects branches the model created, such as with git switch -c.

BUILTIN_ARTIFACT_KINDSConstant#

The built-in artifact kinds: pull request, branch, commit and file.

BUILTIN_REFERENCE_PROVIDERSConstant#

Reference providers hosts offer next to the extensions' (an extension's provider wins on id).

commitKindConstant#

Built-in commit kind. Detects commits from git commit runs and shows their change size.

COMPILE_CACHE_MAX_AGE_MSConstant#

How old an entry may grow without being rewritten before pruneExtensionCompileCache drops it.

COMPLETION_TIMEOUT_MSConstant#

How long a provider's suggest, or the submit hooks, may run before the answer is given up.

ContextSectionConstant#

A context breakdown or context panel section.

ContractConstant#

Helpers to declare contract tokens.

EMPTY_EXTENSION_REGISTRYConstant#

Empty registry — useful as a zero-value when no extensions are loaded. Frozen (shallow + nested) so a consumer can't accidentally mutate the shared sentinel and poison every other reader.

EMPTY_MCP_PORTConstant#

An MCP port with no servers. Calls reject.

ENTRY_CANDIDATESConstant#

Entry-point filenames probed inside each <name>/ directory, in preference order. Bun loads .ts / .tsx natively; .mjs / .js are accepted so pre-compiled extensions (or vibe-coded JS-only ones) work too. index.js is last because most authors will reach for .ts first.

EXTENSION_API_VERSIONConstant#

The API version this runtime supports.

FACET_COMPUTE_TIMEOUT_MSConstant#

Bound of one facet's compute, in ms.

fileKindConstant#

file has NO automatic detector for plain writes on purpose. Every write_file becoming an artifact is noise — a refactor would produce dozens of rows that are really just the diff and go stale on the next rename. A file is an artifact only when something deliberately says so: the model via record_artifact (a generated report, an export), an extension via ctx.artifacts.record (a build output), or a tool whose whole output is the file (generate_image, generatedImageKind). The kind keeps its rendering and file: URI canonicalization for those paths.

GITHUB_ISSUE_PROVIDER_IDConstant#

Id of the built-in reference provider for a bare #123: an issue or a pull request.

GITHUB_PULL_COLORSConstant#

GitHub's state colors (Primer). Draft stays the theme's gray.

GITHUB_PULL_PROVIDER_IDConstant#

Id of the built-in reference provider for GitHub pull requests.

githubIssueReferenceProviderConstant#

#12 in a chat whose repo is on GitHub, keyed like a PR (githubRefKey(owner, repo, 12)). No patterns: only the host knows the repo. GitHub's issues endpoint says whether the number is an issue (drawn here) or a PR (read and drawn as github.pull draws it).

githubPullReferenceProviderConstant#

PR links (https://github.com/o/r/pull/12, with or without a tail) paint as #12 at once and gain their state when GitHub answers. #12 alone needs the chat's repo, which only the host knows: hosts resolve it through this provider with the key githubRefKey(owner, repo, 12).

githubTokenSourceConstant#

Indirection so tests (and hosts with their own credential store) can swap the token source without touching the environment or the gh binary. resolveWithSource is consulted only while resolve is the default.

HOST_MODULE_SPECIFIERSConstant#

The zidane entrypoints an installed extension may import at runtime. A host maps every one to its own live module before it imports an extension (registerCoreExtensionHostModules in discover-and-build.ts does it from hostModuleSpecifiers); unmapped, an installed copy or a compiled binary resolves them from the extension's folder and finds nothing.

Every LinkSource.

LinkHandlerConstant#

Opens matching links.

MAX_COMPLETION_ITEMSConstant#

Most items a provider's popup lists.

MAX_COMPOSER_BADGESConstant#

How many composer.badges items one extension may show in one session, and app.titlebar items in the app.

MAX_FACET_BYTESConstant#

The most JSON one facet value may take, in bytes of its JSON text.

MAX_FACETS_PER_EXTENSIONConstant#

How many facets one extension may hold.

Longest URL a link handler is offered.

MAX_SIDEBAR_ROWSConstant#

How many sidebar rows one extension may show.

MAX_SLOT_BADGESConstant#

How many items one extension may show in a badge slot (isBadgeSlot); per session for composer.badges.

MEMORY_CLIENT_IDConstant#

The client id createScriptedDialogPort and createRecordingUiClientPort report.

A native menu entry.

NO_CLIENT_DIALOG_PORTConstant#

A dialog port with no client: every dialog rejects with NoUiError, toasts resolve undefined.

NO_INTEGRATION_FLOWSConstant#

An integration flow port for hosts that cannot show a sign-in flow.

NO_UI_CLIENT_PORTConstant#

A client port for hosts without clients. Never called: the router finds no client first.

PanelConstant#

Every UI token.

PANEL_CONTENT_LIMITSConstant#

Caps applied before content crosses IPC or reaches a renderer.

pullRequestKindConstant#

Built-in pull_request kind. Detects GitHub PRs and GitLab MRs from gh pr create, glab mr create and *create_pull_request / *create_merge_request tools. Refreshes GitHub PR state.

ReferenceConstant#

Inline reference chips (ticket ids, URLs).

RegistryConstant#

Helpers to declare registry tokens.

RendererConstant#

A renderer for blocks, code languages, tools or artifacts.

RpcConstant#

Helpers to declare RPC contracts.

ScreenConstant#

A full-screen view or modal.

SESSION_FACET_TRIGGERSConstant#

Every trigger, in a fixed order: what a facet without on runs on.

SettingsPageConstant#

A Settings page.

SidebarDecorationConstant#

Extra data on the sidebar rows of matching sessions.

SidebarFilterConstant#

A filter the user turns on in the sidebar.

SidebarGroupConstant#

A grouping the user can pick in the sidebar.

SidebarRowConstant#

A row an extension adds to a space, beside its sessions.

SidebarSortConstant#

A sort order the user can pick in the sidebar.

SlotConstant#

A small item in a named slot.

SpaceConstant#

A space: a named, query-defined view of sessions in the sidebar.

ThemeTokenConstant#

A color theme.

UI_HOST_MODULESConstant#

Bare specifiers kept external in a bundled ui entry: the renderer's shared modules. zidane and zidane/extensions are usually imported for types only (erased); a value import of them stays external and the renderer must map it.

UI_TOKEN_NAMESConstant#

The token names, in a fixed order.

WebviewConstant#

A webview panel or screen.

Interfaces#

ActionSettingInterface#

A button that runs code. status draws a live state next to it.

ActionSettingContextInterface#

What an action's run receives.

ActionSettingResultInterface#

What an action may return.

ActionSettingStatusInterface#

A live state drawn next to an action.

ActionSettingStatusContextInterface#

What an action's status receives: the extension's own settings, read-only.

AgentEditorInterface#

Editor of agent profiles and sub-agents.

AgentsDomainInterface#

ctx.agents.

AppInfoInterface#

What ctx.app tells about the running app.

ApplyConfigReportOptionsInterface#

Options of applyExtensionsConfigReport.

ArtifactDetectHookOptionsInterface#

Options for createArtifactDetectHook.

ArtifactResolveOptionsInterface#

Passed to a kind's resolve.

ArtifactsDomainInterface#

ctx.artifacts.

BadgeActionEffectInterface#

What running an action asks the host to do. Every field is optional; several may combine.

BadgeActionsMatchInterface#

Which badges a registration acts on. Omitted axes match everything; given axes must all match.

BadgeActionSpecInterface#

One menu item. group places it: copy, prompt, open, then the extension's own.

BadgeActionWireInterface#

Badge actions on the wire: which badges they apply to. The menu itself is asked for per target.

BadgeMenuItemInterface#

A host's resolved menu item: a built-in, or an extension's (source names the registration).

BadgeTargetInterface#

What a badge stands for. Every badge surface builds one so the same menu logic applies everywhere.

BooleanSettingInterface#

An on/off setting.

BuildExtensionRegistryOptionsInterface#

Options for buildExtensionRegistry.

BuildRuntimeOptionsInterface#

How buildExtensionRegistry builds the runtime.

CatalogDomainInterface#

Shared members of every catalog domain.

CatalogEditorInterface#

A generic editor over a catalog keyed by id.

CommandListingInterface#

A command as CommandsDomain.list reports it.

CommandsDomainInterface#

ctx.commands.

CommandSpecInterface#

A command.

CompletionRunnerInterface#

Runs completion work for a composer: each bounded in time, a newer suggest for the same key aborting the older one.

ComponentRefInterface#

A reference to a component the extension exports from its ui entry (desktop and web) or its tui entry (terminal). A host without the named component draws the item's data, or its fallback.

ComponentWireInterface#

A component reference on the wire: the export name and JSON props.

ComposerDomainInterface#

ctx.composer.

ConfigSyncItemInterface#

One entry's outcome, as hosts log and show it.

ConfiguredExtensionsInterface#

What config entries change in a registry build: linked folders and disabled ids.

ConnectionInterface#

A stored connection. An integration holds several, one per account; one is the default.

ContextServicesInterface#

The shared registries and host ports every extension's context draws on. One set per runtime.

ContractsDomainInterface#

ctx.contracts.

ContractTokenInterface#

Token of an API an extension provides.

DesktopDomainInterface#

ctx.desktop: present only in the desktop app's main process.

DesktopPortInterface#

The desktop app's main-process handle behind ctx.desktop. Only the desktop host gives one; elsewhere ctx.desktop is undefined.

DialogOptionsInterface#

Options every dialog takes.

DiscoverAndBuildExtensionRegistryOptionsInterface#

DisposableInterface#

Something that can be withdrawn. Calling dispose twice is a no-op.

EnumSettingInterface#

A choice among fixed values.

ExtensionActionRunResultInterface#

What running an action did.

ExtensionActionSummaryInterface#

An action row, without its callbacks.

ExtensionArtifactDetectionInterface#

One artifact a detect hook emits; kind defaults to the registering kind.

ExtensionArtifactKindRegistrationInterface#

Give meaning to an artifact kind (see session/artifacts.ts). Core owns storage and treats kind as an open string; this registration contributes behavior keyed on it: detection from tool results, a row presentation, meta validation, and lazy refresh. Built-in kinds (pull_request, branch, commit, file) go through the same API.

Kinds are global; first registration wins on collision (logged). Sessions outlive extensions, so a stored artifact whose kind has no registration MUST still render — core guarantees the label + uri fallback, never drops rows.

ExtensionArtifactQueryInterface#

Scope selector for ctx.artifacts.list.

ExtensionArtifactRowInterface#

Renderer-agnostic one-line presentation of an artifact. Core lists (sessions badge, artifacts rail, context panel, GUI panels) call the kind's render per row and fall back to label + uri when the kind is unregistered or render throws.

ExtensionArtifactRowFactInterface#

One fact chip of an artifact row: text, an optional link, and its own look.

ExtensionArtifactScopeInterface#

What ctx.artifacts resolves queries against: the host's artifacts (its session store, or a client's view of a host's) plus the active session's identity, so scope: 'session' / 'project' can be answered without the extension knowing either id.

ExtensionBadgeActionsInterface#

Right-click actions an extension adds to matching badges. Registered with ctx.registerBadgeActions.

ExtensionBadgeIconInterface#

An icon in both renderers' vocabularies: gui is an icon class (i-ph-git-commit), tui one or two terminal cells (⎇). Either may be omitted; the host then draws none.

ExtensionCatalogPartitionInterface#

Shape returned by partitionExtensionCatalog.

ExtensionCatalogsInterface#

The catalogs extensions register into and transform.

ExtensionCompletionItemSummaryInterface#

One item of a provider's popup.

ExtensionCompletionProviderSummaryInterface#

A provider as an app's composer lists it: its trigger opens its popup.

ExtensionConfigActionItemInterface#

An imperative config item — rendered as a "press ↵ to run" row instead of a value editor. run executes in the extension's own process (it is never serialized — toWireConfigSchema omits action items entirely), so it can close over the extension's setup(ctx) scope.

Contract for run:

  • Resolve with an ExtensionConfigActionResult (or void) on success — message becomes the row's feedback line, config values are persisted by the host.
  • Throw / reject on failure — the error message is shown on the row.
  • Bound your own runtime: the host serializes actions (one in flight per modal) but imposes no timeout, so a hanging run holds the "running…" state until it settles.

Actions hold no persisted value: ctx.config.get(key) returns undefined for an action key and the resolver never yields a value.

ExtensionConfigActionResultInterface#

What a config ACTION reports back to the host after running. Actions cannot write settings directly — there is deliberately no config.set surface for extensions — so a successful run RETURNS the values it wants persisted and the host writes them through its own validated settings path (sanitizeExtensionConfigActionPatch gates the patch).

ExtensionConfigActionStatusInterface#

Result of an action's passive status probe. state drives the row color (ok accent / off mute / error error); message is the one-line text rendered in the row's value slot.

ExtensionConfigBooleanItemInterface#

A boolean config item — rendered as a toggle.

ExtensionConfigCategoryInterface#

A config category — a labelled grouping the Settings UIs render as a sub-header. Declared via ctx.registerConfigCategory. An item that names no category lands in its extension's implicit category (id = extension name); register a category with that id to give the implicit grouping a friendlier label.

ExtensionConfigEnumItemInterface#

An enum config item — rendered as a cycling choice row. The default must be one of the options values or the item is rejected at registration.

ExtensionConfigItemBaseInterface#

Fields shared by every config-item variant.

ExtensionConfigModelItemInterface#

A model-id config item — rendered as an inline searchable picker over the host's credentialed model catalog (the same interaction grammar as the ctrl+m cross-provider picker: type to filter, ↵ picks — or toggles, in multi mode, where esc applies the selection).

The persisted value is a plain model id, or a comma-separated id list when multi — a string either way, so ExtensionConfigValue and every settings store stay unchanged, and hosts without a catalog (headless, no authed providers) degrade to the free string input. Deliberately catalog-UNvalidated at read time: a stored id whose provider is temporarily unauthed must survive, not silently reset to the default — catalog validation is the consuming extension's call.

ExtensionConfigNumberItemInterface#

A numeric config item — rendered as a free input row, clamped to [min, max] and snapped to step. The default must itself lie within [min, max] or the item is rejected at registration.

ExtensionConfigStringItemInterface#

A string config item — rendered as a free input row (optionally multiline), validated against pattern.

ExtensionContextInterface#

Everything an extension can do. Registrations return a Disposable and work until the extension (or the scope they were made through) is disposed.

plugins, artifacts, sessions, generate and workspace need host support. On a host without it the domain is still there, but its members fail with an error naming the member and the host: synchronous ones (artifacts.kinds.register) throw, async ones reject.

ExtensionContextInputInterface#

What is specific to one extension.

ExtensionContextPanelSectionInterface#

Section an extension adds to the context panel. Supply static or computed rows, a load function, or both.

ExtensionContributionsInterface#

One extension's contributions, in the shapes hosts read.

ExtensionCreateSessionParamsInterface#

What ctx.sessions.create() takes.

ExtensionDefinitionInterface#

An extension. Export it as the module's default export, either through defineExtension or as a plain object (no import needed).

ExtensionEventQueryInterface#

What ctx.sessions.events() searches for. Every field narrows.

ExtensionFooterHintInterface#

Footer hint entry contributed by an extension.

Hints whose key parses as a real chord (ctrl+j, ^J, ⌘+k, f6, …) are CLICKABLE in the TUI: a click synthesizes that exact keypress through the input pipeline, so pair the hint with a registerKeybinding handler for the same chord and the button works by mouse and keyboard alike. Decorative keys that don't parse render as inert text.

ExtensionHookHandlersInterface#

Handlers an extension put on its own agent-hook bus and host events (when the host gave no agent hooks).

ExtensionHostRuntimeBridgeInterface#

Connects a host to the runtime surfaces extensions see as ctx.runtime, ctx.sessions, ctx.workspace and ctx.artifacts.

ExtensionHostRuntimeImplInterface#

What a host attaches to power the runtime surfaces.

ExtensionInfoInterface#

An extension as ctx.extensions reports it.

ExtensionInstallCandidateInterface#

One installable extension found inside a fetched tree.

ExtensionInstallOriginInterface#

Where an installed extension came from, from its .install.json: what Settings shows ("Update from <label>").

ExtensionInstallProvenanceInterface#

What .install.json records — enough to replay the install for updates.

ExtensionInstallResultInterface#

Outcome of an install or update.

ExtensionKeybindingInterface#

A TUI keybinding contributed by an extension. The id is namespaced by convention (<ext-name>.<action>) so two extensions registering the same logical action don't collide. onTrigger runs synchronously inside the TUI keyboard dispatcher — heavy work should hop to its own microtask.

default is a spec string in the same grammar as keybindings.json (e.g. 'ctrl+shift+j'); pass '' to leave the action unbound by default while still registering the id so users can rebind it via their personal keybindings.json.

ExtensionKeybindingDispatchContextInterface#

Argument the TUI dispatcher hands to ExtensionKeybinding.onTrigger. Intentionally tiny — the extension can capture whatever it needs from setup's closure. Extra fields may be added in minor releases; treat unknown ones as forward-compat noise.

ExtensionManifestInterface#

Static metadata an extension declares in extension.json or the zidane key of package.json. Discovery reads it before the module runs, so a bad apiVersion or name fails the load early.

ExtensionMcpHostInterface#

The host side of ctx.mcp, shared by every extension of a registry build.

ExtensionMcpServerInfoInterface#

One server ctx.mcp.servers() reports.

ExtensionMcpToolResultInterface#

What an MCP tool call answered. In-band tool errors resolve with isError: true.

ExtensionModelEntryInterface#

One row of ctx.runtime.models() — a model offered by a provider the user has credentials for. provider.key is the registry key (stable id, e.g. anthropic); provider.name is the display name. model mirrors the host's ModelInfo (id, context window, cost, …).

ExtensionOrderedContributionInterface#

A contribution tagged with the extension that made it, kept in registration order.

ExtensionPaletteProviderEntryInterface#

Registry entry: a host-facing PaletteProvider plus its owner and default group.

ExtensionPanelInterface#

A side-panel tab an extension registers with ctx.registerPanel.

ExtensionPanelEntryInterface#

Registry entry: the definition plus its owning extension.

ExtensionPathsInterface#

Filesystem locations given to an extension.

ExtensionPendingRequestInterface#

One prompt waiting for an answer, from ctx.sessions.pending().

ExtensionPromptBridgeInterface#

Connects ctx.submitPrompt to the host's prompt pipeline. Hosts attach their handler after the UI mounts.

ExtensionPromptDeliveryInterface#

Prompt bridge — the host hand-off behind ctx.submitPrompt.

Extensions submit prompts at any point in their lifetime; the host (the TUI, post-mount) attaches the single handler that routes them into its real submit machinery (run-or-queue gate, Agent.steer, Agent.followUp). Same holder idiom as the host runtime bridge. Prompts are deliberately NOT buffered pre-attach: silently replaying stale prompts after mount would be surprising — submit returns false so callers can react.

ExtensionReferenceCardInterface#

A reference's hover card: what the host shows over the badge. JSON-safe, bounded.

ExtensionReferenceCardFactInterface#

One fact of a reference card.

ExtensionReferencePatternInterface#

A pattern a reference provider finds in text. Declarative so every host matches the same way, in any process (the GUI renderer has no extension runtime): regex is JavaScript RegExp source, run with the g flag plus flags (i, u, m, s; others are ignored). key builds the key handed to resolve from the match: $0 is the whole match, $1… its groups (default $0). A match whose key comes out empty is skipped.

ExtensionReferenceProviderInterface#

Text references without a trigger character: ticket ids, issue URLs, anything a pattern can find in prompts, assistant replies, and session titles. Hosts match patterns, then ask resolve for each key; only a key that resolves to a view paints as a badge, so a false positive (UTF-8 for a [A-Z]+-\d+ pattern) stays plain text. Views are cached by the host per (provider, key).

Overlaps: the earliest match wins, then the longest; across providers, registration order breaks ties.

ExtensionReferenceViewInterface#

How a resolved reference paints: a badge in place of the matched text.

ExtensionRegistryInterface#

Every active extension's contributions, merged, as a LIVE view of the extension runtime: each field reads the runtime's registries (cached until they change), so a command, panel or palette entry registered after setup shows up on the next read. ExtensionRegistry.subscribe says when to read again.

  • Agent-loop surface (tools, hooks, mcpServers, skills): folded into a Preset by buildExtensionPreset.
  • Config-level registries (themes, agents, providers, subagents): merged into ResolvedConfig.
  • UI-bound (completionProviders, tuiContributions, panels, palette, references, badge actions): passed to the renderer.
  • Settings (configCategories, configItems): the settings rows of every active and disabled extension.

ExtensionRunSettledEventInterface#

What run-settled handlers receive (the run:settled host event, in the shape hosts deliver it).

ExtensionRuntimeInterface#

What createExtensionRuntime returns.

ExtensionRuntimeEnvInterface#

Identity of the extension a transform runs on behalf of. Passed as the second argument to registered transforms.

ExtensionRuntimeOptionsInterface#

Options of createExtensionRuntime.

ExtensionRuntimeOutputsInterface#

The extension runtime's outputs.

ExtensionRuntimeSurfaceInterface#

ctx.runtime — reads/controls over the host's active model state.

ExtensionScanEntryInterface#

A discovered (but not yet loaded) extension entry.

ExtensionsConfigSyncInterface#

The process's declarative-install coordinator.

ExtensionsConfigSyncOptionsInterface#

Options of createExtensionsConfigSync.

ExtensionsConfigSyncReportInterface#

The result of one scope's reconcile, handed to every attached target.

ExtensionsConfigSyncTargetInterface#

A registry a host keeps in line with the config.

ExtensionSessionBadgeInterface#

What a session shows under its title for one artifact kind: GUI sidebar rows and the TUI sessions list paint the same data. Built by the kind's badge(artifacts) over that session's artifacts of the kind (newest first). JSON-safe: it crosses IPC as-is.

ExtensionSessionBadgeCardRowInterface#

One line of a session badge's card.

ExtensionSessionControlInterface#

Host-level session control behind ctx.sessions: the orchestration verbs and per-session extension state, addressing any session by id, inside a run or not.

ExtensionSessionDetailInterface#

What ctx.sessions.read() returns.

ExtensionSessionEventInterface#

A session event (a run ended, or a session waits for an answer), as ctx.sessions.onEvent handlers get it.

ExtensionSessionRowInterface#

One row of the orchestration list(limit) (ExtensionSessionVerbs.list), which ctx.sessions.list falls back to on a host without the query verb.

ExtensionSessionScopeInterface#

Which sessions a subscriber hears from. Every field narrows; {} is every session.

ExtensionSessionsSurfaceInterface#

ctx.sessions — the orchestration verbs, acting as this extension (docs/ORCHESTRATION.md), plus this extension's state of any session. Every verb rejects without a chat host (a TUI-only window), and when the call is refused (an unknown session).

ExtensionSessionVerbsInterface#

The orchestration verbs acting as one extension (docs/ORCHESTRATION.md).

ExtensionsInstallPortInterface#

The effects declarative install needs from the host.

ExtensionSkillPolicyInterface#

Rule that activates a skill automatically at the start of a run.

ExtensionToolResultMetadataRegistrationInterface#

Declares a tool-result metadata namespace owned by an extension and how it appears in the context panel.

ExtensionUiSurfaceInterface#

ctx.ui — what this window shows. Per window: a daemon or a server has none, and answers false.

ExtensionWaitResultInterface#

What ctx.sessions.wait() returns.

ExtensionWorkspacePairInterface#

The live (execution, handle) pair behind ctx.workspace. Resolved per call — never cached by the facade — because the pair changes on session switch, cwd change, and registry rebuilds; a captured pair would point at a destroyed container.

ExtensionWorkspaceSurfaceInterface#

ctx.workspace — shell + file operations routed through the SESSION'S execution context, so extension work happens wherever the agent's tools run (host process, docker, remote sandbox) with the same transport output caps and containment. The curated "do work in the workspace" subset — lifecycle methods (spawn / destroy / background tasks) are deliberately absent: the pair belongs to the agent.

Unlike ctx.runtime / ctx.sessions (queries and toggles that degrade to null / false), these are imperative operations whose silent failure would corrupt caller logic — a no-op writeFile must not look like success. Detached ⇒ every method REJECTS with a clear error. Guard with ExtensionWorkspaceSurface.available or try/catch.

FacetComputeOptionsInterface#

Options of FacetRegistry.compute.

FacetInfoInterface#

A registered facet, as hosts list it.

FacetRefreshRequestInterface#

A ctx.sessions.facets.refresh call, as hosts get it.

FacetRegistryInterface#

The facets every extension registered. Hung on ExtensionRuntimeOutputs.facets.

GeneratedImageInterface#

One generated image.

GenerateDomainInterface#

ctx.generate: model calls outside any session. Uses the user's provider resolution and counts usage. On a host without model access, text and object reject, decide.available is false and decide answers unavailable.

GenerateImageOptionsInterface#

What ctx.generate.image takes.

GithubPullInterface#

A pull request as read from GitHub.

HandleInterface#

A live UI contribution. update patches the item and pushes it to every host. dispose withdraws it.

HooksDomainInterface#

ctx.hooks.

HostEventSinkInterface#

Host events the runtime cannot see by itself; hosts emit them.

HttpRequestInputInterface#

An HTTP request a provider is about to send.

HttpResponseInputInterface#

An HTTP response a provider received.

InstalledExtensionTargetOptionsInterface#

Identifies an installed extension and where to look for extension folders. Used by updateInstalledExtension and removeInstalledExtension.

InstallExtensionFromSpecOptionsInterface#

Options for installExtensionFromSpec.

InstructionsDomainInterface#

ctx.instructions: text added to the system prompt.

InstructionsRegistryInterface#

System prompt text added by extensions (ctx.instructions).

IntegrationCustomMethodInterface#

A connect method the extension runs itself (a bespoke OAuth flow, one sending custom headers). connect drives the host's UI through IntegrationFlowIO. An OAuth credential may carry refreshToken: the store keeps it, resolve never hands it out, and refresh gets it back when the credential expires within the refresh skew. integrationMethodFromOAuthProvider adapts a zidane/oauth provider.

IntegrationCustomResultInterface#

What a custom method's connect returns.

IntegrationFlowIOInterface#

What a custom method's connect drives the host's sign-in UI with. The host shows each step the way it shows an OAuth flow's (a link, a code, a question), in the TUI, the desktop app or a browser on another machine.

IntegrationHandleInterface#

A registration. update changes the spec in place; Settings redraws.

IntegrationsDomainInterface#

ctx.integrations.

IntegrationSpecInterface#

An integration an extension offers. Settings draws Connect / Disconnect for it.

InterceptOptionsInterface#

Options of hooks.intercept.

InterceptorsInterface#

Every interceptor: [input, result]. The handler returns a new result or undefined.

KeymapDomainInterface#

ctx.keymap.

KeymapEntryInterface#

One command as ctx.keymap.list reports it.

KeyValueInterface#

Durable key/value data. Reads are synchronous, from a cache: the host loads user and project before setup and the run's session before each run. The first kv() call for any other scope or session starts loading it, and reads return undefined until the load ends; await ready() before reading when that matters (a session's data after a restart).

LinkedExtensionDirInterface#

One extension folder a config entry links in place (a local source in config.json), scanned ahead of every root. Its scope gates it like a scan root's: a project link loads only in a trusted project.

LinkHandlerItemInterface#

Opens links the extension understands, before the app's own behavior. Every link the apps open goes through it: transcript links, file and reference chips, panel rows, badge menus, terminal links. Holding Alt opens a link the default way.

LinkHandlerWireInterface#

A link handler on the wire: which handlers exist and their order. match and open stay in the backend; hosts open a link through the resolver (UiRegistry.openLink, extensions.links.open).

LinkOpenRequestInterface#

A link to open, as hosts pass it to UiCallbacks.openLink.

LiveAccessorInterface#

A Live value you can read and watch.

LoadedExtensionInterface#

Result of attempting to load one extension. Active and disabled entries carry their live contributions; failed ones carry error.

LoadedPluginRecordInterface#

One Agent Plugin an extension loaded through ctx.plugins.load.

The plugin's skills and MCP servers are already folded into the surrounding ExtensionContributions; this record exists so hosts can still see that a PLUGIN was involved. Without it a plugin's contributions are indistinguishable from ones the extension author wrote by hand, and the settings UI has nothing to show a row or a toggle for.

McpDomainInterface#

ctx.mcp.

McpServerStatusInterface#

A connected MCP server, as ctx.mcp.list reports it.

MemorySettingsPortInterface#

An in-memory SettingsPort whose layers can be set from outside.

MemoryStoragePortInterface#

An in-memory StoragePort with a way to simulate another client's write.

A native menu entry (desktop). It runs a command.

A native menu entry on the wire.

ModelEditorInterface#

Editor of the model catalog (active providers only).

ModelInfoInterface#

A model entry.

ModelsDomainInterface#

ctx.models.

ModelSettingInterface#

A model picker. multi stores a list.

NamedToolInterface#

A tool with its name.

NewExtensionFolderInterface#

How a folder the runtime does not hold may load.

NumberSettingInterface#

A number setting.

OnOptionsInterface#

Options of hooks.on.

OwnerInterface#

A group of registrations with one lifetime. The extension's root owner lives until the extension unloads. scope() makes a child that can end earlier (for example "while connected").

PaletteProviderSpecInterface#

A dynamic palette source: items computed on open, drill-down results.

PanelActionInterface#

A button an extension adds to a panel footer. Clicking it calls the extension's onAction with id.

PanelBarsItemInterface#

A stacked bar chart with its legend (daily tokens by model).

PanelBarsPointInterface#

One bar of a bars item.

PanelBarsSeriesInterface#

One series of a bars item: a legend row.

PanelContentInterface#

JSON-safe content a panel's load returns. The host paints it with its own components.

PanelControlInterface#

A control in the panel's header. The host keeps what the user picked as view[id] and reloads the panel with it: no onAction round trip.

  • 'segmented' (default): a few options side by side (Overview | Models, All | 30d | 7d). view[id] is one option id.
  • 'select': one option from a menu (Team, Project). view[id] is one option id.
  • 'multi': any options from a menu (State: Todo, In progress). view[id] is a list of option ids; none picked means no filter.

PanelControlOptionInterface#

One choice of a segmented control.

PanelCustomItemInterface#

Host-specific rich view. The TUI resolves renderer against ctx.tui.registerRenderer ids (<extension>/<id>, bare ids are prefixed at registration); the GUI, and any host without the renderer, paints fallback as markdown.

PanelFocusInterface#

Identifies the badge or card row that opened a panel.

PanelHeatmapDayInterface#

One day of a heatmap. Sparse: days left out are empty.

PanelHeatmapItemInterface#

A week × weekday activity grid ending at end.

PanelHomeLayoutInterface#

How a block sits on the project home before the user arranges it.

PanelHostDepsInterface#

Where panels run: the scope's reads, and the bridge extension code reads its host from (absent: detached).

PanelHostFailureInterface#

A panel action's or a palette run's failure: the extension's own words.

PanelIconInterface#

Per-surface icon: an iconify class for the GUI, a single glyph for the TUI. The GUI ships Phosphor only (i-ph-<name>, -fill for a filled weight); other collections are not registered and paint nothing.

PanelKeyValueItemInterface#

A list of label and value pairs in a panel.

PanelKeyValueRowInterface#

One label and value pair in a key/value item.

PanelLoadContextInterface#

The context hosts hand to load / onAction.

PanelLoadContextInputInterface#

A load context as it arrives from across a boundary (the GUI renderer) or from host UI state, before the host binds it: every field optional. normalizePanelLoadContext reduces untrusted input to this shape; resolvePanelLoadContext turns it into the PanelLoadContext load / onAction receive.

PanelMarkdownItemInterface#

A block of Markdown text in a panel.

PanelMoreInterface#

More items to load after this content: the host shows a Show more button and calls load again with cursor, then appends what comes back (rows to the sections of the same id, new sections after). A new view, search or a change emit loads the first page again.

PanelRowActionInterface#

A button on a panel row. With start, the app opens a new chat for it (never sent); without, it calls the panel's onAction(id, payload).

PanelRowItemInterface#

One line in a panel, same presentation as an artifact row.

PanelScopeDepsInterface#

What a panel's scope reads from its host.

PanelSearchInterface#

A search field in the panel's header: the host keeps its text and reloads with it (PanelLoadContext.search).

PanelSectionInterface#

A titled group of items in a panel.

PanelStartSessionInterface#

A new chat a row action opens: a draft in the panel's folder, never sent. The user reviews the prompt and sends it.

  • where: 'worktree': the draft runs in a new git worktree on branch (a pull request's head when pullRequest is set: fetched when the branch is not local).
  • where: 'here': the draft runs in the folder itself. With pullRequest or branch, the folder switches to it first (never forced: git's refusal comes back to the user); without, the branch is left alone.

PanelStatInterface#

One big-number tile of a stats item.

PanelStatsItemInterface#

A grid of big-number tiles (totals, streaks).

PanelSummaryInterface#

One panel a folder offers, as an app lists it.

PanelWireInterface#

A panel on the wire. Its load / onAction / subscribe stay backend-side.

PluginsDomainInterface#

ctx.plugins: Agent Plugins (skills + MCP bundles).

PromptInputInterface#

A prompt on its way in, before commands and skills.

ProviderEditorInterface#

Editor of provider descriptors (including inactive ones).

ProvidersDomainInterface#

ctx.providers.

ReadableInterface#

A value that changes over time. Stores and selectors implement it.

RecordingUiClientPortInterface#

A UiClientPort that records calls and reports success.

ReferenceMatchInterface#

One reference found in a text: [start, end) and the key to resolve.

ReferenceProviderWireInterface#

What a host needs to match a provider's references: JSON-safe.

ReferenceResolverInterface#

Resolves reference keys to views, caching the answers.

ReferenceResolverOptionsInterface#

Options for createReferenceResolver.

RegistryTokenInterface#

Token of a list an extension owns.

RegistryViewFilterInterface#

How a view narrows its source.

RegistryViewSourceInterface#

What a registry view reads from: the runtime, the entries it refused, and the change feed.

ReloadChangedOptionsInterface#

Options of reloadChangedExtensions.

ReloadChangedResultInterface#

What reloadChangedExtensions did, by extension id.

RendererItemInterface#

A renderer: a component per host, with a markdown fallback.

RendererWireInterface#

A renderer on the wire.

RpcCallContextInterface#

What an implementation receives besides its input.

RpcContractInterface#

An RPC contract made by Rpc.define. Holds no implementation, so others can import it.

RpcDomainInterface#

ctx.rpc.

RpcErrorInterface#

A declared error, returned or thrown by an implementation.

RpcEventInterface#

An event delivered to subscribers.

RpcEventsInterface#

Event side of a client.

RpcEventSpecInterface#

One event of an RPC contract. Event data must be an object.

RpcMethodSpecInterface#

One method of an RPC contract.

RpcRegistrationInterface#

A registered implementation.

RunSettledEventInterface#

What run:settled observers receive.

RuntimeCatalogPortsInterface#

Base data of the shared catalogs. Each falls back to an empty base.

RuntimeEntryInterface#

One extension to load.

RuntimeExtensionInterface#

The loaded state of one extension, for hosts and the registry view.

RuntimeHooksPortsInterface#

The agent-hook side of the hooks port.

RuntimeLoadedExtensionInterface#

A discovered or inline extension, carried in the LoadedExtension list until the runtime takes it.

RuntimePortsInterface#

Everything a host plugs into the runtime. Every member is optional.

ScheduleFireEventInterface#

What an onFire handler gets.

SchedulesDomainInterface#

ctx.schedules. Every call rejects while the person has Reminders off (Settings > Sessions > Reminders) and on a host without a chat host. What this extension creates is tagged createdBy: { kind: 'extension', id }.

ScreenItemInterface#

A full-screen view, or a modal when presentation is 'modal'.

ScreenWireInterface#

A screen on the wire.

ScriptedDialogPortInterface#

A DialogPort with one client that answers from a script.

SelectOptionInterface#

One option of select.

SessionBadgeEntryInterface#

A session badge with the kind it was built for and the artifacts behind it.

SessionEventInterface#

A session event the host reports: a run ended, or a session waits for the user.

SessionFacetsDomainInterface#

ctx.sessions.facets. Works on every host; a host without sessions never computes them.

SessionFacetSpecInterface#

A facet: a JSON value the extension computes for every session, which queries read as facet.<extensionId>.<key> (filters, sorts, groupings, templates). The host stores the last value per session and computes it again on each trigger in on. undefined or null clears it; a throw or a timeout (5 s) keeps the last value and counts against the extension's error budget. A value is at most 8 KiB of JSON, and one extension's values on one session 16 KiB together: a value past either keeps the last one, with a warning on the extension's logger.

SessionFieldsInterface#

The fields of a session a query reads, as ctx.sessions.list rows and facet snapshots carry them.

SessionInfoInterface#

A session's live settings.

SessionListPageInterface#

One page of ctx.sessions.list.

SessionListQueryInterface#

What ctx.sessions.list takes. Every field is optional.

SessionListRowInterface#

One row of ctx.sessions.list.

SessionsDomainInterface#

ctx.sessions. Acts as the extension; what it creates is tagged with the extension id. Rejects on hosts without a session runtime, except facets.

SessionSnapshotInterface#

What a facet is computed on: the session's fields, its metadata and its turn count. Frozen.

SettingBaseInterface#

Fields every setting has.

SettingsCategoryInterface#

An extension's own group in the settings sidebar.

SettingsDomainInterface#

ctx.settings.

SettingsPageItemInterface#

A page in Settings under the extension. Data from a settings-like schema, or a component.

SettingsPageSpecInterface#

One page of an extension's settings.

SettingsPageWireInterface#

A settings page on the wire.

SettingsSchemaInterface#

The settings of an extension.

SettingsSearchEntryInterface#

One searchable settings row.

SettingsSidebarInterface#

What settingsSidebar returns.

SettingsSidebarCategoryInterface#

A top-level group an extension declared (SettingsSchema.category).

SettingsSidebarEntryInterface#

One extension's entry in the "Extensions" group.

SettingsSidebarExtensionInterface#

One extension as settingsSidebar and settingsSearchIndex take it.

SharedWatchesInterface#

Subscriptions shared by the clients that asked for them (an extension panel's or palette's live updates): started on the first request for a key, stopped when the last owner releases it or goes away. Without the count, one window closing a panel would stop the updates of another window showing the same one, and a window that closed without releasing would keep its subscription until the registry was rebuilt.

SidebarBadgeInterface#

A small label on an extension row.

SidebarDecorationItemInterface#

Extra data on the sidebar rows of the sessions that match where: an icon, a tone, a subtitle, chips, or a component. Only { template } values are read as templates; a plain string is drawn as given. Bindable fields follow the sidebar rule (SpaceItem).

SidebarDecorationWireInterface#

A sidebar decoration on the wire.

SidebarFilterItemInterface#

A filter the user turns on in the sidebar. toggle keeps the sessions that match query while on; select keeps those of the one option picked; multi keeps those that match any picked option. Bindable fields follow the sidebar rule (SpaceItem).

SidebarFilterOptionInterface#

One choice of a select or multi sidebar filter. Bind the filter's options to change its labels or queries.

SidebarFilterWireInterface#

A sidebar filter on the wire.

SidebarGroupItemInterface#

A grouping the user can pick for the sidebar. Bindable fields follow the sidebar rule (SpaceItem).

SidebarGroupWireInterface#

A sidebar grouping on the wire.

SidebarRowActionInterface#

An action in an extension row's menu.

SidebarRowActionWireInterface#

A sidebar row's action on the wire.

SidebarRowItemInterface#

A row an extension adds to a space's list beside its sessions: a ticket, a job, a pull request. It lists only in a space that allows items. time sorts it as a session's updatedAt. Bindable fields follow the sidebar rule (SpaceItem).

SidebarRowWireInterface#

A sidebar row on the wire, its bindings read and its references resolved: hosts use them as is.

SidebarSortItemInterface#

A sort order the user can pick for the sidebar. Bindable fields follow the sidebar rule (SpaceItem).

SidebarSortWireInterface#

A sidebar sort on the wire.

SkillsDomainInterface#

ctx.skills.

SlotItemInterface#

A small item placed in a slot: a status line, a banner, a composer badge.

SlotWireInterface#

A slot item on the wire, its bindings read.

SpaceItemInterface#

A space: a named view of sessions, listed in the sidebar beside the built-in spaces. Its published id is <extension>/<id>.

The Bindable rule of every sidebar token (spaces, filters, sorts, groups, decorations, rows): a field is Bindable when it is data that follows the extension's state (names, labels, queries, sorts, groupings, new-session defaults, row state, decoration content). Ids, kind, placement (space, spaces, group, order, items), actions, open and components stay fixed: change them with handle.update. A Bindable is read whole: bind the list (options, chips) to change one of its elements.

SpaceNewSessionInterface#

What a session started from a space runs with. Each field left out takes the app's default.

SpaceWireInterface#

A space on the wire.

StorageDomainInterface#

ctx.storage.

StoreInterface#

A typed, reactive value, kept on disk and synced to every window and client.

StoreOptionsInterface#

Options of a typed store.

StringSettingInterface#

A text setting. secret values go to the auth store and never show in config files.

ToolCallInterface#

A tool call an interceptor can rule on (from tool:gate, which also fires for MCP tools under their mcp_<server>_<tool> name).

ToolCallResultInterface#

A finished tool call (from tool:transform, which also fires for MCP tools).

ToolEditorInterface#

Editor of the tool catalog, per run.

ToolMetadataNamespaceInterface#

A tool-result metadata namespace an extension owns.

ToolResultDecisionInterface#

What a tool.result interceptor returns.

ToolsDomainInterface#

ctx.tools.

TuiContributionsInterface#

TUI-side merged contributions.

UiClientCallInterface#

One call a RecordingUiClientPort received.

UiDomainInterface#

ctx.ui. Dialogs (confirm, prompt, select, form, askUser, presentPlan) reject with NoUiError at once when no client can show them. toast and notify wait for a client instead: up to 20 of them, each for 60 s, delivered in order to the first client that attaches.

UiEntryInterface#

One contribution as the hosts see it.

UiTokenInterface#

A token naming a kind of UI contribution.

WebviewItemInterface#

A web page shown in a panel or a screen, sandboxed. It talks to the extension through RPC only.

WebviewWireInterface#

A webview on the wire. A file source is relative to the extension's folder; the host resolves it.

WireExtensionConfigSchemaInterface#

The full extension-config schema in IPC-safe form.

WireSettingsInterface#

Everything a Settings UI needs to draw an extension's settings.

WireSettingsExtensionInterface#

An extension as the settings wire names it (WireSettings.extensions).

WireSettingsPageInterface#

One page of an extension's settings in the sidebar. kind: 'schema' pages come from the definition's schema and list keys of the wire's own rows; kind: 'ui' pages are SettingsPage items, drawn from their own schema wire or component.

Types#

AccessScopeType#

The least client token scope a remote caller needs: the same scopes as every protocol method (chat ⊂ admin). In-process callers, local connections and other extensions are never limited by it.

ActionSettingValueType#

A value an action reads or writes: what a value setting holds.

AddFnType#

The add signature: a token and its item.

BadgeTargetKindType#

What kind of thing a badge stands for.

BindableType#

A field of a UI item that may be a fixed value or a Readable. A bound field re-pushes the item to the hosts when the readable changes.

CleanupType#

A cleanup function returned from setup or passed to ctx.onCleanup.

CommandInvocationType#

What run receives. A slash invocation carries the full step context (runAgent, emit, interaction…); other sources leave the session-bound members out when no session is active.

CommandSourceType#

How a command was started.

ConfigSyncLogType#

A level and a line, for the host's log.

ConfigSyncStatusType#

What happened to one config entry (or lock entry) in a reconcile.

ContextSectionItemType#

A section of the context breakdown or the context panel.

ContextSectionWireType#

A context section on the wire.

CredentialType#

A usable credential. OAuth tokens refresh on resolve.

refreshToken is only read from what a custom method returns (the store keeps it; resolve strips it). extra carries provider fields kept with the grant (an account id) and is handed back as stored.

DialogAnswerType#

A scripted answer for one dialog: a value, or a function of the request.

DialogRequestType#

A dialog on the wire, by kind.

ExtensionApiVersionType#

The extension API version this runtime loads.

ExtensionApprovalDecisionType#

A tool approval's decision.

ExtensionBadgeColorType#

An exact icon color, #rgb or #rrggbb, for a brand's own palette (a tracker's state colors). Hosts paint it over tone and ignore anything else; keep tone set too, for hosts and themes that don't take colors.

ExtensionBadgeToneType#

Color hint shared by session badges and text references. Hosts map it to their theme: muted is the quiet default, subtle quieter still, accent the theme accent, the rest the status colors.

ExtensionBehaviorTransformType#

Rewrites the agent behavior settings before a run starts. Return a replacement, or nothing to keep it.

ExtensionConfigChangeBehaviorType#

How a host applies a changed config value: read live, rebuild the agent, or restart.

ExtensionConfigItemType#

Discriminated union of the typed config items an extension can declare. The type tag drives both validation (resolveExtensionConfigValue) and rendering (toggle / choice / input / action row).

ExtensionConfigScopeType#

Where a config value should be persisted.

ExtensionConfigValueType#

Concrete value a config item can hold.

ExtensionConfigValueItemType#

The value-holding config items — everything except action. Functions that produce or validate persisted VALUES take this narrower union; ExtensionConfigItem is the full declarable set.

ExtensionFetchResultType#

Result of fetchExtensionSource: the provenance string and, for git clones, the commit SHA.

ExtensionHostKindType#

The host process the extension runs in.

ExtensionInstallErrorCodeType#

Reason an install, update or removal failed. Matches ExtensionInstallError.code.

ExtensionInstallIoType#

Injectable side-effect seams — tests swap these to stay offline; hosts normally omit the whole object. Shared shape with the skills installer.

ExtensionInstallScopeType#

Where an extension is installed: the project or the user directory.

ExtensionInstallSourceType#

The shared install-source shape — see src/install/source.ts for the grammar.

ExtensionMcpConfigTransformType#

Rewrites the MCP server configs before they are connected. Return a replacement list, or nothing to keep it.

ExtensionOrchestrationToolType#

An orchestration tool a session can hold: sessions drives sessions, interactions answers their prompts.

ExtensionPaletteItemType#

Item shape a dynamic provider returns: source is stamped by the host, group defaults to the provider's.

ExtensionPaletteRunResultType#

PaletteRunResult as an extension produces it: nested items are ExtensionPaletteItems.

ExtensionPanelScopeType#

Where a panel shows (ExtensionPanel.scope): 'session' (the default) only beside a session; 'project' only where a folder is open without a session (the new-chat draft screen, project pages); 'both' anywhere.

ExtensionReferenceSurfaceType#

Where hosts look for references.

ExtensionRunSettledHandlerType#

A run-settled handler; may be async.

ExtensionRunTransformType#

Rewrites the options of a run before it starts. Return replacement options, or nothing to keep them.

ExtensionSessionEventHandlerType#

Handler registered with ctx.sessions.onEvent.

ExtensionSourceType#

Where an extension was found.

ExtensionToolCatalogTransformType#

Rewrites the tool catalog before a run. env.phase tells whether it is the pre-run pass or the run itself, and env.mcpToolNames lists the tools that came from MCP servers. Return a replacement catalog, or nothing to keep it.

ExtensionWorkspaceOpsType#

ctx.workspace's operations already bound to a session, for a host whose execution lives in another process (the TUI in daemon mode reaches the session's workspace over IPC). Same contract as the facade's methods.

FacetsRuntimeType#

The registry together with its per-extension domain factory, its close (the runtime's dispose calls it first), and forget (the runtime's unload with forget calls it, after the extension's facets went).

GithubPullStateType#

What a PR shows: merged / draft / closed, or for an open one its review decision (approved / changes_requested) else open.

HookEventsType#

Every event hooks.on accepts: each AgentHooks key plus host events.

HostModuleSourceType#

A host module, eager or lazy. Lazy (() => Promise<module>) exists for self-referencing hosts: zidane/tui maps to ITSELF, which can only be expressed as a deferred dynamic import (the module is still evaluating when it registers).

HostModuleSpecifierType#

One of HOST_MODULE_SPECIFIERS.

InferType#

The value type a Schema accepts: inferred for Standard Schema, unknown for JSON Schema.

InstructionsRuntimeType#

The instructions registry together with its per-extension domain factory (createInstructionsRegistry).

IntegrationMethodType#

One way to connect an integration. For oauth: pkce needs redirectUri (a loopback URL with an explicit port, e.g. http://localhost:51121/callback), device needs deviceUrl (the device authorization endpoint). clientSecret is sent to the token endpoint when set; params are extra authorize-URL parameters (access_type, prompt). custom: see IntegrationCustomMethod.

IntegrationSpecPatchType#

What IntegrationHandle.update may change.

InterceptorHandlerType#

Handler of interceptor K.

ItemOriginType#

Who put an item in a catalog.

JsonType#

A JSON value.

JsonSchemaType#

A plain JSON Schema object. Values validated by it are typed unknown.

KeyScopeType#

Focus areas a keybinding can be limited to. panel:<id> and screen:<id> name an extension's own.

LinkSourceType#

Where a link was clicked.

LiveType#

The state of something another extension provides (a contract, a registry owner, an RPC). Read it where you use it: it changes as the provider starts, stops and reloads.

LoadedExtensionSourceType#

Where a loaded extension came from. Mirrors SkillSource so a Settings panel can show "project" vs "user" badges using the same vocabulary.

  • 'project' — discovered under <git-root>/.{agents,zidane}/extensions/.
  • 'user' — discovered under ~/.{agents,zidane}/extensions/, or installed from config.
  • 'inline' — host passed it programmatically (e.g. via RunTuiOptions.extensions / inlineLoadedExtension).
  • 'builtin' — reserved; no built-in extensions ship today.

McpToolDescriptorType#

One upstream tool an MCP server lists, before it is namespaced.

PanelContentItemType#

One entry in a panel section: a row, Markdown, key/value pairs, stats, a heatmap, a bar chart, or a custom view.

PanelItemType#

A side or home panel: an ExtensionPanel (load, subscribe, onAction, controls, focus), plus an optional component.

PanelLoadScopeType#

What a delivered load context is bound to: a session, or just a folder.

PanelSurfaceType#

Where a panel shows (ExtensionPanel.surfaces): 'side', a tab in the side panel (TUI rail, GUI side panel); 'home', a block on the GUI's project home (the new-chat screen of a folder, and of no folder).

PanelViewType#

A panel's view state, by control id: the picked option, or the picked options of a multi control.

RendererTargetType#

What a renderer draws: a custom block id, a code-block language, a tool's result, or an artifact kind's detail.

RpcClientType#

A typed client. Methods reject with RpcCallError on a declared error, validation failure, missing provider or abort.

RpcImplementationType#

The implementation of a contract.

SchemaType#

Either a Standard Schema (zod, valibot, arktype) or a plain JSON Schema.

SessionFacetTriggerType#

When a host computes a facet again: a session was created, a run settled, or its metadata changed.

SessionListStatusType#

A session's run state, the same in ctx.sessions.get and list rows: idle (never ran, or between runs), running, blocked (a run waits on the user: a question or an approval), completed (the last run ended well) or error (the last run failed).

SettingType#

One setting.

SettingApplyType#

What a change of the setting needs before it applies.

SettingScopeType#

Where a setting's value is stored.

SettingValueType#

The value type of one setting.

SidebarChipType#

A chip a decoration adds to a session row: literal text (blank or whitespace-only: no chip), a template (field paths in braces, {{ and }} for a brace; see escapeTemplate), or one chip per value of a facet.

SidebarRowOpenType#

What opening an extension row does. command resolves and gets its argument as a SidebarRowAction's does. panel and screen name this extension's own panel or screen by that id when it has one, else the id as written (<extension>/<id>, or a built-in panel such as todos).

SidebarRowStatusType#

Run state an extension row shows, like a session's.

SidebarTextType#

A plain string drawn as given (blank or whitespace-only: no text), or { template } with field paths in braces: '{facet.git.branch} · {modelId}'.

SlotNameType#

Named places every app knows. An app without the place ignores the item.

The sidebar has three:

  • 'sidebar.top': full-width block rows pinned under the sidebar's search row, above the session list. Desktop and web: between the search well and the list. Terminal: on the sessions screen, between the search box and the list.
  • 'sidebar.bottom': full-width block rows pinned under the session list, above the footer strip. Terminal: right under the sessions list.
  • 'sidebar.footer': compact chips inside the footer strip itself, next to the app's status (terminal: a line under the sessions list).

'sidebar.top' and 'sidebar.bottom' never scroll with the list. Each row draws the item's icon (or loader), text, count, tone and highlight, or its component. Each block takes at most part of the sidebar's height (desktop and web: 30%; it scrolls on its own past that), so the list keeps the rest. An empty block draws nothing.

StoragePathScopeType#

Folders for storage.path.

StorageScopeType#

Where kv and stores keep their data.

StoredExtensionConfigItemType#

A config item as STORED on the registry / contributions — the authored item plus the resolved category id it belongs to. The owning extension is implied by the namespacing key on ExtensionRegistry.configItems.

SyncInterceptorNameType#

Interceptors that run on a synchronous hot path: their handlers must not return a promise.

ToolCallDecisionType#

tool.call verdict. 'ask' sends the call through the approval flow. patch replaces the input, re-validated before execution. result answers the call without running it. block and result end the chain.

TransformType#

A registered transform.

ValueKeysType#

Keys of the settings that hold a value (not actions).

WireExtensionConfigItemType#

A config item flattened for the wire — carries category + extension, drops validate.

WorkspaceDomainType#

ctx.workspace: exec and files in the session's execution context (sandbox-correct).

Re-exports#

These names are documented on the entry point that owns them.