Submatter/plans/Plan-automation-foundation/Epic-model-provider-registry/Task-shared-schemas-resolve-model.md
Randall Stillwell e256380671 plan(automation): add mission-control foundation backlog and model-routing ADR
Documents the automation foundation plan (nine epics, Epic 1 taskified) and
the accepted model-provider registry contract. Updates .env.example for backlog
import workspace id and local/cloud AI provider env guidance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 13:55:03 -05:00

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 ready 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

  1. packages/shared — export:

    • providerTypeSchema enum: anthropic | openai | google | openai_compatible | azure_openai
    • modelProviderSchema, roleModelRouteSchema, resolvedModelSchema
    • resolveModel(input) — pure function; input includes optional brief/convoy overrides, workspace routes, provider catalog
    • PIPELINE_DEFAULT_ROLE_ROUTES constant (role_id → suggested alias names, not UUIDs)
    • LEGACY_CURSOR_MODEL_ALIASES map for slug migration
  2. Tests — packages/shared/src/model-routing/*.test.ts:

    • Resolution order: brief > convoy > workspace > default
    • Missing/disabled alias → structured error
    • Legacy slug remapping

Constraints

  • packages/shared must 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/shared index

Estimation

S (one agent session)

Acceptance criteria

  • pnpm --filter @tasks/shared test passes with new tests
  • pnpm type-check clean
  • Resolver matches resolution order in ADR § Architecture
  • Epic: ./Epic-model-provider-registry.md
  • Plan: ../Plan-automation-foundation.md
  • ADR: ../../../docs/adr-model-routing.md