Skip to content

feat: 0.3.0 add Vercel AI SDK adapter, streaming, hybrid fix, polish - #2

Merged
EvanPaules merged 1 commit into
mainfrom
feat/0.3.0
May 14, 2026
Merged

feat: 0.3.0 add Vercel AI SDK adapter, streaming, hybrid fix, polish#2
EvanPaules merged 1 commit into
mainfrom
feat/0.3.0

Conversation

@EvanPaules

Copy link
Copy Markdown
Owner

Builds on 0.2.0's adapter foundation. Three production gaps closed and one quality polish pass.

  • src/adapters/ai-sdk.ts: new ctx-opt/ai-sdk entry point. withOptimizer(fn, config) wraps any AI SDK function (generateText, streamText, generateObject, streamObject). trimMessages(messages, config) for the pre-process pattern. ai is an optional peer dep.
  • Streaming: stream: true on chat.completions.create / messages.create now correctly forwards the SDK's async-iterable stream after running optimization. The Anthropic adapter also wraps client.messages.stream().
  • src/strategies/{relevance,summarizer}.ts: support per-strategy recentWindow override. This unblocks the hybrid pipeline: setting relevance.recentWindow larger than summarizer.recentWindow gives the summarizer real compressible material. The known-limitation note from 0.2.0 is resolved with a test that asserts llmCall fires.
  • src/anthropic-tokens.ts: countMessageTokensWithAnthropic helper that delegates to client.messages.countTokens for exact counts on claude-* models. Replaces the README's "roll your own wrapper" note.
  • .github/ISSUE_TEMPLATE/*.yml, PULL_REQUEST_TEMPLATE.md, CONTRIBUTING.md for repo polish.
  • 21 → 52 → 68 tests across three releases. Typecheck, build, and all 68 tests green.

Builds on 0.2.0's adapter foundation. Three production gaps closed
and one quality polish pass.

- src/adapters/ai-sdk.ts: new ctx-opt/ai-sdk entry point. withOptimizer(fn,
  config) wraps any AI SDK function (generateText, streamText,
  generateObject, streamObject). trimMessages(messages, config) for the
  pre-process pattern. ai is an optional peer dep.
- Streaming: stream: true on chat.completions.create / messages.create
  now correctly forwards the SDK's async-iterable stream after running
  optimization. The Anthropic adapter also wraps client.messages.stream().
- src/strategies/{relevance,summarizer}.ts: support per-strategy
  recentWindow override. This unblocks the hybrid pipeline: setting
  relevance.recentWindow larger than summarizer.recentWindow gives the
  summarizer real compressible material. The known-limitation note from
  0.2.0 is resolved with a test that asserts llmCall fires.
- src/anthropic-tokens.ts: countMessageTokensWithAnthropic helper that
  delegates to client.messages.countTokens for exact counts on claude-*
  models. Replaces the README's "roll your own wrapper" note.
- .github/ISSUE_TEMPLATE/*.yml, PULL_REQUEST_TEMPLATE.md, CONTRIBUTING.md
  for repo polish.
- 21 → 52 → 68 tests across three releases. Typecheck, build, and all
  68 tests green.
@EvanPaules
EvanPaules merged commit 4a23219 into main May 14, 2026
3 checks passed
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