docslothregistry

copy-context

Export permitted agent context

connected 1.0.0 Apache-2.0

Install

docsloth component add @docsloth/copy-context@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 313–330
313    {314      "name": "@docsloth/copy-context",315      "version": "1.0.0",316      "kind": "block",317      "description": "Export permitted agent context",318      "license": "Apache-2.0",319      "engine": ">=1 <2",320      "publisher": "docsloth",321      "digest": "sha256:7384e22a62ec776e506652088611bb91cc03f1585c67a5046ac388fdbfe19a90",322      "blocks": [323        "copy-context"324      ],325      "capabilities": [326        "render.html"327      ],328      "manifest_path": "packages/@docsloth/copy-context/1.0.0/manifest.json",329      "files_base": "packages/@docsloth/copy-context/1.0.0/files"330    },

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/copy-context, version 1.0.0
Package digest
sha256:7384e22a62ec776e506652088611bb91cc03f1585c67a5046ac388fdbfe19a90
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
prepare, copy
Built from
packages/contracts/component-props/copy-context.schema.json and packages/contracts/component-specs/copy-context.md in docsloth-registry

Props

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

PropTypeRequiredNotes
titlestringnomaxLength: 160
publication_idstringyesformat: uuid
page_idsarray<string>yes
format"markdown" | "json"yes
token_budgetintegeryes

Required: publication_id, page_ids, format, token_budget.

Example props generated from the schema
{
  "title": "example-title",
  "publication_id": "00000000-0000-4000-8000-000000000000",
  "page_ids": [
    "00000000-0000-4000-8000-000000000000"
  ],
  "format": "markdown",
  "token_budget": 256
}

Preview

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

Document block
{
  "type": "copy-context",
  "props": {
    "title": "example-title",
    "publication_id": "00000000-0000-4000-8000-000000000000",
    "page_ids": [
      "00000000-0000-4000-8000-000000000000"
    ],
    "format": "markdown",
    "token_budget": 256
  }
}

example-title

Pages
1
Format
markdown
Token budget
256

Copying this context needs the live documentation site.

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-copy-context" data-component="copy-context" aria-labelledby="b-title">
<h3 class="ds-block-title" id="b-title">example-title</h3>
<dl class="ds-facts">
<div>
<dt>Pages</dt>
<dd>1</dd>
</div>
<div>
<dt>Format</dt>
<dd>markdown</dd>
</div>
<div>
<dt>Token budget</dt>
<dd>256</dd>
</div>
</dl>
<p class="ds-live-note" role="note">Copying this context needs the live documentation site.</p>
</section>

Specification

From packages/contracts/component-specs/copy-context.md.

Contract

Production props are normative in ../contracts/component-props/copy-context.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

Prepare scoped context with source/version/constraints and copy exact content.

Failure and fallback

No transcript/system instructions/private data appended.

Required acceptance cases

Token limit and complete provenance for included facts. 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.

React host integration

Production props select a publication, at most 100 unique page UUIDs, Markdown or JSON format, and a 256–32768 token budget. The optional title is presentation only. ComponentContentProvider.copyContexts uses copyContextKey with sorted page IDs. Available records and packets must match release, publication, pages, format, budget, reader session and context version exactly.

An optional host prepare adapter receives only that scope plus an AbortSignal. The host authorizes the audience, reserves any query/model budget, selects only permitted facts and constraints, and counts the **exact** copyContextDocument bytes with its named tokenizer. ContextPacket.tokenCount is host-reported; the renderer checks its integer range against the budget but does not independently verify tokenizer accuracy. The host must count the serialized document, including metadata and provenance, rather than just the fact text. No preparation runs on mount; there is no generic executor request, transcript collection or automatic clipboard write.

Packets contain at most 128 uniquely identified facts, each with a selected page ID, source ID, immutable source version and up to 4096 UTF-16 units of text. At most 16 explicit constraints of 2000 units each are accepted. The complete serialized document must fit 128 KiB of UTF-8. Unknown fields are discarded; reader-session and packet-delivery metadata are excluded from the copied text. Markdown wraps the same deterministic JSON data in a fenced block. The host must authorize and remove private material before delivery; client validation cannot establish whether a host-supplied fact is public or its source is true.

Prepared content and provenance remain readable and selectable without JavaScript; prepare/copy controls are disabled during SSR. Hydration enables explicit preparation and a separate native Clipboard API action that copies exactly the displayed document. Clipboard refusal retains a manual selection fallback and never reports success. Empty selection, no facts, loading, restricted/missing bindings, denied/unsupported/rate-limited requests and invalid packets are distinct. Preparation clears old content; cancellation, scope changes and supplied-packet replacement discard late replies. Aborting a wait does not prove cancellation of remote work or undo an already-started clipboard write. Production host transport, permission enforcement and tokenizer integration remain separate integration responsibilities.

Runtime contract

The protocol fixture packages/contracts/component-fixtures/copy-context.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
prepareexecuteno
copyreads onlyno

Package files

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

Filesha256 digestBytes
props.schema.jsonsha256:3efda41f3570b301e71c3229efb56d0e3faa24e9448d9be6fb92698d618525ed780
spec.mdsha256:5a735dfc0b8f04c7addf2e637cae48533e1c464dbce8fcc4eeafc5de41101b334741

Sources

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