@contractspec/lib.surface-runtime
v0.5.29
Published
AI-native surface specs and web runtime for adaptive ContractSpec surfaces
Maintainers
Readme
@contractspec/lib.surface-runtime
Website: https://contractspec.io
Surface runtime for AI-native ContractSpec experiences, including bundle specs, planners, overlays, patching, and React rendering support.
What It Provides
- Provides the runtime layer behind AI-planned surfaces, widget registries, overrides, and bundle resolution.
- Supports React rendering, adapter boundaries, telemetry, evaluation harnesses, and planner tooling.
- Recently expanded to better align with AI chat, i18n, workflow tools, and bundle export needs.
src/adapters/contains runtime, provider, or environment-specific adapters.
Installation
npm install @contractspec/lib.surface-runtime
or
bun add @contractspec/lib.surface-runtime
Usage
Import the root entrypoint from @contractspec/lib.surface-runtime, or choose a documented subpath when you only need one part of the package surface.
Architecture
src/spec/defines module-bundle and surface-patch validation surfaces.src/runtime/contains planners, registries, patch application, policy evaluation, and bundle resolution.src/react/exports the React integration layer for bundle rendering and override handling.src/adapters/,src.telemetry/,src.evals/, andsrc.examples/support integration and verification flows.src/index.tsis the root public barrel and package entrypoint.
Public Entry Points
- Exports runtime, spec, React integration, adapters, telemetry, eval, and example subpaths for AI-native surface composition.
- Export
.resolves through./src/index.ts. - Export
./adaptersresolves through./src/adapters/index.ts. - Export
./adapters/ai-sdk-stubresolves through./src/adapters/ai-sdk-stub.ts. - Export
./adapters/blocknote-stubresolves through./src/adapters/blocknote-stub.tsx. - Export
./adapters/dnd-kit-adapterresolves through./src/adapters/dnd-kit-adapter.tsx. - Export
./adapters/dnd-kit-stubresolves through./src/adapters/dnd-kit-stub.ts. - Export
./adapters/floating-ui-stubresolves through./src/adapters/floating-ui-stub.tsx. - Export
./adapters/interfacesresolves through./src/adapters/interfaces.ts. - Export
./adapters/motion-stubresolves through./src/adapters/motion-stub.ts. - Export
./adapters/resizable-panels-stubresolves through./src/adapters/resizable-panels-stub.tsx. - The package publishes 53 total export subpaths; keep docs aligned with
package.json.
Local Commands
bun run dev— contractspec-bun-build devbun run build— bun run prebuild && bun run build:bundle && bun run build:typesbun run test— bun test --pass-with-no-testsbun run lint— bun lint:fixbun run lint:check— biome check .bun run lint:fix— biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .bun run typecheck— tsc --noEmitbun run publish:pkg— bun publish --tolerate-republish --ignore-scripts --verbosebun run publish:pkg:canary— bun publish:pkg --tag canarybun run clean— rimraf dist .turbobun run build:bundle— contractspec-bun-build transpile && node scripts/fix-use-client-directive.mjsbun run build:types— contractspec-bun-build typesbun run lint:adapters— node scripts/lint-adapters.mjsbun run test:evals— bun test src/evals/bun run prebuild— contractspec-bun-build prebuild
Recent Updates
- Replace eslint+prettier by biomejs to optimize speed.
- Export, sidebar, workflow tools, slotContent.
- Vercel AI SDK parity + surface-runtime i18n and bundle alignment.
- Bundle spec alignment, i18n support, PM workbench pilot.
Notes
- No direct third-party UI imports outside
src/adapters/(when adapters are added). - Every surface must have verification.dimensions for all 7 preference dimensions.
- Adapter rule: BlockNote, dnd-kit, etc. behind adapter boundaries only.
