@vielzeug/codex 26.11.2 → 26.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  # Vielzeug: Full Documentation
2
2
 
3
- > Complete documentation for 43 packages. Version: 26.11.1
3
+ > Complete documentation for 43 packages. Version: 26.11.3
4
4
 
5
5
  ---
6
6
 
@@ -4262,15 +4262,15 @@ npx -y @vielzeug/codex
4262
4262
  | `loadSnapshot` | Read validated snapshot metadata | Sync | Content chunks load lazily |
4263
4263
  | `SnapshotCatalog` | Query package corpus | Sync | Construct from loaded snapshot |
4264
4264
  | `createMcpServer` | MCP adapter factory (generic tools) | Sync | Requires catalog and version |
4265
+ | `createMcpServerWithRefine` | MCP adapter factory (all package and Refine tools) | Sync | Import from `@vielzeug/codex/refine` |
4265
4266
  | `startHttpHost` | Loopback Streamable HTTP host | Async | HTTP remains local-only |
4266
- | `registerRefineTools` | Opt-in Refine tool registration | Sync | Import from `@vielzeug/codex/refine` |
4267
4267
 
4268
4268
  ## Package Entry Points
4269
4269
 
4270
4270
  | Import | Purpose |
4271
4271
  | --- | --- |
4272
4272
  | `@vielzeug/codex` | `Catalog`, `SnapshotCatalog`, `loadSnapshot`, MCP server, and HTTP host |
4273
- | `@vielzeug/codex/refine` | Opt-in Refine component tools (`registerRefineTools`) |
4273
+ | `@vielzeug/codex/refine` | Refine catalog and MCP server with component tools |
4274
4274
 
4275
4275
  ## Snapshot
4276
4276
 
@@ -4304,21 +4304,23 @@ Registers generic package tools over `Catalog`. Refine tools are opt-in through
4304
4304
 
4305
4305
  ## Refine tools (`@vielzeug/codex/refine`)
4306
4306
 
4307
- ### `SnapshotRefineCatalog`
4307
+ ### `createMcpServerWithRefine`
4308
4308
 
4309
4309
  ```ts
4310
- new SnapshotRefineCatalog(snapshot: LoadedSnapshot)
4310
+ createMcpServerWithRefine(catalog: RefineCatalog, options: { version: string; debug?: boolean }): Server;
4311
4311
  ```
4312
4312
 
4313
- Extends `SnapshotCatalog` with `getComponent()` and `listComponents()`.
4313
+ Creates a server with the general Vielzeug package catalog tools and the additional `refine-*` component tools.
4314
4314
 
4315
- ### `registerRefineTools`
4315
+ ### `SnapshotRefineCatalog`
4316
4316
 
4317
4317
  ```ts
4318
- registerRefineTools(server: Server, catalog: RefineCatalog, debug?: boolean): void;
4318
+ new SnapshotRefineCatalog(snapshot: LoadedSnapshot)
4319
4319
  ```
4320
4320
 
4321
- Upgrades a server created by `createMcpServer()` with the combined generic and `refine-*` tool set. `refineTools` is exported as a readonly registry.
4321
+ Extends `SnapshotCatalog` with `getComponent()` and `listComponents()`.
4322
+
4323
+ Component declarations and their nested data use readonly TypeScript types.
4322
4324
 
4323
4325
  ## HTTP
4324
4326
 
@@ -4328,22 +4330,22 @@ Upgrades a server created by `createMcpServer()` with the combined generic and `
4328
4330
  startHttpHost(options: HttpHostOptions): Promise;
4329
4331
  ```
4330
4332
 
4331
- Starts Streamable HTTP on `127.0.0.1` by default. Runtime validation accepts only `127.0.0.1` or `::1`; every request must also pass localhost Host and Origin checks. `configureServer` runs once for each lazily created MCP request server and is not called during host startup.
4333
+ Starts Streamable HTTP on `127.0.0.1` by default. Runtime validation accepts only `127.0.0.1` or `::1`; every request must also pass localhost Host and Origin checks. `createServer` must return a fresh, unconnected server with its request handlers registered.
4332
4334
 
4333
4335
  ## Types
4334
4336
 
4335
4337
  ```ts
4336
4338
  interface SnapshotPointer {
4337
- directory: string;
4339
+ readonly directory: string;
4338
4340
  }
4339
4341
 
4340
4342
  interface SnapshotManifest {
4341
- catalog: 'catalog.json';
4342
- contentDirectory: 'packages';
4343
- refine: 'refine.json' | null;
4344
- schemaVersion: typeof SNAPSHOT_SCHEMA_VERSION;
4345
- search: 'search.json';
4346
- version: string;
4343
+ readonly catalog: 'catalog.json';
4344
+ readonly contentDirectory: 'packages';
4345
+ readonly refine: 'refine.json' | null;
4346
+ readonly schemaVersion: typeof SNAPSHOT_SCHEMA_VERSION;
4347
+ readonly search: 'search.json';
4348
+ readonly version: string;
4347
4349
  }
4348
4350
  ```
4349
4351
 
@@ -4351,88 +4353,82 @@ Dev snapshots use `SnapshotPointer` (via `current.json`); published snapshots ar
4351
4353
 
4352
4354
  ```ts
4353
4355
  interface LoadedSnapshot {
4354
- catalog: CatalogFile;
4355
- contentDirectory: string;
4356
- manifest: SnapshotManifest;
4357
- refineComponents: CemDeclaration[];
4358
- search: SearchRecord[];
4356
+ readonly catalog: CatalogFile;
4357
+ readonly contentDirectory: string;
4358
+ readonly manifest: SnapshotManifest;
4359
+ readonly refineComponents: readonly CemDeclaration[];
4360
+ readonly search: readonly SearchRecord[];
4359
4361
  }
4360
4362
  ```
4361
4363
 
4362
4364
  ```ts
4363
4365
  interface CatalogFile {
4364
- packages: PackageMeta[];
4365
- version: string;
4366
+ readonly packages: readonly PackageMeta[];
4367
+ readonly version: string;
4366
4368
  }
4367
4369
 
4368
4370
  interface SearchRecord {
4369
- category: string;
4370
- description: string;
4371
- docs: Partial>;
4372
- examples: Array;
4373
- exports: string;
4374
- keywords: string;
4375
- name: string;
4376
- related: string;
4377
- slug: string;
4378
- source: string | null;
4371
+ readonly category: string;
4372
+ readonly description: string;
4373
+ readonly docs: Readonly>>;
4374
+ readonly examples: readonly { readonly id: string; readonly text: string }[];
4375
+ readonly exports: string;
4376
+ readonly keywords: string;
4377
+ readonly name: string;
4378
+ readonly related: string;
4379
+ readonly slug: string;
4380
+ readonly source: string | null;
4379
4381
  }
4380
4382
 
4381
4383
  interface PackageMeta {
4382
- availableDocPages: DocPage[];
4383
- category: string;
4384
- description: string;
4385
- exampleIds: string[];
4386
- exports: string[];
4387
- hasSource: boolean;
4388
- keywords: string[];
4389
- name: string;
4390
- related: string[];
4391
- slug: string;
4392
- version: string;
4393
- }
4394
-
4395
- interface PackageContent {
4396
- apiSource: string | null;
4397
- docs: Partial>;
4398
- examples: Example[];
4399
- typeSignatures: Record;
4384
+ readonly availableDocPages: readonly DocPage[];
4385
+ readonly category: string;
4386
+ readonly description: string;
4387
+ readonly exampleIds: readonly string[];
4388
+ readonly exports: readonly string[];
4389
+ readonly hasSource: boolean;
4390
+ readonly keywords: readonly string[];
4391
+ readonly name: string;
4392
+ readonly related: readonly string[];
4393
+ readonly slug: string;
4394
+ readonly version: string;
4400
4395
  }
4401
4396
 
4402
4397
  interface Example {
4403
- code: string;
4404
- id: string;
4405
- name: string;
4398
+ readonly code: string;
4399
+ readonly id: string;
4400
+ readonly name: string;
4406
4401
  }
4407
4402
  ```
