Skip to content

chore: version packages - #54

Merged
MyPrototypeWhat merged 1 commit into
mainfrom
changeset-release/main
Sep 7, 2026
Merged

MyPrototypeWhat merged 1 commit into
mainfrom
changeset-release/main

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@context-chef/ai-sdk-middleware@3.1.0

Minor Changes

  • #53 3549dee Thanks @MyPrototypeWhat! - Track core 4.2: one context store, one overflow strategy.

    • truncate.store replaces truncate.storage (now @deprecated): pass a StorageBackend — InMemoryBackend, FileSystemBackend, your own — or a pre-built Store shared with an archive, instead of a bare VFSStorageAdapter. store wins when both are set; a legacy adapter still works and is wrapped with Store.fromVfsAdapter. Truncated output carries the same context://vfs/ URI either way, readable back through chef.resolveRecall(uri) or the context tool's view.
    • overflow: { strategy, archive }: pass an explicit OverflowStrategy — summarize(), anchored(), reset(), composed with chain() / background() — in place of the policy the compress options describe, and an archive that keeps the evicted span retrievable behind the URI its summary cites. Setting overflow.strategy ignores the compress tuning options (two descriptions of one thing would disagree); the runner concerns — contextWindow, tokenizer, compress.triggerRatio, compress.usagePreference, onCompress, onBeforeCompress — keep applying whatever the strategy is, and contextWindow stays required. archive takes the explicit { store } form: the 'vfs' shorthand substitutes a ContextChef-owned Offloader, which a middleware does not have.
    • Internally the per-session Janitor assembly, the missing-contextWindow throw and the compress-without-persistence warning now come from core's shared createJanitorPool() instead of a copy maintained here. No behavior change.

    tools mode has no target in this package: it neither constructs a ContextChef nor dispatches library-owned tools, so the context tool is reached through a chef in your own loop.

Patch Changes

  • Updated dependencies [3549dee]:
    • @context-chef/core@4.2.0

@context-chef/core@4.2.0

