Skip to content

Seam reference

What is a seam

The seam is Blue's core architectural concept: a joint deliberately left open for replacement and contribution. Blue has no literal Seam type or registerSeam() API — seams take five code forms:

  1. Cordis service + declaration merging — a Service subclass mounted on the Context (ctx.blueScreen, ctx.blueStatus, …); inject and use;
  2. registry + disposerregister(entry): () => void, duplicate ids throw; the plugin fiber's unload rolls everything back ("registration is an effect");
  3. provider replacement — one active provider (themes), with Cordis auto-reloading every dependent on swap;
  4. module-level seam — a cross-plugin shared singleton (the shared editor) that senses mounting and remounting through events;
  5. subpath plugin + patch row — each enhancement is a package subpath export, toggled by a cordis.patch.yml row in the composition layer (zero-code customization).

Each seam splits three roles: definition (the contract, owned by the host package), provider / contributor (the implementation — the plain default is the first registrant), and consumer (depends on the contract, never the implementation). This is the mechanical foundation of "everything is a plugin" — your plugins and Blue's built-in enhancements go through the same seams.

Blue's own seams

Downstream plugins may only import documented contracts and subpaths — never Blue package internals:

SeamEntryContractPlain defaultWhat you can do
Screen mountctx.blueScreenBlueScreen / BlueComponent— (core capability)Mount components (addChild returns a disposer), open overlays, setFocus, request renders
Key registrationctx.blueKeymapBlueKeymap / BlueKeyActionRegister contextual/global keys; conflicts surface at registration, never fight at runtime
Component factoryctx.blueComponentsBlueComponentsCreate editor/markdown/select/image components + width/fuzzy pure functions — no pi-tui anywhere
Terminal factsctx.blueTerminalInfoBlueTerminalInfoRead the OSC 11 background probe and keyboard-protocol capabilities
ThemeblueTheme provider swapBlueTheme (28-token palette)blue-theme-darkProvide a whole palette; hot-switched by /theme, dependents auto-reload
Status barctx.blueStatusBlueStatus / BlueStatusEntryblue-status-basicRegister footer entries (priority / row / align)
Render intentsctx.blueIntentsBlueIntents / BlueIntentEntrygeneric tool cardProvide custom cards for new tool kinds (how diff and terminal cards exist)
Session factsctx.blueSession + eventsBlueSession + blue/session-changed etc.Read the current Agent, track switches, trigger resume/new/fork
Shared editormodule-level editor-instance + blue/input-editor-changedSharedEditor / SubmitTransformerfactory plain editorLayer autocomplete providers, onKey interception, insertText, submit transformers
Chrome helpers@dsh-blue/blue-core/chrome subpathpure functions (no service)Theme-agnostic frame/rule/hint drawing (framePanel, topRule, …), color functions injected by the caller
Compositioncordis.patch.yml rowsbaseline 8 rowsZero-code toggling and reordering of any plugin row

Seams inherited from the harness

Seams the harness (dsh-base) opens — equally open to your plugins:

SeamPurpose
ctx.commands.registerRegister slash commands, auto-listed in the editor's completion and /help
ctx.userQuestions.registerProviderTake over the question interaction (questionnaire panels)
'approval/request' waterfallAnswer approvals (not calling next() short-circuits)
attachments (AttachmentStore)Attachment storage — a pure seam in rc.7, implemented by Blue's blue-attachments, consumable by your plugins
ctx.tools / ctx.agents / ctx.sessionsTool registration/guards, session and agent operations

Harness-side permissionPresets, sessionProjections, and similar seams are not open in rc.7 — Blue will adapt their presentation as they land.

Design discipline

  1. Every seam: contract owned by the host package, registration returns a disposer, the plain default is the first registrant, unknown inputs fall back to plain;
  2. New seams open only when a first real consumer appears — never for hypothetical needs; signatures freeze in P3;
  3. Downstream code depends only on documented seams and contract packages, never Blue package internals;
  4. plain-first: Blue's own enhancements and downstream plugins register through the same seams; the baseline with every enhancement row removed still works.

The full engineering catalog

Contract source locations, which file implements each seam, and the row-by-row patch mapping live in the repository's engineering doc docs/blue-seams.md (Chinese).

Preview · v0.1.0-rc.1