This document defines a migration away from shipping vendor adapters inside the core magic-crayon package.
Keep magic-crayon focused on browser-native drawing behavior and the command contract, while moving vendor-specific agent integrations to companion packages.
- Reduce coupling between UI/runtime releases and vendor API drift.
- Keep the core package small, stable, and framework/vendor agnostic.
- Allow independent release cadence for adapter integrations.
- Make it easier for consumers to choose only the adapter surface they need.
Core magic-crayon package should own:
magic-crayonelement and runtime behavior.- Command contract types (
command/types). - Command runtime execution (
command/runtime). - Vendor-agnostic parsing primitives, if any are truly generic.
Companion adapter packages should own:
- AI SDK adapter mapping and schemas.
- CopilotKit adapter mapping and schemas.
- Vendor-specific payload normalization and naming quirks.
- Vendor-specific test fixtures and compatibility notes.
magic-crayon- exports:
../command/types./command/runtime./defined
- exports:
@magic-crayon/adapter-ai-sdk- exports adapter parse entry and adapter-related types.
@magic-crayon/adapter-copilotkit- exports adapter parse entry and adapter-related types.
- Move adapter implementation source from core into new package folders/repositories.
- Keep adapter code compiling against the public
magic-crayon/command/typescontract only. - Avoid direct imports from core internals that are not part of public exports.
Exit criteria:
- Companion packages build and test independently.
- Core package has no runtime dependency on vendor adapters.
- Publish
@magic-crayon/adapter-ai-sdk. - Publish
@magic-crayon/adapter-copilotkit. - Document installation and usage examples in package READMEs.
Exit criteria:
- Consumers can install adapter packages without importing adapter code from core.
- Remove adapter exports from
magic-crayonpackage exports. - Remove adapter source from core package.
- Keep docs in core pointing users to companion package names.
Exit criteria:
- Core exports include only element + command/runtime surfaces.
- No adapter code ships in core dist artifacts.
- Move adapter-focused tests out of core into each companion package.
- Keep integration tests in one place to validate end-to-end command flow.
- Track compatibility matrix by adapter package version.
Exit criteria:
- Adapter versioning and release cadence are independent from core.
Because this migration removes adapter exports from magic-crayon, treat the de-scope as a major release boundary unless already in a pre-1.0 compatibility window where breakage is expected.
Before:
- Import adapters from core package subpaths.
After:
- Install companion package(s).
- Import adapters from
@magic-crayon/adapter-ai-sdkor@magic-crayon/adapter-copilotkit. - Keep command application logic unchanged against
magic-crayon/command/runtime.
Risk: Fragmented version compatibility.
- Mitigation: Publish and maintain a compatibility table in each adapter package README.
Risk: Consumer confusion during transition.
- Mitigation: Add concise migration snippets and explicit deprecation/removal notes.
Risk: Duplicate shared adapter types.
- Mitigation: Keep shared contracts in a small shared package only if needed; otherwise colocate minimal types per adapter package.
Create companion package skeletons first, wire CI for each package, then remove adapter exports from core in one explicit release step.