Context
ADR-001 (`.maina/decisions/001-ai-package-consolidation.md`) accepted folding `@workkit/ai` into `@workkit/ai-gateway` via a deprecation shim at v1.0, removal at v2.0. This ticket tracks the implementation.
Scope
Changes to `@workkit/ai`
- Reimplement all public exports as thin wrappers over `@workkit/ai-gateway`:
- `ai(binding)` → construct an internal `createGateway({providers:{ai:{type:'workers-ai',binding}},defaultProvider:'ai'})`.
- `streamAI(binding, model, input, opts)` → call `.stream(model, input, opts)`; map `GatewayStreamEvent` back to `ReadableStream` for backwards compat.
- `withRetry`, `fallback`, `structuredAI`, `aiWithTools`, `createToolRegistry` → delegate.
- `StructuredOutputError` stays in `@workkit/ai` but is re-exported from `@workkit/ai-gateway` as well.
- `estimateTokens` stays where it is (low-cost, no dependency on gateway).
- Add `@deprecated` JSDoc on every public export citing ADR-001 and pointing at the migration guide.
- Update `package.json` description and `README.md` to lead with the deprecation notice.
- Add `@workkit/ai-gateway` as a `peerDependency` (or `dependency` — caller's choice after reviewing bundle impact).
Changes to `@workkit/ai-gateway`
- Add `README.md` migration section with before/after examples for every `@workkit/ai` export.
- Consider adding a `workersAiGateway(binding)` convenience factory equivalent to the common Workers-AI gateway config, as noted in ADR-001's open questions. Only if user feedback requests it post-shim.
Release
- `@workkit/ai` bumps to v1.0.0.
- Changeset explains the shim + deprecation timeline (remove at v2.0 after ≥2 minor releases).
- Announce in workkit release notes.
Acceptance
Context
ADR-001 (`.maina/decisions/001-ai-package-consolidation.md`) accepted folding `@workkit/ai` into `@workkit/ai-gateway` via a deprecation shim at v1.0, removal at v2.0. This ticket tracks the implementation.
Scope
Changes to `@workkit/ai`
Changes to `@workkit/ai-gateway`
Release
Acceptance