Skip to content

Anthropic SDK 1.x and TypeScript 7 - #165

Merged
oblomov-dev merged 1 commit into
mainfrom
claude/kind-thompson-49jtb3
Nov 1, 2026
Merged

oblomov-dev merged 1 commit into
mainfrom
claude/kind-thompson-49jtb3

Conversation

@oblomov-dev

Copy link
Copy Markdown
Member

Supersedes #163 (Dependabot, "Bump the major group with 2 updates"). That PR fails CI and conflicts with main. This branch applies the same two bumps on top of current main and fixes what they break.

Bumps

The key header (SDK 1.x)

SDK 1.0 moves to API version 2026-10-21 and now sends apiKey as Authorization: Bearer <key> (see ClientOptions.apiKey in the SDK). Because of that, x-api-key was missing and tests/ai.spec.js:83 and tests/pilot.spec.js:93 failed. createProvider() in src/shell/llm-provider.mjs now passes the key the way the SDK documents for a hand-set key: defaultHeaders: { "x-api-key": key, authorization: null }. That is the header the Messages API has always read a key from. apiKey is still passed, so the SDK treats it as the client's credential and never tries its default credential chain in the browser. The workspace header is unchanged.

  • ai.spec.js and pilot.spec.js keep asserting x-api-key, and now also assert that no authorization header goes along, so the key is not sent twice.
  • llm-provider.spec.js checks the constructor options field by field, so it now expects the new defaultHeaders.

TypeScript 7 typecheck

  • src/shell/attachments.mjs: in wordText(), let row = null was narrowed to never (TS2339 on row.children). It now carries a /** @type {Element | null} */ annotation.
  • src/shell/deep-link.mjs: in followNavigation(), .filter(Boolean) no longer narrows out undefined (TS18048). It is now .filter((file) => file !== undefined), which TypeScript infers as a type predicate.

Also

  • AGENTS.md: the pinned dev-tooling versions are updated to what package.json actually has (typescript 7.0.2; eslint and globals were already one patch behind).
  • The vendored agent client (src/vendor/agent/) does not use the SDK, so nothing needed re-vendoring. _vendor/partial-json-parser is still at the path ai-common.mjs imports.

Run locally

  • npm run lint, npm run typecheck, npm run test:unit (75/75): all green
  • npm run build, npm run check:size: green (site 156.5 MB of 220 MB)
  • Playwright (chromium): ai.spec.js, pilot.spec.js, llm-provider.spec.js 73/73; link.spec.js, shell.spec.js, examples.spec.js 65/65

Generated by Claude Code

Supersedes the Dependabot bump (#163): @anthropic-ai/sdk 0.133.0 -> 1.3.0,
typescript 6.0.3 -> 7.0.2, both pinned exactly.

- SDK 1.x sends `apiKey` as `Authorization: Bearer`. The provider keeps
  sending the key as `x-api-key`, the SDK's documented hand-set header with
  `Authorization` omitted; `apiKey` stays passed so no credential chain is
  resolved in the browser. ai.spec and pilot.spec now also assert that no
  bearer goes along.
- TypeScript 7: `row` in wordText() typed as Element | null (it narrowed
  to never), and followNavigation()'s filter narrows to defined files
  (filter(Boolean) no longer does).
- AGENTS.md: the dev tooling pins as they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014YZFmFjqqPw2HLYh1MvmaA
@oblomov-dev
oblomov-dev merged commit a8600f7 into main Nov 1, 2026
5 of 10 checks passed
@oblomov-dev
oblomov-dev deleted the claude/kind-thompson-49jtb3 branch November 1, 2026 10:35
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.

2 participants