feat(ai-anthropic): support native on-demand compaction
メンテナーはふだん 1 日以内に返信
@tombeckenham がすでに取り組んでいます。
2026年11月7日 から。
評価
この issue はまだ評価されていません。
説明
Request
Implement explicit, on-demand native compaction in @tanstack/ai-anthropic, exposed through the existing optional TextAdapter.compact() capability and consumed by withCompaction({ native: adapter }).
Current behavior
Checked @tanstack/ai-anthropic 1.1.1 and current main. The Anthropic text adapter has no compact() implementation. Passing it as native therefore uses the configured strategy. createAnthropicSummarize is ordinary chat-based summarization, not Anthropic's native compaction operation.
The existing abstraction appears suitable: #1729 added provider-native compaction, with an OpenAI Responses implementation and strategy fallback. I found no existing issue or PR requesting the Anthropic equivalent.
Why this is useful
Claude applications using TanStack's compaction middleware currently need their own provider bridge to call native compaction. That duplicates provider request mapping, capability checks, cancellation, error handling, and usage parsing. Keeping those responsibilities in the adapter would make this capability reusable across applications while retaining the existing portable strategy fallback and full-transcript/provider-context split.
This is an additional provider strategy, not a claim that native summaries are lossless or always preferable to application-defined summaries.
Provider requirements and interface gap
Anthropic documents on-demand compaction as a separate Messages request with compaction: { type: "summarize" } and the compact-2026-09-04 beta. Models expose support through capabilities.compaction.
Unlike the initial OpenAI implementation, it needs the conversation's system prompt and tool definitions, plus an explicit output allowance. TextCompactOptions currently carries system prompts but neither tools nor model options. A supported way to provide the relevant chat configuration would be needed rather than silently dropping tools or asking applications to rebuild provider serialization.
Other important behavior:
- Propagate cancellation and
wrapFetch. - Keep the compaction call outside ordinary tool execution.
- Validate
stop_reason === "compaction"and a nonempty compaction block. HTTP 200 can otherwise contain no usable summary. - Preserve provider data in the returned result, including the signature.
- Let unsupported models or unusable results enter the existing strategy fallback.
- Account for compaction usage, which Anthropic reports in
usage.iterations.
Scope
This request concerns explicit native compaction through the existing adapter/middleware model. Provider-managed threshold compaction, new persistence infrastructure, and a general signed-block replay or retained-thinking redesign are outside this request. The detailed replay contract can be discussed separately, while ensuring the native result is not reduced to unsigned text.
#1959 and #2040 address signed thinking blocks after history rewriting. They do not implement the native compaction operation requested here.
Is extending TextCompactOptions with the required chat configuration the preferred direction, or would maintainers prefer adapter-specific compaction options?
- 主要言語
- TypeScript
- スター
- 3.3k
- フォーク
- 378
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 253
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/ai のほかの issue
-
openai-base: a Responses max_output_tokens cutoff ends as RUN_ERROR without usage instead of finishReason 'length'対応中かも @tombeckenham が 9 日前に担当しました。 オープンhas-pr waiting-on: maintainer
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
TanStack/ai#1916 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
@tanstack/openai-base: strict structured output skips $defs/definitions, so recursive zod schemas are rejected対応中かも @jherr が今日担当しました。 オープンhas-pr waiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
Approval resume validates null-widened history args, so approved tools fail with repairToolInput: false対応中かも @tombeckenham が今日担当しました。 オープンwaiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
ai-sandbox: encrypt snapshot blobs at rest with an encrypting blob store wrapper対応中かも @AlemTuzlak が 1 日前に担当しました。 オープンwaiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
Sandbox takeover: the saved transcript loses everything the first host delivered before the restart対応中かも @tombeckenham が 1 日前に担当しました。 オープンwaiting-on: maintainer
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
binding:python bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
coollabsio/orbit#72 ·
メンテナーはふだん 1 日以内に返信
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
bug needs-triage potential-regression
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
aws/aws-sdk-js-v3#8408 ·
メンテナーはふだん 1 日以内に返信