Skip to content

Consolidate mirrored agent-type/ide-type tables into shared modules - #849

Merged
selfcontained merged 1 commit into
mainfrom
tech-debt/shared-agent-ide-types
Jul 29, 2026
Merged

Consolidate mirrored agent-type/ide-type tables into shared modules#849
selfcontained merged 1 commit into
mainfrom
tech-debt/shared-agent-ide-types

Conversation

@selfcontained

Copy link
Copy Markdown
Owner

What

Moves the agent-type and IDE-type constants/predicates that were duplicated verbatim across the server/web boundary into two new dependency-free shared modules:

  • apps/server/src/shared/agent-types.tsAGENT_TYPES, CLI_AGENT_TYPES, isAgentType, isCliAgentType, sanitizeEnabledAgentTypes
  • apps/server/src/shared/ide-types.tsIDE_TYPES, isIdeType, sanitizeEnabledIdes

apps/server/src/agent-type-settings.ts and ide-settings.ts keep their Pool-dependent getters and re-export the pure symbols, so no server importer changes. apps/web/src/lib/agent-types.ts and ide-types.ts re-export across the workspace boundary (same shape as media-file-types.ts from #844) and keep the web-only labels/helpers (AGENT_TYPE_LABELS, sortAgentTypes, isNestedReviewAgent, IDE_LABELS), so no web importer changes either.

Why it's tech debt

Adding an agent type today means editing two identical tables that have already started to drift in small ways (predicate signatures, comment wording). Same failure mode that produced the media file-type bugs fixed in #844.

Zero behavior change: only widening of isAgentType/isCliAgentType web signatures from (value: string) to (value: unknown), which is safe for all callers.

Validation

  • pnpm run check
  • pnpm run finalize:web
  • pnpm run test — 2362 server + 499 web + 60 passed ✅
  • pnpm run test:e2e — 174 passed, 12 skipped ✅

Queued next

Top of the tech-debt backlog: deduplicating the verbatim server↔web wire types (JobRecord/Job, TemplateRecord/Template, ReleaseJob), one file at a time.

🤖 Generated with Claude Code

AGENT_TYPES, CLI_AGENT_TYPES, and their predicates/sanitizers were
duplicated verbatim between apps/server/src/agent-type-settings.ts and
apps/web/src/lib/agent-types.ts; same for IDE_TYPES between
apps/server/src/ide-settings.ts and apps/web/src/lib/ide-types.ts.
Adding an agent type meant editing both copies.

Move the pure constants and predicates into dependency-free
apps/server/src/shared/agent-types.ts and shared/ide-types.ts,
following the media-file-types.ts shape from #844: the server settings
modules re-export so their importers are untouched, and the web lib
modules re-export across the workspace boundary so web importers keep
their "@/lib/..." specifiers. Pool-dependent getters stay on the
server; display labels and web-only helpers stay in web.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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