4408
4403
 
4409
4404
  ```ts
4410
4405
  interface Catalog {
4411
- getContent(slug: string): PackageContent;
4412
4406
  getDocs(slug: string, page: DocPage): string;
4413
4407
  getExample(slug: string, exampleId: string): Example;
4414
4408
  getPackage(slug: string): PackageMeta;
4415
4409
  getSource(slug: string): string;
4416
4410
  getTypeSignature(slug: string, symbol: string): string;
4417
- listExamples(slug: string): Array>;
4418
- listPackages(): PackageMeta[];
4419
- search(query: string): SearchHit[];
4411
+ listExamples(slug: string): readonly Pick[];
4412
+ listPackages(): readonly PackageMeta[];
4413
+ search(query: string): readonly SearchHit[];
4420
4414
  }
4421
4415
 
4422
4416
  interface RefineCatalog extends Catalog {
4423
4417
  getComponent(tagName: string): CemDeclaration;
4424
- listComponents(): CemDeclaration[];
4418
+ listComponents(): readonly CemDeclaration[];
4425
4419
  }
4426
4420
 
4427
4421
  interface SearchHit {
4428
- matchedExamples?: string[];
4429
- matchedIn: Array;
4430
- matchedPages?: DocPage[];
4431
- name: string;
4432
- slug: string;
4422
+ readonly matchedExamples?: readonly string[];
4423
+ readonly matchedIn: readonly ('docs' | 'examples' | 'exports' | 'keywords' | 'metadata' | 'related' | 'source')[];
4424
+ readonly matchedPages?: readonly DocPage[];
4425
+ readonly name: string;
4426
+ readonly slug: string;
4433
4427
  }
4434
4428
  ```
4435
4429
 
4430
+ Catalog exposes semantic reads. It does not expose its cached content chunks.
4431
+
4436
4432
  ```ts
4437
4433
  interface HttpHost {
4438
4434
  readonly disposalSignal: AbortSignal;
@@ -4444,9 +4440,7 @@ interface HttpHost {
4444
4440
  }
4445
4441
 
4446
4442
  interface HttpHostOptions {
4447
- catalog: Catalog;
4448
- configureServer?: (server: Server) => void;
4449
- debug?: boolean;
4443
+ createServer: () => Server;
4450
4444
  host?: '127.0.0.1' | '::1';
4451
4445
  port: number;
4452
4446
  version: string;
@@ -4464,54 +4458,54 @@ CEM types and `RefineCatalog` are exported from `/refine`.
4464
4458
 
4465
4459
  ```ts
4466
4460
  interface CemDeclaration {
4467
- attributes?: CemAttribute[];
4468
- cssParts?: CemCssPart[];
4469
- cssProperties?: CemCssProperty[];
4470
- description?: string;
4471
- events?: CemEvent[];
4472
- members?: CemMember[];
4473
- name?: string;
4474
- slots?: CemSlot[];
4475
- superclass?: { name: string; package?: string };
4476
- tagName?: string;
4477
- [key: string]: unknown;
4461
+ readonly attributes?: readonly CemAttribute[];
4462
+ readonly cssParts?: readonly CemCssPart[];
4463
+ readonly cssProperties?: readonly CemCssProperty[];
4464
+ readonly description?: string;
4465
+ readonly events?: readonly CemEvent[];
4466
+ readonly members?: readonly CemMember[];
4467
+ readonly name?: string;
4468
+ readonly slots?: readonly CemSlot[];
4469
+ readonly superclass?: { readonly name: string; readonly package?: string };
4470
+ readonly tagName?: string;
4471
+ readonly [key: string]: unknown;
4478
4472
  }
4479
4473
 
4480
4474
  interface CemAttribute {
4481
- default?: string;
4482
- description?: string;
4483
- fieldName?: string;
4484
- name: string;
4485
- type?: { text: string };
4475
+ readonly default?: string;
4476
+ readonly description?: string;
4477
+ readonly fieldName?: string;
4478
+ readonly name: string;
4479
+ readonly type?: { readonly text: string };
4486
4480
  }
4487
4481
 
4488
4482
  interface CemCssPart {
4489
- description?: string;
4490
- name: string;
4483
+ readonly description?: string;
4484
+ readonly name: string;
4491
4485
  }
4492
4486
 
4493
4487
  interface CemCssProperty {
4494
- default?: string;
4495
- description?: string;
4496
- name: string;
4488
+ readonly default?: string;
4489
+ readonly description?: string;
4490
+ readonly name: string;
4497
4491
  }
4498
4492
 
4499
4493
  interface CemEvent {
4500
- description?: string;
4501
- name: string;
4502
- type?: { text: string };
4494
+ readonly description?: string;
4495
+ readonly name: string;
4496
+ readonly type?: { readonly text: string };
4503
4497
  }
4504
4498
 
4505
4499
  interface CemMember {
4506
- description?: string;
4507
- kind?: 'field' | 'method';
4508
- name: string;
4509
- type?: { text: string };
4500
+ readonly description?: string;
4501
+ readonly kind?: 'field' | 'method';
4502
+ readonly name: string;
4503
+ readonly type?: { readonly text: string };
4510
4504
  }
4511
4505
 
4512
4506
  interface CemSlot {
4513
- description?: string;
4514
- name: string;
4507
+ readonly description?: string;
4508
+ readonly name: string;
4515
4509
  }
4516
4510
  ```
4517
4511
 
@@ -4540,7 +4534,7 @@ npx -y @vielzeug/codex --port=3100
4540
4534
  curl http://127.0.0.1:3100/health
4541
4535
  ```
4542
4536
 
4543
- Response includes snapshot version. Runtime bind validation and Host/Origin allowlists restrict access to localhost; no remote host mode exists. Programmatic `configureServer` hooks run once per MCP request server, not at host startup. Dispose the host asynchronously and observe `disposed` or `disposalSignal` when coordinating shutdown.
4537
+ Response includes snapshot version. Runtime bind validation and Host/Origin allowlists restrict access to localhost; no remote host mode exists. Programmatic HTTP hosting takes a `createServer` factory that returns a fresh, unconnected server with its request handlers registered. Dispose the host asynchronously and observe `disposed` or `disposalSignal` when coordinating shutdown.
4544
4538
 
4545
4539
  ## Agent Skill
4546
4540
 
@@ -4590,16 +4584,15 @@ const catalog = new SnapshotCatalog(snapshot);
4590
4584
  await createMcpServer(catalog, { version: snapshot.manifest.version }).connect(new StdioServerTransport());
4591
4585
  ```
4592
4586
 
4593
- To include Refine component tools, upgrade the server with the `@vielzeug/codex/refine` subpath:
4587
+ To include Refine component tools, create a server with the `@vielzeug/codex/refine` subpath:
4594
4588
 
4595
4589
  ```ts
4596
- import { StdioServerTransport, createMcpServer, loadSnapshot } from '@vielzeug/codex';
4597
- import { SnapshotRefineCatalog, registerRefineTools } from '@vielzeug/codex/refine';
4590
+ import { StdioServerTransport, loadSnapshot } from '@vielzeug/codex';
4591
+ import { createMcpServerWithRefine, SnapshotRefineCatalog } from '@vielzeug/codex/refine';
4598
4592
 
4599
4593
  const snapshot = loadSnapshot();
4600
4594
  const catalog = new SnapshotRefineCatalog(snapshot);
4601
- const server = createMcpServer(catalog, { version: snapshot.manifest.version });
4602
- registerRefineTools(server, catalog);
4595
+ const server = createMcpServerWithRefine(catalog, { version: snapshot.manifest.version });
4603
4596
  await server.connect(new StdioServerTransport());
