@gajae-code/ai 0.18.11 → 0.18.12
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 +68 -0
- package/README.md +1 -1
- package/dist/types/auth-broker/wire-schemas.d.ts +30 -0
- package/dist/types/auth-storage.d.ts +80 -8
- package/dist/types/bedrock-claude-cache-policy.d.ts +1 -1
- package/dist/types/model-cache.d.ts +6 -4
- package/dist/types/model-manager.d.ts +2 -0
- package/dist/types/openai-completions-compat.d.ts +2 -1
- package/dist/types/providers/anthropic.d.ts +10 -0
- package/dist/types/providers/aws-credential-config.d.ts +5 -0
- package/dist/types/providers/google-auth.d.ts +7 -0
- package/dist/types/providers/google-gemini-headers.d.ts +10 -5
- package/dist/types/providers/kiro-api-key.d.ts +5 -0
- package/dist/types/providers/openai-chat-server-schema.d.ts +2 -1
- package/dist/types/providers/openai-completions.d.ts +1 -1
- package/dist/types/providers/openai-responses-shared.d.ts +2 -1
- package/dist/types/stream.d.ts +33 -1
- package/dist/types/types.d.ts +26 -3
- package/dist/types/usage.d.ts +3 -0
- package/dist/types/utils/discovery/antigravity.d.ts +11 -0
- package/dist/types/utils/idle-iterator.d.ts +3 -2
- package/dist/types/utils/oauth/types.d.ts +9 -0
- package/package.json +4 -4
- package/src/auth-broker/remote-store.ts +62 -11
- package/src/auth-broker/wire-schemas.ts +2 -0
- package/src/auth-gateway/server.ts +3 -2
- package/src/auth-storage.ts +647 -194
- package/src/bedrock-claude-cache-policy.d.ts +1 -1
- package/src/bedrock-claude-cache-policy.ts +2 -2
- package/src/model-cache.ts +45 -10
- package/src/model-manager.ts +18 -6
- package/src/model-thinking.ts +37 -7
- package/src/models.json +2931 -1670
- package/src/openai-completions-compat.d.ts +2 -1
- package/src/openai-completions-compat.ts +5 -0
- package/src/provider-models/google.ts +7 -1
- package/src/provider-models/openai-compat.ts +26 -0
- package/src/providers/amazon-bedrock.ts +20 -11
- package/src/providers/anthropic.d.ts +10 -0
- package/src/providers/anthropic.ts +139 -4
- package/src/providers/aws-credential-config.d.ts +5 -0
- package/src/providers/aws-credential-config.ts +29 -1
- package/src/providers/google-auth.d.ts +7 -0
- package/src/providers/google-auth.ts +165 -4
- package/src/providers/google-gemini-headers.d.ts +10 -5
- package/src/providers/google-gemini-headers.ts +11 -6
- package/src/providers/google-vertex.ts +2 -4
- package/src/providers/kiro-api-key.d.ts +5 -0
- package/src/providers/kiro-api-key.ts +379 -68
- package/src/providers/ollama.ts +19 -9
- package/src/providers/openai-anthropic-shim.ts +1 -0
- package/src/providers/openai-chat-server-schema.ts +1 -1
- package/src/providers/openai-chat-server.ts +14 -2
- package/src/providers/openai-codex-responses.ts +21 -14
- package/src/providers/openai-completions.d.ts +1 -1
- package/src/providers/openai-completions.ts +65 -4
- package/src/providers/openai-responses-server.ts +10 -1
- package/src/providers/openai-responses-shared.d.ts +2 -1
- package/src/providers/openai-responses-shared.ts +42 -1
- package/src/providers/openai-responses.ts +51 -10
- package/src/providers/pi-native-server.ts +1 -1
- package/src/stream.d.ts +33 -1
- package/src/stream.ts +107 -13
- package/src/types.d.ts +26 -3
- package/src/types.ts +55 -2
- package/src/usage/claude.ts +4 -2
- package/src/usage.ts +3 -0
- package/src/utils/discovery/antigravity.ts +144 -2
- package/src/utils/idle-iterator.d.ts +3 -2
- package/src/utils/idle-iterator.ts +30 -10
- package/src/utils/oauth/anthropic.ts +23 -22
- package/src/utils/oauth/api-key-validation.ts +34 -11
- package/src/utils/oauth/types.d.ts +9 -0
- package/src/utils/oauth/types.ts +9 -0
- package/src/utils/parse-bind.d.ts +35 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,74 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.18.12] - 2026-10-16
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added the `org:<organization id or name>` credential selector, matching an OAuth credential by its organization id or display name (case-insensitive).
|
|
10
|
+
|
|
11
|
+
- `AuthStorageOptions.credentialPreferences` accepts an ordered, persisted soft OAuth account preference list per provider (`ConfiguredCredentialPreference[]`: selector plus optional `maxUsedFraction` cap per entry). Selection uses the first listed account that is usable and under its cap; when every listed account is blocked or capped, the unlisted accounts are ranked by balanced/earliest-reset ranking, and capped listed accounts are used only after those. Caps read the windows each provider reports, so they also apply to providers without a ranking strategy. Runtime `--credential`/`--prefer-credential` selectors and session stickiness take precedence. A list whose entries name one stored row twice (for example an email and `account:<id>` for the same login) is ignored as a whole and reported by `AuthStorage.findDuplicateCredentialPreferences()`.
|
|
12
|
+
|
|
13
|
+
- Add Gemini 4 Argon (`gemini-4-argon`) and send `thinkingLevel` (low/medium/high) for Gemini 4 models instead of falling back to `thinkingBudget`.
|
|
14
|
+
|
|
15
|
+
- Custom `openai-responses` relays whose base URL has a loopback hostname (`127.0.0.0/8`, `localhost`, `::1`) now send `session_id`/`x-client-request-id` affinity headers without an explicit opt-in. The ChatGPT codex backend only reuses a warmed prompt prefix for requests that carry a session identity, so such a relay previously reported zero cached tokens and replayed the entire context on every turn. Remote relays stay opt-in, known non-OpenAI provider IDs stay excluded, retention `none` still suppresses the headers, and `compat.supportsResponsesSessionAffinity: false` opts a loopback relay back out.
|
|
16
|
+
|
|
17
|
+
- Added `ultrafast` as a first-class ServiceTier option, alongside existing tiers (auto, default, flex, scale, priority)
|
|
18
|
+
- Support for OpenAI's ultrafast processing tier on OpenAI chat completions and Codex responses APIs
|
|
19
|
+
- 6x ultrafast multiplier for API token pricing (per OpenAI's official pricing: $60 input, $300 output for gpt-6-astra)
|
|
20
|
+
- Ultrafast service tier now properly resolves and sends to supported models
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Use User-Agent-aware Antigravity model-cache validation so discovery catalogs are refreshed for the active client identity.
|
|
25
|
+
|
|
26
|
+
- `ServiceTier` type now includes "ultrafast" as a valid option
|
|
27
|
+
- `shouldSendServiceTier()` now includes ultrafast in provider send logic for OpenAI
|
|
28
|
+
- OpenAI chat server schema updated to accept "ultrafast" in service_tier field
|
|
29
|
+
- Codex included-usage estimates use the official Fast 2.5x and Ultrafast 8x multipliers
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- Kiro streams now surface explicit content-filter refusal messages with category and explanation instead of the generic "no tokens" error when a refusal is detected. Both bearer token (via `messageMetadataEvent`) and API-key (`ksk_`, via `metadataEvent`) paths are supported, with proper provider safety-stop minting. Bearer-token text streams incrementally unless a thinking block precedes it; API-key text remains quarantined until clean EOF. Tool calls are emitted only at stream end (#6150).
|
|
34
|
+
- Detail-free `stopReason: "CONTENT_FILTERED"` (without `stopDetails.refusal` object) is now treated as a refusal and suppresses unconfirmed content.
|
|
35
|
+
- API-key text remains quarantined through `COMPLETED`/`TOOL_USE` metadata and is released only at clean EOF, so a later refusal or read failure cannot leak content across HTTP chunk boundaries.
|
|
36
|
+
- A refusal takes precedence over ordinary errors or successful completion in the same batch or a later read. An active tool may finish its input after `TOOL_USE`, while `COMPLETED` fences tool fragments and later content.
|
|
37
|
+
- Error events omit duplicate partial messages so credential-shaped upstream text cannot bypass gateway redaction or leak through SSE encoders.
|
|
38
|
+
- Parser no longer resyncs into nested objects when an incomplete outer JSON frame is encountered. Incomplete frames are retained as remainder; EOF with incomplete frame throws an error.
|
|
39
|
+
- Errors before clean EOF discard quarantined text and retain only explicitly completed tool calls.
|
|
40
|
+
|
|
41
|
+
- API-key validation now accepts successful inference responses that contain reasoning output or end at the token limit before producing text, and reports empty or missing choices accurately.
|
|
42
|
+
|
|
43
|
+
- An image Anthropic rejects with `Could not process image` no longer makes every later request in the session fail. The provider replaces the rejected image with a text placeholder and keeps omitting it on later turns and fallback models. The first repair omits the images of the newest message that has any; if the request still fails, the second omits every image (#6810).
|
|
44
|
+
|
|
45
|
+
- Anthropic OAuth keeps one stored credential per organization when a single account belongs to several organizations (for example a Team workspace and a personal Max plan). Credentials now record the organization from the token response, their identity key is scoped to it, so logging in to a second organization no longer replaces or disables the first, and usage limits are reported per organization instead of being merged across them. Rows stored before this change keep working and are deduplicated once their next refresh records the organization.
|
|
46
|
+
|
|
47
|
+
- Broker usage reports are matched to a credential by the identity (account, email, or project) and Anthropic organization they carry, checked against the current broker snapshot. A report without a matching identity is taken only when the provider has a single stored OAuth credential, so a lone report is no longer assigned to every credential of a provider that holds several. A credential stored without an Anthropic organization never takes a report whose organization another stored credential is scoped to, so a legacy row whose own usage fetch fails gets no fresh usage data instead of another row's or another account's limits.
|
|
48
|
+
- An `org:` selector that matches more than one stored credential (organizations sharing a display name) is rejected with the candidate row ids instead of resolving to the first row, and an exact organization-id match is preferred over display-name matches. Pin ambiguity errors now list the candidate row ids.
|
|
49
|
+
|
|
50
|
+
- Keep cached models from a different User-Agent out of failed-refresh fallbacks, and report the effective User-Agent in discovery diagnostics.
|
|
51
|
+
|
|
52
|
+
- Replace user and tool-result images with text markers for Bedrock models without image input, including consecutive tool results, while preserving image payloads for image-capable models.
|
|
53
|
+
|
|
54
|
+
- `--prefer-credential` now selects the designated OAuth account when the provider also stores API-key rows. The preferred row was matched by its index in the full credential list against OAuth-only candidate indices, so a mixed pool could move a different OAuth account to the front.
|
|
55
|
+
|
|
56
|
+
- OpenAI Responses and Completions streams now use a model's configured idle timeout when no environment or request override is set, so long reasoning gaps on compatible proxies can be tuned per model. Longer request-level idle windows also bound SDK setup before response headers arrive, and SDK timers are kept within the platform-safe range. Kimi Code's Anthropic-compatible route also honors its model timeout, with environment and request overrides retaining precedence.
|
|
57
|
+
|
|
58
|
+
- Normalize negative and non-finite model catalog prices to zero so bundled usage estimates cannot become negative.
|
|
59
|
+
|
|
60
|
+
- Switching the model cache to a different database path now fully releases the previous database. A migration query left an unfinalized prepared statement, so closing the old connection left it open in the background; it kept the database locked and, on Windows, blocked deleting its directory.
|
|
61
|
+
|
|
62
|
+
- Omit MCP tool-result image payloads from Ollama chat requests when the model does not support image input, retaining a text omission marker.
|
|
63
|
+
|
|
64
|
+
- Closing AuthStorage and the model cache now deterministically finalizes their owned SQLite statements before releasing the database, allowing immediate removal of owned scratch directories on Windows.
|
|
65
|
+
|
|
66
|
+
- Usage pricing now follows provider-reported effective tiers when available, and gateway responses preserve that tier for downstream clients.
|
|
67
|
+
|
|
68
|
+
### Notes
|
|
69
|
+
|
|
70
|
+
- Ultrafast tier is currently available for gpt-6-astra and gpt-6.1-sol. The gpt-5.6-sol model is Fast-only and is not eligible for ultrafast.
|
|
71
|
+
- For unsupported models, ultrafast is omitted and provider-default processing is used; no unsupported tier is sent.
|
|
72
|
+
|
|
5
73
|
## [0.18.11] - 2026-10-12
|
|
6
74
|
|
|
7
75
|
## [0.18.10] - 2026-10-12
|
package/README.md
CHANGED
|
@@ -782,7 +782,7 @@ interface OpenAICompat {
|
|
|
782
782
|
supportsStore?: boolean; // Whether provider supports the `store` field (default: true)
|
|
783
783
|
supportsDeveloperRole?: boolean; // Whether provider supports `developer` role vs `system` (default: true)
|
|
784
784
|
sendSessionHeaders?: boolean; // Forward the session id as `session_id`/`x-session-id` headers for relay session-affinity & prompt-cache reuse (default: false)
|
|
785
|
-
supportsResponsesSessionAffinity?: boolean; // Opt in to session-affinity headers for custom openai-responses relays; canonical OpenAI routing
|
|
785
|
+
supportsResponsesSessionAffinity?: boolean; // Opt in to session-affinity headers for custom openai-responses relays; canonical OpenAI routing and loopback-hostname relays are automatic (default: false for remote relays)
|
|
786
786
|
supportsReasoningEffort?: boolean; // Whether provider supports `reasoning_effort` (default: true)
|
|
787
787
|
maxTokensField?: "max_completion_tokens" | "max_tokens"; // Which field name to use (default: max_completion_tokens)
|
|
788
788
|
extraBody?: Record<string, unknown>; // Extra request-body fields for custom proxy routing or provider-specific options
|
|
@@ -25,6 +25,8 @@ export declare const oauthCredentialSchema: z.ZodObject<{
|
|
|
25
25
|
projectId: z.ZodOptional<z.ZodString>;
|
|
26
26
|
email: z.ZodOptional<z.ZodString>;
|
|
27
27
|
accountId: z.ZodOptional<z.ZodString>;
|
|
28
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
29
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
28
30
|
mcpBinding: z.ZodOptional<z.ZodObject<{
|
|
29
31
|
resourceOrigin: z.ZodString;
|
|
30
32
|
tokenEndpoint: z.ZodString;
|
|
@@ -39,6 +41,8 @@ export declare const remoteOauthCredentialSchema: z.ZodObject<{
|
|
|
39
41
|
projectId: z.ZodOptional<z.ZodString>;
|
|
40
42
|
email: z.ZodOptional<z.ZodString>;
|
|
41
43
|
accountId: z.ZodOptional<z.ZodString>;
|
|
44
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
45
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
42
46
|
mcpBinding: z.ZodOptional<z.ZodObject<{
|
|
43
47
|
resourceOrigin: z.ZodString;
|
|
44
48
|
tokenEndpoint: z.ZodString;
|
|
@@ -59,6 +63,8 @@ export declare const writableAuthCredentialSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
59
63
|
projectId: z.ZodOptional<z.ZodString>;
|
|
60
64
|
email: z.ZodOptional<z.ZodString>;
|
|
61
65
|
accountId: z.ZodOptional<z.ZodString>;
|
|
66
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
67
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
62
68
|
mcpBinding: z.ZodOptional<z.ZodObject<{
|
|
63
69
|
resourceOrigin: z.ZodString;
|
|
64
70
|
tokenEndpoint: z.ZodString;
|
|
@@ -76,6 +82,8 @@ export declare const snapshotCredentialSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
76
82
|
projectId: z.ZodOptional<z.ZodString>;
|
|
77
83
|
email: z.ZodOptional<z.ZodString>;
|
|
78
84
|
accountId: z.ZodOptional<z.ZodString>;
|
|
85
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
86
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
79
87
|
mcpBinding: z.ZodOptional<z.ZodObject<{
|
|
80
88
|
resourceOrigin: z.ZodString;
|
|
81
89
|
tokenEndpoint: z.ZodString;
|
|
@@ -96,6 +104,8 @@ export declare const credentialSnapshotEntrySchema: z.ZodObject<{
|
|
|
96
104
|
projectId: z.ZodOptional<z.ZodString>;
|
|
97
105
|
email: z.ZodOptional<z.ZodString>;
|
|
98
106
|
accountId: z.ZodOptional<z.ZodString>;
|
|
107
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
108
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
99
109
|
mcpBinding: z.ZodOptional<z.ZodObject<{
|
|
100
110
|
resourceOrigin: z.ZodString;
|
|
101
111
|
tokenEndpoint: z.ZodString;
|
|
@@ -119,6 +129,8 @@ export declare const snapshotEntrySchema: z.ZodObject<{
|
|
|
119
129
|
projectId: z.ZodOptional<z.ZodString>;
|
|
120
130
|
email: z.ZodOptional<z.ZodString>;
|
|
121
131
|
accountId: z.ZodOptional<z.ZodString>;
|
|
132
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
133
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
122
134
|
mcpBinding: z.ZodOptional<z.ZodObject<{
|
|
123
135
|
resourceOrigin: z.ZodString;
|
|
124
136
|
tokenEndpoint: z.ZodString;
|
|
@@ -160,6 +172,8 @@ export declare const snapshotResponseSchema: z.ZodObject<{
|
|
|
160
172
|
projectId: z.ZodOptional<z.ZodString>;
|
|
161
173
|
email: z.ZodOptional<z.ZodString>;
|
|
162
174
|
accountId: z.ZodOptional<z.ZodString>;
|
|
175
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
176
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
163
177
|
mcpBinding: z.ZodOptional<z.ZodObject<{
|
|
164
178
|
resourceOrigin: z.ZodString;
|
|
165
179
|
tokenEndpoint: z.ZodString;
|
|
@@ -223,6 +237,8 @@ export declare const snapshotStreamSnapshotEventSchema: z.ZodObject<{
|
|
|
223
237
|
projectId: z.ZodOptional<z.ZodString>;
|
|
224
238
|
email: z.ZodOptional<z.ZodString>;
|
|
225
239
|
accountId: z.ZodOptional<z.ZodString>;
|
|
240
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
241
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
226
242
|
mcpBinding: z.ZodOptional<z.ZodObject<{
|
|
227
243
|
resourceOrigin: z.ZodString;
|
|
228
244
|
tokenEndpoint: z.ZodString;
|
|
@@ -261,6 +277,8 @@ export declare const snapshotStreamEntryEventSchema: z.ZodObject<{
|
|
|
261
277
|
projectId: z.ZodOptional<z.ZodString>;
|
|
262
278
|
email: z.ZodOptional<z.ZodString>;
|
|
263
279
|
accountId: z.ZodOptional<z.ZodString>;
|
|
280
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
281
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
264
282
|
mcpBinding: z.ZodOptional<z.ZodObject<{
|
|
265
283
|
resourceOrigin: z.ZodString;
|
|
266
284
|
tokenEndpoint: z.ZodString;
|
|
@@ -312,6 +330,8 @@ export declare const snapshotStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
312
330
|
projectId: z.ZodOptional<z.ZodString>;
|
|
313
331
|
email: z.ZodOptional<z.ZodString>;
|
|
314
332
|
accountId: z.ZodOptional<z.ZodString>;
|
|
333
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
334
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
315
335
|
mcpBinding: z.ZodOptional<z.ZodObject<{
|
|
316
336
|
resourceOrigin: z.ZodString;
|
|
317
337
|
tokenEndpoint: z.ZodString;
|
|
@@ -348,6 +368,8 @@ export declare const snapshotStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
348
368
|
projectId: z.ZodOptional<z.ZodString>;
|
|
349
369
|
email: z.ZodOptional<z.ZodString>;
|
|
350
370
|
accountId: z.ZodOptional<z.ZodString>;
|
|
371
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
372
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
351
373
|
mcpBinding: z.ZodOptional<z.ZodObject<{
|
|
352
374
|
resourceOrigin: z.ZodString;
|
|
353
375
|
tokenEndpoint: z.ZodString;
|
|
@@ -453,6 +475,8 @@ export declare const credentialRefreshResponseSchema: z.ZodObject<{
|
|
|
453
475
|
projectId: z.ZodOptional<z.ZodString>;
|
|
454
476
|
email: z.ZodOptional<z.ZodString>;
|
|
455
477
|
accountId: z.ZodOptional<z.ZodString>;
|
|
478
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
479
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
456
480
|
mcpBinding: z.ZodOptional<z.ZodObject<{
|
|
457
481
|
resourceOrigin: z.ZodString;
|
|
458
482
|
tokenEndpoint: z.ZodString;
|
|
@@ -484,6 +508,8 @@ export declare const credentialUploadRequestSchema: z.ZodObject<{
|
|
|
484
508
|
projectId: z.ZodOptional<z.ZodString>;
|
|
485
509
|
email: z.ZodOptional<z.ZodString>;
|
|
486
510
|
accountId: z.ZodOptional<z.ZodString>;
|
|
511
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
512
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
487
513
|
mcpBinding: z.ZodOptional<z.ZodObject<{
|
|
488
514
|
resourceOrigin: z.ZodString;
|
|
489
515
|
tokenEndpoint: z.ZodString;
|
|
@@ -505,6 +531,8 @@ export declare const credentialUploadResponseSchema: z.ZodObject<{
|
|
|
505
531
|
projectId: z.ZodOptional<z.ZodString>;
|
|
506
532
|
email: z.ZodOptional<z.ZodString>;
|
|
507
533
|
accountId: z.ZodOptional<z.ZodString>;
|
|
534
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
535
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
508
536
|
mcpBinding: z.ZodOptional<z.ZodObject<{
|
|
509
537
|
resourceOrigin: z.ZodString;
|
|
510
538
|
tokenEndpoint: z.ZodString;
|
|
@@ -541,6 +569,8 @@ export declare const credentialIfAbsentUploadResponseSchema: z.ZodObject<{
|
|
|
541
569
|
projectId: z.ZodOptional<z.ZodString>;
|
|
542
570
|
email: z.ZodOptional<z.ZodString>;
|
|
543
571
|
accountId: z.ZodOptional<z.ZodString>;
|
|
572
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
573
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
544
574
|
mcpBinding: z.ZodOptional<z.ZodObject<{
|
|
545
575
|
resourceOrigin: z.ZodString;
|
|
546
576
|
tokenEndpoint: z.ZodString;
|
|
@@ -91,6 +91,8 @@ export interface CredentialInventoryRecord {
|
|
|
91
91
|
accountId?: string;
|
|
92
92
|
email?: string;
|
|
93
93
|
projectId?: string;
|
|
94
|
+
organizationId?: string;
|
|
95
|
+
organizationName?: string;
|
|
94
96
|
disabled: boolean;
|
|
95
97
|
disabledCause: string | null;
|
|
96
98
|
}
|
|
@@ -466,6 +468,25 @@ export interface CredentialDisabledEvent {
|
|
|
466
468
|
* thrashes accounts mid-session / cold-starts the server-side prompt cache.
|
|
467
469
|
*/
|
|
468
470
|
export type CredentialRankingMode = "balanced" | "earliest-reset";
|
|
471
|
+
/**
|
|
472
|
+
* One entry of a provider's ordered, persisted soft preference list.
|
|
473
|
+
*
|
|
474
|
+
* Entries are consulted in list order when a credential is selected. Usable
|
|
475
|
+
* entries under their cap are tried first, in list order; the remaining
|
|
476
|
+
* credentials follow in the normal ranking order. An entry whose most-used
|
|
477
|
+
* known usage window has reached `maxUsedFraction` is demoted behind every
|
|
478
|
+
* other credential, so it is used only when nothing else is available. A
|
|
479
|
+
* blocked or missing entry is skipped. Unknown usage never counts as over the
|
|
480
|
+
* cap.
|
|
481
|
+
*
|
|
482
|
+
* Runtime selectors (`--credential`, `--prefer-credential`) and session
|
|
483
|
+
* stickiness take precedence over configured preferences.
|
|
484
|
+
*/
|
|
485
|
+
export interface ConfiguredCredentialPreference {
|
|
486
|
+
selector: AuthCredentialSelector;
|
|
487
|
+
/** Used fraction in (0, 1] at which this entry stops being preferred. Absent means only blocking moves past it. */
|
|
488
|
+
maxUsedFraction?: number;
|
|
489
|
+
}
|
|
469
490
|
/**
|
|
470
491
|
* Whether credential selection may probe provider usage endpoints.
|
|
471
492
|
*
|
|
@@ -481,6 +502,8 @@ export type AuthStorageOptions = {
|
|
|
481
502
|
usageProviderResolver?: (provider: Provider) => UsageProvider | undefined;
|
|
482
503
|
rankingStrategyResolver?: (provider: Provider) => CredentialRankingStrategy | undefined;
|
|
483
504
|
credentialRankingMode?: CredentialRankingMode;
|
|
505
|
+
/** Persisted ordered soft preferences keyed by provider id. */
|
|
506
|
+
credentialPreferences?: Readonly<Record<string, readonly ConfiguredCredentialPreference[]>>;
|
|
484
507
|
usageFetch?: typeof fetch;
|
|
485
508
|
usageRequestTimeoutMs?: number;
|
|
486
509
|
usageLogger?: UsageLogger;
|
|
@@ -548,11 +571,29 @@ export type AuthApiKeyOptions = {
|
|
|
548
571
|
/** Prefer one stored OAuth credential while preserving quota-triggered fallback. */
|
|
549
572
|
preferredCredentialSelector?: AuthCredentialSelector;
|
|
550
573
|
};
|
|
551
|
-
export type AuthCredentialSelectorKind = "id" | "email" | "account" | "project";
|
|
574
|
+
export type AuthCredentialSelectorKind = "id" | "email" | "account" | "project" | "org";
|
|
552
575
|
export interface AuthCredentialSelector {
|
|
553
576
|
kind: AuthCredentialSelectorKind;
|
|
554
577
|
value: string;
|
|
555
578
|
}
|
|
579
|
+
/**
|
|
580
|
+
* Whether an OAuth credential belongs to the organization named by an `org:`
|
|
581
|
+
* selector value: the organization id, or its display name (case-insensitive).
|
|
582
|
+
*/
|
|
583
|
+
export declare function oauthCredentialMatchesOrganization(credential: Pick<OAuthCredentials, "organizationId" | "organizationName">, value: string): boolean;
|
|
584
|
+
/**
|
|
585
|
+
* The items an `org:` selector designates. An exact organization-id match wins
|
|
586
|
+
* over display-name matches, because names are not unique: two organizations
|
|
587
|
+
* can share a name, and a name can equal another organization's id. Callers
|
|
588
|
+
* must treat more than one result as ambiguous rather than picking one.
|
|
589
|
+
*/
|
|
590
|
+
export declare function selectOrganizationMatches<T>(items: readonly T[], value: string, organizationOf: (item: T) => Pick<OAuthCredentials, "organizationId" | "organizationName"> | undefined): T[];
|
|
591
|
+
/**
|
|
592
|
+
* Human-facing identity of a stored OAuth credential. The organization name is
|
|
593
|
+
* appended because one account (same email) can hold one credential per
|
|
594
|
+
* organization.
|
|
595
|
+
*/
|
|
596
|
+
export declare function formatOAuthIdentityLabel(credential: Pick<OAuthCredentials, "email" | "accountId" | "projectId" | "organizationName">): string | null;
|
|
556
597
|
/**
|
|
557
598
|
* Refreshed OAuth access plus identity metadata returned by
|
|
558
599
|
* {@link AuthStorage.getOAuthAccess}. Callers that authenticate via a bearer
|
|
@@ -607,7 +648,13 @@ export declare class AuthStorage {
|
|
|
607
648
|
allocateMonotonicSequence(key: string, expiresAtSec: number): number;
|
|
608
649
|
getProviderConfigurationGeneration(provider: string, owner?: object): number;
|
|
609
650
|
getProviderOAuthRefreshGeneration(provider: string): number;
|
|
610
|
-
|
|
651
|
+
/**
|
|
652
|
+
* Return provider-specific discovery evidence. `stagedConfigApiKey` lets a read-only
|
|
653
|
+
* config candidate derive the same fingerprint before its owner-scoped override is published.
|
|
654
|
+
*/
|
|
655
|
+
getProviderEvidenceGeneration(provider: string, resolvedApiKey?: string, owner?: object, stagedConfigApiKey?: {
|
|
656
|
+
apiKey: string;
|
|
657
|
+
}): string;
|
|
611
658
|
onGenerationChanged(listener: (generation: number) => void): () => void;
|
|
612
659
|
offGenerationChanged(listener: (generation: number) => void): void;
|
|
613
660
|
/**
|
|
@@ -725,6 +772,8 @@ export declare class AuthStorage {
|
|
|
725
772
|
hasRuntimeCredentialSelector(provider: string): boolean;
|
|
726
773
|
/** Whether the effective selector for a session scope is pinned. */
|
|
727
774
|
hasEffectiveCredentialSelector(provider: string, sessionId?: string): boolean;
|
|
775
|
+
/** Whether any runtime/session scope has a credential pin, including an unavailable hard pin. */
|
|
776
|
+
hasAnyCredentialPin(provider: string): boolean;
|
|
728
777
|
/**
|
|
729
778
|
* Opaque stored row id of the credential this session is currently using.
|
|
730
779
|
*
|
|
@@ -738,6 +787,21 @@ export declare class AuthStorage {
|
|
|
738
787
|
* resolver rather than a stored row.
|
|
739
788
|
*/
|
|
740
789
|
getSessionCredentialRowId(provider: string, sessionId?: string): number | undefined;
|
|
790
|
+
/** Return the stored OAuth row pinned by a credential selector without resolving tokens. */
|
|
791
|
+
getSelectedOAuthCredentialRowId(provider: string, sessionId?: string, options?: Pick<AuthApiKeyOptions, "owner">): number | undefined;
|
|
792
|
+
/** Return the usable OAuth row selected by a soft preferred-credential selector. */
|
|
793
|
+
getPreferredOAuthCredentialRowId(provider: string): number | undefined;
|
|
794
|
+
/** Return the stored API-key row pinned by a credential selector without resolving values. */
|
|
795
|
+
getSelectedApiKeyCredentialRowId(provider: string, sessionId?: string, options?: Pick<AuthApiKeyOptions, "owner">): number | undefined;
|
|
796
|
+
/**
|
|
797
|
+
* Preview the stored API-key row request dispatch would try for this session.
|
|
798
|
+
* Requires a session id so the deterministic session order is used instead
|
|
799
|
+
* of advancing the provider's round-robin cursor. Does not resolve key values
|
|
800
|
+
* or mutate session selection.
|
|
801
|
+
*/
|
|
802
|
+
getProspectiveApiKeyCredentialRowId(provider: string, sessionId: string | undefined, options?: Pick<AuthApiKeyOptions, "owner">): number | undefined;
|
|
803
|
+
/** Cached usability of a stored API key; never resolves command-backed values. */
|
|
804
|
+
getStoredApiKeyUsability(provider: string, rowId: number): boolean | undefined;
|
|
741
805
|
/** Whether an enabled stored row is currently available outside quota backoff. */
|
|
742
806
|
isCredentialAvailable(provider: string, rowId: number): boolean;
|
|
743
807
|
/**
|
|
@@ -830,6 +894,14 @@ export declare class AuthStorage {
|
|
|
830
894
|
acquireCredentialDispatchTicket(provider: Provider, signal?: AbortSignal): Promise<CredentialDispatchTicket | undefined>;
|
|
831
895
|
/** Returns the credential type selected for a provider/session, if one has been recorded. */
|
|
832
896
|
getSessionCredentialType(provider: string, sessionId?: string): AuthCredential["type"] | undefined;
|
|
897
|
+
/**
|
|
898
|
+
* Providers whose configured preference list names one stored credential row through more than one entry, for
|
|
899
|
+
* example `email:` and `account:` selectors for the same login. Startup rejects such a list.
|
|
900
|
+
*/
|
|
901
|
+
findDuplicateCredentialPreferences(): Array<{
|
|
902
|
+
provider: string;
|
|
903
|
+
credentialId: number;
|
|
904
|
+
}>;
|
|
833
905
|
/**
|
|
834
906
|
* Get credential for a provider (first entry if multiple).
|
|
835
907
|
*/
|
|
@@ -858,11 +930,11 @@ export declare class AuthStorage {
|
|
|
858
930
|
* Mirrors getApiKey selector validation, overrides, session OAuth stickiness,
|
|
859
931
|
* cached command-key usability, OAuth retry, and environment fallback order.
|
|
860
932
|
*/
|
|
861
|
-
getEffectiveCredentialType(provider: string, sessionId?: string, options?: Pick<AuthApiKeyOptions, "owner">): AuthCredential["type"] | undefined;
|
|
862
|
-
/**
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
933
|
+
getEffectiveCredentialType(provider: string, sessionId?: string, options?: Pick<AuthApiKeyOptions, "owner" | "credentialSelector">): AuthCredential["type"] | undefined;
|
|
934
|
+
/** Check whether configured auth is usable without resolving credentials or refreshing OAuth. */
|
|
935
|
+
hasUsableAuth(provider: string, options?: Pick<AuthApiKeyOptions, "owner" | "credentialSelector"> & {
|
|
936
|
+
sessionId?: string;
|
|
937
|
+
}): boolean;
|
|
866
938
|
/**
|
|
867
939
|
* Check if OAuth credentials are configured for a provider.
|
|
868
940
|
*/
|
|
@@ -983,7 +1055,7 @@ export declare class AuthStorage {
|
|
|
983
1055
|
* and get a best-effort token. For GitHub Copilot we preserve enterprise
|
|
984
1056
|
* routing metadata so discovery can hit the correct host.
|
|
985
1057
|
*/
|
|
986
|
-
peekApiKey(provider: string, options?:
|
|
1058
|
+
peekApiKey(provider: string, options?: AuthApiKeyOptions & {
|
|
987
1059
|
sessionId?: string;
|
|
988
1060
|
}): Promise<string | undefined>;
|
|
989
1061
|
/**
|
|
@@ -10,7 +10,7 @@ export type BedrockClaudeGeneration = {
|
|
|
10
10
|
* - family-first (3.x era): anthropic.claude-3-5-haiku-20241022-v1:0
|
|
11
11
|
* - kind-first (4+ era): anthropic.claude-opus-4-20250514-v1:0,
|
|
12
12
|
* anthropic.claude-haiku-4-5-20251001-v1:0
|
|
13
|
-
* Cross-region profiles (us./eu./au./jp./apac./global. prefixes) and inference-profile
|
|
13
|
+
* Cross-region profiles (us./eu./au./jp./apac./global./in. prefixes) and inference-profile
|
|
14
14
|
* ARNs keep the canonical model id as their final path segment.
|
|
15
15
|
*/
|
|
16
16
|
export declare function parseBedrockClaudeGeneration(id: string): BedrockClaudeGeneration | undefined;
|
|
@@ -14,11 +14,13 @@ interface CacheEntry<TApi extends Api = Api> {
|
|
|
14
14
|
/** IDs returned by the authoritative dynamic provider catalog, when retained. */
|
|
15
15
|
dynamicModelIds: string[] | undefined;
|
|
16
16
|
dynamicModelProvenance: string | undefined;
|
|
17
|
+
/** User-Agent used during discovery; invalidates cache if it changes. */
|
|
18
|
+
discoveryUserAgent: string | undefined;
|
|
17
19
|
}
|
|
18
20
|
/** Close the shared cache only when it owns the exact requested database path. */
|
|
19
21
|
export declare function closeModelCache(dbPath?: string): boolean;
|
|
20
|
-
export declare function readModelCache<TApi extends Api>(providerId: string, ttlMs: number, now: () => number, dbPath?: string): CacheEntry<TApi> | null;
|
|
21
|
-
export declare function writeModelCache<TApi extends Api>(providerId: string, updatedAt: number, models: Model<TApi>[], authoritative: boolean, staticFingerprint: string, dbPath?: string, dynamicModelIds?: readonly string[], dynamicModelProvenance?: string): void;
|
|
22
|
-
export declare function insertModelCacheIfAbsent<TApi extends Api>(providerId: string, updatedAt: number, models: Model<TApi>[], authoritative: boolean, staticFingerprint: string, dbPath?: string, dynamicModelIds?: readonly string[], dynamicModelProvenance?: string): boolean;
|
|
23
|
-
export declare function updateModelCacheIfUnchanged<TApi extends Api>(providerId: string, expectedUpdatedAt: number, expectedDynamicModelIds: readonly string[] | undefined, expectedDynamicModelProvenance: string | undefined, expectedModels: readonly Model<TApi>[], updatedAt: number, models: Model<TApi>[], authoritative: boolean, staticFingerprint: string, dbPath?: string, dynamicModelIds?: readonly string[], dynamicModelProvenance?: string): boolean;
|
|
22
|
+
export declare function readModelCache<TApi extends Api>(providerId: string, ttlMs: number, now: () => number, dbPath?: string, expectedDiscoveryUserAgent?: string): CacheEntry<TApi> | null;
|
|
23
|
+
export declare function writeModelCache<TApi extends Api>(providerId: string, updatedAt: number, models: Model<TApi>[], authoritative: boolean, staticFingerprint: string, dbPath?: string, dynamicModelIds?: readonly string[], dynamicModelProvenance?: string, discoveryUserAgent?: string): void;
|
|
24
|
+
export declare function insertModelCacheIfAbsent<TApi extends Api>(providerId: string, updatedAt: number, models: Model<TApi>[], authoritative: boolean, staticFingerprint: string, dbPath?: string, dynamicModelIds?: readonly string[], dynamicModelProvenance?: string, discoveryUserAgent?: string): boolean;
|
|
25
|
+
export declare function updateModelCacheIfUnchanged<TApi extends Api>(providerId: string, expectedUpdatedAt: number, expectedDynamicModelIds: readonly string[] | undefined, expectedDynamicModelProvenance: string | undefined, expectedModels: readonly Model<TApi>[], expectedDiscoveryUserAgent: string | undefined, updatedAt: number, models: Model<TApi>[], authoritative: boolean, staticFingerprint: string, dbPath?: string, dynamicModelIds?: readonly string[], dynamicModelProvenance?: string, discoveryUserAgent?: string): boolean;
|
|
24
26
|
export {};
|
|
@@ -34,6 +34,8 @@ export interface ModelManagerOptions<TApi extends Api = Api, TModelsDevPayload =
|
|
|
34
34
|
canPublishCache?: () => boolean;
|
|
35
35
|
/** Credential-and-endpoint identity required to reuse dynamic catalog IDs. */
|
|
36
36
|
cacheDynamicModelProvenance?: string;
|
|
37
|
+
/** Discovery User-Agent (e.g., for Antigravity): cache invalidates on change. */
|
|
38
|
+
discoveryUserAgent?: string;
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
39
41
|
* Resolution result.
|
|
@@ -27,13 +27,14 @@ export declare function isDirectXaiReasoningEffortModel(model: {
|
|
|
27
27
|
api?: string;
|
|
28
28
|
baseUrl?: string;
|
|
29
29
|
}, resolvedBaseUrl?: string): boolean;
|
|
30
|
-
export type ResolvedOpenAICompat = Required<Omit<OpenAICompat, "openRouterRouting" | "vercelGatewayRouting" | "extraBody" | "toolStrictMode" | "toolChoiceSupport" | "supportsResponsesSessionAffinity" | "supportsServiceTier" | "reservedToolNames">> & {
|
|
30
|
+
export type ResolvedOpenAICompat = Required<Omit<OpenAICompat, "openRouterRouting" | "vercelGatewayRouting" | "extraBody" | "toolStrictMode" | "toolChoiceSupport" | "supportsResponsesSessionAffinity" | "supportsServiceTier" | "supportsUltrafastTier" | "reservedToolNames">> & {
|
|
31
31
|
openRouterRouting?: OpenAICompat["openRouterRouting"];
|
|
32
32
|
vercelGatewayRouting?: OpenAICompat["vercelGatewayRouting"];
|
|
33
33
|
extraBody?: OpenAICompat["extraBody"];
|
|
34
34
|
toolStrictMode: ResolvedToolStrictMode;
|
|
35
35
|
supportsResponsesSessionAffinity?: OpenAICompat["supportsResponsesSessionAffinity"];
|
|
36
36
|
supportsServiceTier?: OpenAICompat["supportsServiceTier"];
|
|
37
|
+
supportsUltrafastTier?: OpenAICompat["supportsUltrafastTier"];
|
|
37
38
|
/** Optional explicit capability override; resolved via deriveToolChoiceSupport. */
|
|
38
39
|
toolChoiceSupport?: OpenAICompat["toolChoiceSupport"];
|
|
39
40
|
};
|
|
@@ -51,6 +51,16 @@ export declare function isAnthropicThinkingBlockMutationError(error: unknown): b
|
|
|
51
51
|
* than only the latest one.
|
|
52
52
|
*/
|
|
53
53
|
export declare function isAnthropicThinkingSignatureInvalidError(error: unknown): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* 400 shape where Anthropic cannot decode one of the request's images:
|
|
56
|
+
* `{"type":"invalid_request_error","message":"Could not process image"}`.
|
|
57
|
+
* Observed for a truncated JPEG (no end-of-image marker) that local resizing
|
|
58
|
+
* also failed to decode and therefore forwarded unchanged. The body names no
|
|
59
|
+
* image, and the image stays in history, so without omission every later
|
|
60
|
+
* request of the session draws the same rejection.
|
|
61
|
+
*/
|
|
62
|
+
export declare function isAnthropicImageUnprocessableError(error: unknown): boolean;
|
|
63
|
+
export declare const ANTHROPIC_OMITTED_IMAGE_PLACEHOLDER = "[Image omitted: Anthropic could not process this image. The file may be corrupt or truncated; re-export or convert it before attaching it again.]";
|
|
54
64
|
/**
|
|
55
65
|
* CLIProxyAPI replaces Anthropic's rejection body wholesale instead of forwarding
|
|
56
66
|
* it: the client only ever sees
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FetchImpl } from "../types";
|
|
1
2
|
import type { AwsCredentials } from "./aws-sigv4";
|
|
2
3
|
export type AwsIniFile = Record<string, Record<string, string>>;
|
|
3
4
|
export interface AwsCredentialSourceOptions {
|
|
@@ -16,4 +17,8 @@ export declare function classifyAwsProfileCapability(profile: string, credential
|
|
|
16
17
|
export declare function hasResolvableAwsProfileSource(options?: AwsCredentialSourceOptions & {
|
|
17
18
|
onScan?: () => void;
|
|
18
19
|
}, now?: number): boolean;
|
|
20
|
+
/** Probe only the IMDSv2 token and role endpoints; never request role credentials for status. */
|
|
21
|
+
export declare function hasAwsInstanceProfileCredentialSource(options?: {
|
|
22
|
+
fetch?: FetchImpl;
|
|
23
|
+
}): Promise<boolean>;
|
|
19
24
|
export declare function isValidBedrockBearerToken(token: string | undefined): token is string;
|
|
@@ -14,8 +14,15 @@
|
|
|
14
14
|
* (default 60s). Concurrent callers waiting on a refresh share the same in-flight promise.
|
|
15
15
|
*/
|
|
16
16
|
import type { FetchImpl } from "../types";
|
|
17
|
+
export type VertexCredentialSource = "explicit-file" | "default-file" | "metadata-server";
|
|
18
|
+
/** Match the region-label constraint used before Vertex interpolates a location into the request host. */
|
|
19
|
+
export declare function isValidVertexLocation(location: string): boolean;
|
|
17
20
|
/** Test seam: the ADC credentials file path as resolved from trusted env. */
|
|
18
21
|
export declare function resolveAdcCredentialsPathForTest(): string | undefined;
|
|
22
|
+
/** Resolve the source of a currently usable ADC credential without acquiring an access token. */
|
|
23
|
+
export declare function getVertexCredentialSource(options?: {
|
|
24
|
+
fetch?: FetchImpl;
|
|
25
|
+
}): Promise<VertexCredentialSource | undefined>;
|
|
19
26
|
/**
|
|
20
27
|
* Returns a Bearer access token suitable for the `Authorization` header on Vertex AI calls.
|
|
21
28
|
* The token is cached in module scope and refreshed `GOOGLE_VERTEX_REFRESH_SKEW_MS` ms before it expires.
|
|
@@ -29,13 +29,18 @@ export declare const ANTIGRAVITY_SYSTEM_INSTRUCTION = "You are Antigravity, a po
|
|
|
29
29
|
/**
|
|
30
30
|
* Antigravity / Cloud Code Assist user agent.
|
|
31
31
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* Field-evidence-based default: A/B/A test on Windows+Ultra (subscriber) confirmed that
|
|
33
|
+
* 'antigravity/cli/1.3.4 (os_type=darwin; arch=arm64; aidev_client; auth_method=oauth)'
|
|
34
|
+
* unlocks Gemini 4 Argon (low/medium/high) and Gemini 3.8 Flash (low/medium/high) models,
|
|
35
|
+
* plus Opus 5.5. Reverting to 'antigravity-ide' hides Argon models again. Pro accounts
|
|
36
|
+
* receive 'gemini-4-argon-disabled' with disabled:true, confirming the UA gates model
|
|
37
|
+
* visibility by account tier. The darwin/arm64 values were tested on Windows and worked,
|
|
38
|
+
* suggesting this is not platform-specific but rather a client identity string.
|
|
34
39
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
40
|
+
* Historical note: Disassembly (0x5ecb1dd) showed the IDE binary loads 'antigravity-ide';
|
|
41
|
+
* this appears to be outdated or a fallback for older clients.
|
|
37
42
|
*
|
|
38
|
-
*
|
|
43
|
+
* Overridable via PI_AI_ANTIGRAVITY_USER_AGENT environment variable.
|
|
39
44
|
*/
|
|
40
45
|
export declare let getAntigravityUserAgent: () => string;
|
|
41
46
|
export declare const getAntigravityRequestHeaders: () => {
|
|
@@ -1707,7 +1707,8 @@ export declare const openaiChatRequestSchema: z.ZodObject<{
|
|
|
1707
1707
|
flex: "flex";
|
|
1708
1708
|
priority: "priority";
|
|
1709
1709
|
scale: "scale";
|
|
1710
|
-
|
|
1710
|
+
ultrafast: "ultrafast";
|
|
1711
|
+
}>>>, z.ZodTransform<NonNullable<"auto" | "default" | "flex" | "priority" | "scale" | "ultrafast"> | undefined, "auto" | "default" | "flex" | "priority" | "scale" | "ultrafast" | null | undefined>>;
|
|
1711
1712
|
metadata: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<Record<string, unknown> | undefined, Record<string, unknown> | null | undefined>>;
|
|
1712
1713
|
logprobs: z.ZodOptional<z.ZodUnknown>;
|
|
1713
1714
|
top_logprobs: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -33,7 +33,7 @@ export interface OpenAICompletionsOptions extends StreamOptions {
|
|
|
33
33
|
repetitionGuard?: RepetitionGuardOptions;
|
|
34
34
|
}
|
|
35
35
|
export declare const streamOpenAICompletions: StreamFunction<"openai-completions">;
|
|
36
|
-
export declare function parseChunkUsage(rawUsage: object, model: Model<"openai-completions">, premiumRequests: number | undefined): AssistantMessage["usage"];
|
|
36
|
+
export declare function parseChunkUsage(rawUsage: object, model: Model<"openai-completions">, premiumRequests: number | undefined, serviceTier?: ServiceTier): AssistantMessage["usage"];
|
|
37
37
|
export declare function convertMessages(model: Model<"openai-completions">, context: Context, compat: ResolvedOpenAICompat): ChatCompletionMessageParam[];
|
|
38
38
|
/**
|
|
39
39
|
* Detect compatibility settings from provider and baseUrl for known providers.
|
|
@@ -43,6 +43,7 @@ export declare function appendResponsesToolResultMessages<TApi extends Api>(mess
|
|
|
43
43
|
export interface ProcessResponsesStreamOptions {
|
|
44
44
|
onFirstToken?: () => void;
|
|
45
45
|
onOutputItemDone?: (item: ResponseOutputItem) => void;
|
|
46
|
+
serviceTier?: ServiceTier;
|
|
46
47
|
}
|
|
47
48
|
export declare function processResponsesStream<TApi extends Api>(openaiStream: AsyncIterable<OpenAI.Responses.ResponseStreamEvent>, output: AssistantMessage, stream: AssistantMessageEventStream, model: Model<TApi>, options?: ProcessResponsesStreamOptions): Promise<boolean>;
|
|
48
49
|
/**
|
|
@@ -99,7 +100,7 @@ type CommonSamplingOptions = Pick<StreamOptions, "temperature" | "topP" | "topK"
|
|
|
99
100
|
* Apply the common `StreamOptions` → Responses sampling-parameter mapping (max output tokens,
|
|
100
101
|
* temperature, top-p/k, min-p, presence/repetition penalties, service tier). Mutates `params`.
|
|
101
102
|
*/
|
|
102
|
-
export declare function applyCommonResponsesSamplingParams<P extends CommonResponsesParams>(params: P, options: CommonSamplingOptions | undefined, provider: string, supportsServiceTier?: boolean): void;
|
|
103
|
+
export declare function applyCommonResponsesSamplingParams<P extends CommonResponsesParams>(params: P, options: CommonSamplingOptions | undefined, provider: string, supportsServiceTier?: boolean, modelSupportsUltrafastTier?: boolean): void;
|
|
103
104
|
type ReasoningOptions = {
|
|
104
105
|
reasoning?: string;
|
|
105
106
|
reasoningSummary?: "auto" | "detailed" | "concise" | null;
|
package/dist/types/stream.d.ts
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import type { Effort } from "./model-thinking";
|
|
2
2
|
import type { AnthropicOptions } from "./providers/anthropic";
|
|
3
|
-
import type { Api, AssistantMessage, Context, Model, OptionsForApi, SimpleStreamOptions, ToolChoice } from "./types";
|
|
3
|
+
import type { Api, AssistantMessage, Context, FetchImpl, Model, OptionsForApi, SimpleStreamOptions, ToolChoice } from "./types";
|
|
4
4
|
import { AssistantMessageEventStream } from "./utils/event-stream";
|
|
5
|
+
export type EnvApiKeyCredentialSource = {
|
|
6
|
+
kind: "environment";
|
|
7
|
+
name: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: "google-adc";
|
|
10
|
+
source: "explicit-file" | "default-file" | "metadata-server";
|
|
11
|
+
} | {
|
|
12
|
+
kind: "aws";
|
|
13
|
+
source: "bearer-token" | "environment-credentials" | "profile" | "instance-profile";
|
|
14
|
+
} | {
|
|
15
|
+
kind: "unknown";
|
|
16
|
+
};
|
|
5
17
|
/**
|
|
6
18
|
* Get API key for provider from known environment variables, e.g. OPENAI_API_KEY.
|
|
7
19
|
*
|
|
@@ -9,6 +21,26 @@ import { AssistantMessageEventStream } from "./utils/event-stream";
|
|
|
9
21
|
* loaded into $env for app/tool execution, but must not silently fund GJC model requests.
|
|
10
22
|
*/
|
|
11
23
|
export declare function getEnvApiKey(provider: string): string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* List configured environment variable names consulted for a provider's
|
|
26
|
+
* environment credential. Values are never returned. This intentionally uses
|
|
27
|
+
* the same credential-only environment reader as {@link getEnvApiKey}.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getEnvApiKeyEnvNames(provider: string): string[];
|
|
30
|
+
/** Describe the selected source without exposing credential values or unvalidated ADC files. */
|
|
31
|
+
export declare function getEnvApiKeyCredentialSource(provider: string, options?: {
|
|
32
|
+
fetch?: FetchImpl;
|
|
33
|
+
}): Promise<EnvApiKeyCredentialSource | undefined>;
|
|
34
|
+
/** Enumerate usable credential candidates in provider dispatch precedence without exposing credentials. */
|
|
35
|
+
export declare function getEnvApiKeyCredentialSources(provider: string, options?: {
|
|
36
|
+
fetch?: FetchImpl;
|
|
37
|
+
}): Promise<EnvApiKeyCredentialSource[]>;
|
|
38
|
+
/** Resolve Vertex ADC provenance, including metadata-server credentials, without acquiring a token. */
|
|
39
|
+
export declare function getGoogleVertexCredentialSource(options?: {
|
|
40
|
+
fetch?: FetchImpl;
|
|
41
|
+
}): Promise<EnvApiKeyCredentialSource | undefined>;
|
|
42
|
+
/** Name of the environment variable whose value is selected by `getEnvApiKey`, when identifiable. */
|
|
43
|
+
export declare function getEnvApiKeyEnvName(provider: string): Promise<string | undefined>;
|
|
12
44
|
/**
|
|
13
45
|
* Enumerate every provider that has an env-var fallback for `getEnvApiKey`.
|
|
14
46
|
* Used by `gjc auth-broker migrate --include-env` to discover env-sourced keys
|