@oh-my-pi/pi-ai 18.8.9 → 18.9.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 +47 -105
- package/dist/types/auth/affinity.d.ts +1 -0
- package/dist/types/auth/policy.d.ts +1 -0
- package/dist/types/auth/refresh.d.ts +0 -2
- package/dist/types/auth/sqlite-credential-store.d.ts +14 -1
- package/dist/types/auth/types.d.ts +6 -0
- package/dist/types/auth-storage.d.ts +4 -3
- package/dist/types/error/flags.d.ts +23 -0
- package/dist/types/judgment/index.d.ts +1 -0
- package/dist/types/judgment/question-file.d.ts +52 -0
- package/dist/types/providers/anthropic-client.d.ts +10 -0
- package/dist/types/providers/anthropic-state.d.ts +2 -0
- package/dist/types/providers/anthropic.d.ts +17 -1
- package/dist/types/providers/google-shared.d.ts +17 -4
- package/dist/types/providers/inference-headers.d.ts +6 -0
- package/dist/types/providers/openai-codex/request-transformer.d.ts +2 -0
- package/dist/types/providers/openai-codex-responses.d.ts +1 -1
- package/dist/types/providers/openai-configuration-update.d.ts +16 -10
- package/dist/types/providers/openai-responses-wire.d.ts +1 -1
- package/dist/types/providers/openai-shared.d.ts +10 -2
- package/dist/types/types.d.ts +42 -1
- package/dist/types/utils/block-symbols.d.ts +14 -0
- package/dist/types/utils/leaked-thinking-stream.d.ts +1 -1
- package/package.json +6 -6
- package/src/auth/affinity.ts +6 -0
- package/src/auth/policy.ts +10 -1
- package/src/auth/pool.ts +0 -5
- package/src/auth/refresh.ts +0 -3
- package/src/auth/sqlite-credential-store.ts +22 -1
- package/src/auth/types.ts +6 -0
- package/src/auth-storage.ts +5 -3
- package/src/error/flags.ts +93 -0
- package/src/images/openai-hosted.ts +2 -0
- package/src/judgment/index.ts +1 -0
- package/src/judgment/question-file.ts +90 -0
- package/src/providers/amazon-bedrock.ts +6 -5
- package/src/providers/anthropic-client.ts +16 -1
- package/src/providers/anthropic-state.ts +6 -0
- package/src/providers/anthropic.ts +656 -106
- package/src/providers/cursor.ts +384 -37
- package/src/providers/devin.ts +13 -14
- package/src/providers/factory-droid/gemini.ts +14 -45
- package/src/providers/google-shared.ts +116 -92
- package/src/providers/google-vertex.ts +0 -1
- package/src/providers/inference-headers.ts +19 -0
- package/src/providers/openai-codex/request-transformer.ts +16 -11
- package/src/providers/openai-codex-responses.ts +46 -9
- package/src/providers/openai-completions.ts +8 -1
- package/src/providers/openai-configuration-update.ts +37 -12
- package/src/providers/openai-responses-wire.ts +1 -1
- package/src/providers/openai-responses.ts +48 -13
- package/src/providers/openai-shared.ts +68 -11
- package/src/providers/transform-messages.ts +75 -1
- package/src/registry/oauth/callback-server.ts +6 -1
- package/src/stream.ts +2 -0
- package/src/types.ts +47 -1
- package/src/usage/claude.ts +13 -5
- package/src/utils/block-symbols.ts +17 -0
- package/src/utils/leaked-thinking-stream.ts +47 -25
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,52 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [18.9.1] - 2026-10-11
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added `compat.supportsThinkingBindingControls` for Bedrock Converse: setting it to `false` stops prefix-bound Claude requests from sending `thinking.block_binding`, the `thinking-binding-controls-2026-08-01` beta and the `/input_transformations` response path, for gateways or regions that reject them ([#15316](https://github.com/can1357/oh-my-pi/pull/15316) by [@harshaygadekar](https://github.com/harshaygadekar))
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Fixed Bedrock Claude Fable 5.1 requests with thinking off and a forced tool choice sending the forced choice next to adaptive thinking; the choice now falls back to `auto` ([#15316](https://github.com/can1357/oh-my-pi/pull/15316) by [@harshaygadekar](https://github.com/harshaygadekar))
|
|
14
|
+
|
|
15
|
+
## [18.9.0] - 2026-10-11
|
|
16
|
+
|
|
17
|
+
### Breaking Changes
|
|
18
|
+
|
|
19
|
+
- Removed the `retainTextSignature` option from `consumeGoogleStream` and `streamGoogleGenAI`; Google routes now consistently preserve text reply signatures.
|
|
20
|
+
- Custom `SessionsApi` implementations must implement `permits(provider, sessionId, credentialId)`.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- Exported `matchesReplacementCredential` and `isSameOAuthAccount` to help identify credential replacement and account ownership.
|
|
25
|
+
- Added `AuthStorage.sessions.permits(provider, sessionId, credentialId)` for checking whether a stored account may serve a session restricted to an account pool.
|
|
26
|
+
- Added `judgeQuestions()` for loading judge questions from JSON with inferred choice labels and answer types, plus `renderQuestion()` for templated instructions.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- Devin chat turns now use the native Devin CLI sampling settings by default, while continuing to honor explicitly configured temperature, top-p, and stop sequences.
|
|
31
|
+
- Added `parentSessionId` and `minimizeEffort` stream options. Branched side requests can reuse a conversation's prompt cache, and supported models can run them at their lowest effort without losing cache reuse.
|
|
32
|
+
- Improved cross-host continuation for supported models so confirmed prior reasoning is preserved as reasoning context rather than exposed as `<think>` text in replies.
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- Fixed Anthropic subscription quota not appearing in `/usage` when an OAuth token is supplied through `ANTHROPIC_API_KEY`.
|
|
37
|
+
- Fixed custom OpenAI-compatible Responses streams truncating reasoning and incorrectly invoking custom tools with empty input.
|
|
38
|
+
- Fixed Codex WebSocket prewarming so optional service tiers and model routing are handled consistently with normal requests.
|
|
39
|
+
- Fixed OAuth sign-in result pages breaking or rendering injected markup when provider errors or callback values contain special characters.
|
|
40
|
+
- Fixed Anthropic requests failing when tools are added to a conversation or when resumed sessions no longer include earlier tools.
|
|
41
|
+
- Fixed Anthropic requests rejecting tall or oversized historical screenshots by resizing or re-encoding images to the host's limits.
|
|
42
|
+
- Improved compatibility with Anthropic-compatible endpoints that reject prompt-cache options by retrying without unsupported caching features and reporting the disabled capability.
|
|
43
|
+
- LiteLLM proxy logs now group requests by omp conversation instead of displaying a separate session for each request.
|
|
44
|
+
- Fixed Gemini-family integrations echoing prior thinking as visible fenced `thinking` blocks; thinking is now restored as model reasoning across Google, Vertex, Antigravity, Gemini CLI, and Factory Droid routes.
|
|
45
|
+
- Fixed Gemini-family integrations losing text reply signatures needed for subsequent requests across Google, Vertex, Antigravity, Gemini CLI, and Factory Droid routes.
|
|
46
|
+
- Fixed Cursor integrations losing previously recorded reasoning, including signed and redacted reasoning, when continuing or resuming a conversation.
|
|
47
|
+
- Fixed invalid `auth.accountPolicies` entries referring to unavailable accounts from preventing startup, account selection, or login; such entries are now skipped with a warning.
|
|
48
|
+
- Fixed Factory Droid Claude turns with thinking disabled from replaying unsupported earlier thinking blocks, and aligned high-effort Sonnet 5.5 thinking behavior with the native client.
|
|
49
|
+
- Fixed side requests for GPT-6 Responses and Codex models from losing prompt-cache context or applying unsupported reasoning-effort configuration changes.
|
|
50
|
+
|
|
5
51
|
## [18.8.9] - 2026-10-10
|
|
6
52
|
|
|
7
53
|
### Changed
|
|
@@ -2264,108 +2310,4 @@
|
|
|
2264
2310
|
- Fixed OpenCode Go usage reporting to synthesize `/usage` limits from OMP-observed request costs for the 5h, weekly, and monthly provider caps. ([#2942](https://github.com/can1357/oh-my-pi/issues/2942))
|
|
2265
2311
|
- Fixed MiniMax Anthropic-compatible requests to serialize adaptive thinking without an invalid Anthropic `output_config.effort` tier ([#2928](https://github.com/can1357/oh-my-pi/issues/2928)).
|
|
2266
2312
|
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
### Added
|
|
2270
|
-
|
|
2271
|
-
- Added support for ArkType schemas as tool parameters alongside existing Zod schemas
|
|
2272
|
-
- Added `getOpenRouterHeaders` utility to export standard OpenRouter integration headers
|
|
2273
|
-
|
|
2274
|
-
### Changed
|
|
2275
|
-
|
|
2276
|
-
- Expanded thinking loop detection guard to also cover DeepSeek models (family, provider, or id matches).
|
|
2277
|
-
- Extended loop guard to monitor assistant response prose (via `text_delta` events) in addition to thinking logs, customizable via request options.
|
|
2278
|
-
- Modified loop guard error reporting to emit a non-retryable partial content block containing the accumulated streamed text if a loop is detected after response prose has started streaming, preventing unsafe agent session rollbacks.
|
|
2279
|
-
- Migrated internal wire-schema validation (auth-broker, Anthropic Messages request, OpenAI Chat/Responses requests, and /v1/usage shapes) from Zod to ArkType
|
|
2280
|
-
- Replaced the dedicated `xai-responses` provider with a unified `openai-responses` path that handles xAI-specific reasoning effort stripping dynamically
|
|
2281
|
-
- Updated OpenAI Responses stream handling to throw a clearer error message when a stream closes without a terminal response event
|
|
2282
|
-
- Consolidated shared OpenAI-compatible routing and strict-tool fallback helpers across Chat Completions and Responses providers.
|
|
2283
|
-
- Consolidated the OpenAI-family provider stack: merged `openai-responses-shared` into `openai-shared` and removed the now-dead `openai-responses-shared` re-export shim; folded the three duplicated `service_tier` request blocks and the per-provider wire model-id transform into shared `applyOpenAIServiceTier`/`applyWireModelIdTransform` helpers; moved residual provider-name wire-quirk checks (DeepSeek special-token strip, cumulative reasoning deltas, Ollama empty-length context error, OpenAI tool-call-id cap, Fireworks thinking drop, OpenRouter/OpenAI Responses request fields) into resolved compat fields; shared the Responses stream per-block accumulation helpers plus the terminal pending-tool-call finalization (`finalizePendingResponsesToolCalls`) and toolUse/pause stop-reason promotion (`promoteResponsesToolUseStopReason`) between `processResponsesStream` and the Codex stream handler; and removed the redundant `getOpenAIResponsesCacheSessionId` alias in favor of `getOpenAIResponsesPromptCacheKey`.
|
|
2284
|
-
- Centralized OpenAI-family request-param policy into shared `resolveOpenAIOutputTokenParam` (output-token field selection, OpenRouter default-cap omission, `alwaysSendMaxTokens` defaulting, model/provider clamp), `applyOpenAIGatewayRouting` (OpenRouter `provider` + Vercel AI Gateway `providerOptions`), and `applyOpenAIExtraBody` (extra-body merge + Fireworks thinking drop) helpers used by both Chat Completions and Responses `buildParams`, and moved the Chat Completions reasoning/thinking dialect dispatch (`applyChatCompletionsReasoningParams` + `disableChatCompletionsReasoningForDialect`) plus the `OpenAICompletionsParams` request type into `openai-shared` alongside `applyResponsesReasoningParams`. As a consistency consequence, direct `streamOpenAIResponses` calls (bypassing `streamSimple`) now emit `max_output_tokens` for `alwaysSendMaxTokens` (Kimi-family) models even without a caller cap — matching Chat Completions and the value `streamSimple` already supplied.
|
|
2285
|
-
- Centralized OpenAI-family reasoning compat resolution behind a shared `resolveOpenAICompatPolicy` consumed by both Chat Completions and Responses request builders. Shared policy now drives tool-choice reasoning suppression, dialect-specific disable encoding, reasoning-history replay filters, encrypted-reasoning inclusion, Mistral/OpenAI tool-call-id modes, stream healing/DeepSeek token stripping, and xAI/OpenRouter cache-affinity wiring instead of endpoint-local provider/model checks.
|
|
2286
|
-
|
|
2287
|
-
### Fixed
|
|
2288
|
-
|
|
2289
|
-
- Fixed OpenAI Responses cost accounting to apply standard service-tier pricing multipliers (flex 0.5×, priority 2×) to the calculated cost based on the served (or requested) service tier for provider `"openai"` models.
|
|
2290
|
-
- Fixed OpenAI Chat Completions to consume the dedicated `requiresReasoningContentForAllAssistantTurns` compatibility flag, preventing unnecessary reasoning replay on non-tool-call turns for OpenRouter DeepSeek and OpenCode models.
|
|
2291
|
-
- Fixed the Kimi Code and Synthetic dual-surface shim (`streamOpenAIAnthropicShim`) to correctly forward caller-supplied `toolChoice`, `serviceTier`, and `disableReasoning` options.
|
|
2292
|
-
- Fixed the OpenAI Responses tool-choice compatibility helper to drop `tool_choice` when `supportsToolChoice` is false, and downgrade forced choices to `"auto"` when `supportsForcedToolChoice` is false.
|
|
2293
|
-
- Fixed Azure Responses to avoid emitting `tool_choice: "none"` when `context.tools` is empty.
|
|
2294
|
-
- Fixed Kimi via OpenRouter forced-tool requests to omit the OpenRouter `reasoning` object instead of sending `reasoning: { enabled: false }`, preserving the generic OpenRouter explicit-disable behavior while avoiding Kimi's forced-tool reasoning conflict.
|
|
2295
|
-
- Fixed Google Gemini CLI credential parsing schema to gracefully handle empty or unexpected non-string shapes without throwing unhandled exceptions
|
|
2296
|
-
- Fixed Google Gemini CLI credential parsing to correctly prioritize `projectId` over `project_id` even when empty, and drop non-string values gracefully
|
|
2297
|
-
- Fixed OpenRouter Responses requests to omit default max token fields unless an explicit caller cap is provided, preventing upstream filtering issues
|
|
2298
|
-
- Fixed Chat Completions reasoning suppression (`disableReasoningOnToolChoice` / `disableReasoningOnForcedToolChoice`) to turn thinking off symmetrically across every dialect via a shared `disableChatCompletionsReasoningForDialect` helper. Previously the conflict path only deleted `reasoning_effort`/`reasoning` (and set Z.AI `thinking: { type: "disabled" }` on the forced branch alone), leaving Qwen `enable_thinking`, Qwen chat-template `chat_template_kwargs.enable_thinking`, and OpenRouter nested `reasoning` enabled — so those hosts could keep thinking on under forced/required tool choice and re-trip the incompatibility the policy guards against. OpenRouter is now set to `{ reasoning: { enabled: false } }` (not deleted, which OpenRouter treats as default-on).
|
|
2299
|
-
- Fixed OpenRouter Responses requests to send `session_id` from `sessionId` in the request body for sticky provider routing and observability grouping.
|
|
2300
|
-
- Fixed OpenRouter Responses request shaping to preserve provider routing, variant suffixes, caller header overrides, and strict-tool fallback behavior while omitting only unsafe default max-token caps.
|
|
2301
|
-
- Fixed OpenAI Responses stateful chaining so a non-ZDR stale `previous_response_id` retry keeps `store: true`: the full-context retry stays chainable on the next turn and the consecutive stale-failure circuit breaker trips after the configured limit instead of alternating cold turns. Zero Data Retention rejections still disable chaining on the first strike.
|
|
2302
|
-
- Fixed Anthropic Messages tool schema normalization demoting root `anyOf`/`allOf` and all `oneOf` constraints into descriptions instead of forwarding provider-rejected keywords in MCP tool `input_schema`.
|
|
2303
|
-
- Fixed Ollama Cloud GLM-5.2 reasoning efforts to map `xhigh` to native think `"max"` ([#2911](https://github.com/can1357/oh-my-pi/pull/2911) by [@serverinspector](https://github.com/serverinspector))
|
|
2304
|
-
- Fixed OpenRouter Responses requests tagging the streamed assistant message with a hardcoded `openai-responses` API instead of the runtime `model.api`, which silently disabled native-history replay (`buildResponsesInput`) and cross-model tool-call item-id stripping on subsequent OpenRouter turns. The message now carries `model.api` (matching the Chat Completions path).
|
|
2305
|
-
- Fixed OpenAI-family streaming leaking a pre-retry `errorMessage` onto a successful turn: the OpenRouter Anthropic compiled-grammar strict-tool fallback set `errorMessage` before retrying with strict tools disabled and never cleared it on success, and the Chat Completions success path could carry an `errorMessage` from an internally-retried attempt — both made a successful turn read as errored in agent state and telemetry. The Responses fallback no longer assigns `errorMessage`, and the Completions success path clears it before emitting the terminal `done` event.
|
|
2306
|
-
- Fixed Codex stream-error `.code` resolution to use the same nested-first precedence (`error.code` → `error.type` → top-level `code`) as `isRetryableCodexFailureEvent` and the formatted message. Previously the error factory resolved top-level-first, so a failure event carrying both a top-level and a differing nested error code surfaced a `.code` that could disagree with its own `retryable` flag and message text.
|
|
2307
|
-
|
|
2308
|
-
## [16.0.5] - 2026-06-17
|
|
2309
|
-
|
|
2310
|
-
### Added
|
|
2311
|
-
|
|
2312
|
-
- Added `antigravityEndpointMode` stream option with `auto`, `production`, and `sandbox` values to control Antigravity endpoint routing
|
|
2313
|
-
- Added `seedApiKeyResolver` for reusing a pre-resolved request key while preserving resolver-driven auth retry and credential rotation
|
|
2314
|
-
- Added optional `contextSnapshot` property to `AssistantMessage` with token usage metadata via new `ContextSnapshot` interface (`promptTokens`, `nonMessageTokens`, and optional `lastMessageTimestamp`)
|
|
2315
|
-
- Added `LITELLM_BASE_URL` guidance to the LiteLLM login prompt so non-default proxy endpoints are discoverable. ([#2726](https://github.com/can1357/oh-my-pi/issues/2726))
|
|
2316
|
-
- Added a Gemini thinking-loop guard that watches streamed `thinking` deltas for degenerate reasoning loops — verbatim tail repetition and near-duplicate paragraph cycling — and terminates the stream with a retryable, empty-content `error` message (worded as a transient stream stall) so the turn is discarded and re-sampled instead of committing a runaway transcript. Gated to Gemini models across every transport (OpenRouter, direct Google, Vertex) and disarmed once visible answer text or a tool call starts; disable with `PI_NO_THINKING_LOOP_GUARD=1`.
|
|
2317
|
-
|
|
2318
|
-
### Changed
|
|
2319
|
-
|
|
2320
|
-
- Changed the Antigravity (`google-antigravity`) request builder to mirror the captured `antigravity/hub` client: gemini-3.x send `thinkingConfig.thinkingBudget` per tier, a fixed per-model `maxOutputTokens`, a default `functionCallingConfig.mode: "VALIDATED"` tool mode (auto/unset tool choice only), a `role: "user"` system instruction, a structured `requestId` (`agent/<id>/<ts>/<trajectoryId>/<step>`), and `labels` (`model_enum`, `trajectory_id`, `last_step_index`, `last_execution_id`, `used_claude*`) tracked across the conversation via provider session state.
|
|
2321
|
-
|
|
2322
|
-
### Fixed
|
|
2323
|
-
|
|
2324
|
-
- Fixed Gemini usage-tier mapping so `gemini-3.5-flash` is treated as `Flash` and `gemini-3.1-pro` plus `gemini-pro-agent` are treated as `Pro` in usage accounting
|
|
2325
|
-
- Fixed Antigravity stream state handling so a request’s `last_execution_id` is committed only after a successful completion and cleared between retry attempts
|
|
2326
|
-
- Fixed `streamSimple()` Gemini streams to run through the thinking-loop guard for custom API and pi-native transports, so degenerate `thinking` loops now abort with the same retryable empty-content error path as other Gemini stream paths
|
|
2327
|
-
- Fixed Antigravity model streaming and usage fetch paths to retry on transient `429`/`5xx` errors by failing over to the alternate endpoint before surfacing an error
|
|
2328
|
-
- Fixed Antigravity endpoint tracking to prefer a previously successful endpoint in `auto` mode for subsequent requests
|
|
2329
|
-
- Fixed Antigravity and Gemini CLI model requests failing with an opaque error when Google requires account verification. Cloud Code Assist `403 VALIDATION_REQUIRED` responses now surface the `validation_url` and the signed-in account email when available, so users see an actionable account-verification message instead of the raw API error body.
|
|
2330
|
-
- Fixed MiniMax M3 in-band tool calls by adding a MiniMax dialect that parses `<minimax:tool_call>` wrappers instead of falling back to generic XML. ([#2759](https://github.com/can1357/oh-my-pi/issues/2759))
|
|
2331
|
-
- Fixed GitHub Copilot OAuth for Business seats by storing the login-discovered API endpoint and routing model enablement plus chat requests to that endpoint. ([#2876](https://github.com/can1357/oh-my-pi/issues/2876))
|
|
2332
|
-
|
|
2333
|
-
## [16.0.4] - 2026-06-17
|
|
2334
|
-
|
|
2335
|
-
### Fixed
|
|
2336
|
-
|
|
2337
|
-
- Fixed tool argument coercion to parse double-encoded JSON strings, including quoted values like `"300"`, when schema expects a number
|
|
2338
|
-
- Fixed object-array coercion to parse JSON object and array strings into proper array arguments instead of wrapping raw strings
|
|
2339
|
-
- Fixed handling of malformed JSON container strings for array schema fields so validation now surfaces a top-level `expected array, received string` error rather than nested element errors
|
|
2340
|
-
- Fixed ChatGPT/Codex browser login missing connector OAuth scopes and rendering object-shaped token endpoint errors as `[object Object]`. ([#2825](https://github.com/can1357/oh-my-pi/issues/2825))
|
|
2341
|
-
- Fixed Zhipu/BigModel GLM-5.2 chat-completions requests so internal `xhigh` effort serializes as provider-native `reasoning_effort: "max"` and tool calls opt into `tool_stream`. ([#2833](https://github.com/can1357/oh-my-pi/issues/2833))
|
|
2342
|
-
- Fixed Google Gemini CLI and Antigravity tool calls with `toolChoice: "auto"` serializing an explicit `toolConfig` AUTO mode, which can cause Gemini-3 models to leak raw planning JSON instead of executing tools. ([#2830](https://github.com/can1357/oh-my-pi/issues/2830))
|
|
2343
|
-
|
|
2344
|
-
## [16.0.3] - 2026-06-16
|
|
2345
|
-
|
|
2346
|
-
### Added
|
|
2347
|
-
|
|
2348
|
-
- Exported `renderDelimitedThinking` from the `@oh-my-pi/pi-ai/dialect` barrel so consumers can reuse the dialect's `<thinking>` envelope unwrap-and-rewrap logic (the only `./dialect/rendering` primitive re-exported; the rest stay dialect-internal).
|
|
2349
|
-
|
|
2350
|
-
### Fixed
|
|
2351
|
-
|
|
2352
|
-
- Fixed OpenAI Responses/Codex tool schema normalization stripping provider-rejected regex lookaround patterns from MCP tool parameter schemas. ([#2784](https://github.com/can1357/oh-my-pi/issues/2784))
|
|
2353
|
-
- Fixed OpenAI Responses parallel tool-call routing so late keyed argument deltas for a closed call are dropped instead of being appended to another open call.
|
|
2354
|
-
|
|
2355
|
-
## [16.0.2] - 2026-06-16
|
|
2356
|
-
|
|
2357
|
-
### Added
|
|
2358
|
-
|
|
2359
|
-
- Added `UMANS_WEBSEARCH_PROVIDER=native|exa` support for routing Umans gateway-owned web search requests.
|
|
2360
|
-
|
|
2361
|
-
### Fixed
|
|
2362
|
-
|
|
2363
|
-
- A single MCP tool whose input schema can't be emitted as a valid strict tool schema for the active provider no longer fails the whole turn with HTTP 400. `convertTools` (openai-responses) now validates each tool's emitted parameter schema for `enum`/`const`-vs-`type` contradictions that pass structural JSON-Schema validation but the provider rejects — e.g. a non-null `enum` on a `type: "null"` node, or an `enum` on an `array` node — and quarantines just the offending tool with a `logger.warn` naming the tool and schema path, keeping every other tool usable. Adds `findStrictToolSchemaViolation` to `@oh-my-pi/pi-ai/utils/schema` ([#2652](https://github.com/can1357/oh-my-pi/issues/2652))
|
|
2364
|
-
- Fixed OpenAI Responses-compatible streams from Ollama/local hosts dropping arguments for parallel tool calls whose deltas use `fc_<call_id>` item ids, which left earlier `ast_grep` calls with `{}` and failed validation. ([#2715](https://github.com/can1357/oh-my-pi/issues/2715))
|
|
2365
|
-
- Fixed dialect transcript rendering so literal thinking envelopes are unwrapped before adding the dialect's own thinking tags, preventing nested `<thinking>` output in advisor raw dumps ([#2700](https://github.com/can1357/oh-my-pi/issues/2700)).
|
|
2366
|
-
- Fixed Anthropic-compatible Umans requests escaping client tool names and forwarding gateway web search headers so Kimi answers normally instead of returning raw gateway search results.
|
|
2367
|
-
- Fixed Google Gemini tool calls with `toolChoice: "auto"` serializing an explicit `toolConfig` AUTO mode, which can cause Gemini-3 models to leak raw planning JSON instead of executing tools. ([#2776](https://github.com/can1357/oh-my-pi/issues/2776))
|
|
2368
|
-
- Fixed OpenAI-compatible Ollama completions that return empty `finish_reason:length` after filling `num_ctx` so they surface an actionable context-window error instead of an empty length stop. ([#2774](https://github.com/can1357/oh-my-pi/issues/2774))
|
|
2369
|
-
- Fixed Codex browser login issuing credentials for the `opencode` OAuth originator while OMP requests identify as `pi`, which could make the first authenticated Codex request return 401 ([#2696](https://github.com/can1357/oh-my-pi/issues/2696)).
|
|
2370
|
-
|
|
2371
|
-
Older entries are archived in [packages/ai/CHANGELOG.md@0dd6aff5f282](https://github.com/can1357/oh-my-pi/blob/0dd6aff5f2821aec1e5b54c6a458e323667a949b/packages/ai/CHANGELOG.md).
|
|
2313
|
+
Older entries are archived in [packages/ai/CHANGELOG.md@592e894eb29e](https://github.com/can1357/oh-my-pi/blob/592e894eb29ed3db2ee2dae71ec7d72ac13c64c8/packages/ai/CHANGELOG.md).
|
|
@@ -37,6 +37,7 @@ export declare class SessionAffinity implements SessionsApi {
|
|
|
37
37
|
* session, otherwise only an OAuth credential whose identity key is allowed.
|
|
38
38
|
*/
|
|
39
39
|
allows(provider: string, sessionId: string | undefined, credential: AuthCredential): boolean;
|
|
40
|
+
permits(provider: string, sessionId: string, credentialId: number): boolean;
|
|
40
41
|
/** Drop every pin for a provider, both in memory and in the persisted cache. */
|
|
41
42
|
clearProvider(provider: string): void;
|
|
42
43
|
/** Drop only this in-memory session pin after OAuth selection falls through. */
|
|
@@ -14,6 +14,7 @@ export declare class AccountPolicies {
|
|
|
14
14
|
*/
|
|
15
15
|
replace(policies: AuthAccountPolicies, defaultReservePct: number | undefined, storedCredentials?: ReadonlyMap<string, readonly AuthCredential[]>): void;
|
|
16
16
|
validateUsageCapability(provider: string, canFetchUsage: boolean): void;
|
|
17
|
+
/** Throw on ambiguous selectors for `provider`; a selector whose account is absent is inert and warns once. */
|
|
17
18
|
validateFor(provider: string, credentials: readonly AuthCredential[]): void;
|
|
18
19
|
/**
|
|
19
20
|
* Return the configured account policy matching an OAuth identity.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { OAuthCredentials } from "../registry/oauth/types.js";
|
|
2
2
|
import type { Provider } from "../types.js";
|
|
3
3
|
import { type CredentialPool } from "./pool.js";
|
|
4
|
-
import type { AccountPolicies } from "./policy.js";
|
|
5
4
|
import { type AuthCredentialStore } from "./store.js";
|
|
6
5
|
import { type AuthCredentialSnapshotEntry, type AuthStorageOptions, type OAuthCredential, type OAuthRefreshByIdOptions, type OAuthRefreshReason, type StoredOAuthRefreshOptions, type StoredOAuthRefreshResult } from "./types.js";
|
|
7
6
|
/**
|
|
@@ -30,7 +29,6 @@ export declare function mergeRefreshedCredential<T extends OAuthCredential>(curr
|
|
|
30
29
|
export interface OAuthRefresherDeps {
|
|
31
30
|
store: AuthCredentialStore;
|
|
32
31
|
pool: CredentialPool;
|
|
33
|
-
policies: AccountPolicies;
|
|
34
32
|
override?: AuthStorageOptions["refreshOAuthCredential"];
|
|
35
33
|
overrideMints?: AuthStorageOptions["refreshOAuthCredentialMints"];
|
|
36
34
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import type { Database } from "bun:sqlite";
|
|
8
8
|
import { isSqliteBusyError, isSqliteCorruptionError } from "@oh-my-pi/pi-utils";
|
|
9
9
|
import type { AuthCredentialStore, CredentialRefreshLeaseFence } from "./store.js";
|
|
10
|
-
import type { AuthCredential, DisabledCredentialSummary, StoredAuthCredential, StoredCredentialBlock } from "./types.js";
|
|
10
|
+
import type { AuthCredential, DisabledCredentialSummary, OAuthCredential, StoredAuthCredential, StoredCredentialBlock } from "./types.js";
|
|
11
11
|
import type { OAuthCredentials } from "../registry/oauth/types.js";
|
|
12
12
|
import type { ClientUsageReport, ClientUsageSummary, UsageHistoryEntry, UsageHistoryQuery } from "../usage.js";
|
|
13
13
|
export declare const USAGE_REPORT_TTL_MS: number;
|
|
@@ -25,6 +25,19 @@ export declare function serializeCredential(provider: string, credential: AuthCr
|
|
|
25
25
|
* an OAuth credential without any account, email, project, or org identity.
|
|
26
26
|
*/
|
|
27
27
|
export declare function resolveCredentialIdentityKey(provider: string, credential: AuthCredential): string | null;
|
|
28
|
+
/**
|
|
29
|
+
* Whether upserting `incoming` replaces the active row holding `existing` (stored
|
|
30
|
+
* under `existingIdentityKey`) instead of inserting a new row beside it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function matchesReplacementCredential(provider: string, existing: AuthCredential | null, existingIdentityKey: string | null, incoming: AuthCredential): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Whether two OAuth credentials belong to the same account of the same organization,
|
|
35
|
+
* whichever identity key each is stored under. The email decides when both carry one;
|
|
36
|
+
* otherwise a matching account id does, unless it is the organization's own id (a
|
|
37
|
+
* ChatGPT workspace id shared by every member). Project ids are shared between users
|
|
38
|
+
* (every consumer Antigravity login has the same one) and never count.
|
|
39
|
+
*/
|
|
40
|
+
export declare function isSameOAuthAccount(a: OAuthCredential, b: OAuthCredential): boolean;
|
|
28
41
|
/**
|
|
29
42
|
* Default SQLite-backed implementation of {@link AuthCredentialStore}.
|
|
30
43
|
*
|
|
@@ -1092,6 +1092,12 @@ export interface SessionsApi {
|
|
|
1092
1092
|
* so a stale owner never lifts the restriction a newer owner relies on.
|
|
1093
1093
|
*/
|
|
1094
1094
|
unrestrict(provider: string, sessionId: string, lease: SessionRestrictionLease): void;
|
|
1095
|
+
/**
|
|
1096
|
+
* Whether stored credential `credentialId` may serve `sessionId`: always for
|
|
1097
|
+
* an unrestricted session, otherwise only an OAuth account its
|
|
1098
|
+
* {@link restrict} list names.
|
|
1099
|
+
*/
|
|
1100
|
+
permits(provider: string, sessionId: string, credentialId: number): boolean;
|
|
1095
1101
|
/**
|
|
1096
1102
|
* Release a session's sticky credential so its next {@link getApiKey} call
|
|
1097
1103
|
* re-runs native pool ranking. This never blocks or penalizes the released
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AuthCredentialStore } from "./auth/store.js";
|
|
2
2
|
import type { AuthAccountPolicies, AuthApiKeyOptions, AuthStorageOptions, BlocksApi, CredentialsApi, HealthApi, KeysApi, LimitsApi, OAuthApi, ResetsApi, SessionsApi, UsageApi } from "./auth/types.js";
|
|
3
|
-
export { isSqliteBusyError, isSqliteCorruptionError, resolveCredentialIdentityKey, SqliteAuthCredentialStore, } from "./auth/sqlite-credential-store.js";
|
|
3
|
+
export { isSameOAuthAccount, isSqliteBusyError, isSqliteCorruptionError, matchesReplacementCredential, resolveCredentialIdentityKey, SqliteAuthCredentialStore, } from "./auth/sqlite-credential-store.js";
|
|
4
4
|
export * from "./auth/store.js";
|
|
5
5
|
export * from "./auth/types.js";
|
|
6
6
|
/**
|
|
@@ -35,8 +35,9 @@ export declare class AuthStorage {
|
|
|
35
35
|
/**
|
|
36
36
|
* Apply new account routing policy (live `auth.accountPolicies` /
|
|
37
37
|
* `retry.usageReservePct` change). Throws a configuration error, leaving the
|
|
38
|
-
* active policy untouched, when
|
|
39
|
-
* stored OAuth accounts
|
|
38
|
+
* active policy untouched, when a policy is malformed, a selector matches
|
|
39
|
+
* several stored OAuth accounts, or two policies claim the same account; a
|
|
40
|
+
* policy naming an absent account stays inactive and logs a warning.
|
|
40
41
|
*/
|
|
41
42
|
setAccountPolicies(config: {
|
|
42
43
|
accountPolicies: AuthAccountPolicies;
|
|
@@ -23,6 +23,16 @@ export declare const Flag: {
|
|
|
23
23
|
readonly FastModeUnsupported: 536870912;
|
|
24
24
|
/** OAuth refresh failed definitively — the stored grant is dead, re-login required. */
|
|
25
25
|
readonly OAuthExpiry: 1073741824;
|
|
26
|
+
/**
|
|
27
|
+
* An Anthropic-compatible endpoint rejected the `cache_control` field with a
|
|
28
|
+
* 400, so prompt-cache breakpoints must be dropped for it.
|
|
29
|
+
*
|
|
30
|
+
* Every bit from {@link Flag.Class} up is already taken, so this claims a low
|
|
31
|
+
* bit instead. Those belong to the raw-status lane — an unclassified id is an
|
|
32
|
+
* HTTP status (100-599, see `statusFromId`) — and 0x800 is 2048, above every
|
|
33
|
+
* status value, so no raw status id can set it.
|
|
34
|
+
*/
|
|
35
|
+
readonly CacheControlUnsupported: 2048;
|
|
26
36
|
/** HTTP 413 byte/media rejection — token compaction cannot shrink bytes or media budgets (#9235). */
|
|
27
37
|
readonly PayloadRejected: 2147483648;
|
|
28
38
|
};
|
|
@@ -113,6 +123,19 @@ export declare function isGrammarError(error: unknown): boolean;
|
|
|
113
123
|
* Accessor for {@link Flag.FastModeUnsupported}.
|
|
114
124
|
*/
|
|
115
125
|
export declare function isFastModeUnsupported(error: unknown): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* An Anthropic-compatible endpoint returned a 400 rejecting something about
|
|
128
|
+
* `cache_control`. Whether it refused the field or one nested option is not
|
|
129
|
+
* decidable here (see {@link CACHE_CONTROL_FIELD_PATTERN}); the caller's retry
|
|
130
|
+
* ladder settles it by replaying.
|
|
131
|
+
* Accessor for {@link Flag.CacheControlUnsupported}.
|
|
132
|
+
*
|
|
133
|
+
* Unlike the high-bit accessors this also requires a classified id. The flag
|
|
134
|
+
* sits in the raw-status lane (see {@link Flag.CacheControlUnsupported}), and
|
|
135
|
+
* while no HTTP status reaches 0x800, `is` is a bare bit test — the extra gate
|
|
136
|
+
* keeps a stray non-HTTP status out of the retry path.
|
|
137
|
+
*/
|
|
138
|
+
export declare function isCacheControlUnsupported(error: unknown): boolean;
|
|
116
139
|
/**
|
|
117
140
|
* Cline's gateway gates some roster entries (certain free-tier models) to its
|
|
118
141
|
* own product surfaces with a 403. The API key is valid — the restriction is
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Judge questions authored as JSON files: `instructions` plus optional
|
|
3
|
+
* `criteria`, keyed by question id. A JSON import widens every string, so a
|
|
4
|
+
* question's kind follows from the shape of its `criteria` rather than a
|
|
5
|
+
* `type` field — the same rule at compile time ({@link QuestionFor}) and at
|
|
6
|
+
* load ({@link judgeQuestions}):
|
|
7
|
+
* - a list of levels, lowest first → {@link ScoreQuestion}
|
|
8
|
+
* - absent, or only `true`/`false` rubrics → {@link NoulQuestion}
|
|
9
|
+
* - any other labels → {@link ChoiceQuestion} over them; `{}` when the caller
|
|
10
|
+
* supplies every label (table rows, labels shared with another question)
|
|
11
|
+
*
|
|
12
|
+
* Instructions may be Handlebars templates; {@link renderQuestion} fills them.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts ignore
|
|
16
|
+
* import graph from "./auto-graph.json" with { type: "json" };
|
|
17
|
+
* const QUESTIONS = judgeQuestions(graph);
|
|
18
|
+
* QUESTIONS.shading; // ChoiceQuestion<"shared" | "series" | "row">
|
|
19
|
+
* renderQuestion(QUESTIONS.order, { column: "latency" });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
import { prompt } from "@oh-my-pi/pi-utils";
|
|
23
|
+
import type { ChoiceQuestion, NoulQuestion, Question, ScoreQuestion } from "./types.js";
|
|
24
|
+
/** One question as a JSON question file writes it; {@link QuestionFor} gives its kind. */
|
|
25
|
+
export interface QuestionSpec {
|
|
26
|
+
instructions: string;
|
|
27
|
+
criteria?: string[] | {
|
|
28
|
+
readonly [label: string]: string | null;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** A JSON question file: {@link QuestionSpec}s keyed by question id. */
|
|
32
|
+
export interface QuestionFile {
|
|
33
|
+
readonly [id: string]: QuestionSpec;
|
|
34
|
+
}
|
|
35
|
+
/** The question a {@link QuestionSpec} declares, with choice labels taken from its criteria keys. */
|
|
36
|
+
export type QuestionFor<S extends QuestionSpec> = S extends {
|
|
37
|
+
criteria: string[];
|
|
38
|
+
} ? ScoreQuestion : S extends {
|
|
39
|
+
criteria: infer C extends object;
|
|
40
|
+
} ? [keyof C] extends [never] ? ChoiceQuestion : [keyof C] extends ["true" | "false"] ? NoulQuestion : ChoiceQuestion<Extract<keyof C, string>> : NoulQuestion;
|
|
41
|
+
/** Every question a {@link QuestionFile} declares, keyed as in the file. */
|
|
42
|
+
export type QuestionsFor<F extends QuestionFile> = {
|
|
43
|
+
[K in keyof F]: QuestionFor<F[K]>;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The typed questions of a JSON question file; answers to them come back typed
|
|
47
|
+
* through {@link JudgmentResult}.
|
|
48
|
+
* @throws when a score question lists fewer than two levels.
|
|
49
|
+
*/
|
|
50
|
+
export declare function judgeQuestions<F extends QuestionFile>(file: F): QuestionsFor<F>;
|
|
51
|
+
/** `question` with its instructions rendered as a Handlebars template over `context`. */
|
|
52
|
+
export declare function renderQuestion<Q extends Question>(question: Q, context: prompt.TemplateContext): Q;
|
|
@@ -94,6 +94,13 @@ export interface AnthropicMessagesClientLike {
|
|
|
94
94
|
create(params: MessageCreateParams, options?: AnthropicRequestOptions): unknown;
|
|
95
95
|
};
|
|
96
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* Endpoint the client targets, when it exposes one. SDK-style clients
|
|
99
|
+
* (`Anthropic`, `AnthropicVertex`) and {@link AnthropicMessagesClient}
|
|
100
|
+
* publish it; a client that exposes none keeps its transport opaque, and the
|
|
101
|
+
* provider must not assume the model's own routing on its behalf.
|
|
102
|
+
*/
|
|
103
|
+
baseURL?: string;
|
|
97
104
|
}
|
|
98
105
|
export declare class AnthropicMessagesClient implements AnthropicMessagesClientLike {
|
|
99
106
|
#private;
|
|
@@ -101,12 +108,15 @@ export declare class AnthropicMessagesClient implements AnthropicMessagesClientL
|
|
|
101
108
|
readonly beta: {
|
|
102
109
|
readonly messages: AnthropicMessages;
|
|
103
110
|
};
|
|
111
|
+
/** Endpoint shared with the HTTP transport. */
|
|
112
|
+
get baseURL(): string;
|
|
104
113
|
constructor(options: AnthropicClientOptions);
|
|
105
114
|
request(path: string, params: MessageCreateParams, options?: AnthropicRequestOptions): AnthropicApiRequest;
|
|
106
115
|
}
|
|
107
116
|
/** Shared Anthropic HTTP transport for Messages and resource APIs. */
|
|
108
117
|
export declare class AnthropicHttpClient {
|
|
109
118
|
#private;
|
|
119
|
+
readonly baseURL: string;
|
|
110
120
|
constructor(options: AnthropicClientOptions);
|
|
111
121
|
request(method: "GET" | "POST", path: string, params?: unknown, options?: AnthropicRequestOptions): Promise<Response>;
|
|
112
122
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Api, Model, ProviderSessionState } from "../types.js";
|
|
2
2
|
/** Root key for Anthropic's per-session provider state. */
|
|
3
3
|
export declare const ANTHROPIC_PROVIDER_SESSION_STATE_KEY = "anthropic-messages";
|
|
4
|
+
/** Caller-map anchor for session-scoped opaque injected clients. */
|
|
5
|
+
export declare const ANTHROPIC_OPAQUE_CLIENT_ANCHOR_KEY = "anthropic-opaque-clients";
|
|
4
6
|
/** Normalize an Anthropic base URL to its origin path without `/v1`. */
|
|
5
7
|
export declare function normalizeAnthropicBaseUrl(baseUrl?: string): string | undefined;
|
|
6
8
|
/** Resolve the endpoint for a first-party Anthropic model without loading its provider implementation. */
|
|
@@ -135,6 +135,13 @@ export type AnthropicClientOptionsArgs = {
|
|
|
135
135
|
thinkingEnabled?: boolean;
|
|
136
136
|
thinkingDisplay?: AnthropicThinkingDisplay;
|
|
137
137
|
disableStrictTools?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Withhold the prompt-cache betas (see `buildClaudeCodeBetas`). Set when the
|
|
140
|
+
* request carries no breakpoint at all, and also when it carries breakpoints
|
|
141
|
+
* stripped of `ttl`/`scope`: both betas govern those options, so a body
|
|
142
|
+
* without them must advertise neither.
|
|
143
|
+
*/
|
|
144
|
+
dropPromptCacheBetas?: boolean;
|
|
138
145
|
fetch?: FetchImpl;
|
|
139
146
|
maxRetryDelayMs?: number;
|
|
140
147
|
sessionId?: string;
|
|
@@ -218,8 +225,17 @@ type SystemBlockOptions = {
|
|
|
218
225
|
extraInstructions?: string[];
|
|
219
226
|
/** Text of the first conversational wire user turn, used as the billing fingerprint seed. */
|
|
220
227
|
firstUserMessageText?: string;
|
|
221
|
-
/**
|
|
228
|
+
/**
|
|
229
|
+
* Cache lifetime shared by the OAuth system breakpoint and later message
|
|
230
|
+
* breakpoints. Omitted → the identity block keeps its default `ephemeral`
|
|
231
|
+
* breakpoint; see `dropCacheControl` to emit none at all.
|
|
232
|
+
*/
|
|
222
233
|
cacheControl?: AnthropicCacheControl;
|
|
234
|
+
/**
|
|
235
|
+
* Emit no `cache_control` on any block: the endpoint rejected the field.
|
|
236
|
+
* Distinct from an undefined `cacheControl`, which only means "default".
|
|
237
|
+
*/
|
|
238
|
+
dropCacheControl?: boolean;
|
|
223
239
|
};
|
|
224
240
|
export declare function buildAnthropicSystemBlocks(systemPrompt: readonly string[] | undefined, options?: SystemBlockOptions): AnthropicSystemBlock[] | undefined;
|
|
225
241
|
export declare function normalizeExtraBetas(betas?: string[] | string): string[];
|
|
@@ -145,6 +145,22 @@ export declare function pushBlockEndEvent(block: TextContent | ThinkingContent,
|
|
|
145
145
|
* before invoking — this helper does not mutate `output.content`.
|
|
146
146
|
*/
|
|
147
147
|
export declare function pushToolCallEvents(toolCall: ToolCall, contentIndex: number, output: AssistantMessage, stream: AssistantMessageEventStream): void;
|
|
148
|
+
/** How {@link GoogleTextBlocks} keeps thought text: healed of leaked fence delimiters (#8719), or as received. */
|
|
149
|
+
export type GoogleThoughtText = "healed" | "verbatim";
|
|
150
|
+
/**
|
|
151
|
+
* Folds streamed generateContent text and thought parts into text and thinking
|
|
152
|
+
* blocks, opening a new block whenever the part kind changes. A part's
|
|
153
|
+
* `thoughtSignature` stays on the block it belongs to; the empty text part
|
|
154
|
+
* Gemini sends after a reply's last chunk signs the open block.
|
|
155
|
+
*/
|
|
156
|
+
export declare class GoogleTextBlocks {
|
|
157
|
+
#private;
|
|
158
|
+
constructor(output: AssistantMessage, stream: AssistantMessageEventStream, thoughtText: GoogleThoughtText);
|
|
159
|
+
/** Folds one response part; parts without text are ignored. */
|
|
160
|
+
push(part: Part): void;
|
|
161
|
+
/** Ends the open block, releasing thinking text the fence stripper held back. */
|
|
162
|
+
close(): void;
|
|
163
|
+
}
|
|
148
164
|
/**
|
|
149
165
|
* Append a new text- or thinking-block to `output.content` and push the matching
|
|
150
166
|
* `text_start` / `thinking_start` event. `onBeforeStartEvent` lets the SSE consumer
|
|
@@ -170,7 +186,7 @@ export declare function googleStreamChunkError(error: NonNullable<GenerateConten
|
|
|
170
186
|
* pushing `start`/`done`/`error` events, and the surrounding try/catch that translates
|
|
171
187
|
* thrown errors into `output.stopReason`/`errorMessage`.
|
|
172
188
|
*
|
|
173
|
-
* This helper handles: the chunk loop,
|
|
189
|
+
* This helper handles: the chunk loop, text/thinking blocks ({@link GoogleTextBlocks}), usage metadata
|
|
174
190
|
* decoding (`calculateCost` included), tool-call id collision avoidance, finish-reason
|
|
175
191
|
* mapping, and the abort/stop-reason post-checks that re-throw to bubble into the
|
|
176
192
|
* caller's catch.
|
|
@@ -183,8 +199,6 @@ export declare function consumeGoogleStream<T extends GoogleApiType>(args: {
|
|
|
183
199
|
options: {
|
|
184
200
|
signal?: AbortSignal;
|
|
185
201
|
} | undefined;
|
|
186
|
-
/** Vertex preserves `textSignature` on streamed text deltas; google-generative-ai does not. */
|
|
187
|
-
retainTextSignature?: boolean;
|
|
188
202
|
onFirstToken?: () => void;
|
|
189
203
|
}): Promise<void>;
|
|
190
204
|
/**
|
|
@@ -217,7 +231,6 @@ export declare function streamGoogleGenAI<T extends "google-generative-ai" | "go
|
|
|
217
231
|
model: Model<T>;
|
|
218
232
|
options: GoogleSharedStreamOptions | undefined;
|
|
219
233
|
api: T;
|
|
220
|
-
retainTextSignature?: boolean;
|
|
221
234
|
prepare: () => GoogleGenAIRequestPlan | Promise<GoogleGenAIRequestPlan>;
|
|
222
235
|
}): AssistantMessageEventStream;
|
|
223
236
|
/**
|
|
@@ -7,6 +7,12 @@ export interface InferenceHeaderOptions {
|
|
|
7
7
|
}
|
|
8
8
|
/** Set a header unless the map already contains that field under any casing. */
|
|
9
9
|
export declare function setHeaderIfAbsent(headers: Record<string, string>, name: string, value: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Label a request with the conversation id under the model's resolved
|
|
12
|
+
* `compat.sessionHeader` (KDL `session-header`). A header the caller or config
|
|
13
|
+
* already set wins; without a conversation id nothing is sent.
|
|
14
|
+
*/
|
|
15
|
+
export declare function applySessionHeader(headers: Record<string, string> | Headers, compat: object | undefined, sessionId: string | undefined): void;
|
|
10
16
|
/**
|
|
11
17
|
* Project omp's identity and authoritative conversation id onto the headers
|
|
12
18
|
* understood by the active inference protocol and host.
|
|
@@ -78,6 +78,8 @@ export interface RequestBody {
|
|
|
78
78
|
* explicit option; normal inference defaults to the full Responses contract.
|
|
79
79
|
*/
|
|
80
80
|
export declare function resolveCodexResponsesLite(requested: boolean | undefined): boolean;
|
|
81
|
+
/** Wire tier of the model's lowest effort, which a `minimizeEffort` request runs at. */
|
|
82
|
+
export declare function lowestCodexWireEffort(model: Model<"openai-codex-responses">): ReasoningConfig["effort"] | undefined;
|
|
81
83
|
/**
|
|
82
84
|
* Repair both halves of unpaired tool exchanges so the Responses input grammar
|
|
83
85
|
* stays valid — the API rejects either orphan with a 400:
|
|
@@ -148,7 +148,7 @@ export declare function buildTransformedCodexRequestBody(model: Model<"openai-co
|
|
|
148
148
|
*/
|
|
149
149
|
export declare function openCodexCompactionEventStream(model: Model<"openai-codex-responses">, body: OpenAICodexCompactionBody, options: OpenAICodexCompactionStreamOptions): Promise<AsyncGenerator<Record<string, unknown>>>;
|
|
150
150
|
export declare const streamOpenAICodexResponses: StreamFunction<"openai-codex-responses">;
|
|
151
|
-
export declare function prewarmOpenAICodexResponses(model: Model<"openai-codex-responses">, options?: Pick<OpenAICodexResponsesOptions, "apiKey" | "headers" | "sessionId" | "signal" | "preferWebsockets" | "providerSessionState" | "responsesLite">): Promise<void>;
|
|
151
|
+
export declare function prewarmOpenAICodexResponses(model: Model<"openai-codex-responses">, options?: Pick<OpenAICodexResponsesOptions, "apiKey" | "headers" | "sessionId" | "signal" | "preferWebsockets" | "providerSessionState" | "responsesLite" | "serviceTier">): Promise<void>;
|
|
152
152
|
export interface OpenAICodexTransportDetails {
|
|
153
153
|
websocketPreferred: boolean;
|
|
154
154
|
lastTransport?: CodexTransport;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Mid-conversation reasoning effort via `configuration_update` input items
|
|
3
|
-
* (GPT-6
|
|
3
|
+
* (GPT-6 family; `model.compat.supportsConfigurationUpdate`).
|
|
4
4
|
*
|
|
5
5
|
* The request-level `reasoning.effort` is pinned to the value of the session's
|
|
6
6
|
* first request so the cached prompt prefix survives an effort change. Each
|
|
@@ -12,10 +12,12 @@
|
|
|
12
12
|
* planning.
|
|
13
13
|
*
|
|
14
14
|
* Used by both the platform Responses provider and the Codex provider; the
|
|
15
|
-
* state lives in each provider's session state, keyed per conversation.
|
|
15
|
+
* state lives in each provider's session state, keyed per conversation. A side
|
|
16
|
+
* request plans against a copy of its parent conversation's state (see
|
|
17
|
+
* {@link resolveOpenAIEffortControlState}), so it sends the parent's prefix.
|
|
16
18
|
*
|
|
17
|
-
* Wire constraints (
|
|
18
|
-
*
|
|
19
|
+
* Wire constraints (OpenAI reasoning guide): the GPT-6 family supports the item
|
|
20
|
+
* in standard (not `pro`) reasoning mode, adjacent updates are rejected, and
|
|
19
21
|
* `/responses/compact` rejects histories containing them — compaction
|
|
20
22
|
* requests are built outside this planner and never carry the items.
|
|
21
23
|
*/
|
|
@@ -42,10 +44,12 @@ export interface OpenAIEffortControlState<TEffort extends string = string> {
|
|
|
42
44
|
}
|
|
43
45
|
export declare function createOpenAIEffortControlState<TEffort extends string>(sessionId: string): OpenAIEffortControlState<TEffort>;
|
|
44
46
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
+
* Control state a Responses or Codex request plans against. A side request
|
|
48
|
+
* (`parentSessionId`) gets a throwaway copy of its parent's state, fresh when
|
|
49
|
+
* the parent has none: it replays the parent's updates, and its own effort
|
|
50
|
+
* change never reaches the parent. Other requests get their session's state.
|
|
47
51
|
*/
|
|
48
|
-
export declare function
|
|
52
|
+
export declare function resolveOpenAIEffortControlState<TEffort extends string>(states: Map<string, OpenAIEffortControlState<TEffort>>, keyOf: (sessionId: string) => string, sessionId: string, parentSessionId: string | undefined): OpenAIEffortControlState<TEffort>;
|
|
49
53
|
/** Release one conversation's effort state from the Responses and Codex `releaseSession` implementations. */
|
|
50
54
|
export declare function releaseOpenAIEffortControlSession<TEffort extends string>(states: Map<string, OpenAIEffortControlState<TEffort>>, sessionId: string): void;
|
|
51
55
|
interface AnchorableItem {
|
|
@@ -60,8 +64,10 @@ interface AnchorableItem {
|
|
|
60
64
|
*
|
|
61
65
|
* `input` is the freshly built transcript for this request, without any
|
|
62
66
|
* `configuration_update` items. `requested` is the wire effort the caller
|
|
63
|
-
* would otherwise send at the request level.
|
|
64
|
-
*
|
|
67
|
+
* would otherwise send at the request level. `minimized` replaces it once a
|
|
68
|
+
* baseline exists, where the change rides an update and keeps the cached
|
|
69
|
+
* prefix; a request that sets the baseline runs at `requested`. Returns the
|
|
70
|
+
* effort to send at the request level (the baseline).
|
|
65
71
|
*/
|
|
66
|
-
export declare function planStableOpenAIEffort<TItem extends AnchorableItem, TEffort extends string>(state: OpenAIEffortControlState<TEffort>, input: Array<TItem | ConfigurationUpdateItem>, requested: TEffort): TEffort;
|
|
72
|
+
export declare function planStableOpenAIEffort<TItem extends AnchorableItem, TEffort extends string>(state: OpenAIEffortControlState<TEffort>, input: Array<TItem | ConfigurationUpdateItem>, requested: TEffort, minimized?: TEffort): TEffort;
|
|
67
73
|
export {};
|
|
@@ -3452,7 +3452,7 @@ export declare namespace ResponseInputItem {
|
|
|
3452
3452
|
}
|
|
3453
3453
|
/**
|
|
3454
3454
|
* Changes reasoning effort for subsequent responses without touching the
|
|
3455
|
-
* request-level `reasoning.effort` (GPT-6
|
|
3455
|
+
* request-level `reasoning.effort` (GPT-6 family). Must not be adjacent to
|
|
3456
3456
|
* another `configuration_update`.
|
|
3457
3457
|
*/
|
|
3458
3458
|
interface ConfigurationUpdate {
|