@openclaw/ai 2026.11.2 → 2026.11.4
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/README.md +9 -1
- package/dist/{anthropic-CUVqVXTe.mjs → anthropic-C8cQsW5d.mjs} +46 -26
- package/dist/{anthropic-payload-policy-rqCq9sT_.d.mts → anthropic-payload-policy-BCp4dUJR.d.mts} +2 -2
- package/dist/{anthropic-stream-reducer-yWDb5Cct.mjs → anthropic-stream-reducer-BgAICq34.mjs} +11 -10
- package/dist/{anthropic-tool-projection-DZOKfAmL.mjs → anthropic-tool-projection-CrsCkF4k.mjs} +1 -1
- package/dist/{anthropic-tool-projection-JTvMo4KG.d.mts → anthropic-tool-projection-CzSSQzZL.d.mts} +1 -1
- package/dist/{api-registry-gDt0faai.d.mts → api-registry-CkmxPPac.d.mts} +1 -1
- package/dist/{assistant-output-BnQm3fov.mjs → assistant-output-Hl3b-ViJ.mjs} +2 -2
- package/dist/{azure-openai-responses-I97-HnAv.mjs → azure-openai-responses-CZKrN3aq.mjs} +5 -5
- package/dist/diagnostics.d.mts +3 -3
- package/dist/{google-Cpi_cLKZ.mjs → google-DuI8TLy0.mjs} +2 -2
- package/dist/{google-interactions-BYRQ49MR.mjs → google-interactions-jbqgn8zL.mjs} +8 -8
- package/dist/{google-messages-DQMgG5yG.mjs → google-messages-BWhsZ167.mjs} +3 -3
- package/dist/{google-provider-stream-BHd0cST9.mjs → google-provider-stream-DL0bXgX5.mjs} +6 -6
- package/dist/{google-shared-vtag8bj5.mjs → google-shared-DXizMtnG.mjs} +5 -5
- package/dist/{google-vertex-eKoUnW7N.mjs → google-vertex-DnjRWo-M.mjs} +2 -2
- package/dist/{host-jJOffdlW.d.mts → host-B03VqZdH.d.mts} +2 -2
- package/dist/{host-CWt55nnF.mjs → host-CyGba3M8.mjs} +99 -80
- package/dist/{host-policy-Dm7PM6AD.mjs → host-policy-CNQztzZm.mjs} +1 -1
- package/dist/{index-DSprYWaz.d.mts → index-B8ODIVmA.d.mts} +15 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/internal/anthropic.d.mts +15 -5
- package/dist/internal/anthropic.mjs +6 -6
- package/dist/internal/openai-completions-compat.d.mts +1 -1
- package/dist/internal/openai-completions-compat.mjs +1 -1
- package/dist/internal/openai-responses-payload-policy.d.mts +2 -2
- package/dist/internal/openai-responses-payload-policy.mjs +1 -1
- package/dist/internal/openai.d.mts +8 -8
- package/dist/internal/openai.mjs +7 -7
- package/dist/internal/runtime.d.mts +6 -6
- package/dist/internal/runtime.mjs +4 -4
- package/dist/internal/shared.d.mts +3 -3
- package/dist/internal/shared.mjs +2 -2
- package/dist/internal/tool-schema.d.mts +2 -2
- package/dist/internal/tool-schema.mjs +3 -3
- package/dist/{mistral-CQ7aoWg2.mjs → mistral-BgamhpFG.mjs} +4 -4
- package/dist/openai-DAGvHDxa.mjs +20077 -0
- package/dist/{openai-chatgpt-responses-DgDVhpUI.mjs → openai-chatgpt-responses-CWIwGLDZ.mjs} +10 -10
- package/dist/{openai-completions-compat-bNQXF1y9.mjs → openai-completions-compat-D9KEUevM.mjs} +1 -1
- package/dist/{openai-completions-compat-CBvb2eld.d.mts → openai-completions-compat-DTe2EXPi.d.mts} +2 -2
- package/dist/{openai-completions-BdfBhFjx.mjs → openai-completions-kAWkz3bl.mjs} +4 -4
- package/dist/openai-completions-transport-bgZfY_xa.mjs +10881 -0
- package/dist/{openai-prompt-cache-B9AvdoEo.mjs → openai-prompt-cache-CAo-Mah6.mjs} +1 -1
- package/dist/{openai-prompt-cache-DgjD-UL5.d.mts → openai-prompt-cache-k7EPMLa0.d.mts} +1 -1
- package/dist/{openai-responses-compaction-replay-DUBbsfku.d.mts → openai-responses-compaction-replay-DOJaDCUl.d.mts} +3 -3
- package/dist/{openai-responses-contracts-gnl6ZRs1.d.mts → openai-responses-contracts-DHtim7d_.d.mts} +3 -3
- package/dist/{openai-responses-endpoint-CfKR6N5f.mjs → openai-responses-endpoint-DJwbSy3n.mjs} +3 -1
- package/dist/{openai-responses-payload-policy-BzM52TTH.d.mts → openai-responses-payload-policy-cIaYG5ZQ.d.mts} +1 -0
- package/dist/{openai-responses-request-lifecycle-WKXjj_th.mjs → openai-responses-request-lifecycle-CQBkk3bx.mjs} +6 -6
- package/dist/{openai-responses-shared-iWBHb0Sq.mjs → openai-responses-shared-C8C1myRt.mjs} +1092 -15
- package/dist/{openai-responses-terminal-usage-CpVjkqn-.d.mts → openai-responses-terminal-usage-BDGDBGuA.d.mts} +1 -1
- package/dist/{openai-responses-5KI4v8DN.mjs → openai-responses-wWDdPeKC.mjs} +7 -7
- package/dist/{openai-tool-schema-BTEU2xmN.mjs → openai-tool-schema-D913am3I.mjs} +3 -2
- package/dist/openai.LICENSE +201 -0
- package/dist/{provider-options-Bo8GzTGX.d.mts → provider-options-DFjnfImJ.d.mts} +8 -2
- package/dist/{provider-replay-context-4vxI7p4V.mjs → provider-replay-context-BWgW0iTm.mjs} +1 -1
- package/dist/{provider-transport-turn-state-BbaD56A1.mjs → provider-transport-turn-state-CxXS1_Cv.mjs} +3 -3
- package/dist/{provider-types-CWl4VXvE.d.mts → provider-types-C-67EZr8.d.mts} +2 -2
- package/dist/provider-types.d.mts +3 -3
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +10 -10
- package/dist/{reasoning-tag-text-partitioner-DzlRubwU.mjs → reasoning-tag-text-partitioner-CU9A4Lg8.mjs} +2 -13
- package/dist/rolldown-runtime-B4iAMlE-.mjs +35 -0
- package/dist/{sanitize-unicode-ZqVLLEKC.d.mts → sanitize-unicode-CkejzD2f.d.mts} +1 -1
- package/dist/{simple-options-xJkqrG_E.mjs → simple-options-Bd0STwu7.mjs} +2 -2
- package/dist/{src-CyA0zJnt.mjs → src--qsViR3j.mjs} +60 -12
- package/dist/{stream-C4YDqhFj.mjs → stream-BRecd0FZ.mjs} +1 -1
- package/dist/{tool-schema-json-projection-B1sTYwfH.mjs → tool-schema-json-projection-DU-FFSa7.mjs} +1 -1
- package/dist/{transport-stream-shared-lhgkTOz3.mjs → transport-stream-shared-C1AtJhZA.mjs} +1 -1
- package/dist/{transport-stream-shared-8ru8eX4s.d.mts → transport-stream-shared-Dhx_37f1.d.mts} +1 -1
- package/dist/{transport-utils-DwOpuTjL.mjs → transport-utils-4xPfuKp2.mjs} +2 -2
- package/dist/transports.d.mts +13 -13
- package/dist/transports.mjs +61 -41
- package/dist/types-BFfXm_Jr.d.mts +1 -0
- package/dist/types.d.mts +3 -3
- package/dist/types.mjs +2 -2
- package/dist/ws.LICENSE +20 -0
- package/package.json +1 -1
- package/dist/openai-completions-transport-CnFaKYO-.mjs +0 -3425
- package/dist/types-CBJthzJX.d.mts +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $ as StopReason, a as AssistantMessage, pt as Usage } from "./types-CVYzKrMl.mjs";
|
|
2
|
-
import "./types-
|
|
2
|
+
import "./types-BFfXm_Jr.mjs";
|
|
3
3
|
import OpenAI from "openai";
|
|
4
4
|
//#region packages/ai/src/providers/openai-responses-terminal-usage.d.ts
|
|
5
5
|
/** A known output ceiling can resume sampling after admitted tools have settled. */
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { n as __exportAll } from "./
|
|
1
|
+
import { n as __exportAll } from "./rolldown-runtime-B4iAMlE-.mjs";
|
|
2
2
|
import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
3
|
-
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-
|
|
4
|
-
import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat-
|
|
3
|
+
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-CAo-Mah6.mjs";
|
|
4
|
+
import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat-D9KEUevM.mjs";
|
|
5
5
|
import { i as resolveCacheRetention, r as buildCopilotDynamicHeaders } from "./cloudflare-Dttf8jKq.mjs";
|
|
6
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
6
|
+
import { n as buildBaseOptions } from "./simple-options-Bd0STwu7.mjs";
|
|
7
7
|
import { n as getEnvApiKey } from "./env-api-keys-Xd8dm_aV.mjs";
|
|
8
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
9
|
-
import { F as convertProviderResponsesMessages, n as applyResponsesServiceTierPricing, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams, vt as resolveOpenAISimpleReasoningEffort } from "./openai-responses-shared-
|
|
10
|
-
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-
|
|
8
|
+
import { t as createAssistantOutput } from "./assistant-output-Hl3b-ViJ.mjs";
|
|
9
|
+
import { F as convertProviderResponsesMessages, n as applyResponsesServiceTierPricing, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams, vt as resolveOpenAISimpleReasoningEffort } from "./openai-responses-shared-C8C1myRt.mjs";
|
|
10
|
+
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-CxXS1_Cv.mjs";
|
|
11
11
|
import { t as requireApiKey } from "./required-api-key-D088S4Cd.mjs";
|
|
12
12
|
//#region packages/ai/src/providers/openai-responses.ts
|
|
13
13
|
var openai_responses_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -2,7 +2,7 @@ import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
|
2
2
|
import { r as parseLocalSchemaRefPointer } from "./validation-9FSkE8T-.mjs";
|
|
3
3
|
import { r as normalizeLowercaseStringOrEmpty } from "./string-coerce-Cj8sqWHx.mjs";
|
|
4
4
|
import { M as normalizeStringEntries, N as uniqueValues } from "./openai-responses-contracts-B5mGAbR6.mjs";
|
|
5
|
-
import { S as walkSchemaValue, _ as SCHEMA_MAP_KEYS, a as SCHEMA_LITERAL_KEYS, b as evaluateSchemaWalk, c as inlineLocalToolSchemaRefs, d as inheritToolSchemaTruncation, f as reportToolSchemaTruncation, g as SCHEMA_ARRAY_KEYS, h as wasToolSchemaTruncated, i as publishRuntimeToolInputSchema, l as setOwnSchemaProperty, m as truncateToolSchemaDepth, o as canPreserveRootSchemaRefs, s as copySchemaMeta$1, t as getPublishedRuntimeToolInputSchema, v as SCHEMA_NESTED_KEYS, x as walkSchemaArray, y as SCHEMA_OBJECT_KEYS } from "./tool-schema-json-projection-
|
|
5
|
+
import { S as walkSchemaValue, _ as SCHEMA_MAP_KEYS, a as SCHEMA_LITERAL_KEYS, b as evaluateSchemaWalk, c as inlineLocalToolSchemaRefs, d as inheritToolSchemaTruncation, f as reportToolSchemaTruncation, g as SCHEMA_ARRAY_KEYS, h as wasToolSchemaTruncated, i as publishRuntimeToolInputSchema, l as setOwnSchemaProperty, m as truncateToolSchemaDepth, o as canPreserveRootSchemaRefs, s as copySchemaMeta$1, t as getPublishedRuntimeToolInputSchema, v as SCHEMA_NESTED_KEYS, x as walkSchemaArray, y as SCHEMA_OBJECT_KEYS } from "./tool-schema-json-projection-DU-FFSa7.mjs";
|
|
6
6
|
//#region packages/ai/src/providers/openai-function-tool.ts
|
|
7
7
|
const preparedTools = /* @__PURE__ */ new WeakMap();
|
|
8
8
|
const MAX_DESCRIPTOR_VARIANTS = 8;
|
|
@@ -200,7 +200,8 @@ function* cleanSchemaForGeminiWithDefs(schema, defs, refStack, ancestors, budget
|
|
|
200
200
|
for (const [key, value] of Object.entries(obj)) {
|
|
201
201
|
if (GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS.has(key)) continue;
|
|
202
202
|
if (key === "const" || key === "enum") {
|
|
203
|
-
const
|
|
203
|
+
const type = Array.isArray(obj.type) && obj.type.every((entry) => typeof entry === "string") ? obj.type.find((entry) => entry !== "null") : obj.type;
|
|
204
|
+
const enumValues = type === void 0 || type === "string" ? cleanGeminiEnumValues(key === "const" ? [value] : value) : void 0;
|
|
204
205
|
if (enumValues) cleaned.enum = enumValues;
|
|
205
206
|
continue;
|
|
206
207
|
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 OpenAI
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { nt as StreamOptions } from "./types-CVYzKrMl.mjs";
|
|
2
|
-
import "./types-
|
|
3
|
-
import OpenAI from "openai";
|
|
2
|
+
import "./types-BFfXm_Jr.mjs";
|
|
4
3
|
import Anthropic from "@anthropic-ai/sdk";
|
|
4
|
+
import OpenAI from "openai";
|
|
5
5
|
import { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
|
|
6
6
|
//#region packages/ai/src/providers/openai-reasoning-effort.d.ts
|
|
7
7
|
declare const ENABLED_REASONING_EFFORTS: readonly ["minimal", "low", "medium", "high", "xhigh", "max"];
|
|
@@ -132,6 +132,12 @@ type AnthropicContextManagementOptions = {
|
|
|
132
132
|
};
|
|
133
133
|
/** Provider options shared by the Anthropic provider and canonical transport. */
|
|
134
134
|
interface AnthropicOptions extends StreamOptions, AnthropicContextManagementOptions {
|
|
135
|
+
/**
|
|
136
|
+
* Called when Anthropic rejected an OAuth request with claude_code_version_too_old
|
|
137
|
+
* and the transport adopted the version it named. Owners persist it so the next
|
|
138
|
+
* process starts at that version instead of being rejected again.
|
|
139
|
+
*/
|
|
140
|
+
onClaudeCodeVersionRequired?: (version: string) => void;
|
|
135
141
|
/**
|
|
136
142
|
* Enable extended thinking.
|
|
137
143
|
* For Opus 4.6+ and Sonnet 4.6: uses adaptive thinking (model decides when/how much to think).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
2
|
-
import { A as shortHash } from "./transport-stream-shared-
|
|
2
|
+
import { A as shortHash } from "./transport-stream-shared-C1AtJhZA.mjs";
|
|
3
3
|
//#region packages/ai/src/transports/provider-replay-context.ts
|
|
4
4
|
function isProviderReplayContext(value) {
|
|
5
5
|
return isRecord(value) && typeof value.provider === "string" && typeof value.api === "string" && typeof value.model === "string" && (value.baseUrlHash === void 0 || typeof value.baseUrlHash === "string") && (value.sessionHash === void 0 || typeof value.sessionHash === "string") && (value.authProfileHash === void 0 || typeof value.authProfileHash === "string");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as getAiTransportHost } from "./host-
|
|
1
|
+
import { r as getAiTransportHost } from "./host-CyGba3M8.mjs";
|
|
2
2
|
import { n as resolveCloudflareBaseUrl, t as isCloudflareProvider } from "./cloudflare-Dttf8jKq.mjs";
|
|
3
3
|
import { n as resolveOpencodeSessionHeaders, t as hasOpencodeSessionHeader } from "./session-affinity-DA4WHv1h.mjs";
|
|
4
|
-
import { It as resolveOpenAIClientBaseUrl, Rt as withOpenAIErrorResponseHook } from "./openai-responses-shared-
|
|
4
|
+
import { It as resolveOpenAIClientBaseUrl, Rt as withOpenAIErrorResponseHook } from "./openai-responses-shared-C8C1myRt.mjs";
|
|
5
|
+
import { n as OpenAI } from "./openai-DAGvHDxa.mjs";
|
|
5
6
|
import { randomUUID } from "node:crypto";
|
|
6
|
-
import OpenAI from "openai";
|
|
7
7
|
//#region packages/ai/src/providers/openai-provider-client.ts
|
|
8
8
|
function createOpenAIProviderClient(model, apiKey, headers, optionsHeaders, onResponse) {
|
|
9
9
|
if (optionsHeaders) Object.assign(headers, optionsHeaders);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as index_d_exports } from "./index-
|
|
1
|
+
import { t as index_d_exports } from "./index-B8ODIVmA.mjs";
|
|
2
2
|
import { a as AssistantMessage, d as Context, dt as ToolResultMessage, k as Model, mt as UserMessage, n as Api, nt as StreamOptions, p as ImageContent, rt as TextContent, s as AssistantMessageEventStreamContract } from "./types-CVYzKrMl.mjs";
|
|
3
|
-
import "./types-
|
|
3
|
+
import "./types-BFfXm_Jr.mjs";
|
|
4
4
|
//#region packages/ai/src/provider-types.d.ts
|
|
5
5
|
declare const PROVIDER_CONTEXT_HANDOFF: unique symbol;
|
|
6
6
|
declare const PROVIDER_MODEL_INPUT: unique symbol;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as supportsClaudeAdaptiveThinking, C as resolveClaudeMythos5ModelIdentity, D as resolveClaudeSonnet55ModelIdentity, E as resolveClaudeOpus5ModelIdentity, F as supportsClaudeServerCompaction, I as usesClaude5RequestContract, M as supportsClaudeInHistorySystemMessages, N as supportsClaudeNativeMaxEffort, O as resolveClaudeSonnet5ModelIdentity, P as supportsClaudeNativeXhighEffort, S as resolveClaudeModelIdentity, T as resolveClaudeOpus55ModelIdentity, _ as requiresClaudeBetweenToolsThinking, a as normalizeResolvedPricing, b as resolveClaudeFable5ModelIdentity, c as CLAUDE_FABLE_5_THINKING_PROFILE, d as CLAUDE_OPUS_5_THINKING_PROFILE, f as CLAUDE_SONNET_55_THINKING_PROFILE, g as rejectsClaudeAssistantPrefill, h as isReleasedAdaptiveClaudeGeneration, i as normalizeModelCostConfig, j as supportsClaudeFastMode, k as supportsClaude1MContext, l as CLAUDE_HAIKU_55_THINKING_PROFILE, m as bindsClaudeThinkingPrefix, n as appendTextDeltaToAssistantMessage, o as ProviderRefusalReview, p as CLAUDE_SONNET_5_THINKING_PROFILE, r as calculateUsageCost, s as readProviderRefusalReview, u as CLAUDE_OPUS_55_THINKING_PROFILE, v as requiresClaudeDefaultSampling, w as resolveClaudeNativeThinkingLevelMap, x as resolveClaudeHaiku55ModelIdentity, y as requiresClaudeMandatoryAdaptiveThinking } from "./index-B8ODIVmA.mjs";
|
|
2
2
|
import { $ as StopReason, A as ModelCostConfig, At as extractDiagnosticError, B as ProviderImagesOptions, C as KnownApi, Ct as readRuntimeContextMetadata, D as MaybePromise, Dt as DiagnosticErrorInfo, E as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, Et as AssistantMessageDiagnostic, F as OpenRouterRouting, G as RUNTIME_CONTEXT_CUSTOM_TYPE, H as ProviderResponse, I as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, J as RUNTIME_CONTEXT_HEADER, K as RUNTIME_CONTEXT_END_MARKER, L as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, M as ModelThinkingLevel, Mt as isProviderRefusalAssistantError, N as OpenAICompletionsCompat, Ot as appendAssistantMessageDiagnostic, P as OpenAIResponsesCompat, Q as SimpleStreamOptions, R as PricingTier, S as ImagesStopReason, St as labelRuntimeContextText, T as KnownImagesProvider, Tt as setRuntimeContextRetention, V as ProviderReplayState, W as RUNTIME_CONTEXT_BEGIN_MARKER, X as RawPricingTier, Y as RawModelCostConfig, Z as RuntimeContextMessage, _ as ImagesInputContent, _t as escapeRuntimeContextFooter, a as AssistantMessage, at as ThinkingBudgets, b as ImagesOutputContent, bt as isRuntimeContextMessage, c as AssistantMessageEventStreamLike, ct as ThinkingLevelMap, dt as ToolResultMessage, et as StreamFn, f as DEFAULT_MISSING_TOOL_RESULT_TEXT, ft as Transport, g as ImagesFunction, gt as VercelGatewayRouting, h as ImagesContext, ht as ValidateToolArgumentsFn, i as AssistantImages, it as TextSignatureV1, j as ModelCostRates, jt as formatThrownValue, kt as createAssistantMessageDiagnostic, l as CacheRetention, lt as Tool, m as ImagesApi, mt as UserMessage, n as Api, nt as StreamOptions, o as AssistantMessageEvent, ot as ThinkingContent, p as ImageContent, pt as Usage, q as RUNTIME_CONTEXT_FOOTER, r as AssistantDeliveryTtsFacts, rt as TextContent, s as AssistantMessageEventStreamContract, st as ThinkingLevel, t as AnthropicMessagesCompat, u as CompleteSimpleFn, ut as ToolCall, v as ImagesModel, vt as hasLegacyRuntimeContextEnvelope, w as KnownImagesApi, wt as runtimeContextContentToText, x as ImagesProvider, xt as labelRuntimeContextContent, y as ImagesOptions, yt as hasRuntimeContextMarker, z as Provider } from "./types-CVYzKrMl.mjs";
|
|
3
3
|
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-CzpE1g_o.mjs";
|
|
4
4
|
import { n as validateToolCall, t as validateToolArguments } from "./validation-BQ5u20Ru.mjs";
|
|
5
|
-
import { a as ProviderContext, c as ProviderModel, d as ProviderUserMessage, f as VideoContent, i as PROVIDER_MODEL_INPUT, l as ProviderStreamFunction, n as ModelInputContent, o as ProviderContextHandoff, p as resolveProviderContext, r as PROVIDER_CONTEXT_HANDOFF, s as ProviderMessage, t as MediaContent, u as ProviderStreamOptions } from "./provider-types-
|
|
6
|
-
export { type AnthropicMessagesCompat, type Api, type AssistantDeliveryTtsFacts, type AssistantImages, type AssistantMessage, type AssistantMessageDiagnostic, type AssistantMessageEvent, type AssistantMessageEventStream, type AssistantMessageEventStreamContract, type AssistantMessageEventStreamLike, type CLAUDE_FABLE_5_THINKING_PROFILE, type CLAUDE_HAIKU_55_THINKING_PROFILE, type CLAUDE_OPUS_55_THINKING_PROFILE, type CLAUDE_OPUS_5_THINKING_PROFILE, type CLAUDE_SONNET_55_THINKING_PROFILE, type CLAUDE_SONNET_5_THINKING_PROFILE, type CacheRetention, type CompleteSimpleFn, type ProviderContext as Context, ProviderContext, type DEFAULT_MISSING_TOOL_RESULT_TEXT, type DiagnosticErrorInfo, type EventStream, type ImageContent, type ImagesApi, type ImagesContext, type ImagesFunction, type ImagesInputContent, type ImagesModel, type ImagesOptions, type ImagesOutputContent, type ImagesProvider, type ImagesStopReason, type KnownApi, type KnownImagesApi, type KnownImagesProvider, type MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, type MaybePromise, MediaContent, type ProviderMessage as Message, ProviderMessage, type ProviderModel as Model, ProviderModel, type ModelCostConfig, type ModelCostRates, ModelInputContent, type ModelThinkingLevel, type OpenAICompletionsCompat, type OpenAIResponsesCompat, type OpenRouterRouting, PROVIDER_CONTEXT_HANDOFF, type PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_MODEL_INPUT, type PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, type PricingTier, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderRefusalReview, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type RUNTIME_CONTEXT_BEGIN_MARKER, type RUNTIME_CONTEXT_CUSTOM_TYPE, type RUNTIME_CONTEXT_END_MARKER, type RUNTIME_CONTEXT_FOOTER, type RUNTIME_CONTEXT_HEADER, type RawModelCostConfig, type RawPricingTier, type RuntimeContextMessage, type SimpleStreamOptions, type StopReason, type StreamFn, type StreamOptions, type TextContent, type TextSignatureV1, type ThinkingBudgets, type ThinkingContent, type ThinkingLevel, type ThinkingLevelMap, type Tool, type ToolCall, type ToolResultMessage, type Transport, type Usage, type UserMessage, type ValidateToolArgumentsFn, type VercelGatewayRouting, VideoContent, type appendAssistantMessageDiagnostic, type appendTextDeltaToAssistantMessage, type bindsClaudeThinkingPrefix, type calculateUsageCost, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type escapeRuntimeContextFooter, type extractDiagnosticError, type formatThrownValue, type hasLegacyRuntimeContextEnvelope, type hasRuntimeContextMarker, type isProviderRefusalAssistantError, type isRuntimeContextMessage, type labelRuntimeContextContent, type labelRuntimeContextText, type normalizeModelCostConfig, type normalizeResolvedPricing, type readProviderRefusalReview, type readRuntimeContextMetadata, type requiresClaudeBetweenToolsThinking, type requiresClaudeDefaultSampling, type requiresClaudeMandatoryAdaptiveThinking, type resolveClaudeFable5ModelIdentity, type resolveClaudeHaiku55ModelIdentity, type resolveClaudeModelIdentity, type resolveClaudeMythos5ModelIdentity, type resolveClaudeNativeThinkingLevelMap, type resolveClaudeOpus55ModelIdentity, type resolveClaudeOpus5ModelIdentity, type resolveClaudeSonnet55ModelIdentity, type resolveClaudeSonnet5ModelIdentity, resolveProviderContext, type runtimeContextContentToText, type setRuntimeContextRetention, type supportsClaude1MContext, type supportsClaudeAdaptiveThinking, type supportsClaudeFastMode, type supportsClaudeInHistorySystemMessages, type supportsClaudeNativeMaxEffort, type supportsClaudeNativeXhighEffort, type supportsClaudeServerCompaction, type validateToolArguments, type validateToolCall };
|
|
5
|
+
import { a as ProviderContext, c as ProviderModel, d as ProviderUserMessage, f as VideoContent, i as PROVIDER_MODEL_INPUT, l as ProviderStreamFunction, n as ModelInputContent, o as ProviderContextHandoff, p as resolveProviderContext, r as PROVIDER_CONTEXT_HANDOFF, s as ProviderMessage, t as MediaContent, u as ProviderStreamOptions } from "./provider-types-C-67EZr8.mjs";
|
|
6
|
+
export { type AnthropicMessagesCompat, type Api, type AssistantDeliveryTtsFacts, type AssistantImages, type AssistantMessage, type AssistantMessageDiagnostic, type AssistantMessageEvent, type AssistantMessageEventStream, type AssistantMessageEventStreamContract, type AssistantMessageEventStreamLike, type CLAUDE_FABLE_5_THINKING_PROFILE, type CLAUDE_HAIKU_55_THINKING_PROFILE, type CLAUDE_OPUS_55_THINKING_PROFILE, type CLAUDE_OPUS_5_THINKING_PROFILE, type CLAUDE_SONNET_55_THINKING_PROFILE, type CLAUDE_SONNET_5_THINKING_PROFILE, type CacheRetention, type CompleteSimpleFn, type ProviderContext as Context, ProviderContext, type DEFAULT_MISSING_TOOL_RESULT_TEXT, type DiagnosticErrorInfo, type EventStream, type ImageContent, type ImagesApi, type ImagesContext, type ImagesFunction, type ImagesInputContent, type ImagesModel, type ImagesOptions, type ImagesOutputContent, type ImagesProvider, type ImagesStopReason, type KnownApi, type KnownImagesApi, type KnownImagesProvider, type MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, type MaybePromise, MediaContent, type ProviderMessage as Message, ProviderMessage, type ProviderModel as Model, ProviderModel, type ModelCostConfig, type ModelCostRates, ModelInputContent, type ModelThinkingLevel, type OpenAICompletionsCompat, type OpenAIResponsesCompat, type OpenRouterRouting, PROVIDER_CONTEXT_HANDOFF, type PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_MODEL_INPUT, type PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, type PricingTier, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderRefusalReview, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type RUNTIME_CONTEXT_BEGIN_MARKER, type RUNTIME_CONTEXT_CUSTOM_TYPE, type RUNTIME_CONTEXT_END_MARKER, type RUNTIME_CONTEXT_FOOTER, type RUNTIME_CONTEXT_HEADER, type RawModelCostConfig, type RawPricingTier, type RuntimeContextMessage, type SimpleStreamOptions, type StopReason, type StreamFn, type StreamOptions, type TextContent, type TextSignatureV1, type ThinkingBudgets, type ThinkingContent, type ThinkingLevel, type ThinkingLevelMap, type Tool, type ToolCall, type ToolResultMessage, type Transport, type Usage, type UserMessage, type ValidateToolArgumentsFn, type VercelGatewayRouting, VideoContent, type appendAssistantMessageDiagnostic, type appendTextDeltaToAssistantMessage, type bindsClaudeThinkingPrefix, type calculateUsageCost, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type escapeRuntimeContextFooter, type extractDiagnosticError, type formatThrownValue, type hasLegacyRuntimeContextEnvelope, type hasRuntimeContextMarker, type isProviderRefusalAssistantError, type isReleasedAdaptiveClaudeGeneration, type isRuntimeContextMessage, type labelRuntimeContextContent, type labelRuntimeContextText, type normalizeModelCostConfig, type normalizeResolvedPricing, type readProviderRefusalReview, type readRuntimeContextMetadata, type rejectsClaudeAssistantPrefill, type requiresClaudeBetweenToolsThinking, type requiresClaudeDefaultSampling, type requiresClaudeMandatoryAdaptiveThinking, type resolveClaudeFable5ModelIdentity, type resolveClaudeHaiku55ModelIdentity, type resolveClaudeModelIdentity, type resolveClaudeMythos5ModelIdentity, type resolveClaudeNativeThinkingLevelMap, type resolveClaudeOpus55ModelIdentity, type resolveClaudeOpus5ModelIdentity, type resolveClaudeSonnet55ModelIdentity, type resolveClaudeSonnet5ModelIdentity, resolveProviderContext, type runtimeContextContentToText, type setRuntimeContextRetention, type supportsClaude1MContext, type supportsClaudeAdaptiveThinking, type supportsClaudeFastMode, type supportsClaudeInHistorySystemMessages, type supportsClaudeNativeMaxEffort, type supportsClaudeNativeXhighEffort, type supportsClaudeServerCompaction, type usesClaude5RequestContract, type validateToolArguments, type validateToolCall };
|
package/dist/providers.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as ApiRegistry } from "./api-registry-
|
|
2
|
-
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-
|
|
1
|
+
import { n as ApiRegistry } from "./api-registry-CkmxPPac.mjs";
|
|
2
|
+
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-k7EPMLa0.mjs";
|
|
3
3
|
//#region packages/ai/src/providers/register-builtins.d.ts
|
|
4
4
|
/** Source id used for built-in API provider registrations. */
|
|
5
5
|
export declare const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
|
package/dist/providers.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
2
2
|
import { n as projectProviderError } from "./provider-error-qtZD2inE.mjs";
|
|
3
|
-
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-
|
|
3
|
+
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-CAo-Mah6.mjs";
|
|
4
4
|
import { t as createZeroUsage } from "./usage-CJH5D6Ea.mjs";
|
|
5
5
|
//#region packages/ai/src/providers/register-builtins.ts
|
|
6
6
|
/** Source id used for built-in API provider registrations. */
|
|
@@ -50,39 +50,39 @@ function createLazyRegistration(api, importModule, select) {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
const registerBuiltIns = [
|
|
53
|
-
createLazyRegistration("anthropic-messages", () => import("./anthropic-
|
|
53
|
+
createLazyRegistration("anthropic-messages", () => import("./anthropic-C8cQsW5d.mjs").then((n) => n.t), (module) => ({
|
|
54
54
|
stream: module.streamAnthropic,
|
|
55
55
|
streamSimple: module.streamSimpleAnthropic
|
|
56
56
|
})),
|
|
57
|
-
createLazyRegistration("openai-completions", () => import("./openai-completions-
|
|
57
|
+
createLazyRegistration("openai-completions", () => import("./openai-completions-kAWkz3bl.mjs").then((n) => n.t), (module) => ({
|
|
58
58
|
stream: module.streamOpenAICompletions,
|
|
59
59
|
streamSimple: module.streamSimpleOpenAICompletions
|
|
60
60
|
})),
|
|
61
|
-
createLazyRegistration("mistral-conversations", () => import("./mistral-
|
|
61
|
+
createLazyRegistration("mistral-conversations", () => import("./mistral-BgamhpFG.mjs"), (module) => ({
|
|
62
62
|
stream: module.streamMistral,
|
|
63
63
|
streamSimple: module.streamSimpleMistral
|
|
64
64
|
})),
|
|
65
|
-
createLazyRegistration("openai-responses", () => import("./openai-responses-
|
|
65
|
+
createLazyRegistration("openai-responses", () => import("./openai-responses-wWDdPeKC.mjs").then((n) => n.t), (module) => ({
|
|
66
66
|
stream: module.streamOpenAIResponses,
|
|
67
67
|
streamSimple: module.streamSimpleOpenAIResponses
|
|
68
68
|
})),
|
|
69
|
-
createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-
|
|
69
|
+
createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-CZKrN3aq.mjs"), (module) => ({
|
|
70
70
|
stream: module.streamAzureOpenAIResponses,
|
|
71
71
|
streamSimple: module.streamSimpleAzureOpenAIResponses
|
|
72
72
|
})),
|
|
73
|
-
createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-
|
|
73
|
+
createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-CWIwGLDZ.mjs"), (module) => ({
|
|
74
74
|
stream: module.streamOpenAICodexResponses,
|
|
75
75
|
streamSimple: module.streamSimpleOpenAICodexResponses
|
|
76
76
|
})),
|
|
77
|
-
createLazyRegistration("google-generative-ai", () => import("./google-
|
|
77
|
+
createLazyRegistration("google-generative-ai", () => import("./google-DuI8TLy0.mjs"), (module) => ({
|
|
78
78
|
stream: module.streamGoogle,
|
|
79
79
|
streamSimple: module.streamSimpleGoogle
|
|
80
80
|
})),
|
|
81
|
-
createLazyRegistration("google-interactions", () => import("./google-interactions-
|
|
81
|
+
createLazyRegistration("google-interactions", () => import("./google-interactions-jbqgn8zL.mjs"), (module) => ({
|
|
82
82
|
stream: module.streamGoogleInteractions,
|
|
83
83
|
streamSimple: module.streamSimpleGoogleInteractions
|
|
84
84
|
})),
|
|
85
|
-
createLazyRegistration("google-vertex", () => import("./google-vertex-
|
|
85
|
+
createLazyRegistration("google-vertex", () => import("./google-vertex-DnjRWo-M.mjs"), (module) => ({
|
|
86
86
|
stream: module.streamGoogleVertex,
|
|
87
87
|
streamSimple: module.streamSimpleGoogleVertex
|
|
88
88
|
}))
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
+
import { n as __exportAll } from "./rolldown-runtime-B4iAMlE-.mjs";
|
|
1
2
|
import { l as expectDefined } from "./provider-error-qtZD2inE.mjs";
|
|
2
|
-
//#region \0rolldown/runtime.js
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __exportAll = (all, no_symbols) => {
|
|
5
|
-
let target = {};
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
11
|
-
return target;
|
|
12
|
-
};
|
|
13
|
-
//#endregion
|
|
14
3
|
//#region node_modules/.pnpm/mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/lib/index.js
|
|
15
4
|
/**
|
|
16
5
|
* @typedef {import('mdast').Nodes} Nodes
|
|
@@ -12594,4 +12583,4 @@ function createReasoningTagTextPartitioner() {
|
|
|
12594
12583
|
};
|
|
12595
12584
|
}
|
|
12596
12585
|
//#endregion
|
|
12597
|
-
export {
|
|
12586
|
+
export { createReasoningTagTextPartitioner as t };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
|
+
var __exportAll = (all, no_symbols) => {
|
|
11
|
+
let target = {};
|
|
12
|
+
for (var name in all) __defProp(target, name, {
|
|
13
|
+
get: all[name],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
19
|
+
var __copyProps = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
21
|
+
key = keys[i];
|
|
22
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
23
|
+
get: ((k) => from[k]).bind(null, key),
|
|
24
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
34
|
+
//#endregion
|
|
35
|
+
export { __toESM as i, __exportAll as n, __require as r, __commonJSMin as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { F as hasMediaPayload } from "./host-CyGba3M8.mjs";
|
|
3
3
|
import { _ as responsesServiceTierObserver } from "./openai-responses-contracts-B5mGAbR6.mjs";
|
|
4
4
|
import { s as truncateUtf16Safe } from "./provider-error-qtZD2inE.mjs";
|
|
5
5
|
import { t as sanitizeSurrogates } from "./sanitize-unicode-CRGuMONI.mjs";
|
|
6
6
|
import { n as normalizeStructuredPromptSection } from "./prompt-cache-stability-D_MeCQFI.mjs";
|
|
7
|
-
import { i as copyProviderAcceptanceObserver } from "./transport-stream-shared-
|
|
7
|
+
import { i as copyProviderAcceptanceObserver } from "./transport-stream-shared-C1AtJhZA.mjs";
|
|
8
8
|
//#region packages/ai/src/utils/system-prompt-cache-boundary.ts
|
|
9
9
|
const SYSTEM_PROMPT_CACHE_BOUNDARY = "\n<!-- OPENCLAW_CACHE_BOUNDARY -->\n";
|
|
10
10
|
/** Producer-delimited Runtime facts; instructions must remain outside this region. */
|
|
@@ -76,11 +76,51 @@ function resolveClaudeMythos5ModelIdentity(ref) {
|
|
|
76
76
|
return matchClaudeModelIdentity(resolveClaudeModelIdentity(ref), /(?:^|-)claude-mythos-5(?=$|[^a-z0-9])/);
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
79
|
+
* Canonical Claude id for contract checks, with bare family aliases expanded.
|
|
80
|
+
* Undefined for ids that do not name a Claude model.
|
|
81
|
+
*/
|
|
82
|
+
function resolveClaudeContractId(ref) {
|
|
83
|
+
const identity = resolveClaudeModelIdentity(ref);
|
|
84
|
+
if (identity.startsWith("claude-")) return identity;
|
|
85
|
+
return resolveClaudeOpus5ModelIdentity(ref) ?? resolveClaudeSonnet5ModelIdentity(ref) ?? resolveClaudeHaiku55ModelIdentity(ref);
|
|
86
|
+
}
|
|
87
|
+
function release(...ids) {
|
|
88
|
+
return String.raw`(?:${ids.join("|")})(?!-\d(?!\d))`;
|
|
89
|
+
}
|
|
90
|
+
function releases(...patterns) {
|
|
91
|
+
return new RegExp(String.raw`(?:^|-)(?:${patterns.join("|")})(?=$|[^a-z0-9])`);
|
|
92
|
+
}
|
|
93
|
+
const PRE_CLAUDE_5 = String.raw`claude-(?:3|(?:opus|sonnet|haiku)-4)`;
|
|
94
|
+
/** Generations whose thinking survives edits to earlier turns (no prefix check). */
|
|
95
|
+
const CLAUDE_UNBOUND_THINKING = releases(PRE_CLAUDE_5, release("claude-opus-5", "claude-sonnet-5", "claude-fable-5", "claude-mythos-5"), release("claude-mythos-preview"));
|
|
96
|
+
/** Generations that can run with thinking off (disabled or between-tools). */
|
|
97
|
+
const CLAUDE_OPTIONAL_THINKING = releases(PRE_CLAUDE_5, release("claude-opus-5", "claude-sonnet-5", "claude-sonnet-5-5", "claude-haiku-5-5"));
|
|
98
|
+
/** Generations that predate adaptive thinking. */
|
|
99
|
+
const CLAUDE_WITHOUT_ADAPTIVE_THINKING = releases(String.raw`claude-(?:3|(?:opus|sonnet|haiku)-4(?:-[0-5](?!\d))?(?!-\d(?!\d)))`);
|
|
100
|
+
/** Generations that predate the Claude 5 request contract (refusal stop reasons, adaptive default). */
|
|
101
|
+
const CLAUDE_BEFORE_5_CONTRACT = releases(PRE_CLAUDE_5, release("claude-mythos-preview"));
|
|
102
|
+
/** Generations whose requests keep a trailing assistant prefill. */
|
|
103
|
+
const CLAUDE_ASSISTANT_PREFILL = releases(PRE_CLAUDE_5, release("claude-mythos-preview", "claude-fable-5", "claude-fable-5-1"), release("claude-mythos-5", "claude-mythos-5-1"));
|
|
104
|
+
/** Generations that still accept caller-selected temperature, top_p, and top_k. */
|
|
105
|
+
const CLAUDE_SAMPLING_PARAMETERS = releases(String.raw`claude-(?:3|haiku-4|sonnet-4|opus-4(?!-[78](?!\d)))`);
|
|
106
|
+
/**
|
|
107
|
+
* Whether thinking blocks are valid only after the exact request prefix that
|
|
108
|
+
* produced them, so runtime context must be appended instead of re-rendered.
|
|
109
|
+
* Every Claude model is prefix-bound except the closed list of older generations.
|
|
81
110
|
*/
|
|
82
111
|
function bindsClaudeThinkingPrefix(ref) {
|
|
83
|
-
|
|
112
|
+
const id = resolveClaudeContractId(ref);
|
|
113
|
+
return id !== void 0 && !CLAUDE_UNBOUND_THINKING.test(id);
|
|
114
|
+
}
|
|
115
|
+
/** Whether a Claude model follows the Claude 5 request contract (streamed refusals, adaptive by default). */
|
|
116
|
+
function usesClaude5RequestContract(ref) {
|
|
117
|
+
const id = resolveClaudeContractId(ref);
|
|
118
|
+
return id !== void 0 && !CLAUDE_BEFORE_5_CONTRACT.test(id);
|
|
119
|
+
}
|
|
120
|
+
/** Whether a Claude model rejects a trailing assistant prefill. */
|
|
121
|
+
function rejectsClaudeAssistantPrefill(ref) {
|
|
122
|
+
const id = resolveClaudeContractId(ref);
|
|
123
|
+
return id !== void 0 && !CLAUDE_ASSISTANT_PREFILL.test(id);
|
|
84
124
|
}
|
|
85
125
|
/** Return whether Claude accepts operator instructions within conversation history. */
|
|
86
126
|
function supportsClaudeInHistorySystemMessages(ref) {
|
|
@@ -90,8 +130,8 @@ function supportsClaudeInHistorySystemMessages(ref) {
|
|
|
90
130
|
function requiresClaudeMandatoryAdaptiveThinking(ref) {
|
|
91
131
|
const disabledThinking = readListedClaudeCapability(ref, "disabledThinking");
|
|
92
132
|
if (disabledThinking !== void 0) return !disabledThinking && !requiresClaudeBetweenToolsThinking(ref) && supportsClaudeAdaptiveThinking(ref);
|
|
93
|
-
const
|
|
94
|
-
return
|
|
133
|
+
const id = resolveClaudeContractId(ref);
|
|
134
|
+
return id !== void 0 && !CLAUDE_OPTIONAL_THINKING.test(id);
|
|
95
135
|
}
|
|
96
136
|
/** Resolve Claude Sonnet 5 through aliases, direct ids, cloud ids, or deployment metadata. */
|
|
97
137
|
function resolveClaudeSonnet5ModelIdentity(ref) {
|
|
@@ -125,21 +165,29 @@ function resolveClaudeOpus55ModelIdentity(ref) {
|
|
|
125
165
|
if (normalized === "opus" || normalized === "opus-5-5") return "claude-opus-5-5";
|
|
126
166
|
return /^claude-opus-5-5(?=$|[^a-z0-9])/.test(normalized) ? normalized : void 0;
|
|
127
167
|
}
|
|
128
|
-
|
|
168
|
+
/**
|
|
169
|
+
* Whether the id names a released Claude generation with adaptive thinking.
|
|
170
|
+
* Unlike {@link supportsClaudeAdaptiveThinking}, unknown Claude ids answer false,
|
|
171
|
+
* so providers can tell a released model from one they must map onto a template.
|
|
172
|
+
*/
|
|
173
|
+
function isReleasedAdaptiveClaudeGeneration(ref) {
|
|
129
174
|
const modelId = resolveClaudeModelIdentity(ref);
|
|
130
175
|
return resolveClaudeHaiku55ModelIdentity(ref) !== void 0 || resolveClaudeOpus5ModelIdentity(ref) !== void 0 || resolveClaudeSonnet5ModelIdentity(ref) !== void 0 || /(?:^|-)claude-(?:fable-5|mythos-(?:5|preview)|opus-4-(?:6|7|8)|sonnet-4-6)(?=$|[^a-z0-9])/.test(modelId);
|
|
131
176
|
}
|
|
132
177
|
/** Return whether a Claude model supports adaptive thinking. */
|
|
133
178
|
function supportsClaudeAdaptiveThinking(ref) {
|
|
134
|
-
|
|
179
|
+
const listed = readListedClaudeCapability(ref, "adaptiveThinking");
|
|
180
|
+
if (listed !== void 0) return listed;
|
|
181
|
+
const id = resolveClaudeContractId(ref);
|
|
182
|
+
return id !== void 0 && !CLAUDE_WITHOUT_ADAPTIVE_THINKING.test(id);
|
|
135
183
|
}
|
|
136
184
|
/** Return whether a Claude model has a native 1M-token context window. */
|
|
137
185
|
function supportsClaude1MContext(ref) {
|
|
138
|
-
return
|
|
186
|
+
return isReleasedAdaptiveClaudeGeneration(ref);
|
|
139
187
|
}
|
|
140
188
|
/** Return whether Anthropic documents threshold compaction (`compact_20260112`) for a Claude model. */
|
|
141
189
|
function supportsClaudeServerCompaction(ref) {
|
|
142
|
-
return
|
|
190
|
+
return readListedClaudeCapability(ref, "serverCompaction") ?? isReleasedAdaptiveClaudeGeneration(ref);
|
|
143
191
|
}
|
|
144
192
|
/** Return whether a Claude model supports Anthropic's native fast mode. */
|
|
145
193
|
function supportsClaudeFastMode(ref) {
|
|
@@ -162,8 +210,8 @@ function supportsClaudeNativeXhighEffort(ref) {
|
|
|
162
210
|
}
|
|
163
211
|
/** Return whether a Claude model rejects caller-selected sampling parameters. */
|
|
164
212
|
function requiresClaudeDefaultSampling(ref) {
|
|
165
|
-
const
|
|
166
|
-
return
|
|
213
|
+
const id = resolveClaudeContractId(ref);
|
|
214
|
+
return id !== void 0 && !CLAUDE_SAMPLING_PARAMETERS.test(id);
|
|
167
215
|
}
|
|
168
216
|
/**
|
|
169
217
|
* Fill native Claude effort mappings only when the provider did not publish a
|
|
@@ -251,4 +299,4 @@ function calculateUsageCost(usage, pricing) {
|
|
|
251
299
|
return cost;
|
|
252
300
|
}
|
|
253
301
|
//#endregion
|
|
254
|
-
export {
|
|
302
|
+
export { supportsClaudeNativeXhighEffort as A, resolveClaudeSonnet55ModelIdentity as C, supportsClaudeFastMode as D, supportsClaudeAdaptiveThinking as E, usesClaude5RequestContract as M, supportsClaudeInHistorySystemMessages as O, resolveClaudeOpus5ModelIdentity as S, supportsClaude1MContext as T, resolveClaudeHaiku55ModelIdentity as _, CLAUDE_HAIKU_55_THINKING_PROFILE as a, resolveClaudeNativeThinkingLevelMap as b, CLAUDE_SONNET_55_THINKING_PROFILE as c, isReleasedAdaptiveClaudeGeneration as d, rejectsClaudeAssistantPrefill as f, resolveClaudeFable5ModelIdentity as g, requiresClaudeMandatoryAdaptiveThinking as h, CLAUDE_FABLE_5_THINKING_PROFILE as i, supportsClaudeServerCompaction as j, supportsClaudeNativeMaxEffort as k, CLAUDE_SONNET_5_THINKING_PROFILE as l, requiresClaudeDefaultSampling as m, normalizeModelCostConfig as n, CLAUDE_OPUS_55_THINKING_PROFILE as o, requiresClaudeBetweenToolsThinking as p, normalizeResolvedPricing as r, CLAUDE_OPUS_5_THINKING_PROFILE as s, calculateUsageCost as t, bindsClaudeThinkingPrefix as u, resolveClaudeModelIdentity as v, resolveClaudeSonnet5ModelIdentity as w, resolveClaudeOpus55ModelIdentity as x, resolveClaudeMythos5ModelIdentity as y };
|