docslothregistry

terminal

Interactive command example with sandbox binding

connected 1.0.0 Apache-2.0

Install

docsloth component add @docsloth/terminal@1.0.0 \
  --registry https://registry.docsloth.dev

Run it in a project that has a docsloth.config.json (docsloth init writes one). The docsloth CLI is not on npm yet: it runs from a checkout of the Docsloth engine, and the quickstart shows the setup. Every official component already renders in Docsloth sites; installing one vendors its props schema and specification and pins this exact version and digest.

What the CLI checks

docsloth component add reads this entry from index.json, recomputes the package digest from the manifest and the digest of every file, and writes nothing if one differs.

index.json, lines 889–906
889    {890      "name": "@docsloth/terminal",891      "version": "1.0.0",892      "kind": "block",893      "description": "Interactive command example with sandbox binding",894      "license": "Apache-2.0",895      "engine": ">=1 <2",896      "publisher": "docsloth",897      "digest": "sha256:6be4f597ac2a0177f1f08bc2ae4b4e13e695bfbe79a7cab008aa6cbfdc43bbc6",898      "blocks": [899        "terminal"900      ],901      "capabilities": [902        "render.html"903      ],904      "manifest_path": "packages/@docsloth/terminal/1.0.0/manifest.json",905      "files_base": "packages/@docsloth/terminal/1.0.0/files"906    },

Trust signals

Runtime trust class (catalog)
connected. Reaches a service only through a capability the host grants explicitly, and never receives raw credentials.
Install trust class
interactive, derived from the declared render.html. This is the class docsloth component add and docsloth component list report; it installs under the default policy, with no trust policy.
Package
@docsloth/terminal, version 1.0.0
Package digest
sha256:6be4f597ac2a0177f1f08bc2ae4b4e13e695bfbe79a7cab008aa6cbfdc43bbc6
Files
2 files, each pinned by its own sha256 digest (listed under Package files)
Capabilities declared
render.html. A declaration, never a grant; every official package declares the same.
Publisher
docsloth, a publisher id rather than a verified identity
Licence
Apache-2.0
Engine range
>=1 <2
Index signature
Not signed. Digests prove the bytes match the index, not who published them.
Tools
run, cancel
Built from
packages/contracts/component-props/terminal.schema.json and packages/contracts/component-specs/terminal.md in docsloth-registry

Props

The props schema is packages/contracts/component-props/terminal.schema.json; props it does not list are rejected.

PropTypeRequiredNotes
titlestringnomaxLength: 160
commandsarray<string>yes
resourceobjectnoadditionalProperties: false
resource.resource_idstringyesformat: uuid
resource.operationstringyesmaxLength: 160
resource.environment"test" | "staging" | "production"yes
cwdstringno
read_onlybooleanyes
timeout_secondsintegeryes

Required: commands, read_only, timeout_seconds.

Example props generated from the schema
{
  "title": "example-title",
  "commands": [
    "example-commands"
  ],
  "resource": {
    "resource_id": "00000000-0000-4000-8000-000000000000",
    "operation": "example-operation",
    "environment": "test"
  },
  "cwd": "example-cwd",
  "read_only": true,
  "timeout_seconds": 1
}

Preview

Rendered by @docsloth/renderer from a document block whose props are generated from the schema, so the values are placeholders.

Document block
{
  "type": "terminal",
  "props": {
    "title": "example-title",
    "commands": [
      "example-commands"
    ],
    "resource": {
      "resource_id": "00000000-0000-4000-8000-000000000000",
      "operation": "example-operation",
      "environment": "test"
    },
    "cwd": "example-cwd",
    "read_only": true,
    "timeout_seconds": 1
  }
}

example-title

example-commands
Working directory
example-cwd
Mode
Read-only
Time limit
1 s
Runs
example-operation in the test environment

Running these commands needs the live documentation site; copy them to run them yourself.

This is the renderer's real HTML with this registry's styles. Links and controls in the preview are inactive.

Rendered HTML
<section class="ds-block ds-terminal" data-component="terminal" aria-labelledby="b-title">
<h3 class="ds-block-title" id="b-title">example-title</h3>
<pre class="ds-code" data-lang="shell">
<code>example-commands</code>
</pre>
<dl class="ds-facts">
<div>
<dt>Working directory</dt>
<dd>
<code>example-cwd</code>
</dd>
</div>
<div>
<dt>Mode</dt>
<dd>Read-only</dd>
</div>
<div>
<dt>Time limit</dt>
<dd>1 s</dd>
</div>
<div>
<dt>Runs</dt>
<dd>
<code>example-operation</code> in the test environment</dd>
</div>
</dl>
<p class="ds-live-note" role="note">Running these commands needs the live documentation site; copy them to run them yourself.</p>
</section>

