Skip to content

chore: extract Anthropic SDK types to local protocol file - #26

Merged
dahai80 merged 2 commits into
mainfrom
chore/extract-anthropic-sdk-types
Aug 2, 2026
Merged

dahai80 merged 2 commits into
mainfrom
chore/extract-anthropic-sdk-types

Conversation

@dahai80

@dahai80 dahai80 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

Extract @anthropic-ai/sdk type imports to a local src/types/anthropic-protocol.ts file, decoupling type dependencies from the SDK runtime package.

Changes

  • New file: src/types/anthropic-protocol.ts — re-exports 40+ SDK types from 4 SDK sub-paths
  • 119 type-only imports redirected from @anthropic-ai/sdk/... → src/types/anthropic-protocol.js
  • 18 runtime imports (error classes, Anthropic constructor) correctly remain on SDK
  • Fixed: MultiEditTool missing from fileOperationAnalytics union type
  • Fixed: Anthropic default/named import patterns (AnthropicDefault alias)

Verification

Check Status
tsc --noEmit ✅ 0 errors
bun run build ✅ Pass
bun run build:dev ✅ Pass
bun run build:dev:full ✅ Pass
bun run compile ✅ Pass
./fusion-code --version ✅ 0.4.3

Next steps (future PRs)

  • Define types natively in anthropic-protocol.ts instead of re-exporting from SDK
  • Remove @anthropic-ai/sdk from devDependencies once types are self-hosted

🤖 Generated with Claude Code

dahai80 and others added 2 commits August 2, 2026 08:47
- Create src/types/anthropic-protocol.ts re-exporting SDK types
- Redirect 119 type-only imports from @anthropic-ai/sdk to local file
- Keep 18 runtime imports (error classes, Anthropic constructor) on SDK
- Fix MultiEditTool type in fileOperationAnalytics union type
- Add AnthropicDefault/Anthropic named exports for both import patterns
- Includes README_CN.md bilingual support and prior PRD features

tsc --noEmit: 0 errors
bun run build/build:dev/build:dev:full/compile: all pass

Co-Authored-By: Claude <[email protected]>
- Protect audit log directory from AI tampering (add .fusion-code/audit to sensitive dir patterns)
- Expand sensitive file patterns: .netrc, .kube/config, .docker/config.json, .git-credentials, .github-token, .env~
- Make FUSION.rules denied_tools check case-insensitive
- Fix isOfflineMode() to also check FUSION_CODE_OFFLINE env var
- Remove unused normalize import from session-pack

Co-Authored-By: Claude <[email protected]>
@dahai80
dahai80 merged commit efeccb4 into main Aug 2, 2026
1 check passed
@dahai80
dahai80 deleted the chore/extract-anthropic-sdk-types branch August 2, 2026 07:15
dahai80 added a commit that referenced this pull request Aug 29, 2026
…1 slice #26) (#196)

PURE-ROUTING SUB-BLOCK extraction (same class as slice #25 apiMetricsCapture).
Body at REPL.tsx:3101-3138 (37 LOC, 5 closure deps) → maybeExtractHaikuTitle()
in src/utils/haikuTitleExtraction.ts.

Behavior byte-identical: guard moved into helper; ctx carries
titleDisabled/sessionTitle/agentTitle/haikuTitleAttemptedRef/setHaikuTitle.
One-shot ref gates Haiku call (first real user message only, skips synthetic
breadcrumbs via tag-prefix checks). fire-and-forget void generateSessionTitle.

REPL import cleanup: 3 sole-user tags (BASH_INPUT_TAG/COMMAND_MESSAGE_TAG/
COMMAND_NAME_TAG) + 2 sole-user fns (extractFallbackTitle/generateSessionTitle)
removed; LOCAL_COMMAND_STDOUT_TAG + getContentText kept (other users).

REPL 6172→6128 (-44). Cumulative -924→-968.
Gates: typecheck 0 / 914 tests pass / biome new-file clean / build:dev ok.

Co-authored-by: Claude Fable 5 <[email protected]>
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