Commit 73693b5
committed
fix(anthropic): bound streaming 200 success-body SSE reads via shared internal guard
ClawSweeper review follow-up: revert stream-reader-with-limit from a new
public plugin-SDK subpath to an internal helper under src/agents/. The new
subpath required maintainer API-boundary acceptance plus regenerated SDK
metadata; deferring that to the extension follow-up PRs (extensions/google
+ extensions/ollama) keeps this PR a clean bounded-refactor with no public
SDK surface change.
The helper now lives at src/agents/streaming-byte-guard.ts, mirroring the
existing readResponseWithLimit / readProviderJsonResponse family in
src/agents/provider-http-errors.ts. Both Anthropic SSE parsers (the new
src/agents/anthropic-transport-stream.ts parser and the legacy
src/llm/providers/anthropic.ts iterateSseMessages) consume the helper via
relative imports, no plugin-sdk boundary involved.
Removal summary:
- DELETE src/plugin-sdk/stream-reader-with-limit.ts
- CREATE src/agents/streaming-byte-guard.ts (rename with comment update)
- UPDATE src/agents/anthropic-transport-stream.ts (relative import)
- UPDATE src/llm/providers/anthropic.ts (relative import)
- UPDATE scripts/repro/issue-anthropic-sse-bound-read.mjs (relative path)
- REMOVE entry from scripts/lib/plugin-sdk-entrypoints.json (line 314)
- REMOVE ./plugin-sdk/stream-reader-with-limit export from package.json
- REMOVE row from docs/plugins/sdk-subpaths.md
- REMOVE two now-unused @ts-expect-error directives in anthropic-transport-stream.test.ts
Re-verification:
- vitest: 115/115 (src/agents/anthropic-transport-stream.test.ts + src/llm/providers/anthropic.test.ts)
- repro script: 5/5 PASS (real node:http server, 64 MiB content-length-less body)
- tsgo: clean
- oxlint: clean
- plugin-sdk:check-exports: synced
- docs/.generated/plugin-sdk-api-baseline.sha256: unchanged (SDK surface restored)
Closes ClawSweeper P1 blockers from review on this PR: new public SDK subpath
requires maintainer acceptance (deferred), SDK metadata drift (resolved by
removal).1 parent 643410c commit 73693b5
5 files changed
Lines changed: 639 additions & 10 deletions
File tree
- scripts/repro
- src
- agents
- llm/providers
0 commit comments