Minor Changes

  • #53 3549dee Thanks @MyPrototypeWhat! - The five-axis refactor: one owner per axis — selection, placement, persistence, retrieval, adaptation.

    Every option that changed name keeps a working deprecated alias, tools stays 'legacy', and a golden suite (10 configurations × 3 targets, payloads captured before the first edit) asserts the compiled bytes are unchanged under default configuration through every phase below. MIGRATION-5.md lists each alias and what replaces it in 5.0.

    • Cleanup and shared helpers (phase 0): createJanitorPool() replaces the budgeting / persistence-warning / Janitor assembly that ai-sdk-middleware and tanstack-ai had each copied; createThinkingTextifier() dedupes the <thinking> textifier and the redacted-thinking warn-once shared by the OpenAI and Gemini adapters. computeAnthropicBetas and the default server-edits config move out of the facade into anthropicServerContextManagement() in the Anthropic adapter. _anthropic_compaction, _gemini_thought_signature and _openai_reasoning become typed optional Message fields instead of index-signature passthroughs. resolveRecall(uri, { format: 'text' }) renders an archived span as a readable transcript instead of the stored { version, messages } JSON (default unchanged). No behavior change under default config.
    • Pipeline phases and slots (phase 1): compile() is now a fixed, named phase list (start → transform-tool-results → handoff → overflow → inject → memory → skill → assemble → tail → adapt → audit → done), each phase its own file under src/pipeline/phases/, reaching chef state through a closure so nothing became public that was not already. chef.use(slot, handler) / chef.unuse(slot, handler) are the composition surface: before-overflow (return false to skip overflow this compile), after-overflow, before-assemble (ctx.inject(text)), after-assemble (messages → messages), before-adapt, after-adapt. Handlers run in registration order. ChefConfig.onBeforeCompile and transformContext are now registrations on before-assemble / after-assemble — same code path, same output, and both are @deprecated. ChefConfig.pipelineChecks (default off) verifies once after the whole after-assemble chain that pinned messages survived and tool pairs are intact, and once after the tail phase that nothing ahead of the insertion point changed; violations are reported through logger.warn and a pipeline:invariant event and never throw. No behavior change under default config.
    • OverflowStrategy (phase 2): what leaves the window is now a policy object, and the Janitor is the runner around it — budget evaluation, circuit breaker, compress:* events, onCompress / onBeforeCompress, durable compaction, archive. Built-ins in src/overflow/: summarize(opts) (the 'rewrite' path), anchored(opts) (the persistent anchor document), server(config, { fallback }) (Anthropic server-managed compaction, running the fallback on every other target), reset(opts) (new — keep pinned, evict the rest), chain(...strategies) (escalate when a strategy returns changed: false or is still over budget) and background(strategy) (the non-blocking job, with its content-equivalence staleness check). A strategy may implement commit() (so a speculative apply cannot pollute an anchor), attach(), snapshot() / restore(). ChefConfig.overflow: { strategy, archive, handoff } is the new home; janitor.compressionMode / compressionScheduling / archive and contextManagement.strategy / .server all still build exactly the equivalent strategy and are @deprecated (setting both warns once, and overflow.strategy wins). Archiving is strategy-agnostic now: whatever span a strategy compressed is what gets stored, still under context://vfs/ in 4.x. before-overflow handlers receive the runner's real budget. OverflowResult declares both span and evicted: span is what the summary covers (pinned turns re-inserted included), evicted is what actually left the window, and a result that changed nothing declares both empty. onCompress, the archive payload and the citation all read span, so those numbers match 4.1. OverflowInput.forced marks a requestNewContext() pass: summarize() / anchored() then fold every turn but the most recent, ignoring preserveRecentMessages / preserveRatio. OverflowStrategy.pending?() lets background() land a finished job on the next compile even when the history is back under budget (its job accessor is now pendingJob). Janitor: 1294 → 870 lines. No behavior change under default config.
    • Handoff budget, new_context, window lineage (phase 3): overflow.handoff: { budgetTokens, prompt? } reserves headroom above the compression trigger — when remaining tokens drop into that band, one compile carries a notice through the tail channel telling the model its window is about to be cut, so state worth keeping can be written to memory/ / notes/ while the conversation is still there to write it from. Once per window, validated at construction, {n_remaining} template, never persisted and never in getAnnouncements(), skipped on server-managed compiles. getNewContextToolDefinition() (static, no parameters) plus chef.requestNewContext() let the model close a window deliberately: the next compile applies the strategy whatever the budget says, and a before-overflow veto or an open circuit breaker still wins. Window lineage ({ first, previous?, current }) is owned by the runner and advances at commit time only, so a stale background result never moves it; OverflowResult.meta.windowId is the window acted on, CompileMeta.windowId the window the payload belongs to. anchored() keys its anchor per window (pre-4.2 flat anchorDoc snapshots are adopted by the first window). A forced overflow that cannot run — server-managed target, or a before-overflow veto — is consumed anyway and reported through a pipeline:invariant event plus a warn-once, never silently. The once-per-window handoff flag travels in ChefSnapshot.handoffNoticedWindow. Opt-in; no behavior change under default config.
    • One StorageBackend, one Store (phase 4a): persistence collapses to addressed content plus metadata. StorageBackend is read / write / delete / list with optional readAll / append / search / snapshot / restore / getPhysicalPath queried as capabilities; Store routes namespaces, parses and builds context://<ns>/<path> URIs, assigns auto-ids, falls back to read-modify-write for append, and owns the per-namespace LRU eviction that used to live in the Offloader. Ships InMemoryBackend and FileSystemBackend (a port of FileSystemAdapter with a per-namespace on-disk layout, so the Offloader's flat VFS files keep loading). Memory accepts a MemoryStore, a StorageBackend or a Store and speaks only to namespace('memory'); readAll keeps getAll() at 1+N reads. Offloader accepts a Store, a StorageBackend or a VFSStorageAdapter. VFSMemoryStore is rebuilt on FileSystemBackend (same on-disk format; _index.json is still written through so a 4.1 process sharing the directory stays in sync). StoredEntries is Map<string, StoredEntry>, so readAll and NamespaceView.entries() hand back the backend's key order — the order Memory.getAll() renders into the <memory> block, which a plain object would reshuffle — and getAll() preserves it as 4.1 did. FileSystemBackend lists nested paths recursively and refuses any physical path outside its namespace directory. MemoryStore, VFSStorageAdapter, VFSMemoryStore and FileSystemAdapter are @deprecated and wrapped by Store.fromMemoryStore / Store.fromVfsAdapter. Public module APIs unchanged; no behavior change under default config.
    • One model-facing context tool (phase 4b): getContextToolDefinition() returns a single static, frozen, reference-stable tool shaped like memory_20250818 — view / create / str_replace / insert / delete / rename plus search, addressed as context://<ns>/<path>. Its schema has exactly one enum (command), so no live key list can ever enter the cached prefix. chef.ownsTool(name) / chef.handleTool(call) are the one entry point for every library-owned tool — context, new_context and the legacy trio — accepting the JSON string the OpenAI and Anthropic SDKs produce or an already-parsed object. memory/ routes through the Memory module so allowedKeys, the onMemoryUpdate veto, onMemoryChanged, TTL and updateCount all still apply; notes/ is the model's own scratch space; vfs/ and archive/ are view-only by default and render through the recall path. Model-facing mistakes (unknown path, missing argument, write to a read-only namespace, vetoed write) come back as Error: … text the model can correct; programmer errors throw. ChefConfig.tools: 'legacy' | 'unified' (default 'legacy') decides what compile() emits — under 'unified' the payload carries context (plus new_context when overflow.handoff is set) and never the legacy memory tools; the two sets never co-exist. ChefConfig.contextTool.writable is the access policy (default ['memory', 'notes']), enforced at dispatch, never in the store. ChefConfig.store wires one backend into Memory and the Offloader, with explicit per-module stores taking precedence, and chef.getStore() exposes it. Memory.getToolDefinitions() is @deprecated. Every context:// address is validated at dispatch — namespace and each segment reject ., .., empty segments, backslashes and control characters — and the tool description does not advertise archive/ in 4.x (reads still resolve; the namespace goes live in 5.0). Default stays 'legacy'; no behavior change under default config.
    • One vocabulary (phase 4c): every string the model reads — the memory instruction and memory block, the offload truncation marker, the summary wrapper, the default handoff notice — now comes from a Vocabulary resolved once in the constructor from tools mode. LEGACY_VOCABULARY delegates verbatim to the existing Prompts entries (that delegation is the byte-identity guarantee); UNIFIED_VOCABULARY speaks context:// addressing, names the context tool, and adds the window lineage line (Context window: … (previous: …)) to summaries. New constants: CONTEXT_STORE_INSTRUCTION, CONTEXT_MEMORY_BLOCK_HEADER, getContextMemoryBlock, getContextOffloadReminder, getContextSummaryWrapper, CONTEXT_HANDOFF_NOTICE_TEMPLATE. auditAnthropicCachePlacement derives its memory markers from both vocabularies, so the audit catches the block either way. A standalone Memory / Offloader / Janitor with no vocabulary injected behaves exactly as before, and a test asserts the one-vocabulary invariant under tools: 'unified' — no legacy tool name appears anywhere in the payload.

@context-chef/tanstack-ai@1.1.0

Minor Changes

  • #53 3549dee Thanks @MyPrototypeWhat! - Track core 4.2: one context store, one overflow strategy.

    • truncate.store replaces truncate.storage (now @deprecated): pass a StorageBackend — InMemoryBackend, FileSystemBackend, your own — or a pre-built Store shared with an archive, instead of a bare VFSStorageAdapter. store wins when both are set; a legacy adapter still works and is wrapped with Store.fromVfsAdapter. Truncated output carries the same context://vfs/ URI either way, readable back through chef.resolveRecall(uri) or the context tool's view.
    • overflow: { strategy, archive }: pass an explicit OverflowStrategy — summarize(), anchored(), reset(), composed with chain() / background() — in place of the policy the compress options describe, and an archive that keeps the evicted span retrievable behind the URI its summary cites. Setting overflow.strategy ignores the compress tuning options (two descriptions of one thing would disagree); the runner concerns — contextWindow, tokenizer, compress.triggerRatio, compress.usagePreference, onCompress, onBeforeCompress — keep applying whatever the strategy is, and contextWindow stays required as soon as compression is configured. archive takes the explicit { store } form: the 'vfs' shorthand substitutes a ContextChef-owned Offloader, which a middleware does not have.
    • Internally the per-session Janitor assembly, the missing-contextWindow throw and the compress-without-persistence warning now come from core's shared createJanitorPool() instead of a copy maintained here, and the derivable _originalText / _originalThinkingText projections are gone from the adapter. No behavior change.

    tools mode has no target in this package: it neither constructs a ContextChef nor dispatches library-owned tools, so the context tool is reached through a chef in your own loop.

Patch Changes

  • Updated dependencies [3549dee]:
    • @context-chef/core@4.2.0

@context-chef/examples@0.0.3

Patch Changes

  • Updated dependencies [3549dee, 3549dee, 3549dee]:
    • @context-chef/core@4.2.0
    • @context-chef/ai-sdk-middleware@3.1.0
    • @context-chef/tanstack-ai@1.1.0

@MyPrototypeWhat
MyPrototypeWhat merged commit 1a56cdc into main Sep 7, 2026
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