---
type: "TechArticle"
softwareVersion: "1.0.0"
url: "https://registry.docsloth.dev/components/copy-context.html"
markdown: "https://registry.docsloth.dev/docs/copy-context.md"
component: "copy-context"
section: "connected"
trust_class: "connected"
implementation_status: "implemented_native"
renderer: "native block"
install: "docsloth component add @docsloth/copy-context@1.0.0"
spec: "packages/contracts/component-specs/copy-context.md"
props_schema: "packages/contracts/component-props/copy-context.schema.json"
---

> Index: [Agent index](https://registry.docsloth.dev/llms.txt)

# copy-context

Export permitted agent context

| Field | Value |
| --- | --- |
| Trust class | connected |
| Implementation status | implemented_native |
| Renderer | native block |
| Key prop (production schema) | publication_id |
| Key prop (protocol fixture) | task |
| Tools | prepare, copy |
| Package version | 1.0.0 |
| Package digest | sha256:7384e22a62ec776e506652088611bb91cc03f1585c67a5046ac388fdbfe19a90 |

## Install

```sh
docsloth component add @docsloth/copy-context@1.0.0
```

Live package: sha256:7384e22a62ec776e506652088611bb91cc03f1585c67a5046ac388fdbfe19a90 with 2 file digest(s); the catalog entry is generated from the built package, not a placeholder.

## Props

The prop schema is normative in `packages/contracts/component-props/copy-context.schema.json`.

| Prop | Type | Required | Constraints |
| --- | --- | --- | --- |
| `title` | string | no | maxLength: 160 |
| `publication_id` | string | yes | format: uuid |
| `page_ids` | array<string> | yes |  |
| `format` | "markdown" \| "json" | yes |  |
| `token_budget` | integer | yes |  |

Example props generated from this schema:

```json
{
  "title": "example-title",
  "publication_id": "00000000-0000-4000-8000-000000000000",
  "page_ids": [
    "00000000-0000-4000-8000-000000000000"
  ],
  "format": "markdown",
  "token_budget": 256
}
```

Required props: publication_id, page_ids, format, token_budget.

## Example

Example document IR (the block the renderer consumes):

```json
{
  "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
  }
}
```

Renderer HTML (entities decoded and wrapped for display):

```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>
```

Preview (interface-only; the markup above is the same output):

The renderer resolves this component as a native block; the preview above is its real HTML output, and Markdown parity for native blocks is covered by the renderer test suite.

## Specification

Generated 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.

## Package manifest

Protocol fixture: `packages/contracts/component-fixtures/copy-context.json`.

| Field | Value |
| --- | --- |
| Name | @docsloth/copy-context |
| Version | 1.0.0 |
| Protocol | 1.x |
| License | Apache-2.0 |
| Runtime | react |
| Entry | dist/index.js |
| Recording policy | blocked |
| Fallback | html, markdown, json |
| Network hosts | none |
| Production write | no |
| Max runtime seconds | 120 |
| Integrity | all zeros (protocol fixture placeholder) |

| Tool | Effect | Confirmation | Input |
| --- | --- | --- | --- |
| prepare | execute | no | value |
| copy | read | no | value |

## Sources

| Source | Path |
| --- | --- |
| Component page | https://registry.docsloth.dev/components/copy-context.html |
| Markdown twin | https://registry.docsloth.dev/docs/copy-context.md |
| LLM index | https://registry.docsloth.dev/llms.txt |
| Specification | packages/contracts/component-specs/copy-context.md |
| Prop schema | packages/contracts/component-props/copy-context.schema.json |
| Protocol fixture | packages/contracts/component-fixtures/copy-context.json |
| Catalog | packages/contracts/component-catalog.json |
