Skip to content

fix(agent): raise @openrouter/sdk floor to ^0.13.59 (typescript-sdk#350) - #135

Draft
LukasParke wants to merge 1 commit into
mainfrom
chore/sdk-floor-0.13
Draft

LukasParke wants to merge 1 commit into
mainfrom
chore/sdk-floor-0.13

Conversation

@LukasParke

Copy link
Copy Markdown
Contributor

What

Raises @openrouter/agent's @openrouter/sdk dependency from ^0.13.7 to ^0.13.59 and refreshes the lockfile (now 0.13.59). @openrouter/mcp doesn't depend on the SDK directly, so it's unchanged.

0.13.59 contains the APIPromise unhandled-rejection fix for OpenRouterTeam/typescript-sdk#350 (d62c2bde). Before this, aborting a run while the SDK was reading a non-streamed (JSON) body emitted one process-level unhandledRejection per call, even though the caller's promise rejected normally. That crashes Node under --unhandled-rejections=strict, which is the default throw mode.

Why 0.13.59 and not 0.13.67 (latest 0.13.x)

I tried the newer versions. 0.13.60 removed | any from many generated input unions (BaseInputsUnion, EasyInputMessage.content/phase, ...), and the agent src has 20 latent type errors that those anys were hiding (model-result.ts, conversation-state.ts, turn-context.ts, resume-tool-results.ts). Fixing them is a typing migration that belongs in its own PR. Runtime is fine on 0.13.67 (full unit suite passes), and consumers resolving ^0.13.59 will keep getting 0.13.67 at runtime, as they already do with ^0.13.7. Only the lockfile, and so our own typecheck, stays on 0.13.59.

Regression test

tests/unit/sdk-abort-body-read.test.ts runs the real SDK (no mocks) against a local HTTP server that sends JSON headers plus a partial body and then stalls. It fires three parallel callModel(...).getResponse() calls, waits until all three are mid-body, aborts, and then asserts that all three reject and no unhandledRejection fires. It fails on 0.13.7 (3 unhandled) and passes on 0.13.59.

Test plan

  • pnpm install --frozen-lockfile
  • pnpm typecheck, pnpm lint, pnpm test (agent 1237, mcp 12), pnpm verify:packages
  • New test fails with the SDK at 0.13.7 and passes at 0.13.59
  • Unit suite also passes with the SDK at 0.13.67 (runtime compatibility)

Refs OpenRouterTeam/typescript-sdk#350, #113

🤖 Generated with Claude Code

…on fix

0.13.59 fixes an unhandled APIPromise rejection when a request is aborted
during a non-streamed body read (OpenRouterTeam/typescript-sdk#350).
Adds a real-SDK regression test against a stalled local server; it fails
on 0.13.7 and passes on 0.13.59.

The floor stays at 0.13.59 rather than 0.13.67: 0.13.60 removed '| any'
from generated input unions, which surfaces 20 latent type errors in agent
src. Runtime is unaffected (unit suite passes on 0.13.67).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant