Skip to content

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

Merged
endrix merged 6 commits into
mainfrom
refactor/shared-types
Nov 8, 2026
Merged

endrix merged 6 commits into
mainfrom
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

…s the rest

Phase 3 of the declutter plan. About half the keys every product wrote
were identical or derivable from the ones beside them, so the toolkit
now derives them, each as the products spelled it by hand: command ids
from the GLSP client name and the operation prefix, operation kinds from
the prefix, the GLSP client identity from the key, the CLI and sidecar
setting keys, the eight run-driver setting keys, the undo suffix and the
scope argument from their one shared spelling. A value the product gives
wins, so a product that keeps every line is unchanged.

Deprecated, accepted and ignored: the three command ids nothing registers
(createAgentToolPolicyFile, chatAddViewerEditor, chatAddViewerTask), the
two chat fields nothing reads (name, operationPrefix) and the toolkit's
mcpEnabledSetting. The chat's built-in node slash commands are gone: a
profile names its own or offers none. The webview's three network
behaviours are on unless a product sets them off.

Claude-Session: https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv
The webview's three network flags keep their off default: ndf-ide sets
none of them, and on by default would have given its edges a queue
capacity editor and changed its cross-document navigation. Their
default is a design question for the product pass, not this refactor.

A deprecated command id a product still spells stays out of the
resolved profile (only the ids the platform registers come through), a
blank GLSP client name, client id, setting key or suffix is derived like
an absent one, the chat config's doc no longer names a dispatcher that
is gone, and a test pins that a profile without node commands offers no
node-creation slash command.

Claude-Session: 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
# Conflicts:
#	packages/extension-core/src/api.ts
#	packages/shared/src/index.ts
#	packages/sidecar-toolkit/src/registry-tools.ts
#	packages/sidecar-toolkit/src/sidecar-diagram-profile.ts
@endrix
endrix merged commit eb03db1 into main Nov 8, 2026
1 check passed
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