2 KiB
2 KiB
| kind | slug | title | plan_slug | epic_slug | status | priority | tenant_id | owner | cursor_todo_id | updated_at | agent_prompt |
|---|---|---|---|---|---|---|---|---|---|---|---|
| task | shared-schemas-resolve-model | Shared zod schemas and resolveModel() pure function | automation-foundation | model-provider-registry | done | P1 | global | unassigned | null | 2026-07-03 | Read docs/adr-model-routing.md first. Implement only packages/shared (and packages/ai if needed for zero DB imports in shared). No UI, no migration. claim_task this backlog item before coding; complete_task when done. |
Task summary
Add zod schemas and types for model providers, role routes, and a pure resolveModel() function per the ADR.
Description
Deliverables
-
packages/shared— export:providerTypeSchemaenum:anthropic|openai|google|openai_compatible|azure_openaimodelProviderSchema,roleModelRouteSchema,resolvedModelSchemaresolveModel(input)— pure function; input includes optional brief/convoy overrides, workspace routes, provider catalogPIPELINE_DEFAULT_ROLE_ROUTESconstant (role_id → suggested alias names, not UUIDs)LEGACY_CURSOR_MODEL_ALIASESmap for slug migration
-
Tests —
packages/shared/src/model-routing/*.test.ts:- Resolution order: brief > convoy > workspace > default
- Missing/disabled alias → structured error
- Legacy slug remapping
Constraints
packages/sharedmust not import DB or Node-only APIs.- Resolver accepts plain objects (tRPC/orchestrator loads rows and passes in).
Subtasks
- Add schemas and types
- Implement
resolveModel - Add vitest cases (≥6 scenarios)
- Export from
packages/sharedindex
Estimation
S (one agent session)
Acceptance criteria
pnpm --filter @tasks/shared testpasses with new testspnpm type-checkclean- Resolver matches resolution order in ADR § Architecture
Links
- Epic:
./Epic-model-provider-registry.md - Plan:
../Plan-automation-foundation.md - ADR:
../../../docs/adr-model-routing.md