Specification

From packages/contracts/component-specs/terminal.md.

Contract

Production props are normative in ../contracts/component-props/terminal.schema.json. The corresponding component-fixtures manifest is only a minimal protocol fixture; use the production props schema when building the published package. The packaged artifact ships exactly its generated component-package.json manifest plus props.schema.json (the production props schema, copied byte-for-byte) and spec.md (this spec, copied byte-for-byte); it contains no executable payload, fallback implementation, Storybook, test suite, SSR harness or README. Rendering behavior and the acceptance cases below belong to the renderer and the repository tests, not to the package. Installation pins the package version and the digest of every shipped byte.

Intended behavior

Display typed commands and simulated output; live mode isolated sandbox, shell strings never interpolated into host shell.

The React terminal reads the production commands, optional resource/cwd, read_only and timeout_seconds props. Its host supplies a terminals entry keyed by terminalKey(settings) from @docsloth/official-components/host. The entry must match the exact commands, working directory, resource operation/environment, read-only policy, timeout, release, viewer session, command version and sandbox ID. Absent, loading or restricted bindings keep commands readable and execution disabled. SSR run controls are disabled. No generic executor endpoint or implicit simulation is used.

An explicit Run action invokes only that adapter with a fresh request ID and abort signal. Completed replies must echo the request and full scope, identify the execution, declare applied host redaction, and carry an integer exit code from 0 through 255. Each output channel is limited to 32,768 characters and both together to 64 KiB of UTF-8, before and after common-pattern display masking. Output stays escaped plain text; controls and directional overrides are removed. Empty output, nonzero exits, truncation, denial, unsupported execution, rate limits and invalid results are visible. Working-directory text is limited to 1,024 characters; null bytes and blank commands are rejected. Published command arrays otherwise retain their production schema bounds.

Cancel, timeout, scope/binding replacement and unmount abort the adapter request; late replies are discarded and replaced scopes lose old output. Cancellation text reports a request, never a confirmed remote termination. The host must stop remote work, authorize each run independently, reserve approved budget, enforce the signed manifest's tighter constraints, isolate filesystem/network/process access, constrain working directories, enforce read-only/timeout policy and redact before delivery. A binding's isolation: sandbox assertion is not evidence that those controls exist. Host sandbox deployment, core/cloud integration, secret delivery and agent tool dispatch remain separate integration responsibilities. Raw credentials never belong in props, commands or results; common-pattern client masking is not a complete privacy boundary.

Failure and fallback

Write denied outside sandbox; show simulation label.

Required acceptance cases

User-entered command cannot access control-plane FS or instance metadata. Also test empty data, loading, denied access, browser without JS, mobile 360px, keyboard navigation, dark mode and an explicit constrained agent tool call. The server independently authorizes capability requests; a package manifest cannot grant authority.

Data and maintenance

Data bindings resolve from a specific publication/release vector and permitted fact/evidence graph. Configuration edits create versioned component patches. Update invalidation uses dependency IDs, never indiscriminate whole-page regeneration. Human-owned props survive automatic updates unless invalidated with an explicit conflict. Missing optional resources leave an honest inert/readable fallback, not a broken page or fake success.

Cost and tools

Pure/local interaction must never invoke a model by accident. Any model, remote query or executor call must reserve approved budget before dispatch. Public visitors do not inherit owner resources. The component may call only named tools in its signed manifest with valid typed inputs. A cancelled job stops polling and closes resources. No component gets platform administration, raw credentials or an unlimited execution loop.

Runtime contract

The protocol fixture packages/contracts/component-fixtures/terminal.json records what this component may ask of a host when it runs. It is a contract, not a shipped runtime: the installable package contains no executable code.

FieldValue
Network hostsnone
Production writesnot allowed
Longest run120 seconds
Recordingblocked
Fallback outputhtml, markdown, json
ToolEffectNeeds confirmation
runexecuteno
cancelreads onlyno

Package files

Served under packages/@docsloth/terminal/1.0.0/. The package digest covers manifest.json, which lists each file with its digest.

Filesha256 digestBytes
props.schema.jsonsha256:46440caaea7e4a23e482295efb17638e0f3416208933b5b0f95b5ffc03ac2ca21245
spec.mdsha256:2833b192637b8e18467b5d27ccbfd2fdc41cc1e0f6dd99de13588aba2c14986f4476

Sources

SourceLocation
Markdown twinhttps://registry.docsloth.dev/docs/terminal.md
JSON metadatahttps://registry.docsloth.dev/api/v1/components/terminal.json
Specificationpackages/contracts/component-specs/terminal.md
Props schemapackages/contracts/component-props/terminal.schema.json
Protocol fixturepackages/contracts/component-fixtures/terminal.json
Catalogpackages/contracts/component-catalog.json