Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .changeset/great-wolves-shake.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/lucky-pianos-guess.md

This file was deleted.

14 changes: 0 additions & 14 deletions .changeset/tidy-moons-search.md

This file was deleted.

17 changes: 17 additions & 0 deletions packages/ai-sdk-middleware/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# @context-chef/ai-sdk-middleware

## 2.1.0

### Minor Changes

- [#45](https://github.com/MyPrototypeWhat/context-chef/pull/45) [`09ba1d6`](https://github.com/MyPrototypeWhat/context-chef/commit/09ba1d63e2fe3a60db0ee085b878d3317cfa5580) Thanks [@MyPrototypeWhat](https://github.com/MyPrototypeWhat)! - Session isolation, lossless-er tool output flattening, and tighter peer ranges.

- **Session isolation**: compression state (fed token usage, compression suppression, the failure circuit breaker) is now tracked per session instead of per middleware instance. Pass `providerOptions: { contextChef: { sessionId } }` on each call; calls without a `sessionId` share one default session (prior behavior). New `maxSessions` option caps concurrently tracked sessions (default 256, LRU-evicted). Previously a middleware created at module scope leaked Janitor state across every conversation it served.
- `stringifyToolOutput` no longer silently drops non-text content parts: file/media parts flatten to a `[tool result file: <mediaType>]` placeholder so compression and truncation see that they exist. The truncator's duplicate text extraction now delegates to the same implementation.
- Tighten peerDependency ranges from `>=4` / `>=7` to `^4.0.0` / `^7.0.0`. The middleware depends on `LanguageModelV4*` type shapes from `@ai-sdk/provider` v4 — an unbounded range would let a future major install silently and fail at runtime.
- Compression flattening now reuses `flattenForCompression` from `@context-chef/core` (behavior unchanged).
- An invalid `sessionId` (empty string, non-string, or a malformed `contextChef` namespace) now warns once and routes to the default session instead of failing silently. The Janitor missing-compression-config nag fires once per middleware instead of once per session.

### Patch Changes

- Updated dependencies [[`09ba1d6`](https://github.com/MyPrototypeWhat/context-chef/commit/09ba1d63e2fe3a60db0ee085b878d3317cfa5580)]:
- @context-chef/core@3.9.0

## 2.0.0

### Major Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-sdk-middleware/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@context-chef/ai-sdk-middleware",
"version": "2.0.0",
"version": "2.1.0",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
Expand Down
15 changes: 15 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# context-chef

## 3.9.0

### Minor Changes

- [#45](https://github.com/MyPrototypeWhat/context-chef/pull/45) [`09ba1d6`](https://github.com/MyPrototypeWhat/context-chef/commit/09ba1d63e2fe3a60db0ee085b878d3317cfa5580) Thanks [@MyPrototypeWhat](https://github.com/MyPrototypeWhat)! - Fix Gemini tool call correlation, harden Janitor compression failure paths, and add shared middleware infrastructure.

- `fromGemini` now synthesizes tool call IDs with per-name counters spanning the whole conversation and correlates each `functionResponse` to the oldest unconsumed call of the same name (FIFO). Previously the correlation state was scoped to a single message, so responses arriving in a later content entry always fell back to the `-0` suffix — repeat calls of the same tool produced duplicate IDs and misattributed results.
- When the compression model throws, the raw error is no longer appended to the LLM-bound fallback summary. It now goes to the configured `logger` (default `console`) instead, keeping stack traces out of model context.
- A throwing/rejecting `onCompress` hook no longer aborts `compile()`. It is caught and logged via `logger`; the compression result is kept. Hooks that follow the documented "must not throw" contract see no behavior change.
- `onBeforeCompress` (and the deprecated `onBudgetExceeded`) now degrade the same way: a throwing hook is caught, logged via `logger`, and treated as if it returned `null` — default compression proceeds. Both hooks now share one failure stance: a broken hook never fails `compile()`.
- The text-placeholder vocabulary is centralized in `Prompts`: new `getAttachmentPlaceholder` (previously janitor-internal), `getToolResultFilePlaceholder`, and `getToolResultPartPlaceholder`. Formats are unchanged — this gives each convention a single source instead of scattered string literals.
- New export `SessionPool<T>` — a keyed instance pool with LRU eviction, used by the middleware packages to hold one Janitor per conversation. `maxSize` is validated (throws `RangeError` unless a positive integer — a non-positive cap would silently evict every entry on insert, disabling pooling). Companion exports `DEFAULT_SESSION_KEY`, `normalizeSessionKey`, and `dedupeConstructionWarnings` back the middlewares' shared session-key normalization and construction-nag dedupe.
- New export `flattenForCompression(messages)` — the canonical role-flattening implementation required by the `summarizeHistory` compress-callback contract (tool results → user messages, tool calls → assistant text).
- `OpenAIAdapter.compile` replaces its per-message `JSON.parse(JSON.stringify(...))` deep clone with a direct clone that skips `undefined` properties — same output, no string serialization detour (noticeable with base64 attachments). The clone honors `toJSON`, so a `Date` still lands as its ISO string.

## 3.8.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@context-chef/core",
"version": "3.8.0",
"version": "3.9.0",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
Expand Down
13 changes: 13 additions & 0 deletions packages/tanstack-ai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# @context-chef/tanstack-ai

## 0.6.0

### Minor Changes

- [#45](https://github.com/MyPrototypeWhat/context-chef/pull/45) [`09ba1d6`](https://github.com/MyPrototypeWhat/context-chef/commit/09ba1d63e2fe3a60db0ee085b878d3317cfa5580) Thanks [@MyPrototypeWhat](https://github.com/MyPrototypeWhat)! - Conversation isolation: compression state (fed token usage, compression suppression, the failure circuit breaker) is now tracked per `ctx.conversationId` instead of per middleware instance. Calls without a `conversationId` share one default slot (prior behavior). New `maxSessions` option caps concurrently tracked conversations (default 256, LRU-evicted). Previously a middleware instance reused across chat() calls leaked Janitor state across every conversation it served. Compression flattening now reuses `flattenForCompression` from `@context-chef/core` (behavior unchanged).

An empty-string `conversationId` now warns once and routes to the default slot (previously it was silently treated as a distinct conversation, diverging from the AI SDK middleware's semantics). The Janitor missing-compression-config nag fires once per middleware instead of once per conversation.

### Patch Changes

- Updated dependencies [[`09ba1d6`](https://github.com/MyPrototypeWhat/context-chef/commit/09ba1d63e2fe3a60db0ee085b878d3317cfa5580)]:
- @context-chef/core@3.9.0

## 0.5.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/tanstack-ai/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@context-chef/tanstack-ai",
"version": "0.5.2",
"version": "0.6.0",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
Expand Down
Loading