4604
4597
  ```
4605
4598
 
@@ -4609,7 +4602,7 @@ await server.connect(new StdioServerTransport());
4609
4602
  - Use `get-type-signature` before loading full source.
4610
4603
  - Published package snapshots are static directories; local dev snapshots are immutable generations selected by `.dev/current.json`.
4611
4604
  - Pass `validateContents: true` to `loadSnapshot()` for artifact verification; normal startup keeps package chunks lazy.
4612
- - Treat `configureServer` as a per-request factory hook and avoid process-global side effects.
4605
+ - Return a fresh configured server from `startHttpHost`'s `createServer` factory.
4613
4606
  - Keep HTTP local. Use stdio for normal client integration.
4614
4607
  - Run `pnpm test:unit` before `pnpm test:integration`.
4615
4608
 
@@ -15466,7 +15459,7 @@ animation.dispose();
15466
15459
  - `animate()`: Native element animation with lifecycle ownership and direct native access
15467
15460
  - `animateEach()`: Group ownership with stable keyframe factories and `stagger`
15468
15461
  - `captureLayout()`: One-shot FLIP transition with additive `translate` (position) and `scale` (size)
15469
- - `motion`: `'system'` reduced-motion support with explicit reduced outcomes
15462
+ - `motion`: `'system'` reduced-motion support with the same keyframes on instant timing
15470
15463
  - Native timing: Omitted timing fields retain Web Animations API behavior
15471
15464
  - `signal`: Abort a handle from its parent lifecycle
15472
15465
  - `dispose()`: Idempotent cleanup with `[Symbol.dispose]()`
@@ -15480,7 +15473,7 @@ Necromancer owns explicit WAAPI keyframes. It does not generate CSS keyframes, o
15480
15473
  - [Usage Guide](./usage.md)
15481
15474
  - [API Reference](./api.md)
15482
15475
  - [Examples](./examples.md)
15483
- - [3.0 Migration](./migration.md)
15476
+ - [Migration Guide](./migration.md)
15484
15477
 
15485
15478
  ## See Also
15486
15479
 
@@ -15638,11 +15631,10 @@ type MotionMode = 'full' | 'reduced' | 'system';
15638
15631
  ```ts
15639
15632
  type AnimationResult =
15640
15633
  | { readonly status: 'finished' }
15641
- | { readonly status: 'reduced' }
15642
15634
  | { readonly reason?: unknown; readonly status: 'cancelled' };
15643
15635
  ```
15644
15636
 
15645
- `cancelled` describes native cancellation and includes its native rejection reason. A reason passed to `dispose()` or an abort signal takes precedence. The independent `disposed` property becomes `true` only when the lifecycle owner is explicitly disposed.
15637
+ A reduced animation finishes: reduction is decided at call time and `shouldReduceMotion()` answers it, so the result reports only what the caller could not know. `cancelled` carries the reason the animation was cancelled: the value passed to `dispose()`, the abort reason of the owning `signal`, or the native rejection reason when something outside Necromancer cancelled the animation. A bare `dispose()` carries no reason. The independent `disposed` property becomes `true` only when the lifecycle owner is explicitly disposed.
15646
15638
 
15647
15639
  ### `AnimateOptions`
15648
15640
 
@@ -15838,7 +15830,7 @@ const result = await handle.result;
15838
15830
  handle.dispose();
15839
15831
  ```
15840
15832
 
15841
- `result` distinguishes natural completion, reduced timing, and cancellation. `disposed` reports only whether the owner was explicitly disposed.
15833
+ `result` distinguishes natural completion from cancellation. `disposed` reports only whether the owner was explicitly disposed.
15842
15834
 
15843
15835
  Omitted timing fields retain native Web Animations API behavior. Pass an explicit `duration` when the animation should run over time.
15844
15836
 
@@ -15857,7 +15849,7 @@ const result = await handle.result;
15857
15849
 
15858
15850
  `'system'` is the default and reduces movement when `prefers-reduced-motion: reduce` matches. `'full'` preserves the requested timing, while `'reduced'` always reduces it.
15859
15851
 
15860
- Reduced motion keeps the supplied keyframes but normalizes delay, duration, and end delay to zero and iterations to one. The result is `{ status: 'reduced' }`, and `handle.animation` still represents the requested visual transition.
15852
+ Reduced motion keeps the supplied keyframes but normalizes delay, duration, and end delay to zero and iterations to one. The animation finishes immediately, so its result is `{ status: 'finished' }`; call `shouldReduceMotion()` with the same mode when your own code needs to know whether movement was reduced. `handle.animation` still represents the requested visual transition.
15861
15853
 
15862
15854
  ## Parent Cancellation
15863
15855
 
@@ -21860,6 +21852,8 @@ Classification guides discovery and bundle selection. It is not a reason to remo
21860
21852
  | `@vielzeug/refine/frameworks/react` | Register typed React JSX elements | Types only | Does not provide runtime wrappers |
21861
21853
  | `@vielzeug/refine/frameworks/vue` | Register typed Vue global components | Types only | Does not install a Vue plugin |
21862
21854
  | `@vielzeug/refine/theme` | `createThemeController()`: light/dark/system document theme | Sync | Does not persist the preference or set an accent color |
21855
+ | `@vielzeug/refine/blueprint` | `parseUiBlueprint()`: validate a model-authored UI document against a fixed registry | Sync | Pure contract only: it registers no components and renders nothing |
21856
+ | `@vielzeug/refine/blueprint/render` | `renderUiBlueprint()`: render a validated document with registered components | Sync | Registers its thirteen components on import; rejects before touching the container |
21863
21857
  | `eventFieldValue()` / `eventFieldChecked()` | Read a form control's value/checked from `event.currentTarget` | Sync | Exported from the package root; guards non-field targets |
21864
21858
  | `animateReflow()` | Token-driven FLIP reflow for keyed lists | Async (next frame) | Exported from the package root; elements need stable keys or it correctly does nothing |
21865
21859
  | `setMotionMode()` / `getMotionMode()` | Read/write the `data-motion` attribute on `` | Sync | Exported from the package root; an unknown mode throws `RangeError` |
@@ -21872,6 +21866,8 @@ Classification guides discovery and bundle selection. It is not a reason to remo
21872
21866
  | `@vielzeug/refine` | Export `registerIcons`, icon definition types, `RefineError`, `animateReflow`, the motion-mode functions, and the field readers without registering components |
21873
21867
  | `@vielzeug/refine/` | Register one component and export its tag constant, props, events, and related types |
21874
21868
  | `@vielzeug/refine/theme` | `createThemeController()` and its theme types |
21869
+ | `@vielzeug/refine/blueprint` | On-demand UI document contract: `parseUiBlueprint()`, the node types, bounds, `UI_BLUEPRINT_REGISTRY`, and `UI_BLUEPRINT_JSON_SCHEMA` |
21870
+ | `@vielzeug/refine/blueprint/render` | `renderUiBlueprint()` and the thirteen component tags it registers |
21875
21871
  | `@vielzeug/refine/tokens.css` | Required global design contract |
21876
21872
  | `@vielzeug/refine/fouc.css` | Optional pre-upgrade visibility rule |
21877
21873
  | `@vielzeug/refine/styles/*` | Focused theme, animation, layer, and preflight stylesheets |
@@ -22043,6 +22039,68 @@ setMotionMode('reduced'); // returns the applied mode
22043
22039
 
