@linxiraos/pi-ai 1.1.6 → 1.1.8
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 +23 -6
- package/dist/types/auth-gateway/types.d.ts +2 -0
- package/dist/types/auth-storage.d.ts +2 -2
- package/dist/types/dialect/thinking.d.ts +9 -0
- package/dist/types/dialect/types.d.ts +10 -0
- package/dist/types/error/flags.d.ts +5 -5
- package/dist/types/error/rate-limit.d.ts +14 -12
- package/dist/types/error/retryable.d.ts +3 -10
- package/dist/types/index.d.ts +0 -1
- package/dist/types/providers/anthropic-messages-server-schema.d.ts +136 -12
- package/dist/types/providers/anthropic-messages-server.d.ts +1 -1
- package/dist/types/providers/anthropic-wire.d.ts +41 -2
- package/dist/types/providers/anthropic.d.ts +18 -14
- package/dist/types/providers/claude-code-fingerprint.d.ts +9 -9
- package/dist/types/providers/cursor.d.ts +4 -2
- package/dist/types/providers/gitlab-duo.d.ts +2 -22
- package/dist/types/providers/kimi.d.ts +1 -1
- package/dist/types/providers/mock.d.ts +1 -0
- package/dist/types/providers/openai-shared.d.ts +21 -11
- package/dist/types/providers/vision-guard.d.ts +0 -26
- package/dist/types/registry/amazon-bedrock.d.ts +3 -10
- package/dist/types/registry/api-key-validation.d.ts +3 -0
- package/dist/types/registry/bedrock-mantle.d.ts +3 -22
- package/dist/types/registry/build.d.ts +11 -0
- package/dist/types/registry/cloudflare-ai-gateway.d.ts +3 -13
- package/dist/types/registry/engine/api-key.d.ts +8 -0
- package/dist/types/registry/engine/common.d.ts +55 -0
- package/dist/types/registry/engine/device-code.d.ts +9 -0
- package/dist/types/registry/engine/oauth-code.d.ts +27 -0
- package/dist/types/registry/engine/refresh.d.ts +11 -0
- package/dist/types/registry/hooks/api-key.d.ts +8 -0
- package/dist/types/registry/hooks/custom.d.ts +7 -0
- package/dist/types/registry/hooks/device-code.d.ts +8 -0
- package/dist/types/registry/hooks/env.d.ts +2 -0
- package/dist/types/registry/hooks/index.d.ts +3 -0
- package/dist/types/registry/hooks/oauth-code.d.ts +8 -0
- package/dist/types/registry/hooks/types.d.ts +44 -0
- package/dist/types/registry/oauth/alibaba-coding-plan.d.ts +2 -0
- package/dist/types/registry/{alibaba-token-plan.d.ts → oauth/alibaba-token-plan.d.ts} +1 -6
- package/dist/types/registry/oauth/anthropic.d.ts +24 -16
- package/dist/types/registry/oauth/cloudflare-ai-gateway.d.ts +3 -0
- package/dist/types/registry/oauth/coreweave.d.ts +1 -0
- package/dist/types/registry/oauth/cursor.d.ts +3 -1
- package/dist/types/registry/oauth/github-copilot.d.ts +5 -2
- package/dist/types/registry/oauth/gitlab-duo.d.ts +3 -3
- package/dist/types/registry/oauth/google-antigravity.d.ts +3 -7
- package/dist/types/registry/oauth/google-gemini-cli.d.ts +3 -6
- package/dist/types/registry/oauth/google-oauth-shared.d.ts +0 -24
- package/dist/types/registry/oauth/kilo.d.ts +2 -0
- package/dist/types/registry/oauth/kimi.d.ts +0 -9
- package/dist/types/registry/oauth/openai-codex.d.ts +6 -13
- package/dist/types/registry/oauth/xai-oauth.d.ts +5 -10
- package/dist/types/registry/oauth/xiaomi.d.ts +2 -10
- package/dist/types/registry/oauth/zai.d.ts +3 -15
- package/dist/types/registry/registry.d.ts +9 -382
- package/dist/types/registry/types.d.ts +12 -9
- package/dist/types/stream.d.ts +4 -1
- package/dist/types/types.d.ts +37 -5
- package/dist/types/usage/cline-pass.d.ts +2 -0
- package/dist/types/usage/devin.d.ts +12 -0
- package/dist/types/usage.d.ts +12 -0
- package/dist/types/utils/harmony-leak.d.ts +13 -4
- package/dist/types/utils/http-inspector.d.ts +22 -4
- package/dist/types/utils/leaked-thinking-stream.d.ts +6 -0
- package/dist/types/utils/schema/normalize.d.ts +10 -0
- package/dist/types/utils/schema/strict-tool-validation.d.ts +3 -3
- package/dist/types/utils/stream-markup-healing.d.ts +2 -5
- package/dist/types/utils/thinking-loop.d.ts +4 -7
- package/package.json +5 -5
- package/src/auth-broker/client.ts +1 -1
- package/src/auth-broker/remote-store.ts +1 -1
- package/src/auth-broker/server.ts +4 -4
- package/src/auth-gateway/server.ts +15 -7
- package/src/auth-gateway/types.ts +2 -0
- package/src/auth-storage.ts +331 -98
- package/src/dialect/deepseek.ts +36 -2
- package/src/dialect/owned-stream.ts +3 -0
- package/src/dialect/thinking.ts +44 -7
- package/src/dialect/types.ts +8 -0
- package/src/error/auth-classify.ts +4 -1
- package/src/error/classes.ts +1 -2
- package/src/error/flags.ts +23 -52
- package/src/error/format.ts +4 -0
- package/src/error/rate-limit.ts +41 -24
- package/src/error/retryable.ts +3 -12
- package/src/index.ts +0 -1
- package/src/providers/amazon-bedrock.ts +60 -11
- package/src/providers/anthropic-client.ts +1 -1
- package/src/providers/anthropic-messages-server-schema.ts +29 -1
- package/src/providers/anthropic-messages-server.ts +56 -8
- package/src/providers/anthropic-wire.ts +63 -2
- package/src/providers/anthropic.ts +785 -157
- package/src/providers/aws-credentials.ts +2 -2
- package/src/providers/azure-openai-responses.ts +2 -1
- package/src/providers/claude-code-fingerprint.ts +9 -9
- package/src/providers/cowork-fetch.ts +2 -3
- package/src/providers/cursor-external-tool-handoff.md +1 -0
- package/src/providers/cursor.ts +55 -12
- package/src/providers/devin.ts +139 -68
- package/src/providers/github-copilot-headers.ts +7 -2
- package/src/providers/gitlab-duo.ts +18 -160
- package/src/providers/google-gemini-cli.ts +16 -18
- package/src/providers/google-shared.ts +16 -38
- package/src/providers/google-vertex.ts +2 -2
- package/src/providers/google.ts +2 -2
- package/src/providers/kimi.ts +6 -2
- package/src/providers/mock.ts +3 -0
- package/src/providers/ollama.ts +8 -22
- package/src/providers/openai-anthropic-shim.ts +1 -1
- package/src/providers/openai-codex/request-transformer.ts +5 -4
- package/src/providers/openai-codex-responses.ts +8 -16
- package/src/providers/openai-completions.ts +84 -47
- package/src/providers/openai-data-uri.ts +32 -3
- package/src/providers/openai-responses.ts +48 -84
- package/src/providers/openai-shared.ts +71 -36
- package/src/providers/pi-native-client.ts +1 -1
- package/src/providers/transform-messages.ts +233 -59
- package/src/providers/vision-guard.ts +1 -68
- package/src/registry/amazon-bedrock.ts +5 -8
- package/src/registry/api-key-validation.ts +36 -6
- package/src/registry/bedrock-mantle.ts +5 -8
- package/src/registry/build.ts +73 -0
- package/src/registry/cloudflare-ai-gateway.ts +22 -63
- package/src/registry/engine/api-key.ts +109 -0
- package/src/registry/engine/common.ts +306 -0
- package/src/registry/engine/device-code.ts +131 -0
- package/src/registry/engine/oauth-code.ts +231 -0
- package/src/registry/engine/refresh.ts +105 -0
- package/src/registry/hooks/api-key.ts +19 -0
- package/src/registry/hooks/custom.ts +15 -0
- package/src/registry/hooks/device-code.ts +13 -0
- package/src/registry/hooks/env.ts +42 -0
- package/src/registry/hooks/index.ts +21 -0
- package/src/registry/hooks/oauth-code.ts +18 -0
- package/src/registry/hooks/types.ts +53 -0
- package/src/registry/{alibaba-coding-plan.ts → oauth/alibaba-coding-plan.ts} +3 -11
- package/src/registry/{alibaba-token-plan.ts → oauth/alibaba-token-plan.ts} +3 -10
- package/src/registry/oauth/anthropic.ts +39 -272
- package/src/registry/oauth/cloudflare-ai-gateway.ts +39 -0
- package/src/registry/oauth/coreweave.ts +16 -0
- package/src/registry/oauth/cursor.ts +12 -1
- package/src/registry/oauth/device-code.ts +1 -2
- package/src/registry/oauth/github-copilot.ts +37 -21
- package/src/registry/oauth/gitlab-duo.ts +6 -219
- package/src/registry/oauth/google-antigravity.ts +32 -66
- package/src/registry/oauth/google-gemini-cli.ts +32 -65
- package/src/registry/oauth/google-oauth-shared.ts +0 -143
- package/src/registry/oauth/index.ts +28 -39
- package/src/registry/{kilo.ts → oauth/kilo.ts} +2 -9
- package/src/registry/oauth/kimi.ts +1 -246
- package/src/registry/oauth/openai-codex.ts +28 -109
- package/src/registry/oauth/perplexity.ts +48 -2
- package/src/registry/oauth/xai-oauth.ts +7 -327
- package/src/registry/oauth/xiaomi.ts +9 -60
- package/src/registry/oauth/zai.ts +6 -86
- package/src/registry/registry.ts +32 -171
- package/src/registry/types.ts +12 -9
- package/src/stream.ts +32 -22
- package/src/types.ts +48 -11
- package/src/usage/claude.ts +3 -2
- package/src/usage/cline-pass.ts +167 -0
- package/src/usage/devin.ts +310 -0
- package/src/usage/gemini.ts +2 -32
- package/src/usage/github-copilot.ts +2 -2
- package/src/usage/google-antigravity.ts +45 -14
- package/src/usage/openai-codex.ts +2 -1
- package/src/usage.ts +9 -0
- package/src/utils/aws-profile.ts +1 -1
- package/src/utils/empty-completion-retry.ts +0 -1
- package/src/utils/harmony-leak.ts +7 -7
- package/src/utils/http-inspector.ts +42 -7
- package/src/utils/leaked-thinking-stream.ts +37 -7
- package/src/utils/proxy.ts +2 -3
- package/src/utils/request-debug.ts +1 -1
- package/src/utils/schema/fields.ts +1 -1
- package/src/utils/schema/normalize.ts +173 -16
- package/src/utils/schema/strict-tool-validation.ts +4 -4
- package/src/utils/stream-markup-healing.ts +5 -26
- package/src/utils/thinking-loop.ts +12 -17
- package/src/utils/tool-call-loop-guard.ts +19 -9
- package/src/utils.ts +13 -1
- package/dist/types/registry/aiand.d.ts +0 -7
- package/dist/types/registry/aimlapi.d.ts +0 -4
- package/dist/types/registry/alibaba-coding-plan.d.ts +0 -8
- package/dist/types/registry/anthropic.d.ts +0 -10
- package/dist/types/registry/api-key-login.d.ts +0 -44
- package/dist/types/registry/azure.d.ts +0 -4
- package/dist/types/registry/baseten.d.ts +0 -7
- package/dist/types/registry/cerebras.d.ts +0 -7
- package/dist/types/registry/coreweave.d.ts +0 -7
- package/dist/types/registry/cursor.d.ts +0 -7
- package/dist/types/registry/deepinfra.d.ts +0 -6
- package/dist/types/registry/deepseek.d.ts +0 -8
- package/dist/types/registry/devin.d.ts +0 -8
- package/dist/types/registry/exa.d.ts +0 -8
- package/dist/types/registry/firepass.d.ts +0 -16
- package/dist/types/registry/fireworks.d.ts +0 -7
- package/dist/types/registry/github-copilot.d.ts +0 -7
- package/dist/types/registry/gitlab-duo-workflow.d.ts +0 -10
- package/dist/types/registry/gitlab-duo.d.ts +0 -9
- package/dist/types/registry/gmi-cloud.d.ts +0 -7
- package/dist/types/registry/google-antigravity.d.ts +0 -9
- package/dist/types/registry/google-gemini-cli.d.ts +0 -9
- package/dist/types/registry/google-vertex.d.ts +0 -5
- package/dist/types/registry/google.d.ts +0 -4
- package/dist/types/registry/groq.d.ts +0 -4
- package/dist/types/registry/huggingface.d.ts +0 -7
- package/dist/types/registry/kagi.d.ts +0 -14
- package/dist/types/registry/kilo.d.ts +0 -7
- package/dist/types/registry/kimi-code.d.ts +0 -7
- package/dist/types/registry/litellm.d.ts +0 -13
- package/dist/types/registry/llama-cpp.d.ts +0 -8
- package/dist/types/registry/lm-studio.d.ts +0 -8
- package/dist/types/registry/meta.d.ts +0 -7
- package/dist/types/registry/minimax-code-cn.d.ts +0 -6
- package/dist/types/registry/minimax-code.d.ts +0 -6
- package/dist/types/registry/minimax.d.ts +0 -4
- package/dist/types/registry/mistral.d.ts +0 -4
- package/dist/types/registry/moonshot.d.ts +0 -7
- package/dist/types/registry/nanogpt.d.ts +0 -7
- package/dist/types/registry/novita.d.ts +0 -6
- package/dist/types/registry/nvidia.d.ts +0 -7
- package/dist/types/registry/oauth/devin.d.ts +0 -5
- package/dist/types/registry/oauth/gitlab-duo-workflow.d.ts +0 -6
- package/dist/types/registry/oauth/minimax-code.d.ts +0 -27
- package/dist/types/registry/oauth/opencode.d.ts +0 -25
- package/dist/types/registry/oauth/openrouter.d.ts +0 -36
- package/dist/types/registry/oauth/wafer.d.ts +0 -1
- package/dist/types/registry/ollama-cloud.d.ts +0 -7
- package/dist/types/registry/ollama.d.ts +0 -12
- package/dist/types/registry/openai-codex-device.d.ts +0 -8
- package/dist/types/registry/openai-codex.d.ts +0 -9
- package/dist/types/registry/openai.d.ts +0 -4
- package/dist/types/registry/opencode-go.d.ts +0 -6
- package/dist/types/registry/opencode-zen.d.ts +0 -6
- package/dist/types/registry/openrouter.d.ts +0 -14
- package/dist/types/registry/parallel.d.ts +0 -14
- package/dist/types/registry/perplexity.d.ts +0 -7
- package/dist/types/registry/qianfan.d.ts +0 -7
- package/dist/types/registry/qwen-portal.d.ts +0 -7
- package/dist/types/registry/sakana.d.ts +0 -7
- package/dist/types/registry/siliconflow-cn.d.ts +0 -7
- package/dist/types/registry/siliconflow.d.ts +0 -7
- package/dist/types/registry/synthetic.d.ts +0 -6
- package/dist/types/registry/tavily.d.ts +0 -14
- package/dist/types/registry/together.d.ts +0 -6
- package/dist/types/registry/umans.d.ts +0 -7
- package/dist/types/registry/venice.d.ts +0 -13
- package/dist/types/registry/vercel-ai-gateway.d.ts +0 -7
- package/dist/types/registry/vllm.d.ts +0 -7
- package/dist/types/registry/wafer-serverless.d.ts +0 -6
- package/dist/types/registry/xai-oauth.d.ts +0 -7
- package/dist/types/registry/xai.d.ts +0 -7
- package/dist/types/registry/xiaomi-token-plan-ams.d.ts +0 -6
- package/dist/types/registry/xiaomi-token-plan-cn.d.ts +0 -6
- package/dist/types/registry/xiaomi-token-plan-sgp.d.ts +0 -6
- package/dist/types/registry/xiaomi.d.ts +0 -6
- package/dist/types/registry/yolo-auto.d.ts +0 -15
- package/dist/types/registry/zai.d.ts +0 -15
- package/dist/types/registry/zenmux.d.ts +0 -7
- package/dist/types/registry/zhipu-coding-plan.d.ts +0 -7
- package/dist/types/utils/retry.d.ts +0 -14
- package/src/registry/aiand.ts +0 -22
- package/src/registry/aimlapi.ts +0 -6
- package/src/registry/anthropic.ts +0 -26
- package/src/registry/api-key-login.ts +0 -129
- package/src/registry/azure.ts +0 -6
- package/src/registry/baseten.ts +0 -22
- package/src/registry/cerebras.ts +0 -23
- package/src/registry/coreweave.ts +0 -40
- package/src/registry/cursor.ts +0 -20
- package/src/registry/deepinfra.ts +0 -24
- package/src/registry/deepseek.ts +0 -46
- package/src/registry/devin.ts +0 -15
- package/src/registry/exa.ts +0 -19
- package/src/registry/firepass.ts +0 -32
- package/src/registry/fireworks.ts +0 -28
- package/src/registry/github-copilot.ts +0 -22
- package/src/registry/gitlab-duo-workflow.ts +0 -20
- package/src/registry/gitlab-duo.ts +0 -19
- package/src/registry/gmi-cloud.ts +0 -22
- package/src/registry/google-antigravity.ts +0 -22
- package/src/registry/google-gemini-cli.ts +0 -22
- package/src/registry/google-vertex.ts +0 -38
- package/src/registry/google.ts +0 -6
- package/src/registry/groq.ts +0 -6
- package/src/registry/huggingface.ts +0 -29
- package/src/registry/kagi.ts +0 -28
- package/src/registry/kimi-code.ts +0 -17
- package/src/registry/litellm.ts +0 -27
- package/src/registry/llama-cpp.ts +0 -25
- package/src/registry/lm-studio.ts +0 -20
- package/src/registry/meta.ts +0 -22
- package/src/registry/minimax-code-cn.ts +0 -12
- package/src/registry/minimax-code.ts +0 -12
- package/src/registry/minimax.ts +0 -6
- package/src/registry/mistral.ts +0 -6
- package/src/registry/moonshot.ts +0 -28
- package/src/registry/nanogpt.ts +0 -22
- package/src/registry/novita.ts +0 -25
- package/src/registry/nvidia.ts +0 -61
- package/src/registry/oauth/devin.ts +0 -124
- package/src/registry/oauth/gitlab-duo-workflow.ts +0 -146
- package/src/registry/oauth/minimax-code.ts +0 -53
- package/src/registry/oauth/opencode.ts +0 -64
- package/src/registry/oauth/openrouter.ts +0 -120
- package/src/registry/oauth/wafer.ts +0 -24
- package/src/registry/ollama-cloud.ts +0 -36
- package/src/registry/ollama.ts +0 -43
- package/src/registry/openai-codex-device.ts +0 -18
- package/src/registry/openai-codex.ts +0 -19
- package/src/registry/openai.ts +0 -6
- package/src/registry/opencode-go.ts +0 -12
- package/src/registry/opencode-zen.ts +0 -12
- package/src/registry/openrouter.ts +0 -24
- package/src/registry/parallel.ts +0 -27
- package/src/registry/perplexity.ts +0 -13
- package/src/registry/qianfan.ts +0 -27
- package/src/registry/qwen-portal.ts +0 -50
- package/src/registry/sakana.ts +0 -22
- package/src/registry/siliconflow-cn.ts +0 -22
- package/src/registry/siliconflow.ts +0 -22
- package/src/registry/synthetic.ts +0 -21
- package/src/registry/tavily.ts +0 -27
- package/src/registry/together.ts +0 -26
- package/src/registry/umans.ts +0 -23
- package/src/registry/venice.ts +0 -33
- package/src/registry/vercel-ai-gateway.ts +0 -20
- package/src/registry/vllm.ts +0 -24
- package/src/registry/wafer-serverless.ts +0 -12
- package/src/registry/xai-oauth.ts +0 -17
- package/src/registry/xai.ts +0 -22
- package/src/registry/xiaomi-token-plan-ams.ts +0 -12
- package/src/registry/xiaomi-token-plan-cn.ts +0 -12
- package/src/registry/xiaomi-token-plan-sgp.ts +0 -12
- package/src/registry/xiaomi.ts +0 -12
- package/src/registry/yolo-auto.ts +0 -30
- package/src/registry/zai.ts +0 -41
- package/src/registry/zenmux.ts +0 -22
- package/src/registry/zhipu-coding-plan.ts +0 -27
- package/src/utils/retry.ts +0 -77
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [1.1.8] - 2026-09-04
|
|
6
|
+
|
|
7
|
+
- OMP sync v18.1.2–v18.1.5: Copilot auth standardization, transport-error-safe retries after tool calls, and prefix-binding control state.
|
|
8
|
+
- Fixed the Z.ai OAuth key name to the Zeta brand (`zeta`) — the merge had reintroduced upstream's `oh-my-pi` fixture rows.
|
|
9
|
+
|
|
5
10
|
## [1.1.6] - 2026-08-30
|
|
6
11
|
|
|
7
12
|
- 同步上游 OMP v18.0.9(`cc14e04f075d`)。
|
|
@@ -10,12 +15,6 @@
|
|
|
10
15
|
|
|
11
16
|
- 同步上游 OMP v18.0.5 / v18.0.6:新增 Yolo-Auto / OpenRouter 浏览器登录与 DeepInfra 支持,空补全重试重构(withReplaySafeStreamRetry)。
|
|
12
17
|
|
|
13
|
-
## [1.1.3] - 2026-08-25
|
|
14
|
-
|
|
15
|
-
### Fixed
|
|
16
|
-
|
|
17
|
-
- Republished as 1.1.3 to reset the latest tag after the broken 1.1.2 (no functional change over 1.1.1).
|
|
18
|
-
|
|
19
18
|
## [1.1.2] - 2026-08-25
|
|
20
19
|
|
|
21
20
|
### Fixed
|
|
@@ -43,3 +42,21 @@
|
|
|
43
42
|
### Changed
|
|
44
43
|
|
|
45
44
|
- Reset the version to 1.0.0 and republished under the `@linxiraos/*` scope, breaking from the `@linxiraos` version lineage.
|
|
45
|
+
- Fixed Gemini thought summaries occasionally leaking a raw `` ```thinking `` / `` ``````thinking `` fence delimiter into the reasoning block, so it no longer shows up as fence spam in the thinking display or persisted transcripts ([#8719](https://github.com/can1357/oh-my-pi/issues/8719)).
|
|
46
|
+
- Fixed the OpenCode Go login prompting for an "OpenCode Zen API key": the shared login flow now names the provider you selected, so connecting OpenCode Go asks for an OpenCode Go key (the `opencode.ai/auth` console is still shared, as documented upstream) ([#8738](https://github.com/can1357/oh-my-pi/issues/8738)).
|
|
47
|
+
- Fixed Anthropic-compatible endpoints with strict prompt validation (e.g. Z.AI GLM `api.z.ai/api/anthropic`, which rejects the whole request with `400 code 1213 "The prompt parameter was not received normally"`) failing sessions once a tool returned empty output on a vision-capable model: empty successful `tool_result` blocks now encode as `content: ""` instead of `content: []`, which both the official API and strict compatible endpoints accept.
|
|
48
|
+
- Fixed `retry.usageReservePct` (Reserve Margin) ignoring Claude Fable/Mythos weekly tier usage until it hit 100%, so a Fable model kept serving turns past the configured reserve; reserve health now honors the mapped tier row while credential-wide hard blocks still require confirmed exhaustion ([#8773](https://github.com/can1357/oh-my-pi/issues/8773)).
|
|
49
|
+
- Fixed `cursor-agent` streams stalling with "Provider stream stalled while waiting for the next event" when Cursor asked the client to approve a hosted WebFetch / web search (reproduced on `cursor-grok-4.6-xhigh` after "I'll fetch the page…"). Those `interaction_query` frames — including the newer WebFetch field 9 this proto did not name — were dropped, so the server waited forever and the idle watchdog aborted a live connection. Permission queries are now answered; hosted search/fetch is approved, unnamed permission fields get an `approved` reply on the same field number, and prompts this client cannot serve are rejected so the turn can continue.
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- Fixed thinking effort selections being ignored for local Qwen 3.8+ models on llama.cpp and vLLM: the Qwen chat-completions dialects only toggled `enable_thinking`, so the chat template always reasoned at its `xhigh` default no matter which level was selected. The encoder now routes the requested effort onto the template's `reasoning_effort` kwarg (`chat_template_kwargs` for both Qwen dialects, plus the top-level field newer llama.cpp builds map natively).
|
|
54
|
+
- Fixed OpenAI Completions, Amazon Bedrock, and Cursor providers ignoring `onPayload` replacement payloads. The hook now transforms the actual request body sent upstream on these providers, matching the Anthropic/Gemini/OpenAI Responses replacement contract. `devin-agent` still does not fire the hook (its payload is a protobuf object).
|
|
55
|
+
- Fixed Codex requests failing outright when the signed-in ChatGPT account is not entitled to the requested model; the exact model denial is now classified as an account-policy error so credential rotation can reach an entitled sibling account
|
|
56
|
+
- Fixed Perplexity email-OTP login after its verification response renamed the encrypted session token from `token` to `challenge_token`.
|
|
57
|
+
- Cloud Code Assist Gemini 3.6/3.7 Flash requests at `minimal` now send `thinkingLevel: LOW` on the aliased `-low` SKU instead of `MINIMAL`, which the API rejects with HTTP 400.
|
|
58
|
+
- Answer Cursor `interaction_query` permission gates (hosted web search, Exa, unnamed field-9 WebFetch) so the Run RPC continues instead of sitting silent until the 300s idle watchdog.
|
|
59
|
+
- Fixed provider tool calls arriving with flattened array argument paths (e.g. Gemini's `questions[0].id`) being stripped and rejected by argument validation; well-formed flattened paths are now rebuilt into the nested arrays the tool schema expects ([#8886](https://github.com/can1357/oh-my-pi/issues/8886)).
|
|
60
|
+
- Fixed opencode-go (Console Go) rejecting Responses turns with `400 No tool output found for tool call …` (naming a random call of the batch on each retry) when a model streamed a trailing text/thinking block after its tool calls: `buildResponsesInput` emitted that block as an assistant `message` item wedged between the `function_call` batch and its `function_call_output` items. Such interleaved messages are now hoisted ahead of their call batch (canonical `message(s) → calls → outputs`), which the strict gateway validator accepts; content is unchanged ([#8789](https://github.com/can1357/oh-my-pi/issues/8789)).
|
|
61
|
+
- Fixed the OpenAI-wire transport sleeping on a LiteLLM concurrency-admission 429 (`rate_limit_type: max_parallel_requests`, `Retry-After: 60`) and retrying it up to 6 times (~300s) before session recovery saw the error. Because a 60s hint equals the transport's `maxDelayMs` cap, `fetchWithRetry` kept sleeping and retrying; the request now surfaces on the first attempt so `TurnRecovery`'s concurrency backoff/model fallback runs promptly. Genuine RPM/quota 429s (no such marker) still honor `Retry-After` ([#8854](https://github.com/can1357/oh-my-pi/issues/8854)).
|
|
62
|
+
- Fixed OAuth login (Codex `localhost:1455`, and any `localhost` callback flow) failing on hosts with IPv6 disabled at the kernel (`ipv6.disable=1`). The `::1` companion listener added in #8081 fails there with Bun's generic "Is port X in use?" message (oven-sh/bun#7187), which the in-use check misread as a real collision — tearing down the healthy IPv4 listener and surfacing a bogus "port 1455 is in use" error. The dual-bind path now detects the missing IPv6 loopback up front and serves IPv4 alone ([#8814](https://github.com/can1357/oh-my-pi/issues/8814)).
|
|
@@ -60,6 +60,8 @@ export interface AuthGatewayParsedRequestOptions {
|
|
|
60
60
|
hideThinkingSummary?: boolean;
|
|
61
61
|
/** Anthropic `output_config.task_budget` advisory loop budget. */
|
|
62
62
|
taskBudget?: TokenTaskBudget;
|
|
63
|
+
/** Anthropic preserved-thinking behavior for a changed conversation prefix. */
|
|
64
|
+
anthropicPrefixMismatchBehavior?: "drop_block" | "error";
|
|
63
65
|
/** OpenAI service tier (auto|default|flex|scale|priority). */
|
|
64
66
|
serviceTier?: ServiceTier;
|
|
65
67
|
/** Cache retention hint derived from inbound `cache_control` markers. */
|
|
@@ -3,7 +3,7 @@ import type { OAuthAuthInfo, OAuthController, OAuthCredentials, OAuthProviderId
|
|
|
3
3
|
import type { Provider } from "./types.js";
|
|
4
4
|
import type { ClientUsageIdentity, ClientUsageReport, ClientUsageSummary, CredentialRankingStrategy, ObservedUsageEntry, UsageHistoryEntry, UsageHistoryQuery, UsageLogger, UsageProvider, UsageReport } from "./usage.js";
|
|
5
5
|
import { type CodexResetConsumeCode, type CodexResetCredit } from "./usage/openai-codex-reset.js";
|
|
6
|
-
export { isSqliteBusyError, isSqliteCorruptionError, SqliteAuthCredentialStore
|
|
6
|
+
export { isSqliteBusyError, isSqliteCorruptionError, SqliteAuthCredentialStore } from "./auth/sqlite-credential-store.js";
|
|
7
7
|
export type ApiKeyCredential = {
|
|
8
8
|
type: "api_key";
|
|
9
9
|
key: string;
|
|
@@ -468,7 +468,7 @@ export type AuthStorageOptions = {
|
|
|
468
468
|
* so the TUI can show where a token came from (broker URL or local SQLite path).
|
|
469
469
|
*
|
|
470
470
|
* Examples:
|
|
471
|
-
* - `"local ~/.
|
|
471
|
+
* - `"local ~/.omp/agent/agent.db"`
|
|
472
472
|
* - `"broker http://omp.internal:8765"`
|
|
473
473
|
*/
|
|
474
474
|
sourceLabel?: string;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { InbandScanEvent, InbandScanner } from "./types.js";
|
|
2
|
+
export interface ThinkingInbandScannerOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Report a bare reasoning close tag (no open seen) as an `impliedThinkingEnd`
|
|
5
|
+
* event instead of passing it through as text. Off by default: only a
|
|
6
|
+
* consumer that owns the whole message can reclassify the text before it.
|
|
7
|
+
*/
|
|
8
|
+
readonly impliedOpen?: boolean;
|
|
9
|
+
}
|
|
2
10
|
export declare class ThinkingInbandScanner implements InbandScanner {
|
|
3
11
|
#private;
|
|
12
|
+
constructor(options?: ThinkingInbandScannerOptions);
|
|
4
13
|
feed(text: string): InbandScanEvent[];
|
|
5
14
|
flush(): InbandScanEvent[];
|
|
6
15
|
}
|
|
@@ -12,6 +12,16 @@ export type InbandScanEvent = {
|
|
|
12
12
|
} | {
|
|
13
13
|
type: "thinkingEnd";
|
|
14
14
|
thinking: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A reasoning close tag with no open in this stream. Chat templates that
|
|
18
|
+
* prefill the opener into the prompt (DeepSeek-R1, Qwen3-Thinking) make the
|
|
19
|
+
* model stream only the close, so everything emitted as `text` before this
|
|
20
|
+
* event was reasoning. Only {@link ThinkingInbandScanner} with `impliedOpen`
|
|
21
|
+
* emits it.
|
|
22
|
+
*/
|
|
23
|
+
| {
|
|
24
|
+
type: "impliedThinkingEnd";
|
|
15
25
|
} | {
|
|
16
26
|
type: "toolStart";
|
|
17
27
|
id: string;
|
|
@@ -81,12 +81,12 @@ export declare function isGrammarError(error: unknown): boolean;
|
|
|
81
81
|
*/
|
|
82
82
|
export declare function isFastModeUnsupported(error: unknown): boolean;
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
84
|
+
* Cline's gateway gates some roster entries (certain free-tier models) to its
|
|
85
|
+
* own product surfaces with a 403. The API key is valid — the restriction is
|
|
86
|
+
* per-model client policy — so it must neither rotate sibling credentials (they
|
|
87
|
+
* fail identically) nor surface as an auth failure.
|
|
88
88
|
*/
|
|
89
|
-
export declare function
|
|
89
|
+
export declare function isClinePassSurfaceGateMessage(errorMessage: string | undefined): boolean;
|
|
90
90
|
export declare function classifyMessage(message: {
|
|
91
91
|
api?: Api;
|
|
92
92
|
provider?: string;
|
|
@@ -24,13 +24,15 @@ export declare function calculateRateLimitBackoffMs(reason: RateLimitReason): nu
|
|
|
24
24
|
/**
|
|
25
25
|
* HTTP status codes that, absent richer body classification, represent an
|
|
26
26
|
* account-local usage cap rather than a bad credential or a transient blip.
|
|
27
|
-
* HTTP 402 Payment Required
|
|
27
|
+
* HTTP 402 Payment Required represents an account-billing cap (xAI
|
|
28
28
|
* Grok Build "usage balance exhausted", DeepSeek "Insufficient Balance",
|
|
29
|
-
* OpenRouter credit exhaustion)
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* OpenRouter credit exhaustion) when opaque, payment/deactivation/balance-worded,
|
|
30
|
+
* or QUOTA_EXHAUSTED/CONCURRENT_LIMIT, while informative non-quota 402s (e.g.
|
|
31
|
+
* endpoint subscription requirements) remain non-usage-limits. Always combine
|
|
32
|
+
* with {@link isUsageLimitOutcome} when a message is available.
|
|
32
33
|
*/
|
|
33
34
|
export declare function isUsageLimitStatus(status: number | undefined): boolean;
|
|
35
|
+
export declare function is402BillingCapBody(message: string | undefined): boolean;
|
|
34
36
|
/**
|
|
35
37
|
* Returns true for failures that should burn one credential and rotate to a
|
|
36
38
|
* sibling account. Decision tree:
|
|
@@ -43,13 +45,13 @@ export declare function isUsageLimitStatus(status: number | undefined): boolean;
|
|
|
43
45
|
* empty JSON, HTTP framing only) → rotate conservatively: the server
|
|
44
46
|
* gave us nothing else to go on.
|
|
45
47
|
* 4. Body has content → defer to {@link parseRateLimitReason}. `QUOTA_EXHAUSTED`
|
|
46
|
-
* rotates; for
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* `
|
|
51
|
-
*
|
|
52
|
-
* credentials.
|
|
48
|
+
* rotates; for a 402 status a `CONCURRENT_LIMIT` body also rotates (the cap
|
|
49
|
+
* is concurrent-worded but the status is an exhausted billing cap).
|
|
50
|
+
* `RATE_LIMIT_EXCEEDED` (`Too many requests`, per-minute caps),
|
|
51
|
+
* `MODEL_CAPACITY_EXHAUSTED` (`Service overloaded`), `SERVER_ERROR`, and
|
|
52
|
+
* `UNKNOWN` (e.g. "A subscription is required for this endpoint" or
|
|
53
|
+
* "Please retry in 5s") stay in the provider's own backoff / failure
|
|
54
|
+
* layer so transient or non-quota responses don't burn sibling credentials.
|
|
53
55
|
*/
|
|
54
56
|
export declare function isUsageLimitOutcome(status: number | undefined, message: string | undefined): boolean;
|
|
55
57
|
/**
|
|
@@ -78,6 +80,6 @@ export declare function isAccountScopedCapText(message: string): boolean;
|
|
|
78
80
|
/**
|
|
79
81
|
* A concurrency cap on a non-billing status is shed-and-backoff, not
|
|
80
82
|
* credential-rotatable. This mirrors the exclusion in {@link isUsageLimitOutcome}
|
|
81
|
-
* for the 403 auth-retry entry points. A 402 remains
|
|
83
|
+
* for the 403 auth-retry entry points. A 402 remains an account-billing cap.
|
|
82
84
|
*/
|
|
83
85
|
export declare function isConcurrencyCapExclusion(status: number | undefined, message: string | undefined): boolean;
|
|
@@ -7,13 +7,6 @@
|
|
|
7
7
|
* may match more. Use this when you only have a `status: number`.
|
|
8
8
|
*/
|
|
9
9
|
export declare function isTransientStatus(status: number | undefined): boolean;
|
|
10
|
-
/** Hook for provider-specific transient detection that the error module must not import directly. */
|
|
11
|
-
export interface ProviderRetryableHooks {
|
|
12
|
-
/** Provider id of the failing request, used to gate provider-specific checks. */
|
|
13
|
-
provider?: string;
|
|
14
|
-
/** Provider-specific transient predicate (e.g. Copilot model-availability 400s). */
|
|
15
|
-
isProviderTransient?: (error: Error) => boolean;
|
|
16
|
-
}
|
|
17
10
|
/**
|
|
18
11
|
* Whether a provider stream error should be retried against the same credential.
|
|
19
12
|
*
|
|
@@ -21,7 +14,7 @@ export interface ProviderRetryableHooks {
|
|
|
21
14
|
* here — they are owned by the credential-rotation layer (auth-gateway /
|
|
22
15
|
* `streamSimple` a/b/c policy), not this seconds-scale provider backoff.
|
|
23
16
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
17
|
+
* Every 4xx other than 408/429 is terminal: a request the provider rejected
|
|
18
|
+
* as malformed, unauthorized, or unentitled fails identically on replay.
|
|
26
19
|
*/
|
|
27
|
-
export declare function isProviderRetryableError(error: unknown
|
|
20
|
+
export declare function isProviderRetryableError(error: unknown): boolean;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -46,7 +46,6 @@ export * from "./utils/anthropic-auth.js";
|
|
|
46
46
|
export * from "./utils/event-stream.js";
|
|
47
47
|
export * from "./utils/glyph-codec.js";
|
|
48
48
|
export * from "./utils/openrouter-headers.js";
|
|
49
|
-
export * from "./utils/retry.js";
|
|
50
49
|
export * from "./utils/schema/index.js";
|
|
51
50
|
export * from "./utils/thinking-loop.js";
|
|
52
51
|
export * from "./utils/tool-call-loop-guard.js";
|
|
@@ -196,24 +196,56 @@ export declare const userMessageSchema: import("@linxiraos/pi-omptype").FluentTy
|
|
|
196
196
|
role: "user";
|
|
197
197
|
}>;
|
|
198
198
|
export declare const systemMessageSchema: import("@linxiraos/pi-omptype").FluentType<{
|
|
199
|
-
|
|
199
|
+
clear_at?: "never" | "next_user_message" | undefined;
|
|
200
|
+
content: string | ({
|
|
200
201
|
cache_control?: {
|
|
201
202
|
ttl?: "1h" | "5m" | undefined;
|
|
202
203
|
type: "ephemeral";
|
|
203
204
|
} | undefined;
|
|
204
205
|
text: string;
|
|
205
206
|
type: "text";
|
|
206
|
-
}
|
|
207
|
+
} | {
|
|
208
|
+
tool: {
|
|
209
|
+
name: string;
|
|
210
|
+
type: "tool_reference";
|
|
211
|
+
};
|
|
212
|
+
type: "tool_addition";
|
|
213
|
+
} | {
|
|
214
|
+
tool: {
|
|
215
|
+
name: string;
|
|
216
|
+
type: "tool_reference";
|
|
217
|
+
};
|
|
218
|
+
type: "tool_removal";
|
|
219
|
+
})[];
|
|
220
|
+
output_config?: {
|
|
221
|
+
effort?: "high" | "low" | "max" | "medium" | "xhigh" | undefined;
|
|
222
|
+
} | undefined;
|
|
207
223
|
role: "system";
|
|
208
224
|
}, {
|
|
209
|
-
|
|
225
|
+
clear_at?: "never" | "next_user_message" | undefined;
|
|
226
|
+
content: string | ({
|
|
210
227
|
cache_control?: {
|
|
211
228
|
ttl?: "1h" | "5m" | undefined;
|
|
212
229
|
type: "ephemeral";
|
|
213
230
|
} | undefined;
|
|
214
231
|
text: string;
|
|
215
232
|
type: "text";
|
|
216
|
-
}
|
|
233
|
+
} | {
|
|
234
|
+
tool: {
|
|
235
|
+
name: string;
|
|
236
|
+
type: "tool_reference";
|
|
237
|
+
};
|
|
238
|
+
type: "tool_addition";
|
|
239
|
+
} | {
|
|
240
|
+
tool: {
|
|
241
|
+
name: string;
|
|
242
|
+
type: "tool_reference";
|
|
243
|
+
};
|
|
244
|
+
type: "tool_removal";
|
|
245
|
+
})[];
|
|
246
|
+
output_config?: {
|
|
247
|
+
effort?: "high" | "low" | "max" | "medium" | "xhigh" | undefined;
|
|
248
|
+
} | undefined;
|
|
217
249
|
role: "system";
|
|
218
250
|
}>;
|
|
219
251
|
export declare const assistantMessageSchema: import("@linxiraos/pi-omptype").FluentType<{
|
|
@@ -352,14 +384,30 @@ export declare const messageSchema: import("@linxiraos/pi-omptype").FluentType<{
|
|
|
352
384
|
})[];
|
|
353
385
|
role: "user";
|
|
354
386
|
} | {
|
|
355
|
-
|
|
387
|
+
clear_at?: "never" | "next_user_message" | undefined;
|
|
388
|
+
content: string | ({
|
|
356
389
|
cache_control?: {
|
|
357
390
|
ttl?: "1h" | "5m" | undefined;
|
|
358
391
|
type: "ephemeral";
|
|
359
392
|
} | undefined;
|
|
360
393
|
text: string;
|
|
361
394
|
type: "text";
|
|
362
|
-
}
|
|
395
|
+
} | {
|
|
396
|
+
tool: {
|
|
397
|
+
name: string;
|
|
398
|
+
type: "tool_reference";
|
|
399
|
+
};
|
|
400
|
+
type: "tool_addition";
|
|
401
|
+
} | {
|
|
402
|
+
tool: {
|
|
403
|
+
name: string;
|
|
404
|
+
type: "tool_reference";
|
|
405
|
+
};
|
|
406
|
+
type: "tool_removal";
|
|
407
|
+
})[];
|
|
408
|
+
output_config?: {
|
|
409
|
+
effort?: "high" | "low" | "max" | "medium" | "xhigh" | undefined;
|
|
410
|
+
} | undefined;
|
|
363
411
|
role: "system";
|
|
364
412
|
} | {
|
|
365
413
|
content: string | ({
|
|
@@ -460,14 +508,30 @@ export declare const messageSchema: import("@linxiraos/pi-omptype").FluentType<{
|
|
|
460
508
|
})[];
|
|
461
509
|
role: "user";
|
|
462
510
|
} | {
|
|
463
|
-
|
|
511
|
+
clear_at?: "never" | "next_user_message" | undefined;
|
|
512
|
+
content: string | ({
|
|
464
513
|
cache_control?: {
|
|
465
514
|
ttl?: "1h" | "5m" | undefined;
|
|
466
515
|
type: "ephemeral";
|
|
467
516
|
} | undefined;
|
|
468
517
|
text: string;
|
|
469
518
|
type: "text";
|
|
470
|
-
}
|
|
519
|
+
} | {
|
|
520
|
+
tool: {
|
|
521
|
+
name: string;
|
|
522
|
+
type: "tool_reference";
|
|
523
|
+
};
|
|
524
|
+
type: "tool_addition";
|
|
525
|
+
} | {
|
|
526
|
+
tool: {
|
|
527
|
+
name: string;
|
|
528
|
+
type: "tool_reference";
|
|
529
|
+
};
|
|
530
|
+
type: "tool_removal";
|
|
531
|
+
})[];
|
|
532
|
+
output_config?: {
|
|
533
|
+
effort?: "high" | "low" | "max" | "medium" | "xhigh" | undefined;
|
|
534
|
+
} | undefined;
|
|
471
535
|
role: "system";
|
|
472
536
|
} | {
|
|
473
537
|
content: string | ({
|
|
@@ -511,6 +575,7 @@ export declare const toolSchema: import("@linxiraos/pi-omptype").FluentType<{
|
|
|
511
575
|
ttl?: "1h" | "5m" | undefined;
|
|
512
576
|
type: "ephemeral";
|
|
513
577
|
} | undefined;
|
|
578
|
+
defer_loading?: boolean | undefined;
|
|
514
579
|
description?: string | undefined;
|
|
515
580
|
input_schema: Record<string, unknown>;
|
|
516
581
|
name: string;
|
|
@@ -519,6 +584,7 @@ export declare const toolSchema: import("@linxiraos/pi-omptype").FluentType<{
|
|
|
519
584
|
ttl?: "1h" | "5m" | undefined;
|
|
520
585
|
type: "ephemeral";
|
|
521
586
|
} | undefined;
|
|
587
|
+
defer_loading?: boolean | undefined;
|
|
522
588
|
description?: string | undefined;
|
|
523
589
|
input_schema: Record<string, unknown>;
|
|
524
590
|
name: string;
|
|
@@ -554,14 +620,23 @@ export declare const thinkingConfigSchema: import("@linxiraos/pi-omptype").Fluen
|
|
|
554
620
|
display?: unknown;
|
|
555
621
|
type: "disabled";
|
|
556
622
|
} | {
|
|
623
|
+
block_binding?: {
|
|
624
|
+
prefix_mismatch_behavior: "drop_block" | "error";
|
|
625
|
+
} | undefined;
|
|
557
626
|
budget_tokens?: number | undefined;
|
|
558
627
|
display?: unknown;
|
|
559
628
|
type: "adaptive";
|
|
560
629
|
} | {
|
|
630
|
+
block_binding?: {
|
|
631
|
+
prefix_mismatch_behavior: "drop_block" | "error";
|
|
632
|
+
} | undefined;
|
|
561
633
|
budget_tokens: number;
|
|
562
634
|
display?: unknown;
|
|
563
635
|
type: "enabled";
|
|
564
636
|
}, {
|
|
637
|
+
block_binding?: {
|
|
638
|
+
prefix_mismatch_behavior: "drop_block" | "error";
|
|
639
|
+
} | undefined;
|
|
565
640
|
budget_tokens: number;
|
|
566
641
|
display?: unknown;
|
|
567
642
|
type: "enabled";
|
|
@@ -569,6 +644,9 @@ export declare const thinkingConfigSchema: import("@linxiraos/pi-omptype").Fluen
|
|
|
569
644
|
display?: unknown;
|
|
570
645
|
type: "disabled";
|
|
571
646
|
} | {
|
|
647
|
+
block_binding?: {
|
|
648
|
+
prefix_mismatch_behavior: "drop_block" | "error";
|
|
649
|
+
} | undefined;
|
|
572
650
|
budget_tokens?: number | undefined;
|
|
573
651
|
display?: unknown;
|
|
574
652
|
type: "adaptive";
|
|
@@ -641,14 +719,30 @@ export declare const anthropicMessagesRequestSchema: import("@linxiraos/pi-ompty
|
|
|
641
719
|
})[];
|
|
642
720
|
role: "user";
|
|
643
721
|
} | {
|
|
644
|
-
|
|
722
|
+
clear_at?: "never" | "next_user_message" | undefined;
|
|
723
|
+
content: string | ({
|
|
645
724
|
cache_control?: {
|
|
646
725
|
ttl?: "1h" | "5m" | undefined;
|
|
647
726
|
type: "ephemeral";
|
|
648
727
|
} | undefined;
|
|
649
728
|
text: string;
|
|
650
729
|
type: "text";
|
|
651
|
-
}
|
|
730
|
+
} | {
|
|
731
|
+
tool: {
|
|
732
|
+
name: string;
|
|
733
|
+
type: "tool_reference";
|
|
734
|
+
};
|
|
735
|
+
type: "tool_addition";
|
|
736
|
+
} | {
|
|
737
|
+
tool: {
|
|
738
|
+
name: string;
|
|
739
|
+
type: "tool_reference";
|
|
740
|
+
};
|
|
741
|
+
type: "tool_removal";
|
|
742
|
+
})[];
|
|
743
|
+
output_config?: {
|
|
744
|
+
effort?: "high" | "low" | "max" | "medium" | "xhigh" | undefined;
|
|
745
|
+
} | undefined;
|
|
652
746
|
role: "system";
|
|
653
747
|
} | {
|
|
654
748
|
content: string | ({
|
|
@@ -714,10 +808,16 @@ export declare const anthropicMessagesRequestSchema: import("@linxiraos/pi-ompty
|
|
|
714
808
|
display?: unknown;
|
|
715
809
|
type: "disabled";
|
|
716
810
|
} | {
|
|
811
|
+
block_binding?: {
|
|
812
|
+
prefix_mismatch_behavior: "drop_block" | "error";
|
|
813
|
+
} | undefined;
|
|
717
814
|
budget_tokens?: number | undefined;
|
|
718
815
|
display?: unknown;
|
|
719
816
|
type: "adaptive";
|
|
720
817
|
} | {
|
|
818
|
+
block_binding?: {
|
|
819
|
+
prefix_mismatch_behavior: "drop_block" | "error";
|
|
820
|
+
} | undefined;
|
|
721
821
|
budget_tokens: number;
|
|
722
822
|
display?: unknown;
|
|
723
823
|
type: "enabled";
|
|
@@ -741,6 +841,7 @@ export declare const anthropicMessagesRequestSchema: import("@linxiraos/pi-ompty
|
|
|
741
841
|
ttl?: "1h" | "5m" | undefined;
|
|
742
842
|
type: "ephemeral";
|
|
743
843
|
} | undefined;
|
|
844
|
+
defer_loading?: boolean | undefined;
|
|
744
845
|
description?: string | undefined;
|
|
745
846
|
input_schema: Record<string, unknown>;
|
|
746
847
|
name: string;
|
|
@@ -815,14 +916,30 @@ export declare const anthropicMessagesRequestSchema: import("@linxiraos/pi-ompty
|
|
|
815
916
|
})[];
|
|
816
917
|
role: "user";
|
|
817
918
|
} | {
|
|
818
|
-
|
|
919
|
+
clear_at?: "never" | "next_user_message" | undefined;
|
|
920
|
+
content: string | ({
|
|
819
921
|
cache_control?: {
|
|
820
922
|
ttl?: "1h" | "5m" | undefined;
|
|
821
923
|
type: "ephemeral";
|
|
822
924
|
} | undefined;
|
|
823
925
|
text: string;
|
|
824
926
|
type: "text";
|
|
825
|
-
}
|
|
927
|
+
} | {
|
|
928
|
+
tool: {
|
|
929
|
+
name: string;
|
|
930
|
+
type: "tool_reference";
|
|
931
|
+
};
|
|
932
|
+
type: "tool_addition";
|
|
933
|
+
} | {
|
|
934
|
+
tool: {
|
|
935
|
+
name: string;
|
|
936
|
+
type: "tool_reference";
|
|
937
|
+
};
|
|
938
|
+
type: "tool_removal";
|
|
939
|
+
})[];
|
|
940
|
+
output_config?: {
|
|
941
|
+
effort?: "high" | "low" | "max" | "medium" | "xhigh" | undefined;
|
|
942
|
+
} | undefined;
|
|
826
943
|
role: "system";
|
|
827
944
|
} | {
|
|
828
945
|
content: string | ({
|
|
@@ -885,6 +1002,9 @@ export declare const anthropicMessagesRequestSchema: import("@linxiraos/pi-ompty
|
|
|
885
1002
|
}[] | undefined;
|
|
886
1003
|
temperature?: number | undefined;
|
|
887
1004
|
thinking?: {
|
|
1005
|
+
block_binding?: {
|
|
1006
|
+
prefix_mismatch_behavior: "drop_block" | "error";
|
|
1007
|
+
} | undefined;
|
|
888
1008
|
budget_tokens: number;
|
|
889
1009
|
display?: unknown;
|
|
890
1010
|
type: "enabled";
|
|
@@ -892,6 +1012,9 @@ export declare const anthropicMessagesRequestSchema: import("@linxiraos/pi-ompty
|
|
|
892
1012
|
display?: unknown;
|
|
893
1013
|
type: "disabled";
|
|
894
1014
|
} | {
|
|
1015
|
+
block_binding?: {
|
|
1016
|
+
prefix_mismatch_behavior: "drop_block" | "error";
|
|
1017
|
+
} | undefined;
|
|
895
1018
|
budget_tokens?: number | undefined;
|
|
896
1019
|
display?: unknown;
|
|
897
1020
|
type: "adaptive";
|
|
@@ -915,6 +1038,7 @@ export declare const anthropicMessagesRequestSchema: import("@linxiraos/pi-ompty
|
|
|
915
1038
|
ttl?: "1h" | "5m" | undefined;
|
|
916
1039
|
type: "ephemeral";
|
|
917
1040
|
} | undefined;
|
|
1041
|
+
defer_loading?: boolean | undefined;
|
|
918
1042
|
description?: string | undefined;
|
|
919
1043
|
input_schema: Record<string, unknown>;
|
|
920
1044
|
name: string;
|
|
@@ -8,7 +8,7 @@ import type { AuthGatewayStreamControl, AuthGatewayParsedRequest as ParsedReques
|
|
|
8
8
|
export type { ParsedRequest };
|
|
9
9
|
export declare function parseRequest(body: unknown, headers?: Headers): ParsedRequest;
|
|
10
10
|
export declare function encodeResponse(message: AssistantMessage, requestedModelId: string): Record<string, unknown>;
|
|
11
|
-
export declare function encodeStream(events: AssistantMessageEventStream, requestedModelId: string,
|
|
11
|
+
export declare function encodeStream(events: AssistantMessageEventStream, requestedModelId: string, options?: ParsedRequest["options"], control?: AuthGatewayStreamControl): ReadableStream<Uint8Array>;
|
|
12
12
|
/**
|
|
13
13
|
* Anthropic error envelope: `{ type: "error", error: { type, message } }`.
|
|
14
14
|
* See https://docs.anthropic.com/en/api/errors. Returned as a `Response` so
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
* `scope`, tool `strict`/`eager_input_streaming`, mid-conversation `system`
|
|
12
12
|
* role) are first-class here instead of being patched in via casts.
|
|
13
13
|
*/
|
|
14
|
-
import type { TokenTaskBudget } from "../types.js";
|
|
14
|
+
import type { ProviderInputTransformation, TokenTaskBudget } from "../types.js";
|
|
15
|
+
/** Beta enabling preserved-thinking block controls and transformation reports. */
|
|
16
|
+
export declare const THINKING_BINDING_CONTROLS_BETA = "thinking-binding-controls-2026-08-01";
|
|
15
17
|
/** Ephemeral prefix-cache breakpoint marker. */
|
|
16
18
|
export type CacheControlEphemeral = {
|
|
17
19
|
type: "ephemeral";
|
|
@@ -87,6 +89,18 @@ export type ToolSearchToolResultBlockParam = {
|
|
|
87
89
|
content: unknown;
|
|
88
90
|
[key: string]: unknown;
|
|
89
91
|
};
|
|
92
|
+
export type ToolChangeReferenceParam = {
|
|
93
|
+
type: "tool_reference";
|
|
94
|
+
name: string;
|
|
95
|
+
};
|
|
96
|
+
export type ToolAdditionBlockParam = {
|
|
97
|
+
type: "tool_addition";
|
|
98
|
+
tool: ToolChangeReferenceParam;
|
|
99
|
+
};
|
|
100
|
+
export type ToolRemovalBlockParam = {
|
|
101
|
+
type: "tool_removal";
|
|
102
|
+
tool: ToolChangeReferenceParam;
|
|
103
|
+
};
|
|
90
104
|
/** Anthropic server-tool history variants omp can replay atomically. */
|
|
91
105
|
export type AnthropicServerToolHistoryBlockParam = WebSearchServerToolUseBlockParam | WebSearchToolResultBlockParam | ToolSearchServerToolUseBlockParam | ToolSearchToolResultBlockParam;
|
|
92
106
|
/** True when a block is complete Anthropic server-tool history omp can replay. */
|
|
@@ -121,7 +135,7 @@ export type FallbackBlockParam = {
|
|
|
121
135
|
model: string;
|
|
122
136
|
};
|
|
123
137
|
};
|
|
124
|
-
export type ContentBlockParam = TextBlockParam | ImageBlockParam | ToolUseBlockParam | ToolResultBlockParam | ServerToolUseBlockParam | WebSearchToolResultBlockParam | ToolSearchToolResultBlockParam | ThinkingBlockParam | RedactedThinkingBlockParam | FallbackBlockParam;
|
|
138
|
+
export type ContentBlockParam = TextBlockParam | ImageBlockParam | ToolUseBlockParam | ToolResultBlockParam | ServerToolUseBlockParam | WebSearchToolResultBlockParam | ToolSearchToolResultBlockParam | ToolAdditionBlockParam | ToolRemovalBlockParam | ThinkingBlockParam | RedactedThinkingBlockParam | FallbackBlockParam;
|
|
125
139
|
/**
|
|
126
140
|
* A single conversation turn.
|
|
127
141
|
*
|
|
@@ -132,6 +146,10 @@ export type ContentBlockParam = TextBlockParam | ImageBlockParam | ToolUseBlockP
|
|
|
132
146
|
export type MessageParam = {
|
|
133
147
|
role: "user" | "assistant" | "system";
|
|
134
148
|
content: string | ContentBlockParam[];
|
|
149
|
+
/** Turn-scoped system-message lifetime. */
|
|
150
|
+
clear_at?: "never" | "next_user_message";
|
|
151
|
+
/** Per-message effort override. */
|
|
152
|
+
output_config?: OutputConfig;
|
|
135
153
|
};
|
|
136
154
|
export type ToolInputSchema = {
|
|
137
155
|
type: "object";
|
|
@@ -148,6 +166,8 @@ export type Tool = {
|
|
|
148
166
|
strict?: boolean;
|
|
149
167
|
/** Fine-grained tool streaming beta: stream tool input as it is generated. */
|
|
150
168
|
eager_input_streaming?: boolean;
|
|
169
|
+
/** Withhold this tool until a later `tool_addition` block references it. */
|
|
170
|
+
defer_loading?: boolean;
|
|
151
171
|
};
|
|
152
172
|
export type ToolChoiceAuto = {
|
|
153
173
|
type: "auto";
|
|
@@ -169,11 +189,16 @@ export type ToolChoice = ToolChoiceAuto | ToolChoiceAny | ToolChoiceTool | ToolC
|
|
|
169
189
|
export type Metadata = {
|
|
170
190
|
user_id?: string | null;
|
|
171
191
|
};
|
|
192
|
+
export type ThinkingBlockBinding = {
|
|
193
|
+
prefix_mismatch_behavior: "drop_block" | "error";
|
|
194
|
+
};
|
|
172
195
|
export type ThinkingConfigEnabled = {
|
|
173
196
|
type: "enabled";
|
|
174
197
|
budget_tokens: number;
|
|
175
198
|
/** Opus 4.7+ reasoning display mode. */
|
|
176
199
|
display?: "summarized" | "omitted";
|
|
200
|
+
/** Preserved-thinking prefix mismatch policy. */
|
|
201
|
+
block_binding?: ThinkingBlockBinding;
|
|
177
202
|
};
|
|
178
203
|
export type ThinkingConfigDisabled = {
|
|
179
204
|
type: "disabled";
|
|
@@ -182,6 +207,8 @@ export type ThinkingConfigAdaptive = {
|
|
|
182
207
|
type: "adaptive";
|
|
183
208
|
/** Opus 4.7+ reasoning display mode. */
|
|
184
209
|
display?: "summarized" | "omitted";
|
|
210
|
+
/** Preserved-thinking prefix mismatch policy. */
|
|
211
|
+
block_binding?: ThinkingBlockBinding;
|
|
185
212
|
};
|
|
186
213
|
export type ThinkingConfigParam = ThinkingConfigEnabled | ThinkingConfigDisabled | ThinkingConfigAdaptive;
|
|
187
214
|
export type OutputConfig = {
|
|
@@ -228,6 +255,8 @@ export type MessageCreateParams = {
|
|
|
228
255
|
speed?: "fast";
|
|
229
256
|
/** Claude Code context-management beta. */
|
|
230
257
|
context_management?: ContextManagement;
|
|
258
|
+
/** Google Cloud rawPredict carries Anthropic beta names in the body. */
|
|
259
|
+
anthropic_beta?: string[];
|
|
231
260
|
/**
|
|
232
261
|
* Server-side fallback beta chain — up to three fallback models the API
|
|
233
262
|
* retries when a classifier blocks the primary. Required companion beta
|
|
@@ -271,6 +300,14 @@ export type Usage = {
|
|
|
271
300
|
iterations?: UsageIteration[] | null;
|
|
272
301
|
};
|
|
273
302
|
/** The `message` envelope carried by `message_start`. */
|
|
303
|
+
export type InputTransformation = {
|
|
304
|
+
type: string;
|
|
305
|
+
path?: string;
|
|
306
|
+
reason?: string;
|
|
307
|
+
[key: string]: unknown;
|
|
308
|
+
};
|
|
309
|
+
/** Parse Anthropic's forward-compatible input transformation list. */
|
|
310
|
+
export declare function parseAnthropicInputTransformations(value: unknown): ProviderInputTransformation[];
|
|
274
311
|
export type ResponseMessage = {
|
|
275
312
|
id: string;
|
|
276
313
|
type?: "message";
|
|
@@ -279,6 +316,7 @@ export type ResponseMessage = {
|
|
|
279
316
|
content?: unknown[];
|
|
280
317
|
stop_reason?: StopReason | null;
|
|
281
318
|
stop_sequence?: string | null;
|
|
319
|
+
input_transformations?: InputTransformation[];
|
|
282
320
|
usage: Usage;
|
|
283
321
|
};
|
|
284
322
|
/** `content_block` payload carried by `content_block_start`. */
|
|
@@ -351,6 +389,7 @@ export type RawMessageDeltaEvent = {
|
|
|
351
389
|
type: "message_delta";
|
|
352
390
|
delta: MessageDelta;
|
|
353
391
|
usage: Usage;
|
|
392
|
+
input_transformations?: InputTransformation[];
|
|
354
393
|
};
|
|
355
394
|
export type RawMessageStopEvent = {
|
|
356
395
|
type: "message_stop";
|