Skip to content

gut(ui): remove plugin discriminator from tool catalog types (#2522)#2534

Merged
alexey-pelykh merged 1 commit intomainfrom
gut/ui-plugin-discriminator-2522
Apr 24, 2026
Merged

gut(ui): remove plugin discriminator from tool catalog types (#2522)#2534
alexey-pelykh merged 1 commit intomainfrom
gut/ui-plugin-discriminator-2522

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Summary

Narrow source: "core" | "plugin"source: "core" and delete optional
pluginId?: string on ToolCatalogEntry and ToolCatalogGroup in
ui/src/ui/types.ts. UI has zero consumers of either field (no branches on
source, no reads of pluginId), so the discriminator is dead weight from
the gutted plugin system.

Closes #2522.

Changes

  • ui/src/ui/types.ts (L352-367): 2 literals narrowed, 2 optional fields deleted.

Backend coordination note

Backend (src/gateway/server-methods/tools-catalog.ts:99,110) still emits
source: "plugin" via buildPluginGroups — the plugin subsystem is not
fully gutted yet. This is out of scope for #2522, which per its title/AC
is UI-only.

Narrowing is safe at the UI type level because the UI consumes the response
via an untyped generic cast (request<ToolsCatalogResult>) with no runtime
schema validation. The narrowed type is declarative-only: it documents that
UI code should not branch on "plugin", and since no UI code does, the
runtime shape of the response is immaterial.

If/when the backend-side gut is done, the protocol schema at
src/gateway/protocol/schema/agents-tools.ts and the handler at
src/gateway/server-methods/tools-catalog.ts will need a matching narrowing —
tracked as a follow-up, not in this PR.

AC evidence

  • grep -rn 'pluginId' ui/src/ → zero hits ✅
  • grep -rn 'source: "plugin"\|source:"plugin"' ui/src/ → zero hits ✅
  • pnpm check → green (format, tsgo, lint, CSS class drift) ✅
  • pnpm test → green (7014 passed, 3 skipped) ✅
  • pnpm test:ui:smoke → green (12 passed across 2 files) ✅

Test plan

  • pnpm check passes
  • pnpm test passes
  • pnpm test:ui:smoke passes
  • CI all green on PR

🤖 Generated with Claude Code

… no consumer (#2522)

Narrow `source: "core" | "plugin"` to `source: "core"` and delete optional
`pluginId?: string` on `ToolCatalogEntry` and `ToolCatalogGroup`. No UI code
branches on these fields (zero grep hits in `ui/src/`), so the discriminator
is dead weight from the gutted plugin system.

Backend (`src/gateway/server-methods/tools-catalog.ts`) still emits `"plugin"`
values via `buildPluginGroups`; gutting that path is out of scope for this
issue and would be tracked separately. UI narrowing is safe at the type level
because UI does not runtime-validate the response — the narrowed type is
declarative documentation that the UI ignores the `"plugin"` case entirely.

Refs #2522
@alexey-pelykh alexey-pelykh enabled auto-merge (squash) April 24, 2026 12:04
@alexey-pelykh alexey-pelykh merged commit 79aa071 into main Apr 24, 2026
16 checks passed
@alexey-pelykh alexey-pelykh deleted the gut/ui-plugin-discriminator-2522 branch April 24, 2026 12:10
alexey-pelykh added a commit that referenced this pull request Apr 24, 2026
…re plugin tag after #2522 over-narrowing

Plugin system is a kept, load-bearing extensibility mechanism of the fork (10 active registerTool calls across 5 bundled extensions; buildPluginGroups in src/gateway/server-methods/tools-catalog.ts:71-123 emits source: "plugin" at runtime). PR #2522/#2534 narrowed the UI type system to source: "core" only on the premise that plugins were being gutted — premise was false, corrected in CLAUDE.md via #2544.

Widens ToolCatalogEntry.source and ToolCatalogGroup.source back to "core" | "plugin" and restores the pluginId? field on both. Protocol schema (src/gateway/protocol/schema/agents-tools.ts) already carries the full union, so no schema change needed.

UI has no current consumer of the tool catalog (removed in #2520), so there is no immediate behavior change — this corrects the latent type lie before any future tool-browsing UI inherits the wrong shape.

Closes #2543

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
alexey-pelykh added a commit that referenced this pull request Apr 24, 2026
…re plugin tag after #2522 over-narrowing (#2548)

Plugin system is a kept, load-bearing extensibility mechanism of the fork (10 active registerTool calls across 5 bundled extensions; buildPluginGroups in src/gateway/server-methods/tools-catalog.ts:71-123 emits source: "plugin" at runtime). PR #2522/#2534 narrowed the UI type system to source: "core" only on the premise that plugins were being gutted — premise was false, corrected in CLAUDE.md via #2544.

Widens ToolCatalogEntry.source and ToolCatalogGroup.source back to "core" | "plugin" and restores the pluginId? field on both. Protocol schema (src/gateway/protocol/schema/agents-tools.ts) already carries the full union, so no schema change needed.

UI has no current consumer of the tool catalog (removed in #2520), so there is no immediate behavior change — this corrects the latent type lie before any future tool-browsing UI inherits the wrong shape.

Closes #2543

Co-authored-by: Claude Opus 4.7 (1M context) <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.

gut(ui): remove plugin discriminator from tool catalog types

1 participant