22044
22040
  Read/write the `data-motion` attribute on `` (`'full' | 'reduced' | 'system'`; `'system'` removes the attribute). An unknown mode throws `RangeError`. The attribute drives the token layer: see [Animation & Motion → Motion Mode](./animation#motion-mode).
22045
22041
 
22042
+ ## On-Demand UI Documents
22043
+
22044
+ `@vielzeug/refine/blueprint` is the trusted boundary for UI that a model writes. A harness asks a model to describe a small UI in JSON, and this contract decides whether that JSON may be rendered. It is data only: no code, no HTML, no callbacks, no styles, no URLs. See [On-Demand UI Documents](./on-demand-ui) for the full guide.
22045
+
22046
+ ```ts
22047
+ import { parseUiBlueprint, safeParseUiBlueprint } from '@vielzeug/refine/blueprint';
22048
+
22049
+ const result = safeParseUiBlueprint(JSON.parse(modelOutput)); // model output stays `unknown`
22050
+ if (!result.success) showError(result.issues); // safe to display: field paths, no secrets
22051
+ else renderValidated(result.document);
22052
+ ```
22053
+
22054
+ | Export | Purpose |
22055
+ | --- | --- |
22056
+ | `UI_BLUEPRINT_VERSION` | The only document version accepted (`1`) |
22057
+ | `parseUiBlueprint(value)` | Validate `unknown`. Returns the document unchanged, or throws `UiBlueprintError`. Nothing is repaired or partially accepted |
22058
+ | `safeParseUiBlueprint(value)` | Non-throwing form: `{ success: true, document }` or `{ success: false, issues }` |
22059
+ | `UiBlueprintError` | `RefineError` subclass carrying `issues: readonly string[]`, each a field path such as `root.children[0].size` |
22060
+ | `UI_BLUEPRINT_COMPONENTS` | The thirteen accepted component names: `text`, `box`, `card`, `button`, `badge`, `separator`, `slider`, `switch`, `checkbox`, `number-input`, `alert`, `progress`, `icon` |
22061
+ | `UI_BLUEPRINT_REGISTRY` | The same registry as data: element tag, child policy, attribute names, slot-text fields, and accepted values per component |
22062
+ | `UI_BLUEPRINT_JSON_SCHEMA` | JSON Schema (draft 2020-12) for the contract, for harnesses with structured output |
22063
+ | `BlueprintDocument`, `BlueprintNode`, and the node interfaces | TypeScript types for the document shape. Every node accepts an optional bounded `id` through `BlueprintNodeMeta` |
22064
+ | `MAX_BLUEPRINT_NODES`, `MAX_BLUEPRINT_DEPTH`, `MAX_BLUEPRINT_CHILDREN`, `MAX_BLUEPRINT_TEXT_LENGTH`, `MAX_BLUEPRINT_LABEL_LENGTH`, `MAX_BLUEPRINT_NUMBER`, `MAX_BLUEPRINT_ID_LENGTH` | Document bounds, not user-configurable |
22065
+
22066
+ `@vielzeug/refine/blueprint` imports nothing but `RefineError`: it is pure, DOM-free, and safe to run in a model harness, a worker, or CI. It registers no components.
22067
+
22068
+ `UI_BLUEPRINT_JSON_SCHEMA` constrains generation but cannot express the tree-wide node and depth bounds, so runtime validation stays mandatory. Treat the schema as a generation aid, never as the trust boundary.
22069
+
22070
+ ### `renderUiBlueprint(container, value, options?)`
22071
+
22072
+ ```ts
22073
+ import { renderUiBlueprint } from '@vielzeug/refine/blueprint/render';
22074
+
22075
+ try {
22076
+ const { element, nodes } = renderUiBlueprint(host, JSON.parse(modelOutput), { label: 'Generated summary' });
22077
+ nodes.get('rate')?.addEventListener('change', () => recalculate());
22078
+ } catch (error) {
22079
+ // The container is untouched: the previous preview is still on screen.
22080
+ }
22081
+ ```
22082
+
22083
+ Validate `value`, then render it into `container` using only registry components. Importing the entry registers those thirteen components, so no separate component imports are needed.
22084
+
22085
+ | Parameter | Type | Description |
22086
+ | --- | --- | --- |
22087
+ | `container` | `HTMLElement` | Element that receives the rendered tree |
22088
+ | `value` | `unknown` | Untrusted model output. Validated before anything is rendered |
22089
+ | `options.label` | `string?` | Accessible name for a `role="group"` wrapper. Host-owned: a document cannot set it |
22090
+ | `options.replace` | `boolean?` | Clear the container first. Default `true`; `false` appends |
22091
+
22092
+ **Returns** a `UiBlueprintRenderResult`: `{ element, nodes }`, the rendered root and a `ReadonlyMap` keyed by each node's optional `id` so the host can wire behaviour to addressable controls. `id` is host-facing metadata: the renderer never writes it to the DOM. Validation runs first, so a rejected document throws `UiBlueprintError` before the container is read or written: an invalid response can never partially render or erase a valid preview. Text becomes a text node, never markup.
22093
+
22094
+ ### `createUiBlueprintElement(node, owner?, nodes?)`
22095
+
22096
+ ```ts
22097
+ import { createUiBlueprintElement } from '@vielzeug/refine/blueprint/render';
22098
+
22099
+ const element = createUiBlueprintElement(document.root, 'root', nodeMap);
22100
+ ```
22101
+
22102
+ Build one element for an already-validated node. Pass a `Map` as `nodes` to collect every id-tagged element it creates, including nested ones; `owner` labels the node's position in rejection messages. This is the component registry: adding a component means adding a rule in the contract and a case here, and nothing else. It throws `TypeError` for an unregistered node type, so a hand-built node cannot bypass validation either. Embedders that place nodes themselves use this; `renderUiBlueprint()` is the normal entry point.
22103
+
22046
22104
  ## Types
22047
22105
 
22048
22106
  Component props follow the `OreProps` naming pattern. Event maps follow `OreEvents`. Import both from the component subpath that owns them.
@@ -22063,6 +22121,16 @@ class RefineError extends Error {
22063
22121
 
22064
22122
  Base class for public Refine errors. It preserves `cause` through `ErrorOptions`.
22065
22123
 
22124
+ ### `UiBlueprintError`
22125
+
22126
+ ```ts
22127
+ class UiBlueprintError extends RefineError {
22128
+ readonly issues: readonly string[];
22129
+ }
22130
+ ```
22131
+
22132
+ Thrown by `parseUiBlueprint()` and `renderUiBlueprint()` for a rejected on-demand UI document. Every rejection is collected first, so `issues` lists all of them at once, each as a field path plus a plain reason (`root.children[0].size: expected one of sm, md, lg, received string.`). The messages name fields and allowed values, report a wrong-typed value only as its *type*, and echo an accepted-type value only as a truncated snippet, so they are safe to display to a user. See [On-Demand UI Documents](./on-demand-ui).
22133
+
22066
22134
  ### Usage Guide
22067
22135
 
22068
22136
  ## Basic Usage
@@ -22307,6 +22375,7 @@ Use Necromancer directly when you need animation handles, groups, or explicit ke
22307
22375
  - **Dispose** application-owned Ripple effects and service handles.
22308
22376
  - **Guard** DOM-dependent component registration during SSR.
22309
22377
  - **Working with AI agents?** Install the `vielzeug` skill (`npx -y @vielzeug/codex skills install`) so agents reach for Refine components and tokens instead of custom widgets: see the [Codex usage guide](../codex/usage.md#agent-skill).
22378
+ - **Rendering model-authored UI?** Validate it through the [on-demand UI document contract](./on-demand-ui) instead of trusting model output; never build DOM from unvalidated JSON.
22310
22379
 
22311
22380
  ---
22312
22381
 
package/data/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # Vielzeug
2
2
 
3
- > 43 focused TypeScript packages. Version: 26.11.1
3
+ > 43 focused TypeScript packages. Version: 26.11.3
4
4
 
5
5
  Install any package independently: `pnpm add @vielzeug/<name>`
6
6
 
@@ -4,5 +4,5 @@
4
4
  "refine": "refine.json",
5
5
  "schemaVersion": 1,
6
6
  "search": "search.json",
7
- "version": "26.11.1"
7
+ "version": "26.11.3"
8
8
  }
@@ -1,9 +1,9 @@
1
1
  {
2
- "apiSource": "/**\n * `@vielzeug/codex`: supported public contract.\n *\n * Exposes the generic catalog, snapshot loader, errors, and server hosts.\n * Refine catalog types and tools live behind `@vielzeug/codex/refine`.\n */\nexport { StdioServerTransport } from '@modelcontextprotocol/server/stdio';\nexport { type Catalog, CatalogError, type SearchHit, SnapshotCatalog } from './catalog.js';\nexport { CodexError } from './errors.js';\nexport { type HttpHost, type HttpHostOptions, startHttpHost } from './http.js';\nexport { createMcpServer } from './server.js';\nexport { type LoadedSnapshot, loadSnapshot } from './snapshot.js';\nexport type {\n DocPage,\n Example,\n PackageContent,\n PackageMeta,\n SnapshotManifest,\n} from './types.js';\n",
2
+ "apiSource": "/**\n * `@vielzeug/codex`: supported public contract.\n *\n * Exposes the generic catalog, snapshot loader, errors, and server hosts.\n * Refine catalog types and tools live behind `@vielzeug/codex/refine`.\n */\nexport { StdioServerTransport } from '@modelcontextprotocol/server/stdio';\nexport { type Catalog, CatalogError, type SearchHit, SnapshotCatalog } from './catalog.js';\nexport { CodexError } from './errors.js';\nexport { type HttpHost, type HttpHostOptions, startHttpHost } from './http.js';\nexport { createMcpServer } from './server.js';\nexport { type LoadedSnapshot, loadSnapshot } from './snapshot.js';\nexport type {\n DocPage,\n Example,\n PackageMeta,\n SnapshotManifest,\n} from './types.js';\n",
3
3
  "docs": {
4
- "index": "---\ntitle: Codex\ndescription: Local MCP access to Vielzeug documentation and package metadata.\npackage: codex\ncategory: AI\nkeywords: [mcp, docs, ai]\nrelated: [refine]\nexports: [loadSnapshot, SnapshotCatalog, createMcpServer, startHttpHost, StdioServerTransport, CatalogError, CodexError]\nenvironments: [node]\n---\n\n<PackageHero package=\"codex\" />\n\n## Why Codex?\n\nCodex exposes current Vielzeug catalog data through MCP without scanning source at request time.\n\n## Installation\n\n```sh\npnpm add @vielzeug/codex\n```\n\n## Quick Start\n\n```sh\nnpx -y @vielzeug/codex\n```\n\n## Features\n\n- `loadSnapshot` validates chunked snapshot metadata.\n- `SnapshotCatalog` loads package content only when requested.\n- `createMcpServer` registers generic package tools; `/refine` adds component tools explicitly.\n- Root and `/refine` entry points publish TypeScript declarations.\n- `startHttpHost` enforces loopback binding plus localhost Host and Origin validation.\n\n## Documentation\n\n- [Usage](./usage.md)\n- [API](./api.md)\n- [Examples](./examples.md)\n- [Migration Guide](./migration.md)\n\n## See Also\n\n- [Refine](../refine/) provides component metadata bundled by Codex.\n",
5
- "api": "---\ntitle: Codex API\ndescription: Snapshot, catalog, MCP server, and local HTTP host APIs.\n---\n\n[[toc]]\n\n## API Overview\n\n| Symbol | Purpose | Execution mode | Common gotcha |\n| --- | --- | --- | --- |\n| `loadSnapshot` | Read validated snapshot metadata | Sync | Content chunks load lazily |\n| `SnapshotCatalog` | Query package corpus | Sync | Construct from loaded snapshot |\n| `createMcpServer` | MCP adapter factory (generic tools) | Sync | Requires catalog and version |\n| `startHttpHost` | Loopback Streamable HTTP host | Async | HTTP remains local-only |\n| `registerRefineTools` | Opt-in Refine tool registration | Sync | Import from `@vielzeug/codex/refine` |\n\n## Package Entry Points\n\n| Import | Purpose |\n| --- | --- |\n| `@vielzeug/codex` | `Catalog`, `SnapshotCatalog`, `loadSnapshot`, MCP server, and HTTP host |\n| `@vielzeug/codex/refine` | Opt-in Refine component tools (`registerRefineTools`) |\n\n## Snapshot\n\n### `loadSnapshot`\n\n```ts\nloadSnapshot(snapshotRoot?: string, options?: { validateContents?: boolean }): LoadedSnapshot;\n```\n\nLoads catalog/search metadata and Refine metadata. `snapshotRoot` defaults to bundled `data/`. Package content chunks stay lazy unless `validateContents: true`, which validates every package content chunk during loading.\n\n### `SnapshotCatalog`\n\n```ts\nnew SnapshotCatalog(snapshot: LoadedSnapshot)\n```\n\nProvides generic package lookup, docs/source/example/signature access, and deterministic search. Use `SnapshotRefineCatalog` from `/refine` when component methods are needed.\n\n---\n\n## MCP\n\n### `createMcpServer`\n\n```ts\ncreateMcpServer(catalog: Catalog, options: { version: string; debug?: boolean }): Server;\n```\n\nRegisters generic package tools over `Catalog`. Refine tools are opt-in through `/refine`. The root also re-exports `StdioServerTransport` for connecting the server without a second package import.\n\n## Refine tools (`@vielzeug/codex/refine`)\n\n### `SnapshotRefineCatalog`\n\n```ts\nnew SnapshotRefineCatalog(snapshot: LoadedSnapshot)\n```\n\nExtends `SnapshotCatalog` with `getComponent()` and `listComponents()`.\n\n### `registerRefineTools`\n\n```ts\nregisterRefineTools(server: Server, catalog: RefineCatalog, debug?: boolean): void;\n```\n\nUpgrades a server created by `createMcpServer()` with the combined generic and `refine-*` tool set. `refineTools` is exported as a readonly registry.\n\n## HTTP\n\n### `startHttpHost`\n\n```ts\nstartHttpHost(options: HttpHostOptions): Promise<HttpHost>;\n```\n\nStarts Streamable HTTP on `127.0.0.1` by default. Runtime validation accepts only `127.0.0.1` or `::1`; every request must also pass localhost Host and Origin checks. `configureServer` runs once for each lazily created MCP request server and is not called during host startup.\n\n## Types\n\n```ts\ninterface SnapshotPointer {\n directory: string;\n}\n\ninterface SnapshotManifest {\n catalog: 'catalog.json';\n contentDirectory: 'packages';\n refine: 'refine.json' | null;\n schemaVersion: typeof SNAPSHOT_SCHEMA_VERSION;\n search: 'search.json';\n version: string;\n}\n```\n\nDev snapshots use `SnapshotPointer` (via `current.json`); published snapshots are static directories.\n\n```ts\ninterface LoadedSnapshot {\n catalog: CatalogFile;\n contentDirectory: string;\n manifest: SnapshotManifest;\n refineComponents: CemDeclaration[];\n search: SearchRecord[];\n}\n```\n\n```ts\ninterface CatalogFile {\n packages: PackageMeta[];\n version: string;\n}\n\ninterface SearchRecord {\n category: string;\n description: string;\n docs: Partial<Record<DocPage, string>>;\n examples: Array<{ id: string; text: string }>;\n exports: string;\n keywords: string;\n name: string;\n related: string;\n slug: string;\n source: string | null;\n}\n\ninterface PackageMeta {\n availableDocPages: DocPage[];\n category: string;\n description: string;\n exampleIds: string[];\n exports: string[];\n hasSource: boolean;\n keywords: string[];\n name: string;\n related: string[];\n slug: string;\n version: string;\n}\n\ninterface PackageContent {\n apiSource: string | null;\n docs: Partial<Record<DocPage, string>>;\n examples: Example[];\n typeSignatures: Record<string, string>;\n}\n\ninterface Example {\n code: string;\n id: string;\n name: string;\n}\n```\n\n```ts\ninterface Catalog {\n getContent(slug: string): PackageContent;\n getDocs(slug: string, page: DocPage): string;\n getExample(slug: string, exampleId: string): Example;\n getPackage(slug: string): PackageMeta;\n getSource(slug: string): string;\n getTypeSignature(slug: string, symbol: string): string;\n listExamples(slug: string): Array<Pick<Example, 'id' | 'name'>>;\n listPackages(): PackageMeta[];\n search(query: string): SearchHit[];\n}\n\ninterface RefineCatalog extends Catalog {\n getComponent(tagName: string): CemDeclaration;\n listComponents(): CemDeclaration[];\n}\n\ninterface SearchHit {\n matchedExamples?: string[];\n matchedIn: Array<'docs' | 'examples' | 'exports' | 'keywords' | 'metadata' | 'related' | 'source'>;\n matchedPages?: DocPage[];\n name: string;\n slug: string;\n}\n```\n\n```ts\ninterface HttpHost {\n readonly disposalSignal: AbortSignal;\n dispose(): Promise<void>;\n readonly disposed: boolean;\n readonly host: string;\n readonly port: number;\n [Symbol.asyncDispose](): Promise<void>;\n}\n\ninterface HttpHostOptions {\n catalog: Catalog;\n configureServer?: (server: Server) => void;\n debug?: boolean;\n host?: '127.0.0.1' | '::1';\n port: number;\n version: string;\n}\n```\n\n```ts\nconst DOC_PAGES = ['index', 'api', 'usage', 'examples'] as const;\ntype DocPage = (typeof DOC_PAGES)[number];\n\nconst SNAPSHOT_SCHEMA_VERSION = 1 as const;\n```\n\nCEM types and `RefineCatalog` are exported from `/refine`.\n\n```ts\ninterface CemDeclaration {\n attributes?: CemAttribute[];\n cssParts?: CemCssPart[];\n cssProperties?: CemCssProperty[];\n description?: string;\n events?: CemEvent[];\n members?: CemMember[];\n name?: string;\n slots?: CemSlot[];\n superclass?: { name: string; package?: string };\n tagName?: string;\n [key: string]: unknown;\n}\n\ninterface CemAttribute {\n default?: string;\n description?: string;\n fieldName?: string;\n name: string;\n type?: { text: string };\n}\n\ninterface CemCssPart {\n description?: string;\n name: string;\n}\n\ninterface CemCssProperty {\n default?: string;\n description?: string;\n name: string;\n}\n\ninterface CemEvent {\n description?: string;\n name: string;\n type?: { text: string };\n}\n\ninterface CemMember {\n description?: string;\n kind?: 'field' | 'method';\n name: string;\n type?: { text: string };\n}\n\ninterface CemSlot {\n description?: string;\n name: string;\n}\n```\n\n## Errors\n\n`CodexError` signals malformed snapshots or host failures. `CatalogError` adds `INVALID_ARG`, `NOT_FOUND`, or `UNAVAILABLE` for expected tool failures.\n",
6
- "usage": "---\ntitle: 'Codex: Usage Guide'\ndescription: Install, connect, develop, and debug the Vielzeug MCP server.\n---\n\n[[toc]]\n\n## Basic Usage\n\nRun local stdio server:\n\n```sh\nnpx -y @vielzeug/codex\n```\n\nUse shipped `mcp-setup.json` for machine-readable generic configuration. Client-specific configuration must use its documented MCP format.\n\n## HTTP Mode\n\nHTTP uses Streamable HTTP and binds loopback only:\n\n```sh\nnpx -y @vielzeug/codex --port=3100\ncurl http://127.0.0.1:3100/health\n```\n\nResponse includes snapshot version. Runtime bind validation and Host/Origin allowlists restrict access to localhost; no remote host mode exists. Programmatic `configureServer` hooks run once per MCP request server, not at host startup. Dispose the host asynchronously and observe `disposed` or `disposalSignal` when coordinating shutdown.\n\n## Agent Skill\n\nCodex ships a `vielzeug` agent skill: a `SKILL.md` that tells an AI agent working in *your* project to discover packages through the MCP tools instead of guessing, to use the owning `@vielzeug/*` package instead of hand-rolling, and to build UI from Refine components, tokens, and theme whenever `@vielzeug/refine` is installed. Install it into the project:\n\n```sh\nnpx -y @vielzeug/codex skills install\nnpx -y @vielzeug/codex skills install --target=.claude/skills\nnpx -y @vielzeug/codex skills install --force # overwrite an existing copy\n```\n\nWithout `--target`, the first existing directory among `.agents/skills`, `.github/skills`, and `.claude/skills` is used; when none exists, `.agents/skills` is created. The command refuses to overwrite an installed skill unless `--force` is passed. Rerun after upgrading codex to pick up the current package list, which is generated from the published manifests. The skill pairs with the MCP server: its lookups (`get-docs`, `refine-get-component`, `refine-validate-usage`, …) assume codex is connected, and it documents `node_modules` fallbacks for when it is not.\n\n## Local Development\n\nRequires Node 22+ and root setup:\n\n```sh\npnpm setup\ncd packages/codex\npnpm test:unit\npnpm test:integration\npnpm dev\n```\n\n`test:unit` uses fixtures only. `test:integration` regenerates a current snapshot then checks real monorepo inputs.\n\n`pnpm dev` watches documentation and package inputs, atomically publishes snapshots, then restarts server when snapshot changes.\n\n## Debugging\n\n```sh\npnpm dev\nnode src/cli.ts --port=3100 --debug\ncurl http://127.0.0.1:3100/health\n```\n\n`--debug` logs tool durations and expected catalog errors to stderr. Build `@vielzeug/refine` before generating snapshot when component metadata changes.\n\n## Programmatic Usage\n\n```ts\nimport { SnapshotCatalog, StdioServerTransport, createMcpServer, loadSnapshot } from '@vielzeug/codex';\n\nconst snapshot = loadSnapshot();\nconst catalog = new SnapshotCatalog(snapshot);\nawait createMcpServer(catalog, { version: snapshot.manifest.version }).connect(new StdioServerTransport());\n```\n\nTo include Refine component tools, upgrade the server with the `@vielzeug/codex/refine` subpath:\n\n```ts\nimport { StdioServerTransport, createMcpServer, loadSnapshot } from '@vielzeug/codex';\nimport { SnapshotRefineCatalog, registerRefineTools } from '@vielzeug/codex/refine';\n\nconst snapshot = loadSnapshot();\nconst catalog = new SnapshotRefineCatalog(snapshot);\nconst server = createMcpServer(catalog, { version: snapshot.manifest.version });\nregisterRefineTools(server, catalog);\nawait server.connect(new StdioServerTransport());\n```\n\n## Best Practices\n\n- Use `search-packages` for capability discovery before loading broad source.\n- Use `get-type-signature` before loading full source.\n- Published package snapshots are static directories; local dev snapshots are immutable generations selected by `.dev/current.json`.\n- Pass `validateContents: true` to `loadSnapshot()` for artifact verification; normal startup keeps package chunks lazy.\n- Treat `configureServer` as a per-request factory hook and avoid process-global side effects.\n- Keep HTTP local. Use stdio for normal client integration.\n- Run `pnpm test:unit` before `pnpm test:integration`.\n",
4
+ "index": "---\ntitle: Codex\ndescription: Local MCP access to Vielzeug documentation and package metadata.\npackage: codex\ncategory: AI\nkeywords: [mcp, docs, ai]\nrelated: [refine]\nexports: [loadSnapshot, SnapshotCatalog, createMcpServer, createMcpServerWithRefine, startHttpHost, StdioServerTransport, CatalogError, CodexError]\nenvironments: [node]\n---\n\n<PackageHero package=\"codex\" />\n\n## Why Codex?\n\nCodex exposes current Vielzeug catalog data through MCP without scanning source at request time.\n\n## Installation\n\n```sh\npnpm add @vielzeug/codex\n```\n\n## Quick Start\n\n```sh\nnpx -y @vielzeug/codex\n```\n\n## Features\n\n- `loadSnapshot` validates chunked snapshot metadata.\n- `SnapshotCatalog` loads package content only when requested.\n- `createMcpServer` registers generic package tools; `/refine` adds component tools explicitly.\n- Root and `/refine` entry points publish TypeScript declarations.\n- `startHttpHost` enforces loopback binding plus localhost Host and Origin validation.\n\n## Documentation\n\n- [Usage](./usage.md)\n- [API](./api.md)\n- [Examples](./examples.md)\n- [Migration Guide](./migration.md)\n\n## See Also\n\n- [Refine](../refine/) provides component metadata bundled by Codex.\n",
5
+ "api": "---\ntitle: Codex API\ndescription: Snapshot, catalog, MCP server, and local HTTP host APIs.\n---\n\n[[toc]]\n\n## API Overview\n\n| Symbol | Purpose | Execution mode | Common gotcha |\n| --- | --- | --- | --- |\n| `loadSnapshot` | Read validated snapshot metadata | Sync | Content chunks load lazily |\n| `SnapshotCatalog` | Query package corpus | Sync | Construct from loaded snapshot |\n| `createMcpServer` | MCP adapter factory (generic tools) | Sync | Requires catalog and version |\n| `createMcpServerWithRefine` | MCP adapter factory (all package and Refine tools) | Sync | Import from `@vielzeug/codex/refine` |\n| `startHttpHost` | Loopback Streamable HTTP host | Async | HTTP remains local-only |\n\n## Package Entry Points\n\n| Import | Purpose |\n| --- | --- |\n| `@vielzeug/codex` | `Catalog`, `SnapshotCatalog`, `loadSnapshot`, MCP server, and HTTP host |\n| `@vielzeug/codex/refine` | Refine catalog and MCP server with component tools |\n\n## Snapshot\n\n### `loadSnapshot`\n\n```ts\nloadSnapshot(snapshotRoot?: string, options?: { validateContents?: boolean }): LoadedSnapshot;\n```\n\nLoads catalog/search metadata and Refine metadata. `snapshotRoot` defaults to bundled `data/`. Package content chunks stay lazy unless `validateContents: true`, which validates every package content chunk during loading.\n\n### `SnapshotCatalog`\n\n```ts\nnew SnapshotCatalog(snapshot: LoadedSnapshot)\n```\n\nProvides generic package lookup, docs/source/example/signature access, and deterministic search. Use `SnapshotRefineCatalog` from `/refine` when component methods are needed.\n\n---\n\n## MCP\n\n### `createMcpServer`\n\n```ts\ncreateMcpServer(catalog: Catalog, options: { version: string; debug?: boolean }): Server;\n```\n\nRegisters generic package tools over `Catalog`. Refine tools are opt-in through `/refine`. The root also re-exports `StdioServerTransport` for connecting the server without a second package import.\n\n## Refine tools (`@vielzeug/codex/refine`)\n\n### `createMcpServerWithRefine`\n\n```ts\ncreateMcpServerWithRefine(catalog: RefineCatalog, options: { version: string; debug?: boolean }): Server;\n```\n\nCreates a server with the general Vielzeug package catalog tools and the additional `refine-*` component tools.\n\n### `SnapshotRefineCatalog`\n\n```ts\nnew SnapshotRefineCatalog(snapshot: LoadedSnapshot)\n```\n\nExtends `SnapshotCatalog` with `getComponent()` and `listComponents()`.\n\nComponent declarations and their nested data use readonly TypeScript types.\n\n## HTTP\n\n### `startHttpHost`\n\n```ts\nstartHttpHost(options: HttpHostOptions): Promise<HttpHost>;\n```\n\nStarts Streamable HTTP on `127.0.0.1` by default. Runtime validation accepts only `127.0.0.1` or `::1`; every request must also pass localhost Host and Origin checks. `createServer` must return a fresh, unconnected server with its request handlers registered.\n\n## Types\n\n```ts\ninterface SnapshotPointer {\n readonly directory: string;\n}\n\ninterface SnapshotManifest {\n readonly catalog: 'catalog.json';\n readonly contentDirectory: 'packages';\n readonly refine: 'refine.json' | null;\n readonly schemaVersion: typeof SNAPSHOT_SCHEMA_VERSION;\n readonly search: 'search.json';\n readonly version: string;\n}\n```\n\nDev snapshots use `SnapshotPointer` (via `current.json`); published snapshots are static directories.\n\n```ts\ninterface LoadedSnapshot {\n readonly catalog: CatalogFile;\n readonly contentDirectory: string;\n readonly manifest: SnapshotManifest;\n readonly refineComponents: readonly CemDeclaration[];\n readonly search: readonly SearchRecord[];\n}\n```\n\n```ts\ninterface CatalogFile {\n readonly packages: readonly PackageMeta[];\n readonly version: string;\n}\n\ninterface SearchRecord {\n readonly category: string;\n readonly description: string;\n readonly docs: Readonly<Partial<Record<DocPage, string>>>;\n readonly examples: readonly { readonly id: string; readonly text: string }[];\n readonly exports: string;\n readonly keywords: string;\n readonly name: string;\n readonly related: string;\n readonly slug: string;\n readonly source: string | null;\n}\n\ninterface PackageMeta {\n readonly availableDocPages: readonly DocPage[];\n readonly category: string;\n readonly description: string;\n readonly exampleIds: readonly string[];\n readonly exports: readonly string[];\n readonly hasSource: boolean;\n readonly keywords: readonly string[];\n readonly name: string;\n readonly related: readonly string[];\n readonly slug: string;\n readonly version: string;\n}\n\ninterface Example {\n readonly code: string;\n readonly id: string;\n readonly name: string;\n}\n```\n\n```ts\ninterface Catalog {\n getDocs(slug: string, page: DocPage): string;\n getExample(slug: string, exampleId: string): Example;\n getPackage(slug: string): PackageMeta;\n getSource(slug: string): string;\n getTypeSignature(slug: string, symbol: string): string;\n listExamples(slug: string): readonly Pick<Example, 'id' | 'name'>[];\n listPackages(): readonly PackageMeta[];\n search(query: string): readonly SearchHit[];\n}\n\ninterface RefineCatalog extends Catalog {\n getComponent(tagName: string): CemDeclaration;\n listComponents(): readonly CemDeclaration[];\n}\n\ninterface SearchHit {\n readonly matchedExamples?: readonly string[];\n readonly matchedIn: readonly ('docs' | 'examples' | 'exports' | 'keywords' | 'metadata' | 'related' | 'source')[];\n readonly matchedPages?: readonly DocPage[];\n readonly name: string;\n readonly slug: string;\n}\n```\n\nCatalog exposes semantic reads. It does not expose its cached content chunks.\n\n```ts\ninterface HttpHost {\n readonly disposalSignal: AbortSignal;\n dispose(): Promise<void>;\n readonly disposed: boolean;\n readonly host: string;\n readonly port: number;\n [Symbol.asyncDispose](): Promise<void>;\n}\n\ninterface HttpHostOptions {\n createServer: () => Server;\n host?: '127.0.0.1' | '::1';\n port: number;\n version: string;\n}\n```\n\n```ts\nconst DOC_PAGES = ['index', 'api', 'usage', 'examples'] as const;\ntype DocPage = (typeof DOC_PAGES)[number];\n\nconst SNAPSHOT_SCHEMA_VERSION = 1 as const;\n```\n\nCEM types and `RefineCatalog` are exported from `/refine`.\n\n```ts\ninterface CemDeclaration {\n readonly attributes?: readonly CemAttribute[];\n readonly cssParts?: readonly CemCssPart[];\n readonly cssProperties?: readonly CemCssProperty[];\n readonly description?: string;\n readonly events?: readonly CemEvent[];\n readonly members?: readonly CemMember[];\n readonly name?: string;\n readonly slots?: readonly CemSlot[];\n readonly superclass?: { readonly name: string; readonly package?: string };\n readonly tagName?: string;\n readonly [key: string]: unknown;\n}\n\ninterface CemAttribute {\n readonly default?: string;\n readonly description?: string;\n readonly fieldName?: string;\n readonly name: string;\n readonly type?: { readonly text: string };\n}\n\ninterface CemCssPart {\n readonly description?: string;\n readonly name: string;\n}\n\ninterface CemCssProperty {\n readonly default?: string;\n readonly description?: string;\n readonly name: string;\n}\n\ninterface CemEvent {\n readonly description?: string;\n readonly name: string;\n readonly type?: { readonly text: string };\n}\n\ninterface CemMember {\n readonly description?: string;\n readonly kind?: 'field' | 'method';\n readonly name: string;\n readonly type?: { readonly text: string };\n}\n\ninterface CemSlot {\n readonly description?: string;\n readonly name: string;\n}\n```\n\n## Errors\n\n`CodexError` signals malformed snapshots or host failures. `CatalogError` adds `INVALID_ARG`, `NOT_FOUND`, or `UNAVAILABLE` for expected tool failures.\n",
6
+ "usage": "---\ntitle: 'Codex: Usage Guide'\ndescription: Install, connect, develop, and debug the Vielzeug MCP server.\n---\n\n[[toc]]\n\n## Basic Usage\n\nRun local stdio server:\n\n```sh\nnpx -y @vielzeug/codex\n```\n\nUse shipped `mcp-setup.json` for machine-readable generic configuration. Client-specific configuration must use its documented MCP format.\n\n## HTTP Mode\n\nHTTP uses Streamable HTTP and binds loopback only:\n\n```sh\nnpx -y @vielzeug/codex --port=3100\ncurl http://127.0.0.1:3100/health\n```\n\nResponse includes snapshot version. Runtime bind validation and Host/Origin allowlists restrict access to localhost; no remote host mode exists. Programmatic HTTP hosting takes a `createServer` factory that returns a fresh, unconnected server with its request handlers registered. Dispose the host asynchronously and observe `disposed` or `disposalSignal` when coordinating shutdown.\n\n## Agent Skill\n\nCodex ships a `vielzeug` agent skill: a `SKILL.md` that tells an AI agent working in *your* project to discover packages through the MCP tools instead of guessing, to use the owning `@vielzeug/*` package instead of hand-rolling, and to build UI from Refine components, tokens, and theme whenever `@vielzeug/refine` is installed. Install it into the project:\n\n```sh\nnpx -y @vielzeug/codex skills install\nnpx -y @vielzeug/codex skills install --target=.claude/skills\nnpx -y @vielzeug/codex skills install --force # overwrite an existing copy\n```\n\nWithout `--target`, the first existing directory among `.agents/skills`, `.github/skills`, and `.claude/skills` is used; when none exists, `.agents/skills` is created. The command refuses to overwrite an installed skill unless `--force` is passed. Rerun after upgrading codex to pick up the current package list, which is generated from the published manifests. The skill pairs with the MCP server: its lookups (`get-docs`, `refine-get-component`, `refine-validate-usage`, …) assume codex is connected, and it documents `node_modules` fallbacks for when it is not.\n\n## Local Development\n\nRequires Node 22+ and root setup:\n\n```sh\npnpm setup\ncd packages/codex\npnpm test:unit\npnpm test:integration\npnpm dev\n```\n\n`test:unit` uses fixtures only. `test:integration` regenerates a current snapshot then checks real monorepo inputs.\n\n`pnpm dev` watches documentation and package inputs, atomically publishes snapshots, then restarts server when snapshot changes.\n\n## Debugging\n\n```sh\npnpm dev\nnode src/cli.ts --port=3100 --debug\ncurl http://127.0.0.1:3100/health\n```\n\n`--debug` logs tool durations and expected catalog errors to stderr. Build `@vielzeug/refine` before generating snapshot when component metadata changes.\n\n## Programmatic Usage\n\n```ts\nimport { SnapshotCatalog, StdioServerTransport, createMcpServer, loadSnapshot } from '@vielzeug/codex';\n\nconst snapshot = loadSnapshot();\nconst catalog = new SnapshotCatalog(snapshot);\nawait createMcpServer(catalog, { version: snapshot.manifest.version }).connect(new StdioServerTransport());\n```\n\nTo include Refine component tools, create a server with the `@vielzeug/codex/refine` subpath:\n\n```ts\nimport { StdioServerTransport, loadSnapshot } from '@vielzeug/codex';\nimport { createMcpServerWithRefine, SnapshotRefineCatalog } from '@vielzeug/codex/refine';\n\nconst snapshot = loadSnapshot();\nconst catalog = new SnapshotRefineCatalog(snapshot);\nconst server = createMcpServerWithRefine(catalog, { version: snapshot.manifest.version });\nawait server.connect(new StdioServerTransport());\n```\n\n## Best Practices\n\n- Use `search-packages` for capability discovery before loading broad source.\n- Use `get-type-signature` before loading full source.\n- Published package snapshots are static directories; local dev snapshots are immutable generations selected by `.dev/current.json`.\n- Pass `validateContents: true` to `loadSnapshot()` for artifact verification; normal startup keeps package chunks lazy.\n- Return a fresh configured server from `startHttpHost`'s `createServer` factory.\n- Keep HTTP local. Use stdio for normal client integration.\n- Run `pnpm test:unit` before `pnpm test:integration`.\n",
7
7
  "examples": "---\ntitle: 'Codex: Examples'\ndescription: Practical MCP tool-call examples for package discovery, docs lookup, and Refine component queries.\n---\n\n## Examples\n\n- [Listing Packages](./examples/listing-packages.md)\n- [Searching Packages](./examples/searching-packages.md)\n- [Package Metadata](./examples/package-metadata.md)\n- [Reading Docs](./examples/reading-docs.md)\n- [Running REPL Examples](./examples/running-repl-examples.md)\n- [Looking Up Components](./examples/looking-up-components.md)\n- [Inspector](./examples/inspector.md)\n"
8
8
  },
9
9
  "examples": [],
@@ -20,10 +20,9 @@
20
20
  "createMcpServer": "export { createMcpServer } from './server.js';",
21
21
  "LoadedSnapshot": "export { type LoadedSnapshot, loadSnapshot } from './snapshot.js';",
22
22
  "loadSnapshot": "export { type LoadedSnapshot, loadSnapshot } from './snapshot.js';",
23
- "DocPage": "export type {\n DocPage,\n Example,\n PackageContent,\n PackageMeta,\n SnapshotManifest,\n} from './types.js';",
24
- "Example": "export type {\n DocPage,\n Example,\n PackageContent,\n PackageMeta,\n SnapshotManifest,\n} from './types.js';",
25
- "PackageContent": "export type {\n DocPage,\n Example,\n PackageContent,\n PackageMeta,\n SnapshotManifest,\n} from './types.js';",
26
- "PackageMeta": "export type {\n DocPage,\n Example,\n PackageContent,\n PackageMeta,\n SnapshotManifest,\n} from './types.js';",
27
- "SnapshotManifest": "export type {\n DocPage,\n Example,\n PackageContent,\n PackageMeta,\n SnapshotManifest,\n} from './types.js';"
23
+ "DocPage": "export type {\n DocPage,\n Example,\n PackageMeta,\n SnapshotManifest,\n} from './types.js';",
24
+ "Example": "export type {\n DocPage,\n Example,\n PackageMeta,\n SnapshotManifest,\n} from './types.js';",
25
+ "PackageMeta": "export type {\n DocPage,\n Example,\n PackageMeta,\n SnapshotManifest,\n} from './types.js';",
26
+ "SnapshotManifest": "export type {\n DocPage,\n Example,\n PackageMeta,\n SnapshotManifest,\n} from './types.js';"
28
27
  }
29
28
  }