Fix: missing SDKControlInitializeRequest exports in the CLI print module#948
Fix: missing SDKControlInitializeRequest exports in the CLI print module#948kauanunesz wants to merge 1 commit intoGitlawb:mainfrom
Conversation
gnanam1990
left a comment
There was a problem hiding this comment.
Thanks for the PR! The controlTypes.ts half is fine — adding stub = any types for SDKControlInitializeRequest, SDKControlInitializeResponse, SDKControlMcpSetServersResponse, SDKControlReloadPluginsResponse matches the existing stub pattern in that file and resolves the TS2305 in print.ts. Good find.
The print.ts change is wrong though, and needs to be reverted/redone:
-
@anthropic-ai/claude-agent/sdk(with a slash) is not a published package. The original@anthropic-ai/claude-agent-sdk(with a dash) is the real npm package name, but neither is listed in this repo'spackage.jsondependencies and neither is installed innode_modules. The original line was a dangling reference; the rename makes it more wrong, not less. Build only passes because it's a type-only import (TypeScript erases it). -
The right fix is one of:
- Define a local stub for
PermissionModeinsrc/entrypoints/sdk/controlTypes.ts(same= anypattern as the others) and import it from there, or - Drop the import entirely and use the already-imported
InternalPermissionModefromsrc/types/permissions.jsat the cast site (line 1068) — that's likely the actually-correct type anyway.
- Define a local stub for
-
Minor: trailing whitespace on the four new lines in
controlTypes.tsand missing newline at EOF — could you clean those up while you're in there?
Could you split this into the controlTypes stub additions (good as-is, modulo whitespace) and a proper fix for the PermissionMode import? Happy to re-review.
|
Thanks for the PR. This still needs a fresh pass before it can be reviewed/merged. Current state:
Could you rebase this onto latest |
Vasanthdev2004
left a comment
There was a problem hiding this comment.
Thanks for the PR. I did a targeted current-head review of ff7bb8b and I agree with the existing blocker: this still needs changes before merge.
Review scope: Targeted review of the SDK control type export/import fix only.
Verdict: Needs changes
Blocking issue:
src/cli/print.tschanges the type import to@anthropic-ai/claude-agent/sdk, but that package path is not a valid dependency in this repo. Since this is a type-only import, the build can miss it, but it still leaves a stale/invalid type boundary in source. Please do not introduce this external package path.
Suggested fix:
- Keep the local
controlTypes.tsstub additions, but clean the trailing whitespace/newline. - For
PermissionMode, either use the already-importedInternalPermissionModefromsrc/types/permissions.jsat the cast site, or define/export a local stub fromsrc/entrypoints/sdk/controlTypes.tsand import from there. - Rebase onto latest
main, because the SDK/control surface has moved significantly since this branch was opened.
Non-blocking note:
- The added
SDKControl*stubs are fine in principle and match the existing stub style; the blocker is the invalidPermissionModeimport plus the stale branch state.
Happy to re-review once this is rebased and the import is fixed.
Summary
What changed: Fixed broken type exports in src/entrypoints/sdk/controlTypes.js and ensured the print.ts CLI module correctly imports SDKControlInitializeRequest.
Why it changed: The CLI was failing to compile because it was attempting to import members that were not being correctly exported or recognized by the TypeScript compiler in the SDK entrypoint.
Impact
User-facing impact: None directly, but this fix is essential for the stability of the CLI build and prevents crashes during SDK initialization.
Developer/maintainer impact: Fixes build errors (TS2305) and improves type safety across the CLI and SDK boundaries.
Testing
bun run buildbun run smokeNotes
Provider/model path tested: N/A (Build/Type fix).
Screenshots attached: See image_c4d99f.jpg for the original error.
Follow-up work or known limitations: None.