Skip to content

feat: streamText() with streaming fallbacks (0.2.0) - #4

Merged
ralyodio merged 1 commit into
mainfrom
feat/stream-text
Nov 7, 2026
Merged

ralyodio merged 1 commit into
mainfrom
feat/stream-text

Conversation

@ralyodio

@ralyodio ralyodio commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Adds streamText() (ROLLOUT.md "Package gaps": rssamplifier translate, parklookup trip generator).

  • src/sse.js: one SSE block reader, now used by c0mpute's job stream and by both paid providers.
  • C0mputeProvider.stream, OpenAIProvider.stream (stream: true, include_usage), AnthropicProvider.stream (text deltas, usage from message_start/message_delta).
  • AiRouter.streamText(req): usual order and parking; falls back only until the first token, then a failure is final with partial: true. A provider without stream is called through generate and sent as one token.
  • streamText(req, router?): { textStream, result }, also async-iterable.
  • c0mpute: a stall after tokens are out is an error, not a silent retry on the next model.
  • CLI ask --stream. Version 0.2.0.

Tests: 11 new in test/stream.test.js (chunk-split SSE, CRLF, token tail from done, stall mid-answer, OpenAI/Anthropic deltas + usage, cut streams, dead-key billing, fallback before first token, partial after).

🤖 Generated with Claude Code

c0mpute streams its job's token events through a shared SSE reader;
OpenAI and Anthropic stream with stream: true. Fallback runs until the
first token; after that a failure is final and marked partial.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ralyodio
ralyodio merged commit 006cc27 into main Nov 7, 2026
3 checks passed
@ralyodio
ralyodio deleted the feat/stream-text branch November 7, 2026 10:06
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