@bastani/pi-ai 0.9.46-alpha.1 → 0.9.47-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 +29 -0
- package/dist/api/anthropic-messages.d.ts.map +1 -1
- package/dist/api/anthropic-messages.js +4 -12
- package/dist/api/anthropic-messages.js.map +1 -1
- package/dist/api/bedrock-converse-stream.d.ts.map +1 -1
- package/dist/api/bedrock-converse-stream.js +59 -30
- package/dist/api/bedrock-converse-stream.js.map +1 -1
- package/dist/api/constrained-sampling.d.ts +4 -0
- package/dist/api/constrained-sampling.d.ts.map +1 -1
- package/dist/api/constrained-sampling.js +18 -0
- package/dist/api/constrained-sampling.js.map +1 -1
- package/dist/providers/data/.manifest.json +1 -1
- package/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/dist/providers/data/cloudflare-workers-ai.json +1 -1
- package/dist/providers/data/openai.json +1 -1
- package/dist/providers/data/opencode-go.json +1 -1
- package/dist/providers/data/opencode.json +1 -1
- package/dist/providers/data/openrouter.json +1 -1
- package/dist/providers/data/radius.json +1 -1
- package/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/utils/overflow.d.ts.map +1 -1
- package/dist/utils/overflow.js +2 -0
- package/dist/utils/overflow.js.map +1 -1
- package/dist/utils/version.d.ts +1 -1
- package/dist/utils/version.js +1 -1
- package/dist/utils/version.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,35 @@ 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.47-alpha.1] - 2026-10-27
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- LiteLLM's pre-call `ContextWindowExceededError` ("Context Window exceeded for given call") is now recognized as a context overflow, so the session compacts and retries instead of failing the turn with the 400 ([pi #11492](https://github.com/earendil-works/pi/issues/11492))
|
|
12
|
+
|
|
13
|
+
## [0.9.46] - 2026-10-27
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Added GPT-6.1 Terra to the OpenAI, Azure OpenAI Responses, and OpenAI Codex providers with official pricing ($1 input, $0.05 cached input, $1.25 cache writes, $5 output, long-context tier above 272k), Fast at twice those rates on the OpenAI API, tool search, and mid-conversation effort changes. Unlike GPT-6.1 Sol it supports `off` (reasoning effort `none`); it rejects `minimal`. Codex serves it with a 500K context window ([pi 363ad78b](https://github.com/earendil-works/pi/commit/363ad78bf0625e1dfbe848429782f5e07bb1584e))
|
|
18
|
+
- `OAuthAuth.needsRefresh()` (optional) reports that an unexpired stored credential lacks data only a refresh restores; `Models.refresh()` with network access then refreshes it once for providers without a model source ([#3998](https://github.com/bastani-inc/atomic/issues/3998))
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- GitHub Copilot offers fewer models its account can't use: a model enabled during login is offered only if the model list re-read afterwards marks it usable, and an OAuth login without a stored model list re-reads the list on the next `Models.refresh()` with network access (until then it keeps offering the catalog) ([#3998](https://github.com/bastani-inc/atomic/issues/3998))
|
|
23
|
+
- Anthropic Messages, Azure OpenAI Responses, Mistral and pi-messages failures now report the server retry hint (`Retry-After-Ms`, `Retry-After` in seconds or as an HTTP date, or a body `retry_after`) as `AssistantMessage.retryAfterMs`, as the OpenAI providers already did. A hint longer than `maxRetryDelayMs` stays on the failure that rejects it, and HTTP 529 overload responses are retryable like 503 ([#3984](https://github.com/bastani-inc/atomic/issues/3984))
|
|
24
|
+
- OAuth logins accept only `http:` and `https:` URLs from servers. Radius now also checks its browser authorization endpoint and device verification URI, and GitHub Copilot, Kimi Coding and Meta share one check ([pi 89c921d8](https://github.com/earendil-works/pi/commit/89c921d8b56b59e768b26e7f48b6832978119310))
|
|
25
|
+
- pi-messages streams now fail on a `contentIndex` that is not the next or an existing content block, such as `__proto__` or a huge index ([pi 89c921d8](https://github.com/earendil-works/pi/commit/89c921d8b56b59e768b26e7f48b6832978119310))
|
|
26
|
+
- The `pi-ai` CLI writes its `auth.json` with mode `0600`, so other users can no longer read the stored tokens; an existing file is tightened before new tokens are written ([pi 89c921d8](https://github.com/earendil-works/pi/commit/89c921d8b56b59e768b26e7f48b6832978119310))
|
|
27
|
+
- OpenCode DeepSeek V4.1 Flash no longer sends `prompt_cache_retention` with long cache retention, which the OpenCode gateway rejects ([pi 89c921d8](https://github.com/earendil-works/pi/commit/89c921d8b56b59e768b26e7f48b6832978119310))
|
|
28
|
+
- Google Generative AI, Google Vertex and Amazon Bedrock failures now report the server's retry hint as `retryAfterMs`: Google's `RetryInfo.retryDelay` from the error body, and Bedrock's `Retry-After` / `Retry-After-Ms` response headers. A Google request retried by the shared retry policy now waits that delay instead of a guessed backoff, and a delay above the retry-delay cap fails at once with the hint attached.
|
|
29
|
+
- ChatGPT (Codex) HTTP failures other than usage limits now keep the HTTP status in their message (`402: …`), so an exhausted quota or server error is still recognizable from the message.
|
|
30
|
+
- Amazon Bedrock GPT-6.1 Sol (`openai.gpt-6.1-sol`, `us.openai.gpt-6.1-sol`, `global.openai.gpt-6.1-sol`) now offers its published reasoning efforts `low` through `max`, including `xhigh` and `max`, and no longer offers `off` or `minimal`, which the model does not support ([OpenAI](https://developers.openai.com/api/docs/models/gpt-6.1-sol)). Bedrock GPT-6 Sol and GPT-6 Luna routes now offer `xhigh` and `max` and no longer offer `minimal`, matching their AWS model cards ([GPT-6 Sol](https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-openai-gpt-6-sol.html), [GPT-6 Luna](https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-openai-gpt-6-luna.html))
|
|
31
|
+
- Amazon Bedrock OpenAI GPT models with reasoning `off` now send the model's mapped `off` effort, as the OpenAI Responses provider does, so Bedrock GPT-6 Sol and GPT-6 Luna run with `reasoning.effort: "none"` instead of silently using their default `medium`. Models whose map gives `off` no value, such as GPT-6 Astra and GPT-6.1 Sol, still send no reasoning field.
|
|
32
|
+
- OpenCode Zen and OpenCode Go requests use the documented protocol-specific endpoints (`/openai/v1`, `/anthropic`, `/google/v1beta`, and `/systemone/v1` for Jev classifiers) instead of the shared `/inference/v1` base ([pi #11132](https://github.com/earendil-works/pi/issues/11132))
|
|
33
|
+
- GPT-5.4 and GPT-5.5 no longer fail with `Missing namespace for function_call` after switching from another model that called tools. On the OpenAI, OpenCode and GitHub Copilot providers they now declare their tools in the top-level tool list instead of loading them through `additional_tools` or tool search ([pi #11415](https://github.com/earendil-works/pi/issues/11415))
|
|
34
|
+
- Bedrock requests no longer fail when `strict: "prefer"` tools exceed Claude's strict tool limits, such as more than 16 optional parameters across all strict tools. They retry once with preferred tools non-strict and keep `strict: "require"` tools strict, as the Anthropic provider already does ([pi #11416](https://github.com/earendil-works/pi/issues/11416))
|
|
35
|
+
|
|
7
36
|
## [0.9.46-alpha.1] - 2026-10-27
|
|
8
37
|
|
|
9
38
|
### 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;AAiBnF,OAAO,KAAK,EASX,mBAAmB,EAEnB,cAAc,EACd,aAAa,EAKb,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"anthropic-messages.d.ts","sourceRoot":"","sources":["../../src/api/anthropic-messages.ts"],"names":[],"mappings":"AAAA,OAAO,SAAkD,MAAM,mBAAmB,CAAC;AAiBnF,OAAO,KAAK,EASX,mBAAmB,EAEnB,cAAc,EACd,aAAa,EAKb,MAAM,aAAa,CAAC;AAkLrB,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAE1E,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG,SAAS,CAAC;AAqPhE,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;IAC3C;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACtE;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;CACnB;AAsTD,eAAO,MAAM,MAAM,EAAE,cAAc,CAAC,oBAAoB,EAAE,gBAAgB,CA6YzE,CAAC;AA4BF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,oBAAoB,EAAE,mBAAmB,CAgDlF,CAAC"}
|
|
@@ -18,7 +18,7 @@ import { createStreamDeadline, withStreamDeadline } from "../utils/stream-deadli
|
|
|
18
18
|
import { ToolCallArgumentsStream } from "../utils/streaming-json.js";
|
|
19
19
|
import { getSystemMessageText, renderSystemMessageUpdate } from "../utils/text.js";
|
|
20
20
|
import { getCurrentTools, getInitialSystemMessage, resolveTranscript, } from "../utils/transcript.js";
|
|
21
|
-
import { ANTHROPIC_STRICT_JSON_SCHEMA_PROFILE, getJsonSchemaToolParameters, resolveJsonSchemaStrictSampling, } from "./constrained-sampling.js";
|
|
21
|
+
import { ANTHROPIC_STRICT_JSON_SCHEMA_PROFILE, getJsonSchemaToolParameters, isStrictToolLimitErrorMessage, prefersJsonSchemaStrictSampling, resolveJsonSchemaStrictSampling, } from "./constrained-sampling.js";
|
|
22
22
|
import { buildCopilotDynamicHeaders, hasCopilotVisionInput, preserveCopilotIntegrationHeader, } from "./github-copilot-headers.js";
|
|
23
23
|
import { adjustMaxTokensForThinking, buildBaseOptions, clampMaxTokensToContext } from "./simple-options.js";
|
|
24
24
|
import { splitErrorToolResultImages, transformMessages } from "./transform-messages.js";
|
|
@@ -670,11 +670,7 @@ export const stream = (model, context, options) => {
|
|
|
670
670
|
!(error instanceof Anthropic.APIError) ||
|
|
671
671
|
error.status !== 400 ||
|
|
672
672
|
error.type !== "invalid_request_error" ||
|
|
673
|
-
!
|
|
674
|
-
"The compiled grammar is too large",
|
|
675
|
-
"Too many strict tools (",
|
|
676
|
-
"Schemas contains too many parameters with union types (",
|
|
677
|
-
].some((message) => error.message.includes(message)))
|
|
673
|
+
!isStrictToolLimitErrorMessage(error.message))
|
|
678
674
|
throw error;
|
|
679
675
|
disablePreferredStrictTools = true;
|
|
680
676
|
appendAssistantMessageDiagnostic(output, {
|
|
@@ -1156,10 +1152,7 @@ function buildParams(model, context, isOAuthToken, options, disablePreferredStri
|
|
|
1156
1152
|
if (isOAuthToken)
|
|
1157
1153
|
tools = [...new Map(tools.map((tool) => [toClaudeCodeName(tool.name), tool])).values()];
|
|
1158
1154
|
const definitions = convertTools(tools, isOAuthToken, compat.supportsEagerToolInputStreaming, compat.supportsStrictTools, toolCacheControl, disablePreferredStrictTools);
|
|
1159
|
-
if (definitions.some((definition, index) =>
|
|
1160
|
-
const config = tools[index].constrainedSampling;
|
|
1161
|
-
return definition.strict === true && config && config.type === "json_schema" && config.strict === "prefer";
|
|
1162
|
-
}))
|
|
1155
|
+
if (definitions.some((definition, index) => definition.strict === true && prefersJsonSchemaStrictSampling(tools[index])))
|
|
1163
1156
|
hasPreferredStrictTools = true;
|
|
1164
1157
|
return definitions;
|
|
1165
1158
|
};
|
|
@@ -1635,8 +1628,7 @@ function convertTools(tools, isOAuthToken, supportsEagerToolInputStreaming, supp
|
|
|
1635
1628
|
if (!tools)
|
|
1636
1629
|
return [];
|
|
1637
1630
|
return tools.map((tool, index) => {
|
|
1638
|
-
const
|
|
1639
|
-
const strict = disablePreferredStrictTools && config && config.type === "json_schema" && config.strict === "prefer"
|
|
1631
|
+
const strict = disablePreferredStrictTools && prefersJsonSchemaStrictSampling(tool)
|
|
1640
1632
|
? undefined
|
|
1641
1633
|
: resolveJsonSchemaStrictSampling(tool, supportsStrictTools, ANTHROPIC_STRICT_JSON_SCHEMA_PROFILE);
|
|
1642
1634
|
const parameters = getJsonSchemaToolParameters(tool, strict, ANTHROPIC_STRICT_JSON_SCHEMA_PROFILE);
|