Repository navigation
refactor(shared): derive WellKnownAgentType from TuiAgent - #19645
Conversation
The hand-written 22-member WellKnownAgentType union was a stale copy of the
launchable-agent list, 15 members behind TuiAgent: aug, autohand,
claude-agent-teams, cline, codebuff, continue, crush, goose, kilo, kimi, kiro,
mistral-vibe, openclaw, qwen-code, rovo. All 21 non-'unknown' members it did
carry were already TuiAgent members, so the union is now derived
(`TuiAgent | 'unknown'`) and cannot drift again.
'unknown' stays outside TuiAgent: it is the "no agent identified yet" sentinel,
not a launchable agent.
AgentType is structurally unchanged. `(string & {})` absorbs the union, so
AgentType was and remains `string` — this is a documentation/staleness fix with
no behaviour change and zero consumers affected (WellKnownAgentType had none
repo-wide beyond the AgentType alias itself).
tui-agent.ts is a pure type union with no imports, so this adds no cycle.
Adds a type-level coverage test that fails to compile if anyone reverts to a
hand-written list.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
WellKnownAgentTypenow derived fromTuiAgent— replaces the hand-maintained 22-member union withTuiAgent | 'unknown', so the well-known set can no longer drift from the launchable agents (qwen-code,mistral-vibe,claude-agent-teamswere previously dropped).- Two compile-time contract tests —
widenTuiAgentprovesTuiAgentremains assignable toWellKnownAgentType(fail-to-compile if the union is ever narrowed below the launchable set), andkeeps AgentType open to custom agent namespins the trailing(string & {}).
The refactor is sound: WellKnownAgentType has no production consumers (only AgentType, which stays open via (string & {}) and is semantically unchanged at runtime), all 21 prior members survive in the 36-member TuiAgent union, and the import type adds no runtime dependency. The two new tests are idiomatic "compile-time proof" guards matching existing patterns in the codebase; their expect(...) bodies are deliberately trivial since the value is in the type-level assertion. Verified agent-status-types.test.ts passes (55 tests).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to Well-known agent identifiers now automatically follow the launchable TUI agent set while retaining the unknown sentinel and custom agent support. The change is ready to merge with no identified current-head risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description explains the problem and solution, but it omits most required template sections, including ELI5, Why, Linked Issue, Visual Proof, Testing, AI Disclosure, Review, boundary confirmation, Notes, and the Checklist. Resolution Complete the required template sections. Add an issue reference after "Fixes #"; provide testing details and checklist status; add
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |

Problem
The
WellKnownAgentTypewas manually-maintained and fell out of sync—three agents ('qwen-code', 'mistral-vibe', 'claude-agent-teams') were missing from the hardcoded 22-member list.Solution
Derive
WellKnownAgentTypefromTuiAgent(the source of truth for launchable agents) plus 'unknown'. This eliminates manual sync work and auto-covers all launchable agents.Changed the type from a hardcoded union to
TuiAgent | 'unknown', and added compile-time and runtime tests to verify coverage.