Skip to content

extension types: a toolDefinition() helper so shared def consts keep literal names #248

Closed

Description

@omridevk

Split out of #238 (landed in PR #247).

Tools declared through a shared def const (export const fooDef = {name: 'foo', ...} — the pattern tanstack, whiteboard, ios, recorder and test-runner all use so client and server share one definition) widen name to string. ToolNameOf maps a non-literal name to never, so those tools are deliberately absent from the typed registry client — and therefore also invisible to the type-level collision checks (#247's prefix/duplicate/segment diagnostics).

Work: a toolDefinition() identity helper providing a const Name inference site, applied to the ~40 shared def objects, so every tool keeps its literal name into RegisterExtension. Mechanical after the helper exists; the type tests from packages/extension/test/extension-registry.test-d.ts are the model.

Acceptance:

  • A shared-def tool appears on the typed client with its literal name
  • Collision diagnostics cover shared-def tools (a duplicate between a shared-def tool and an inline one is a diagnostic)
  • No cast, no second declaration mechanism; suite green

Activity

  1. added
    ready-for-agent
    on Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions