@bastani/pi-ai 0.9.75-alpha.1 → 0.9.76-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,41 @@ This package is a Bastani fork of `@earendil-works/pi-ai`. Upstream history at t
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.9.76-alpha.1] - 2026-11-10
8
+
9
+ Claude Fable 5.2 works with an Anthropic subscription login.
10
+
11
+ - **Fable 5.2 over Claude subscriptions.** `claude-fable-5-2` no longer fails with `claude_code_version_too_old` when you sign in with an Anthropic subscription, because OAuth requests now identify as the latest Claude Code release (`2.1.322`) ([#4634](https://github.com/bastani-inc/atomic/pull/4634), upstream [#11969](https://github.com/earendil-works/pi/issues/11969)).
12
+
13
+ ### Fixed
14
+
15
+ - Claude Fable 5.2 (`claude-fable-5-2`) works with an Anthropic subscription login. The Claude Code version sent on OAuth requests is now `2.1.322`, the latest Claude Code release, so Anthropic no longer rejects them with `claude_code_version_too_old` (upstream [#11969](https://github.com/earendil-works/pi/issues/11969))
16
+
17
+ ## [0.9.75] - 2026-11-10
18
+
19
+ Claude Fable 5.2, steadier GitHub Copilot streams and SVG output that works without extra options.
20
+
21
+ - **Claude Fable 5.2.** `claude-fable-5-2` joins the `anthropic` provider with per-message effort and server-side fallback to Claude Opus 5, and Fable and Mythos 5.2 on other providers get the same effort support.
22
+ - **Diagnosable, steadier Copilot streams.** A Copilot stream that ends early reports how long it ran, whether the response had started and the request ID, Anthropic `ping` events keep a silently thinking model inside `streamDeadlineMs`, and a stored API key is filtered by the account's own model list ([#4626](https://github.com/bastani-inc/atomic/issues/4626), [#4627](https://github.com/bastani-inc/atomic/issues/4627)).
23
+ - **SVG images on GPT Image 2.6.** `outputFormat: "svg"` retries with a default authoring model when the API needs one, reports it in `svgModel`, and fails with a typed `invalid-option` error instead of `api-error` ([#4615](https://github.com/bastani-inc/atomic/issues/4615)).
24
+ - **Shared cache warming and correct costs.** Prompt cache warming decisions are shared helpers every host can use, Azure OpenAI keeps its long-context price tier, Anthropic and Bedrock stop resending rejected strict tools, and credential-free catalogs refresh even when a login is stale (upstream [#11857](https://github.com/earendil-works/pi/pull/11857), [#11948](https://github.com/earendil-works/pi/issues/11948), [#11626](https://github.com/earendil-works/pi/issues/11626), [#4610](https://github.com/bastani-inc/atomic/issues/4610)).
25
+
26
+ ### Added
27
+
28
+ - Added the prompt cache warming policy as shared helpers, so every host that warms a prompt cache decides the same way: `getPromptCacheTtlMs()` (the lifetime of the entry a request writes, from the model's `promptCache` tier for the request's `cacheRetention`, then `PI_CACHE_RETENTION`, defaulting to `short`), `getCacheWarmingDelayMs()`, `isCacheWarmingReplayable()`, `getCacheWarmingRequestOptions()`, `evaluateCacheWarming()`, the `CACHE_WARMING_*` constants and the `CacheWarmingAction`, `CacheWarmingPhase` and `CacheWarmingDecision` types. They moved from the coding agent's cache warmer, which keeps resolving the model-specific default retention before it asks for the lifetime (upstream [#11857](https://github.com/earendil-works/pi/pull/11857))
29
+ - Added Claude Fable 5.2 (`claude-fable-5-2`) to the `anthropic` provider ($8/$40 per million input/output tokens, 1M context, 128K output). Like Fable 5.1 it uses per-message effort and mid-conversation system messages; requests its safety classifiers refuse before any output are answered by Claude Opus 5 through server-side fallback and billed at Opus 5's price. Claude Fable 5.2 and Mythos 5.2 on other providers, such as OpenRouter's `anthropic/claude-fable-5.2`, get the same per-message effort support
30
+ - Added `GitHubCopilotStreamAttempt`, which records the request ID, duration and progress of one Copilot streaming request, and its `GitHubCopilotStreamSnapshot` result type, which `classifyGitHubCopilotFailure()` takes as `stream` ([#4626](https://github.com/bastani-inc/atomic/issues/4626))
31
+
32
+ ### Fixed
33
+
34
+ - GitHub Copilot now filters a stored API key by its account's model list as it does an OAuth login. `ApiKeyCredential` gains the optional `availableModelIds` and `fastModelIds` that a model refresh saves from the account's list, `RefreshModelsContext.updateCredential` is offered for a stored API key too and now takes and returns a `Credential` (it writes only while the store still holds the key or token the refresh used), and `refreshGitHubCopilotAccountModelLists()` renews just those lists for a provider alias. Nothing is hidden for a key whose list was not read or names no usable model ([#4627](https://github.com/bastani-inc/atomic/issues/4627))
35
+ - Catalog providers can set `Provider.refreshModelsAuth: "configured"` to refresh without renewing OAuth or receiving a provider credential, while still skipping unconfigured providers. Stale logins no longer block credential-free catalogs ([#4610](https://github.com/bastani-inc/atomic/issues/4610))
36
+ - Azure OpenAI models now keep OpenAI's long-context price tier, so requests above 272K input tokens are costed at Azure's long-context rates instead of the standard rates (upstream [#11948](https://github.com/earendil-works/pi/issues/11948))
37
+ - Fixed Anthropic and Bedrock sending `strict: "prefer"` tools strict again on every request after Claude rejected them for exceeding its strict tool limits, which cost a rejected request (400) per turn. Later requests with the same `sessionId` now send those tools non-strict right away, until `cleanupSessionResources(sessionId)` (upstream [#11626](https://github.com/earendil-works/pi/issues/11626))
38
+ - Fixed `outputFormat: "svg"` on GPT Image 2.6 failing with a generic `api-error` (HTTP 400, `missing_required_parameter` for `svg.model`) on accounts where the API requires the SVG authoring model. A request without `svg` now retries once with a default authoring model, `DEFAULT_SVG_AUTHOR_MODEL` (`gpt-6.1-sol`, a value that worked in testing: OpenAI documents no default), and retries once more without `svg` if the API rejects it as unsupported, so a call sends at most three requests. An `svg` you pass is always sent as given and never retried or replaced. `AssistantImages.svgModel` reports the model that wrote the SVG. A rejected `svg` or `svg.model` now fails with `ImageGenerationConfigError` (`code: "invalid-option"`, `field` `svg.model` or `svg`, and the new `reason` values `required-by-api`, `rejected-by-api` and `unsupported-by-api`) instead of `api-error`. Image requests pass their 10-minute default timeout to the SDK explicitly, so SVG authoring that takes tens of seconds never times out early ([#4615](https://github.com/bastani-inc/atomic/issues/4615))
39
+ - Fixed GitHub Copilot `stream-ended-early` failures giving almost nothing to diagnose them with. `GitHubCopilotStreamEndedEarlyError` now carries `durationMs` (how long the attempt ran) and `startedContent` (whether any stream event had arrived), and takes its `requestId` from the response's `x-request-id`, on Anthropic Messages, Chat Completions and Responses streams. The fields appear in `fields()`, survive serialization, and show in the message (`Attempt ran 312.4 s, response started, request ID …`). The hint no longer says Atomic retries "when retries are enabled", which was wrong once the retries were used up; it now suggests splitting the work, lowering the thinking effort or adding a fallback model. `GitHubCopilotFailureContext.streamStarted` is replaced by `stream`, and `recordGitHubCopilotFailure()` takes a `GitHubCopilotStreamSnapshot` (or `undefined` when no response arrived) instead of a boolean. `GitHubCopilotErrorFieldValue` now includes `boolean` ([#4626](https://github.com/bastani-inc/atomic/issues/4626))
40
+ - Fixed Anthropic `ping` events not counting as activity for the stream idle deadline (`streamDeadlineMs`), so a model thinking silently while the server kept the connection alive was cut at the deadline as if the stream had stalled. `withStreamDeadline()` takes an optional keep-alive predicate: a match restarts the idle timer and is not yielded, so pings never reach `onProviderStreamEvent` ([#4626](https://github.com/bastani-inc/atomic/issues/4626))
41
+
7
42
  ## [0.9.75-alpha.1] - 2026-11-10
8
43
 
9
44
  ### Added
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic-messages.d.ts","sourceRoot":"","sources":["../../src/api/anthropic-messages.ts"],"names":[],"mappings":"AAAA,OAAO,SAAkD,MAAM,mBAAmB,CAAC;AAqBnF,OAAO,KAAK,EASX,mBAAmB,EAEnB,cAAc,EACd,aAAa,EAMb,MAAM,aAAa,CAAC;AA0LrB,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAE1E,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG,SAAS,CAAC;AAkfhE,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACtD;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;;;;;;;;;;OAWG;IACH,eAAe,CAAC,EAAE,wBAAwB,CAAC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AM,CAAA;KAAE,CAAC;IACtE;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;CACnB;AAqVD,eAAO,MAAM,MAAM,EAAE,cAAc,CAAC,oBAAoB,EAAE,gBAAgB,CAobzE,CAAC;AA+CF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,oBAAoB,EAAE,mBAAmB,CAgDlF,CAAC"}
@@ -58,12 +58,13 @@ function getCacheControl(model, cacheRetention, env) {
58
58
  //
59
59
  // Anthropic gates newer models on the `claude-cli/<version>` user agent alone and rejects an
60
60
  // older one with `claude_code_version_too_old`. `claude-fable-5-1` requires >= 2.1.251 (bisected
61
- // against the live API: 2.1.250 -> 400, 2.1.251 -> 200) and Claude Opus 5.5 requires >= 2.1.280,
62
- // the floor the API names in its rejection. This is pinned to the highest published minimum
63
- // among shipped models rather than the newest release; every model this provider ships answers
64
- // 200 at 2.1.280. Raise it only when a model rejects this value; a caller can override it for
65
- // one client through the `headers` option, whose lowercase `user-agent` key is merged last.
66
- const claudeCodeVersion = "2.1.280";
61
+ // against the live API: 2.1.250 -> 400, 2.1.251 -> 200), Claude Opus 5.5 requires >= 2.1.280 and
62
+ // `claude-fable-5-2` requires >= 2.1.290, the floors the API names in its rejections. This tracks
63
+ // the latest published Claude Code release (`npm view @anthropic-ai/claude-code version`), which
64
+ // stays above every shipped model's floor and matches what an up-to-date Claude Code sends. A
65
+ // caller can override it for one client through the `headers` option, whose lowercase
66
+ // `user-agent` key is merged last.
67
+ const claudeCodeVersion = "2.1.322";
67
68
  // Claude Code 2.x tool names (canonical casing)
68
69
  // Source: https://cchistory.mariozechner.at/data/prompts-2.1.11.md
69
70
  // To update: https://github.com/badlogic/cchistory