Move docs/ package mirror into document-navigator plugin

Relocate the ~6k-file docs tree from the repo root into
plugins/document-navigator/docs/ so the plugin is self-contained and
portable. docs/superpowers/ (specs and plans) stays at the repo root.

Moved via cp+rm rather than git mv because directory rename() fails with
EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the
identical-content files at commit time.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-30 01:10:00 +01:00
parent fe3fedf42e
commit 9bf56a806b
6022 changed files with 12437 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
# `sampler/schemas`
<!-- begin:auto-docs -->
_(no submodules)_
<!-- end:auto-docs -->
## Purpose
Zod schemas validating the construction-time options, load options, and preset payload of `SamplerPlugin`. These run on the public boundary so any malformed object is rejected with `AUDIO_FX.INVALID_OPTIONS` / `AUDIO_FX.INVALID_PRESET` before it can corrupt runtime state.
Separating schemas from the plugin module lets `index.ts` re-export them so callers can introspect the option surface (for forms, RPC validation, or storybook controls) without importing the audio implementation.
## Features
- `SamplerPluginOptionsSchema` — `initialMaxVoices` integer 1..128, `initialReleaseMs` 0..5000.
- `SamplerLoadOptionsSchema` — `.strict()` with `signal: AbortSignal | undefined`.
- `SamplerPresetDataSchema` — empty strict object; the sampler has no plugin-specific preset payload.
## Usage: Basic Example
```ts
import { SamplerPluginOptionsSchema } from "@suaveplan/audio-fx-plugin-sampler";
const parsed = SamplerPluginOptionsSchema.parse({ initialMaxVoices: 16 });
```
## Usage: Advanced Example
```ts
import {
SamplerLoadOptionsSchema,
SamplerPluginOptionsSchema,
} from "@suaveplan/audio-fx-plugin-sampler";
// Validate load options from an RPC boundary before forwarding.
function safeLoadOptions(blob: unknown) {
return SamplerLoadOptionsSchema.parse(blob);
}
// Driver for an editor form: pull the keys from the schema.
const fields = SamplerPluginOptionsSchema.keyof().options;
```
## API Reference
- `SamplerPluginOptionsSchema: z.ZodObject<{ initialMaxVoices?, initialReleaseMs? }>`
- `SamplerLoadOptionsSchema: z.ZodObject<{ signal? }, "strict">`
- `SamplerPresetDataSchema: z.ZodObject<{}, "strict">`
## Implementation Notes
`SamplerLoadOptionsSchema` uses `z.instanceof(AbortSignal)` for the signal field. `instanceof` is the only Zod check that can verify a value is a real `AbortSignal` rather than a structurally-similar object — a fake `{ aborted: false, addEventListener: () => {} }` would pass a duck-typed check but break the actual abort wiring. The constructor-identity check is reliable in any runtime that exposes `AbortSignal` as a global (browser, Node 18+, Bun).
The schemas are duplicated in concept between the OpenSpec and the enterprise main-branch spec; this implementation reflects the OpenSpec (subset of the enterprise spec). Future revisions extending the sampler to support multi-velocity layers or round-robin sample selection would extend these schemas with optional fields and update `SamplerPresetDataSchema` accordingly.