Skip to content

refactor: one declaration of the behaviour flags, the command ids and the chat tool - #124

Open
endrix wants to merge 3 commits into
refactor/profile-defaultsfrom
refactor/shared-types
Open

endrix wants to merge 3 commits into
refactor/profile-defaultsfrom
refactor/shared-types

Conversation

@endrix

@endrix endrix commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Phase 4c of the declutter plan: the hand-kept type twins. Stacked on #120 (it edits the same DiagramCommandIds block that PR deprecates three ids in); the base moves to main once #120 lands. No product repo changes; every product's profile compiles unchanged.

What was duplicated

type copies before now
DiagramClientBehavior + AcpConnectorInfo extension-core/api.ts, sidecar-toolkit (SidecarClientBehavior, minus the four derived fields), diagram-client/profile.ts (its own, already missing env on the connector) @dialogram/shared/client-behavior.ts, with the API's docs; ProductClientBehavior is the shared type minus chatBackend, acpConnectors, resumeAtStep, statusSource
DiagramCommandIds api.ts, toolkit SidecarProfileCommandIds (20 identical keys + 2), client (6 keys) @dialogram/shared/command-ids.ts; the toolkit's extends it with sidecarEdit/sidecarSend; the client types commandIds as Partial<DiagramCommandIds> and names the six it runs itself
InProcessChatTool api.ts, toolkit RegistryChatTool @dialogram/shared/chat-tools.ts; RegistryChatTool is an alias

The API re-exports all four from @dialogram/shared, so every extension-core consumer and extension-core/src/index.ts keep their imports. client-behavior-twin.test.ts, which compared two declarations as source text, is deleted with the second declaration; its note on why the four derived fields are not product-facing lives on as the doc of ProductClientBehavior.

Kept: the toolkit's RunHost.useLiveOverlaySignatureSource argument (it names vscode.Uri, which shared cannot), and DiagramLiveOverlaySource in the API.

scriptInterpreterCommands has no reader (node families decide the icon); deprecated, not removed, since two products still set it.

What the review made of it

No correctness findings. Cleanups taken: PlatformMcpTool in the server's MCP bridge was a third hand-written copy of the chat tool and is now Readonly<InProcessChatTool>; DiagramOperationKinds moves to shared beside the command ids (the webview had its own); the stale "twin" doc above RegistryChatTool, a {@link} to a type the shared package cannot see, the deprecated flag's three assertions in the webview's flag test, and the indentation in chat-tools.ts.

Typecheck 5/5, neutrality 5/5, client 361, extension-core 332, toolkit profile suites 46.

https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv

… the chat tool

Phase 4c of the declutter plan. DiagramClientBehavior (with
AcpConnectorInfo), DiagramCommandIds and InProcessChatTool were each
declared by hand in two or three packages: the API, the toolkit (as
SidecarClientBehavior, SidecarProfileCommandIds, RegistryChatTool) and
the webview, with a test to keep two of the twins in step. They live in
@dialogram/shared now, the API re-exports them, the toolkit's names are
the shared types (ProductClientBehavior is the shared behaviour minus
the four fields the platform derives), and the webview reads them. The
twin test goes with the second twin. scriptInterpreterCommands is
deprecated: nothing reads it.

Claude-Session: https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv
The server's MCP bridge used a third hand-written copy of the chat tool;
PlatformMcpTool is the shared type, read-only. DiagramOperationKinds
moves to shared beside the command ids, so the webview stops keeping
its own. The stale twin doc above RegistryChatTool, a doc link to a
type the shared package cannot see, the deprecated flag's assertions in
the webview's flag test, and the odd indentation in chat-tools.ts are
gone.

Claude-Session: https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv
The extension build runs with unused locals forbidden; AcpConnectorInfo
is re-exported, not used, so it is no longer imported.

Claude-Session: https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv
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