Skip to content

[WIP] model-routing-enhancement base branch#195

Open
jsyqrt wants to merge 2 commits into
mainfrom
feature/model-routing-enhancement
Open

[WIP] model-routing-enhancement base branch#195
jsyqrt wants to merge 2 commits into
mainfrom
feature/model-routing-enhancement

Conversation

@jsyqrt

@jsyqrt jsyqrt commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

📋 基本信息

  • 提交者: Backend Developer (ID: agt_45ee41456c2a1e988a9c19fd)
  • 关联任务: tsk_82332b2bf0098cf4e80faa02 (Wave 0)
  • 关联需求: req_6e6e455cc2798b4701f07892
  • 目标分支: main
  • 关联 Feature 分支: feature/model-routing-enhancement

🎯 背景与动机 (Why)

这是模型路由功能完善优化 (feature/model-routing) 的基础分支。本 PR 作为后续 Wave 1-4 工作的 base,所有任务分支都基于此分支。

参考:

  • 上游研究报告: delivery-reports/model-routing-research-step1.md (21KB)
  • 任务分解方案: delivery-reports/model-routing-decomposition-step2.md (15.5KB)
  • 上游原始分支: feat/model-routing @ commit 3e3d09d

🔧 变更内容 (What)

空 PR(带 marker commit)。本 PR 仅为 Wave 0 子任务 2 (shared 类型扩展) 提供 base。

后续将通过以下子任务的 PR 陆续合并到本分支:

  • T1 (shared 类型扩展) — Wave 0 / Subtask 2
  • T2a-T2d (Core 服务) — Wave 1
  • T3a-T3b, T5 (API + CLI) — Wave 2
  • T4a-T4d (Frontend) — Wave 3
  • T6-T8 (Quality) — Wave 4

✅ 验证方式 (How to Verify)

  • feature/model-routing-enhancement 从 main 创建并 push
  • 分支追踪 origin/main
  • Marker commit 建立 base(避免 GraphQL "no commits" 错误)

👤 评审人

  • Reviewer: Code Reviewer (agt_42fc22d8cd79900a089eea09)
  • 最终合入: Owner (jsyqrt)

Auto-generated by Backend Developer for [模型路由] enhancement Wave 0 / Subtask 1

Backend Developer added 2 commits June 15, 2026 12:22
Wave 0 / Subtask 1 — Create base branch for model-routing enhancement feature.

This is the foundation branch for the 5-Wave implementation:
- Wave 0: Shared types extension (current task)
- Wave 1: Core services (catalog/scores/profile/router)
- Wave 2: API endpoints + CLI
- Wave 3: Frontend (ModelSelect + ModelRoutingSection + Settings)
- Wave 4: Quality (e2e + review + docs)

Reference:
- Upstream: feat/model-routing @ 3e3d09d (33 files, 3700+ lines)
- Research: delivery-reports/model-routing-research-step1.md
- Decomposition: delivery-reports/model-routing-decomposition-step2.md
- Task: tsk_82332b2bf0098cf4e80faa02
…ypes (tier/cost/task/strategy)

Wave 0: extend @markus/shared foundation for the model-routing feature.

- packages/shared/src/types/model-catalog.ts
  + Add ModelTier ('base'|'pro'|'max') + CostTier ('$'..'4834648346')
  + Add ModelTaskType (12 types: text_chat/reasoning/coding/.., image_*, audio_*, video_*, embedding, web_search)
  + Add RoutingStrategy (always_max/always_cheapest/balanced/cache_optimized)
  + Add MultiModalStrategy, PricingType, PriceConfidence enums
  + Add TaskModelAssignment, TaskRoutingConfig, RoutingConfig
  + Add NormalizedCost, ModelQuality, ProviderCapabilities, ModelProfile
- packages/shared/src/types/llm.ts
  + Add optional `tier?: ModelTier` field to ModelDefinition
- packages/shared/src/utils/config.ts
  + Add `routing?: RoutingConfig` and `taskRouting?: TaskRoutingConfig` to llm config block

All new types are non-breaking additions — existing consumers (CLI/core/org-manager) compile clean.

Verification:
- pnpm --filter @markus/shared build: success
- pnpm typecheck: success (tsc -b + web-ui)
@jsyqrt

jsyqrt commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

✅ Code Review — Approved

Reviewer: Code Reviewer (agt_42fc22d8cd79900a089eea09)
Task: tsk_82332b2bf0098cf4e80faa02 — [模型路由] Backend Wave 0 — 共享类型扩展与 Feature 分支准备
Base Branch: main → feature/model-routing-enhancement


Verification Results

Check Status Details
PR State OPEN / MERGEABLE
Commits 2 commits: 56518b3 (marker) + 907569c (types)
Files / Insertions 4 files / 160 insertions
Feature Branch feature/model-routing-enhancement @ 907569c
pnpm --filter @markus/shared build tsc -b exit 0
pnpm typecheck (all packages) tsc -b && web-ui exit 0
pnpm test (vitest) 46 files / 722 tests all passed

Code Review Summary

New types in model-catalog.ts (+152 lines):

  • ModelTier (base/pro/max), CostTier ($/$$/$$$/$$$$)
  • ModelTaskType (12 types: text_chat, reasoning, coding, translation, summary, image_recognition, image_generation, audio_tts, audio_stt, video_generation, embedding, web_search)
  • RoutingStrategy (always_max/always_cheapest/balanced/cache_optimized)
  • CatalogModel, CatalogStatus, ValidateKeyRequest, ValidateKeyResponse
  • ModelProfile, ModelQuality, NormalizedCost, ProviderCapabilities
  • TaskRoutingConfig, RoutingConfig
  • LiteLLMRawModelEntry (LiteLLM adapter input)

Extended files:

  • llm.ts: ModelDefinition.tier? (non-breaking)
  • config.ts: routing config injection (+5 lines)
  • models.ts: unchanged (PROVIDERS already has models: string[])

Naming convention compliance: ✅ All PascalCase types, snake_case union literals, kebab-case filenames

Spec Deviations (pre-accepted by PM + Code Reviewer, awaiting Owner confirmation)

  1. CostTier: $/$$/$$$/$$$$ (4 tiers) vs spec economy/standard/premium (3 tiers)
  2. RoutingStrategy: behavior semantics vs spec cost-first/quality-first/latency-first/round-robin

Decision

Approved

Merging Note

Per team policy, Agents must NOT merge PRs themselves. This PR (feature/model-routing-enhancement) serves as the base branch for subsequent Wave 1-4 feature work and should remain open for incremental merges. Please have the Owner (jsyqrt) finalize.

3 Owner pre-decisions needed before Wave 1 starts:

  1. ID aliases — cross-provider model identity mapping
  2. qualityScore schema — numeric range definition
  3. Cache key strategy — prompt cache reuse rules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant