@openclaw/ai 2026.9.4 → 2026.9.5
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 +1 -1
- package/dist/{anthropic-C4Qu4H0Z.mjs → anthropic-COtDvgtt.mjs} +10 -11
- package/dist/{anthropic-payload-policy-BZ8umAbk.d.mts → anthropic-payload-policy-5Erq1Nzy.d.mts} +3 -3
- package/dist/{anthropic-stream-reducer-CILWF7JD.mjs → anthropic-stream-reducer-BvdYYWL8.mjs} +47 -43
- package/dist/{api-registry-ByUwIR0e.d.mts → api-registry-Ba2Cv-ut.d.mts} +2 -2
- package/dist/{assistant-output-tLt4H-iQ.mjs → assistant-output-BsEkB-vU.mjs} +1 -1
- package/dist/{azure-openai-responses-BAlqlKKc.mjs → azure-openai-responses-YrgnD583.mjs} +6 -9
- package/dist/{base64-D-su8YVo.mjs → base64-BQOzsvUH.mjs} +4 -4
- package/dist/credential-redaction-BKv49aiv.d.mts +24 -0
- package/dist/{diagnostics-QuErwCIl.mjs → diagnostics-Dm4bisWG.mjs} +89 -2
- package/dist/diagnostics.d.mts +4 -23
- package/dist/diagnostics.mjs +3 -3
- package/dist/{event-stream-Bt5Y4Pav.d.mts → event-stream-CCoa-qSI.d.mts} +1 -1
- package/dist/event-stream-DmSCpi1T.d.mts +1 -0
- package/dist/event-stream.d.mts +2 -2
- package/dist/expect-lbe3Hgrh.mjs +8 -0
- package/dist/{google-DPBAOaOW.mjs → google-BuhpRO9r.mjs} +6 -9
- package/dist/{google-messages-6JkpHrhJ.mjs → google-messages-CyWnYlh0.mjs} +3 -3
- package/dist/{google-shared-BvBeW9aq.mjs → google-shared-BT5ZeNer.mjs} +13 -13
- package/dist/{google-vertex-k-TMCAYD.mjs → google-vertex-C7EplRvt.mjs} +5 -8
- package/dist/{host-B8YfDGd4.mjs → host-B4MeUNBc.mjs} +25 -27
- package/dist/{host-4atIX-2V.d.mts → host-FZ1RA_qD.d.mts} +5 -3
- package/dist/{host-policy-Zcg_cNz8.mjs → host-policy-DUnXSx0I.mjs} +1 -1
- package/dist/{index-DdD3qerf.d.mts → index-DaF2QbwS.d.mts} +4 -9
- package/dist/index.d.mts +6 -7
- package/dist/index.mjs +3 -4
- package/dist/internal/anthropic.d.mts +6 -7
- package/dist/internal/anthropic.mjs +4 -4
- package/dist/internal/openai-completions-compat.d.mts +2 -0
- package/dist/internal/openai-completions-compat.mjs +2 -0
- package/dist/internal/openai-responses-payload-policy.d.mts +2 -2
- package/dist/internal/openai-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.d.mts +10 -53
- package/dist/internal/openai.mjs +11 -9
- package/dist/internal/runtime.d.mts +6 -8
- package/dist/internal/runtime.mjs +5 -9
- package/dist/internal/shared.d.mts +6 -5
- package/dist/internal/shared.mjs +4 -3
- package/dist/internal/tool-schema.d.mts +3 -3
- package/dist/internal/tool-schema.mjs +2 -2
- package/dist/{mistral-CxUZ1jUb.mjs → mistral-moA-mbwl.mjs} +9 -13
- package/dist/{openai-chatgpt-responses-CgO6kZfo.mjs → openai-chatgpt-responses-DWID3EFO.mjs} +73 -29
- package/dist/{openai-completions-yJuk7eis.mjs → openai-completions-DJ1Vm-CD.mjs} +11 -12
- package/dist/{openai-prompt-cache-Bds-n_9Q.mjs → openai-completions-compat-CkwdxTZx.mjs} +5 -50
- package/dist/{openai-completions-compat-eHgh5UPE.d.mts → openai-completions-compat-JE7gqxb9.d.mts} +4 -4
- package/dist/{openai-completions-stream-Da2vvl-S.mjs → openai-completions-stream-Bu98b0Hv.mjs} +94 -96
- package/dist/openai-prompt-cache-1wfaIszn.mjs +46 -0
- package/dist/{openai-prompt-cache-B4eYo2-I.d.mts → openai-prompt-cache-CJ_xEevu.d.mts} +2 -2
- package/dist/{openai-provider-client-S2gCrM2Z.mjs → openai-provider-client-DPo0Hmak.mjs} +2 -2
- package/dist/openai-reasoning-effort-NlFZmfEu.mjs +235 -0
- package/dist/{openai-responses-DaYwH05E.mjs → openai-responses-BejZzQCP.mjs} +8 -12
- package/dist/{openai-responses-compaction-window-CIhBAkkq.mjs → openai-responses-compaction-window-D6P5oZP5.mjs} +20 -62
- package/dist/openai-responses-contracts-DWrfMODE.mjs +81 -0
- package/dist/{openai-responses-contracts-BjBAqAg_.d.mts → openai-responses-contracts-Dflvrfa8.d.mts} +9 -5
- package/dist/{openai-responses-payload-policy-rLRPsSmB.d.mts → openai-responses-payload-policy-C7GsA1y0.d.mts} +5 -3
- package/dist/openai-responses-prompt-observer-internal-C15_-OwV.mjs +195 -0
- package/dist/{openai-responses-shared-B8RdBPCv.mjs → openai-responses-shared-CwsziD_m.mjs} +385 -178
- package/dist/openai-responses-terminal-usage-Dl3J6zrf.d.mts +47 -0
- package/dist/{openai-tool-schema-CzjyYXun.mjs → openai-tool-schema-BO8rwyAD.mjs} +92 -68
- package/dist/{openai-transport-params-9aPuV5YY.mjs → openai-transport-params-DQeuAvBl.mjs} +157 -47
- package/dist/{positive-integer-41zhOdcV.mjs → positive-integer-DtjCkbue.mjs} +1 -1
- package/dist/{provider-error-BA-v_tKd.mjs → provider-error-DDqw9Qda.mjs} +100 -38
- package/dist/{provider-options-Ceqv1OKk.d.mts → provider-options-DprLsWh9.d.mts} +9 -6
- package/dist/{provider-replay-context-CJ_YvcEW.mjs → provider-replay-context-CnUSOwhr.mjs} +1 -1
- package/dist/{provider-transcript-transform-V5YzU9zh.mjs → provider-transcript-transform-BsRAhuWJ.mjs} +1 -1
- package/dist/{provider-transport-turn-state-D5EXOFL2.mjs → provider-transport-turn-state-CkGToCD2.mjs} +1 -1
- package/dist/{provider-types-CVjKjsuq.d.mts → provider-types-CAKRC7N5.d.mts} +3 -3
- package/dist/provider-types.d.mts +5 -6
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +10 -10
- package/dist/{reasoning-tag-text-partitioner-BcR5pztD.mjs → reasoning-tag-text-partitioner-Dy9IO8Dc.mjs} +15 -7
- package/dist/{simple-options-BQbb4yQL.mjs → simple-options-C6cFWj_f.mjs} +5 -3
- package/dist/{usage-cost-BNWbbXav.mjs → src-DeKjbE8I.mjs} +3 -5
- package/dist/{stream-first-event-timeout-2hfrquuz.mjs → stream-first-event-timeout-C9ZadkJW.mjs} +1 -1
- package/dist/{string-normalization-CmLIasuf.mjs → string-normalization-J9ZiLfGO.mjs} +13 -1
- package/dist/tool-schema-json-projection-CD9c_fK8.mjs +134 -0
- package/dist/{transport-stream-shared-DNvmoWnv.d.mts → transport-stream-shared-BbUkFaHi.d.mts} +4 -4
- package/dist/{transport-stream-shared-zHll9BxO.mjs → transport-stream-shared-D-6FQSHm.mjs} +14 -14
- package/dist/{transport-utils-zrYjICLZ.mjs → transport-utils-1cyq5Y7x.mjs} +3 -3
- package/dist/transports.d.mts +26 -12
- package/dist/transports.mjs +130 -449
- package/dist/{types-Ntv5z2g2.d.mts → types-4_uVs5WH.d.mts} +47 -3
- package/dist/types-DkJfb4W3.d.mts +1 -0
- package/dist/types.d.mts +5 -6
- package/dist/types.mjs +2 -3
- package/dist/{validation-B0t_G2H6.d.mts → validation-Ctzu2DhF.d.mts} +1 -1
- package/dist/{validation-BDzVDnTs.mjs → validation-Dw7cb6BV.mjs} +1 -0
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +10 -5
- package/dist/diagnostics-DnPnOui6.d.mts +0 -29
- package/dist/event-stream-C3WGFsum.d.mts +0 -1
- package/dist/openai-responses-contracts-DDOHA62Y.mjs +0 -245
- package/dist/openai-responses-prompt-observer-internal-f8J7wpsk.mjs +0 -32
- package/dist/src-DDmEryvj.mjs +0 -2
- package/dist/tool-schema-json-projection-ClptDdAO.mjs +0 -82
- package/dist/types-DlfwzH3T.d.mts +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { M as clampThinkingLevel, v as sanitizeSurrogates } from "./host-
|
|
2
|
-
import { m as stripSystemPromptCacheBoundary } from "./simple-options-
|
|
3
|
-
import { m as notifyProviderStreamOpened, n as assignTransportErrorDetails, v as transportAbortError } from "./transport-stream-shared-
|
|
4
|
-
import { a as googleFlashSupportsMinimalThinking, i as consumeGoogleGenerateContentStream, n as projectGoogleMessages, r as requiresGoogleToolCallId, t as convertGoogleTools } from "./google-messages-
|
|
5
|
-
import { t as transformProviderMessages } from "./provider-transcript-transform-
|
|
1
|
+
import { M as clampThinkingLevel, v as sanitizeSurrogates } from "./host-B4MeUNBc.mjs";
|
|
2
|
+
import { m as stripSystemPromptCacheBoundary } from "./simple-options-C6cFWj_f.mjs";
|
|
3
|
+
import { m as notifyProviderStreamOpened, n as assignTransportErrorDetails, v as transportAbortError } from "./transport-stream-shared-D-6FQSHm.mjs";
|
|
4
|
+
import { a as googleFlashSupportsMinimalThinking, i as consumeGoogleGenerateContentStream, n as projectGoogleMessages, r as requiresGoogleToolCallId, t as convertGoogleTools } from "./google-messages-CyWnYlh0.mjs";
|
|
5
|
+
import { t as transformProviderMessages } from "./provider-transcript-transform-BsRAhuWJ.mjs";
|
|
6
6
|
import { FunctionCallingConfigMode, ThinkingLevel } from "@google/genai";
|
|
7
7
|
//#region packages/ai/src/providers/google-shared.ts
|
|
8
8
|
/**
|
|
@@ -97,7 +97,7 @@ function buildGoogleGenerateContentParams(model, context, options = {}) {
|
|
|
97
97
|
function isAdaptiveGoogleReasoningLevel(value) {
|
|
98
98
|
return value === "adaptive";
|
|
99
99
|
}
|
|
100
|
-
function buildGoogleSimpleThinking(model, options
|
|
100
|
+
function buildGoogleSimpleThinking(model, options) {
|
|
101
101
|
if (!options?.reasoning || options.reasoning === "off") return { enabled: false };
|
|
102
102
|
if (isAdaptiveGoogleReasoningLevel(options.reasoning)) {
|
|
103
103
|
if (!model.reasoning) return { enabled: false };
|
|
@@ -113,13 +113,13 @@ function buildGoogleSimpleThinking(model, options, config) {
|
|
|
113
113
|
const clampedReasoning = clampThinkingLevel(model, options.reasoning);
|
|
114
114
|
if (clampedReasoning === "off") return { enabled: false };
|
|
115
115
|
const effort = clampedReasoning === "max" ? "high" : clampedReasoning;
|
|
116
|
-
if (isGemini3ProModel(model) || isGemini3FlashModel(model) ||
|
|
116
|
+
if (isGemini3ProModel(model) || isGemini3FlashModel(model) || isGemma4Model(model)) return {
|
|
117
117
|
enabled: true,
|
|
118
|
-
level: getGoogleThinkingLevel(effort, model
|
|
118
|
+
level: getGoogleThinkingLevel(effort, model)
|
|
119
119
|
};
|
|
120
120
|
return {
|
|
121
121
|
enabled: true,
|
|
122
|
-
budgetTokens: getGoogleBudget(model, effort, options.thinkingBudgets
|
|
122
|
+
budgetTokens: getGoogleBudget(model, effort, options.thinkingBudgets)
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
125
|
function getDisabledGoogleThinkingConfig(model) {
|
|
@@ -138,14 +138,14 @@ function isGemini3ProModel(model) {
|
|
|
138
138
|
function isGemini3FlashModel(model) {
|
|
139
139
|
return /gemini-(?:3(?:\.\d+)?-flash|flash(?:-lite)?-latest)/.test(model.id.toLowerCase());
|
|
140
140
|
}
|
|
141
|
-
function getGoogleThinkingLevel(effort, model
|
|
141
|
+
function getGoogleThinkingLevel(effort, model) {
|
|
142
142
|
if (isGemini3ProModel(model)) switch (effort) {
|
|
143
143
|
case "minimal":
|
|
144
144
|
case "low": return ThinkingLevel.LOW;
|
|
145
145
|
case "medium":
|
|
146
146
|
case "high": return ThinkingLevel.HIGH;
|
|
147
147
|
}
|
|
148
|
-
if (
|
|
148
|
+
if (isGemma4Model(model)) switch (effort) {
|
|
149
149
|
case "minimal":
|
|
150
150
|
case "low": return ThinkingLevel.MINIMAL;
|
|
151
151
|
case "medium":
|
|
@@ -159,7 +159,7 @@ function getGoogleThinkingLevel(effort, model, config) {
|
|
|
159
159
|
}
|
|
160
160
|
return ThinkingLevel.HIGH;
|
|
161
161
|
}
|
|
162
|
-
function getGoogleBudget(model, effort, customBudgets
|
|
162
|
+
function getGoogleBudget(model, effort, customBudgets) {
|
|
163
163
|
if (customBudgets?.[effort] !== void 0) return customBudgets[effort];
|
|
164
164
|
if (model.id.includes("2.5-pro")) return {
|
|
165
165
|
minimal: 128,
|
|
@@ -167,7 +167,7 @@ function getGoogleBudget(model, effort, customBudgets, config) {
|
|
|
167
167
|
medium: 8192,
|
|
168
168
|
high: 32768
|
|
169
169
|
}[effort];
|
|
170
|
-
if (
|
|
170
|
+
if (model.id.includes("2.5-flash-lite")) return {
|
|
171
171
|
minimal: 512,
|
|
172
172
|
low: 2048,
|
|
173
173
|
medium: 8192,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-D8PARQfL.mjs";
|
|
2
2
|
import { a as normalizeOptionalString } from "./string-coerce-fsri9iCu.mjs";
|
|
3
|
-
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-
|
|
4
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
5
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
6
|
-
import { n as buildGoogleSimpleThinking, r as runGoogleGenerateContentLifecycle, t as buildGoogleGenerateContentParams } from "./google-shared-
|
|
3
|
+
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-B4MeUNBc.mjs";
|
|
4
|
+
import { n as buildBaseOptions } from "./simple-options-C6cFWj_f.mjs";
|
|
5
|
+
import { t as createAssistantOutput } from "./assistant-output-BsEkB-vU.mjs";
|
|
6
|
+
import { n as buildGoogleSimpleThinking, r as runGoogleGenerateContentLifecycle, t as buildGoogleGenerateContentParams } from "./google-shared-BT5ZeNer.mjs";
|
|
7
7
|
import { GoogleGenAI, ResourceScope } from "@google/genai";
|
|
8
8
|
//#region packages/ai/src/providers/google-vertex.ts
|
|
9
9
|
const API_VERSION = "v1";
|
|
@@ -30,10 +30,7 @@ const streamSimpleGoogleVertex = (model, context, options) => {
|
|
|
30
30
|
const base = buildBaseOptions(model, options, void 0);
|
|
31
31
|
return streamGoogleVertex(model, context, {
|
|
32
32
|
...base,
|
|
33
|
-
thinking: buildGoogleSimpleThinking(model, options
|
|
34
|
-
includeGemma4ThinkingLevel: true,
|
|
35
|
-
useFlashLiteBudgets: true
|
|
36
|
-
})
|
|
33
|
+
thinking: buildGoogleSimpleThinking(model, options)
|
|
37
34
|
});
|
|
38
35
|
};
|
|
39
36
|
function createClient(model, project, location, optionsHeaders) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b as supportsClaudeNativeXhighEffort, c as requiresClaudeDefaultSampling, f as resolveClaudeMythos5ModelIdentity, h as resolveClaudeSonnet5ModelIdentity, l as requiresClaudeMandatoryAdaptiveThinking, m as resolveClaudeOpus5ModelIdentity, p as resolveClaudeNativeThinkingLevelMap, t as calculateUsageCost, u as resolveClaudeFable5ModelIdentity, y as supportsClaudeNativeMaxEffort } from "./
|
|
2
|
-
import "./src-DDmEryvj.mjs";
|
|
1
|
+
import { b as supportsClaudeNativeXhighEffort, c as requiresClaudeDefaultSampling, f as resolveClaudeMythos5ModelIdentity, h as resolveClaudeSonnet5ModelIdentity, i as CLAUDE_FABLE_5_THINKING_PROFILE, l as requiresClaudeMandatoryAdaptiveThinking, m as resolveClaudeOpus5ModelIdentity, p as resolveClaudeNativeThinkingLevelMap, t as calculateUsageCost, u as resolveClaudeFable5ModelIdentity, y as supportsClaudeNativeMaxEffort } from "./src-DeKjbE8I.mjs";
|
|
3
2
|
import { n as normalizeLowercaseStringOrEmpty } from "./string-coerce-fsri9iCu.mjs";
|
|
4
3
|
import { i as asOptionalRecord, o as isRecord } from "./record-coerce-DwRYMj3t.mjs";
|
|
4
|
+
import { a as resolveOpenAIModelReasoningEfforts, d as MODEL_CATALOG_THINKING_LEVELS, f as listMappedModelThinkingLevels, p as resolveOpenAIThinkingApi } from "./openai-reasoning-effort-NlFZmfEu.mjs";
|
|
5
5
|
import { t as truncateUtf16Safe } from "./utf16-slice-CvGodqok.mjs";
|
|
6
6
|
//#region packages/ai/src/model-utils.ts
|
|
7
7
|
/** Calculates and stores model cost fields from token usage and per-million pricing. */
|
|
@@ -15,15 +15,6 @@ function applyProviderReportedUsageCost(usage, reportedCost) {
|
|
|
15
15
|
usage.cost.total = reportedCost;
|
|
16
16
|
usage.cost.totalOrigin = "provider-billed";
|
|
17
17
|
}
|
|
18
|
-
const EXTENDED_THINKING_LEVELS = [
|
|
19
|
-
"off",
|
|
20
|
-
"minimal",
|
|
21
|
-
"low",
|
|
22
|
-
"medium",
|
|
23
|
-
"high",
|
|
24
|
-
"xhigh",
|
|
25
|
-
"max"
|
|
26
|
-
];
|
|
27
18
|
function resolveThinkingLevelMap(model) {
|
|
28
19
|
return model.api === "anthropic-messages" ? resolveClaudeNativeThinkingLevelMap(model) ?? model.thinkingLevelMap : model.thinkingLevelMap;
|
|
29
20
|
}
|
|
@@ -32,10 +23,12 @@ function getSupportedThinkingLevels(model) {
|
|
|
32
23
|
const mandatoryAdaptiveContract = model.api === "anthropic-messages" && requiresClaudeMandatoryAdaptiveThinking(model);
|
|
33
24
|
if (!model.reasoning && !mandatoryAdaptiveContract) return ["off"];
|
|
34
25
|
const thinkingLevelMap = resolveThinkingLevelMap(model);
|
|
35
|
-
|
|
26
|
+
const reasoningEfforts = resolveOpenAIThinkingApi(model.api) ? resolveOpenAIModelReasoningEfforts(model) : void 0;
|
|
27
|
+
const mappedLevels = listMappedModelThinkingLevels(model);
|
|
28
|
+
return MODEL_CATALOG_THINKING_LEVELS.filter((level) => {
|
|
36
29
|
const mapped = thinkingLevelMap?.[level];
|
|
37
30
|
if (mapped === null) return false;
|
|
38
|
-
if (level === "xhigh" || level === "max") return mapped !== void 0;
|
|
31
|
+
if (level === "xhigh" || level === "max") return reasoningEfforts?.length !== 0 && (mapped !== void 0 || mappedLevels.includes(level) || reasoningEfforts?.includes(level) === true);
|
|
39
32
|
return true;
|
|
40
33
|
});
|
|
41
34
|
}
|
|
@@ -43,15 +36,13 @@ function getSupportedThinkingLevels(model) {
|
|
|
43
36
|
function clampThinkingLevel(model, level) {
|
|
44
37
|
const availableLevels = getSupportedThinkingLevels(model);
|
|
45
38
|
if (availableLevels.includes(level)) return level;
|
|
46
|
-
const requestedIndex =
|
|
39
|
+
const requestedIndex = MODEL_CATALOG_THINKING_LEVELS.indexOf(level);
|
|
47
40
|
if (requestedIndex === -1) return availableLevels[0] ?? "off";
|
|
48
41
|
const thinkingLevelMap = resolveThinkingLevelMap(model);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
for (const candidate of EXTENDED_THINKING_LEVELS.slice(0, requestedIndex).toReversed()) if (availableLevels.includes(candidate)) return candidate;
|
|
54
|
-
return availableLevels[0] ?? "off";
|
|
42
|
+
const lowerFirst = (level === "xhigh" || level === "max") && thinkingLevelMap?.[level] === null;
|
|
43
|
+
const lowerLevels = MODEL_CATALOG_THINKING_LEVELS.slice(0, requestedIndex).toReversed();
|
|
44
|
+
const upperLevels = MODEL_CATALOG_THINKING_LEVELS.slice(requestedIndex);
|
|
45
|
+
return (lowerFirst ? [...lowerLevels, ...upperLevels] : [...upperLevels, ...lowerLevels]).find((candidate) => availableLevels.includes(candidate)) ?? availableLevels[0] ?? "off";
|
|
55
46
|
}
|
|
56
47
|
/** Compares model identity by provider and id. */
|
|
57
48
|
function modelsAreEqual(a, b) {
|
|
@@ -86,13 +77,13 @@ function requiresClaudeAdaptiveThinking(model) {
|
|
|
86
77
|
if (normalizeApi(model.api) !== "anthropic-messages") return false;
|
|
87
78
|
return requiresClaudeMandatoryAdaptiveThinking(model);
|
|
88
79
|
}
|
|
89
|
-
/** Return whether omitted thinking should default to adaptive
|
|
80
|
+
/** Return whether omitted thinking should default to adaptive mode. */
|
|
90
81
|
function defaultsClaudeAdaptiveThinking(model) {
|
|
91
82
|
return requiresClaudeAdaptiveThinking(model) || normalizeApi(model.api) === "anthropic-messages" && (resolveClaudeOpus5ModelIdentity(model) !== void 0 || resolveClaudeSonnet5ModelIdentity(model) !== void 0);
|
|
92
83
|
}
|
|
93
84
|
/** Resolve provider-native effort once for direct and managed Claude requests. */
|
|
94
85
|
function resolveAnthropicThinkingEffort(model, level) {
|
|
95
|
-
const requestedLevel = level;
|
|
86
|
+
const requestedLevel = level ?? (resolveClaudeFable5ModelIdentity(model) ? CLAUDE_FABLE_5_THINKING_PROFILE.defaultLevel : void 0);
|
|
96
87
|
const thinkingLevelMap = resolveClaudeNativeThinkingLevelMap(model);
|
|
97
88
|
const clampModel = {
|
|
98
89
|
...model,
|
|
@@ -329,15 +320,22 @@ function extractToolResultBlockText(block) {
|
|
|
329
320
|
}
|
|
330
321
|
function extractToolResultText(blocks, options) {
|
|
331
322
|
const explicitTexts = [];
|
|
332
|
-
const
|
|
323
|
+
const structuredBlocks = [];
|
|
333
324
|
for (const block of blocks) {
|
|
325
|
+
if (!block || typeof block !== "object") continue;
|
|
326
|
+
if (block.type === "text") {
|
|
327
|
+
const text = extractToolResultBlockText(block);
|
|
328
|
+
if (text) explicitTexts.push(text);
|
|
329
|
+
} else structuredBlocks.push(block);
|
|
330
|
+
}
|
|
331
|
+
if (explicitTexts.length > 0 && !options?.includeStructured) return explicitTexts.join("\n");
|
|
332
|
+
const structuredTexts = [];
|
|
333
|
+
for (const block of structuredBlocks) {
|
|
334
334
|
const text = extractToolResultBlockText(block);
|
|
335
|
-
if (
|
|
336
|
-
if (block.type === "text") explicitTexts.push(text);
|
|
337
|
-
else structuredTexts.push(text);
|
|
335
|
+
if (text) structuredTexts.push(text);
|
|
338
336
|
}
|
|
339
337
|
if (explicitTexts.length > 0) {
|
|
340
|
-
if (
|
|
338
|
+
if (structuredTexts.length > 0) explicitTexts.push(truncateStructuredToolText(structuredTexts.join("\n")));
|
|
341
339
|
return explicitTexts.join("\n");
|
|
342
340
|
}
|
|
343
341
|
return truncateStructuredToolText(structuredTexts.join("\n"));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { O as Model, d as Context, n as Api, q as StreamFn } from "./types-
|
|
3
|
-
import { n as ApiRegistry } from "./api-registry-
|
|
1
|
+
import "./index-DaF2QbwS.mjs";
|
|
2
|
+
import { O as Model, d as Context, n as Api, q as StreamFn } from "./types-4_uVs5WH.mjs";
|
|
3
|
+
import { n as ApiRegistry } from "./api-registry-Ba2Cv-ut.mjs";
|
|
4
4
|
//#region packages/ai/src/host.d.ts
|
|
5
5
|
/** Provider capability facts needed by the package-owned transports. */
|
|
6
6
|
interface AiProviderRequestCapabilities {
|
|
@@ -115,6 +115,8 @@ interface AiTransportHost {
|
|
|
115
115
|
}): typeof fetch | undefined;
|
|
116
116
|
/** Resolves host-owned process-local secret sentinel substrings immediately before egress. */
|
|
117
117
|
resolveSecretSentinel(value: string): string;
|
|
118
|
+
/** Resolves visible headers and host-private request overrides before plugin handoff. */
|
|
119
|
+
unwrapModelTransportSentinels?<T extends Model>(model: T, boundary: string): T;
|
|
118
120
|
/** Redacts model-visible tool results without treating ordinary source assignments as secrets. */
|
|
119
121
|
redactModelVisibleSecrets<T>(value: T): T;
|
|
120
122
|
/** Redacts secret-bearing text in tool payload strings. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as getAiTransportHost } from "./host-
|
|
1
|
+
import { n as getAiTransportHost } from "./host-B4MeUNBc.mjs";
|
|
2
2
|
//#region packages/ai/src/transports/host-policy.ts
|
|
3
3
|
function buildGuardedModelFetch(model, timeoutMs, options) {
|
|
4
4
|
const host = getAiTransportHost();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { $ as ThinkingContent, A as ModelCostRates, B as ProviderReplayState, C as KnownImagesApi, D as Message, E as MaybePromise, F as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, G as SimpleStreamOptions, H as ProviderStreamOptions, I as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, J as StreamFunction, K as StopReason, L as PricingTier, M as OpenAICompletionsCompat, N as OpenAIResponsesCompat, O as Model, P as OpenRouterRouting, Q as ThinkingBudgets, R as Provider, S as KnownApi, T as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, U as RawModelCostConfig, V as ProviderResponse, W as RawPricingTier, X as TextContent, Y as StreamOptions, Z as TextSignatureV1, _ as ImagesModel, a as AssistantMessage, at as Transport, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as ValidateToolArgumentsFn, d as Context, et as ThinkingLevel, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, it as ToolResultMessage, j as ModelThinkingLevel, k as ModelCostConfig, l as CacheRetention, lt as VercelGatewayRouting, m as ImagesContext, n as Api, nt as Tool, o as AssistantMessageEvent, ot as Usage, p as ImagesApi, q as StreamFn, r as AssistantDeliveryTtsFacts, rt as ToolCall, s as AssistantMessageEventStreamContract, st as UserMessage, t as AnthropicMessagesCompat, tt as ThinkingLevelMap, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderImagesOptions } from "./types-
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-B0t_G2H6.mjs";
|
|
1
|
+
import { $ as ThinkingContent, A as ModelCostRates, B as ProviderReplayState, C as KnownImagesApi, D as Message, E as MaybePromise, F as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, G as SimpleStreamOptions, H as ProviderStreamOptions, I as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, J as StreamFunction, K as StopReason, L as PricingTier, M as OpenAICompletionsCompat, N as OpenAIResponsesCompat, O as Model, P as OpenRouterRouting, Q as ThinkingBudgets, R as Provider, S as KnownApi, T as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, U as RawModelCostConfig, V as ProviderResponse, W as RawPricingTier, X as TextContent, Y as StreamOptions, Z as TextSignatureV1, _ as ImagesModel, a as AssistantMessage, at as Transport, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as ValidateToolArgumentsFn, d as Context, dt as DiagnosticErrorInfo, et as ThinkingLevel, f as ImageContent, ft as appendAssistantMessageDiagnostic, g as ImagesInputContent, gt as isProviderRefusalAssistantError, h as ImagesFunction, ht as formatThrownValue, i as AssistantImages, it as ToolResultMessage, j as ModelThinkingLevel, k as ModelCostConfig, l as CacheRetention, lt as VercelGatewayRouting, m as ImagesContext, mt as extractDiagnosticError, n as Api, nt as Tool, o as AssistantMessageEvent, ot as Usage, p as ImagesApi, pt as createAssistantMessageDiagnostic, q as StreamFn, r as AssistantDeliveryTtsFacts, rt as ToolCall, s as AssistantMessageEventStreamContract, st as UserMessage, t as AnthropicMessagesCompat, tt as ThinkingLevelMap, u as CompleteSimpleFn, ut as AssistantMessageDiagnostic, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderImagesOptions } from "./types-4_uVs5WH.mjs";
|
|
2
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-CCoa-qSI.mjs";
|
|
3
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-Ctzu2DhF.mjs";
|
|
5
4
|
//#region packages/llm-core/src/model-contracts/anthropic.d.ts
|
|
6
5
|
type ClaudeModelRef = {
|
|
7
6
|
id?: string;
|
|
@@ -12,8 +11,6 @@ type ClaudeEffortModelRef = ClaudeModelRef & {
|
|
|
12
11
|
};
|
|
13
12
|
declare const CLAUDE_FABLE_5_THINKING_PROFILE: {
|
|
14
13
|
readonly levels: readonly [{
|
|
15
|
-
readonly id: "minimal";
|
|
16
|
-
}, {
|
|
17
14
|
readonly id: "low";
|
|
18
15
|
}, {
|
|
19
16
|
readonly id: "medium";
|
|
@@ -21,12 +18,10 @@ declare const CLAUDE_FABLE_5_THINKING_PROFILE: {
|
|
|
21
18
|
readonly id: "high";
|
|
22
19
|
}, {
|
|
23
20
|
readonly id: "xhigh";
|
|
24
|
-
}, {
|
|
25
|
-
readonly id: "adaptive";
|
|
26
21
|
}, {
|
|
27
22
|
readonly id: "max";
|
|
28
23
|
}];
|
|
29
|
-
readonly defaultLevel: "
|
|
24
|
+
readonly defaultLevel: "medium";
|
|
30
25
|
readonly preserveWhenCatalogReasoningFalse: true;
|
|
31
26
|
};
|
|
32
27
|
declare const CLAUDE_SONNET_5_THINKING_PROFILE: {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { _ as supportsClaude1MContext, a as CLAUDE_FABLE_5_THINKING_PROFILE, b as supportsClaudeNativeMaxEffort, c as bindsClaudeThinkingPrefix, d as resolveClaudeFable5ModelIdentity, f as resolveClaudeModelIdentity, g as resolveClaudeSonnet5ModelIdentity, h as resolveClaudeOpus5ModelIdentity, i as normalizeResolvedPricing, l as requiresClaudeDefaultSampling, m as resolveClaudeNativeThinkingLevelMap, n as calculateUsageCost, o as CLAUDE_OPUS_5_THINKING_PROFILE, p as resolveClaudeMythos5ModelIdentity, r as normalizeModelCostConfig, s as CLAUDE_SONNET_5_THINKING_PROFILE, u as requiresClaudeMandatoryAdaptiveThinking, v as supportsClaudeAdaptiveThinking, x as supportsClaudeNativeXhighEffort, y as supportsClaudeFastMode } from "./index-
|
|
2
|
-
import { $ as ThinkingContent, A as ModelCostRates, B as ProviderReplayState, C as KnownImagesApi, D as Message, E as MaybePromise, F as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, G as SimpleStreamOptions, H as ProviderStreamOptions, I as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, J as StreamFunction, K as StopReason, L as PricingTier, M as OpenAICompletionsCompat, N as OpenAIResponsesCompat, O as Model, P as OpenRouterRouting, Q as ThinkingBudgets, R as Provider, S as KnownApi, T as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, U as RawModelCostConfig, V as ProviderResponse, W as RawPricingTier, X as TextContent, Y as StreamOptions, Z as TextSignatureV1, _ as ImagesModel, a as AssistantMessage, at as Transport, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as ValidateToolArgumentsFn, d as Context, et as ThinkingLevel, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, it as ToolResultMessage, j as ModelThinkingLevel, k as ModelCostConfig, l as CacheRetention, lt as VercelGatewayRouting, m as ImagesContext, n as Api, nt as Tool, o as AssistantMessageEvent, ot as Usage, p as ImagesApi, q as StreamFn, r as AssistantDeliveryTtsFacts, rt as ToolCall, s as AssistantMessageEventStreamContract, st as UserMessage, t as AnthropicMessagesCompat, tt as ThinkingLevelMap, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderImagesOptions } from "./types-
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
5
|
-
import { n as
|
|
6
|
-
import { a as
|
|
7
|
-
import { a as AiProviderRequestPolicyInput, c as AiTransportHost, d as configureAiTransportHost, f as getAiTransportHost, i as AiProviderRequestCapabilities, l as AiTransportPluginHost, n as AiInlineImageBlock, o as AiProviderStreamHookContext, p as resolveAiTransportHeaderSentinels, r as AiInlineTextBlock, s as AiTransformTransportMessages, t as AiInlineContentBlock, u as OpenAIStrictToolSettingOptions } from "./host-4atIX-2V.mjs";
|
|
1
|
+
import { _ as supportsClaude1MContext, a as CLAUDE_FABLE_5_THINKING_PROFILE, b as supportsClaudeNativeMaxEffort, c as bindsClaudeThinkingPrefix, d as resolveClaudeFable5ModelIdentity, f as resolveClaudeModelIdentity, g as resolveClaudeSonnet5ModelIdentity, h as resolveClaudeOpus5ModelIdentity, i as normalizeResolvedPricing, l as requiresClaudeDefaultSampling, m as resolveClaudeNativeThinkingLevelMap, n as calculateUsageCost, o as CLAUDE_OPUS_5_THINKING_PROFILE, p as resolveClaudeMythos5ModelIdentity, r as normalizeModelCostConfig, s as CLAUDE_SONNET_5_THINKING_PROFILE, u as requiresClaudeMandatoryAdaptiveThinking, v as supportsClaudeAdaptiveThinking, x as supportsClaudeNativeXhighEffort, y as supportsClaudeFastMode } from "./index-DaF2QbwS.mjs";
|
|
2
|
+
import { $ as ThinkingContent, A as ModelCostRates, B as ProviderReplayState, C as KnownImagesApi, D as Message, E as MaybePromise, F as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, G as SimpleStreamOptions, H as ProviderStreamOptions, I as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, J as StreamFunction, K as StopReason, L as PricingTier, M as OpenAICompletionsCompat, N as OpenAIResponsesCompat, O as Model, P as OpenRouterRouting, Q as ThinkingBudgets, R as Provider, S as KnownApi, T as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, U as RawModelCostConfig, V as ProviderResponse, W as RawPricingTier, X as TextContent, Y as StreamOptions, Z as TextSignatureV1, _ as ImagesModel, a as AssistantMessage, at as Transport, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as ValidateToolArgumentsFn, d as Context, dt as DiagnosticErrorInfo, et as ThinkingLevel, f as ImageContent, ft as appendAssistantMessageDiagnostic, g as ImagesInputContent, gt as isProviderRefusalAssistantError, h as ImagesFunction, ht as formatThrownValue, i as AssistantImages, it as ToolResultMessage, j as ModelThinkingLevel, k as ModelCostConfig, l as CacheRetention, lt as VercelGatewayRouting, m as ImagesContext, mt as extractDiagnosticError, n as Api, nt as Tool, o as AssistantMessageEvent, ot as Usage, p as ImagesApi, pt as createAssistantMessageDiagnostic, q as StreamFn, r as AssistantDeliveryTtsFacts, rt as ToolCall, s as AssistantMessageEventStreamContract, st as UserMessage, t as AnthropicMessagesCompat, tt as ThinkingLevelMap, u as CompleteSimpleFn, ut as AssistantMessageDiagnostic, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderImagesOptions } from "./types-4_uVs5WH.mjs";
|
|
3
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-CCoa-qSI.mjs";
|
|
4
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-Ctzu2DhF.mjs";
|
|
5
|
+
import { a as RegisteredApiProvider, i as ApiStreamSimpleFunction, n as ApiRegistry, o as createApiRegistry, r as ApiStreamFunction, t as ApiProvider } from "./api-registry-Ba2Cv-ut.mjs";
|
|
6
|
+
import { a as AiProviderRequestPolicyInput, c as AiTransportHost, d as configureAiTransportHost, f as getAiTransportHost, i as AiProviderRequestCapabilities, l as AiTransportPluginHost, n as AiInlineImageBlock, o as AiProviderStreamHookContext, p as resolveAiTransportHeaderSentinels, r as AiInlineTextBlock, s as AiTransformTransportMessages, t as AiInlineContentBlock, u as OpenAIStrictToolSettingOptions } from "./host-FZ1RA_qD.mjs";
|
|
8
7
|
//#region packages/ai/src/stream.d.ts
|
|
9
8
|
/** Creates an isolated LLM runtime backed by the supplied provider registry. */
|
|
10
9
|
export declare function createLlmRuntime(registry?: ApiRegistry): {
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { _ as supportsClaudeAdaptiveThinking, a as CLAUDE_OPUS_5_THINKING_PROFILE, b as supportsClaudeNativeXhighEffort, c as requiresClaudeDefaultSampling, d as resolveClaudeModelIdentity, f as resolveClaudeMythos5ModelIdentity, g as supportsClaude1MContext, h as resolveClaudeSonnet5ModelIdentity, i as CLAUDE_FABLE_5_THINKING_PROFILE, l as requiresClaudeMandatoryAdaptiveThinking, m as resolveClaudeOpus5ModelIdentity, n as normalizeModelCostConfig, o as CLAUDE_SONNET_5_THINKING_PROFILE, p as resolveClaudeNativeThinkingLevelMap, r as normalizeResolvedPricing, s as bindsClaudeThinkingPrefix, t as calculateUsageCost, u as resolveClaudeFable5ModelIdentity, v as supportsClaudeFastMode, y as supportsClaudeNativeMaxEffort } from "./
|
|
1
|
+
import { _ as supportsClaudeAdaptiveThinking, a as CLAUDE_OPUS_5_THINKING_PROFILE, b as supportsClaudeNativeXhighEffort, c as requiresClaudeDefaultSampling, d as resolveClaudeModelIdentity, f as resolveClaudeMythos5ModelIdentity, g as supportsClaude1MContext, h as resolveClaudeSonnet5ModelIdentity, i as CLAUDE_FABLE_5_THINKING_PROFILE, l as requiresClaudeMandatoryAdaptiveThinking, m as resolveClaudeOpus5ModelIdentity, n as normalizeModelCostConfig, o as CLAUDE_SONNET_5_THINKING_PROFILE, p as resolveClaudeNativeThinkingLevelMap, r as normalizeResolvedPricing, s as bindsClaudeThinkingPrefix, t as calculateUsageCost, u as resolveClaudeFable5ModelIdentity, v as supportsClaudeFastMode, y as supportsClaudeNativeMaxEffort } from "./src-DeKjbE8I.mjs";
|
|
2
2
|
import { n as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, r as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, t as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE } from "./types-LFWwv0cF.mjs";
|
|
3
3
|
import { a as isProviderRefusalAssistantError, i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-CPeq9F7y.mjs";
|
|
4
4
|
import { i as createAssistantMessageEventStream, n as EventStream, t as AssistantMessageEventStream } from "./event-stream-D8PARQfL.mjs";
|
|
5
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
6
|
-
import "./src-DDmEryvj.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-Dw7cb6BV.mjs";
|
|
7
6
|
import { n as createApiRegistry, t as createLlmRuntime } from "./stream-CREqxHgU.mjs";
|
|
8
|
-
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels, t as configureAiTransportHost } from "./host-
|
|
7
|
+
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels, t as configureAiTransportHost } from "./host-B4MeUNBc.mjs";
|
|
9
8
|
export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, EventStream, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, appendAssistantMessageDiagnostic, bindsClaudeThinkingPrefix, calculateUsageCost, configureAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, createLlmRuntime, extractDiagnosticError, formatThrownValue, getAiTransportHost, isProviderRefusalAssistantError, normalizeModelCostConfig, normalizeResolvedPricing, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { b as supportsClaudeNativeMaxEffort, c as bindsClaudeThinkingPrefix, d as resolveClaudeFable5ModelIdentity, f as resolveClaudeModelIdentity, g as resolveClaudeSonnet5ModelIdentity, h as resolveClaudeOpus5ModelIdentity, l as requiresClaudeDefaultSampling, m as resolveClaudeNativeThinkingLevelMap, p as resolveClaudeMythos5ModelIdentity, u as requiresClaudeMandatoryAdaptiveThinking, v as supportsClaudeAdaptiveThinking, x as supportsClaudeNativeXhighEffort } from "../index-
|
|
2
|
-
import { G as SimpleStreamOptions, J as StreamFunction, K as StopReason, O as Model, d as Context, ot as Usage } from "../types-
|
|
3
|
-
import { t as
|
|
4
|
-
import
|
|
5
|
-
import "../
|
|
6
|
-
import { p as resolveAnthropicServerCompactionPlan } from "../anthropic-payload-policy-BZ8umAbk.mjs";
|
|
1
|
+
import { b as supportsClaudeNativeMaxEffort, c as bindsClaudeThinkingPrefix, d as resolveClaudeFable5ModelIdentity, f as resolveClaudeModelIdentity, g as resolveClaudeSonnet5ModelIdentity, h as resolveClaudeOpus5ModelIdentity, l as requiresClaudeDefaultSampling, m as resolveClaudeNativeThinkingLevelMap, p as resolveClaudeMythos5ModelIdentity, u as requiresClaudeMandatoryAdaptiveThinking, v as supportsClaudeAdaptiveThinking, x as supportsClaudeNativeXhighEffort } from "../index-DaF2QbwS.mjs";
|
|
2
|
+
import { G as SimpleStreamOptions, J as StreamFunction, K as StopReason, O as Model, d as Context, ot as Usage, ut as AssistantMessageDiagnostic } from "../types-4_uVs5WH.mjs";
|
|
3
|
+
import { i as AnthropicThinkingDisplay, n as AnthropicEffort, r as AnthropicOptions, t as AnthropicContextManagementOptions } from "../provider-options-DprLsWh9.mjs";
|
|
4
|
+
import "../types-DkJfb4W3.mjs";
|
|
5
|
+
import { p as resolveAnthropicServerCompactionPlan } from "../anthropic-payload-policy-5Erq1Nzy.mjs";
|
|
7
6
|
import { Tool } from "@anthropic-ai/sdk/resources/messages.js";
|
|
8
7
|
//#region packages/ai/src/providers/anthropic.d.ts
|
|
9
8
|
type AnthropicCompactionOptions = AnthropicOptions & {
|
|
@@ -53,7 +52,7 @@ export declare function requiresClaudeAdaptiveThinking(model: {
|
|
|
53
52
|
params?: Record<string, unknown>;
|
|
54
53
|
api?: string;
|
|
55
54
|
}): boolean;
|
|
56
|
-
/** Return whether omitted thinking should default to adaptive
|
|
55
|
+
/** Return whether omitted thinking should default to adaptive mode. */
|
|
57
56
|
export declare function defaultsClaudeAdaptiveThinking(model: {
|
|
58
57
|
id?: string;
|
|
59
58
|
params?: Record<string, unknown>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as supportsClaudeAdaptiveThinking, b as supportsClaudeNativeXhighEffort, c as requiresClaudeDefaultSampling, d as resolveClaudeModelIdentity, f as resolveClaudeMythos5ModelIdentity, h as resolveClaudeSonnet5ModelIdentity, l as requiresClaudeMandatoryAdaptiveThinking, m as resolveClaudeOpus5ModelIdentity, p as resolveClaudeNativeThinkingLevelMap, s as bindsClaudeThinkingPrefix, u as resolveClaudeFable5ModelIdentity, y as supportsClaudeNativeMaxEffort } from "../
|
|
2
|
-
import { C as mapAnthropicStopReason, D as resolveModelBoundThinkingReplayMode, E as resolveAnthropicThinkingEffort, O as usesClaudeFable5MessagesContract, S as defaultsClaudeAdaptiveThinking, T as requiresClaudeAdaptiveThinking, b as ANTHROPIC_CLAUDE_CODE_VERSION, k as usesClaudeStreamingRefusalContract, w as prepareClaudeNoPrefillRequestContext, x as applyClaudeRequestContract, y as ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK } from "../host-
|
|
3
|
-
import { A as applyAnthropicFallbackBoundary, C as applyAnthropicThinkingBindingControls, D as ANTHROPIC_SERVER_SIDE_FALLBACKS, E as readAnthropicInputTransformations, G as resolveAnthropicServerCompactionPlan, J as usesFoundryBearerAuth, K as isAnthropicOAuthApiKey, M as resolveAnthropicFallbackServingModelCost, O as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, S as ANTHROPIC_OMITTED_REASONING_TEXT, T as logAnthropicThinkingDrops, _ as normalizeAnthropicToolChoice, a as readAnthropicPromptUsageSnapshot, b as resolveOriginalAnthropicToolName, c as applyAnthropicRefusal, g as normalizeAnthropicToolCallId, i as readAnthropicCacheWriteUsage, j as readAnthropicFallbackBoundary, k as CLAUDE_OPUS_FALLBACK_MODEL_COST, n as applyAnthropicMessageDeltaUsage, o as readAnthropicUsageTokenCount, q as omitFoundryBearerCredentialHeaders, r as applyAnthropicMessageStartUsage, s as readLastAnthropicIterationUsage, v as projectAnthropicTools, w as findActiveAnthropicToolTurnAssistantIndex, x as toClaudeCodeToolName, y as reconcileAnthropicToolChoice } from "../anthropic-stream-reducer-
|
|
4
|
-
import { n as streamAnthropic, r as streamSimpleAnthropic } from "../anthropic-
|
|
1
|
+
import { _ as supportsClaudeAdaptiveThinking, b as supportsClaudeNativeXhighEffort, c as requiresClaudeDefaultSampling, d as resolveClaudeModelIdentity, f as resolveClaudeMythos5ModelIdentity, h as resolveClaudeSonnet5ModelIdentity, l as requiresClaudeMandatoryAdaptiveThinking, m as resolveClaudeOpus5ModelIdentity, p as resolveClaudeNativeThinkingLevelMap, s as bindsClaudeThinkingPrefix, u as resolveClaudeFable5ModelIdentity, y as supportsClaudeNativeMaxEffort } from "../src-DeKjbE8I.mjs";
|
|
2
|
+
import { C as mapAnthropicStopReason, D as resolveModelBoundThinkingReplayMode, E as resolveAnthropicThinkingEffort, O as usesClaudeFable5MessagesContract, S as defaultsClaudeAdaptiveThinking, T as requiresClaudeAdaptiveThinking, b as ANTHROPIC_CLAUDE_CODE_VERSION, k as usesClaudeStreamingRefusalContract, w as prepareClaudeNoPrefillRequestContext, x as applyClaudeRequestContract, y as ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK } from "../host-B4MeUNBc.mjs";
|
|
3
|
+
import { A as applyAnthropicFallbackBoundary, C as applyAnthropicThinkingBindingControls, D as ANTHROPIC_SERVER_SIDE_FALLBACKS, E as readAnthropicInputTransformations, G as resolveAnthropicServerCompactionPlan, J as usesFoundryBearerAuth, K as isAnthropicOAuthApiKey, M as resolveAnthropicFallbackServingModelCost, O as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, S as ANTHROPIC_OMITTED_REASONING_TEXT, T as logAnthropicThinkingDrops, _ as normalizeAnthropicToolChoice, a as readAnthropicPromptUsageSnapshot, b as resolveOriginalAnthropicToolName, c as applyAnthropicRefusal, g as normalizeAnthropicToolCallId, i as readAnthropicCacheWriteUsage, j as readAnthropicFallbackBoundary, k as CLAUDE_OPUS_FALLBACK_MODEL_COST, n as applyAnthropicMessageDeltaUsage, o as readAnthropicUsageTokenCount, q as omitFoundryBearerCredentialHeaders, r as applyAnthropicMessageStartUsage, s as readLastAnthropicIterationUsage, v as projectAnthropicTools, w as findActiveAnthropicToolTurnAssistantIndex, x as toClaudeCodeToolName, y as reconcileAnthropicToolChoice } from "../anthropic-stream-reducer-BvdYYWL8.mjs";
|
|
4
|
+
import { n as streamAnthropic, r as streamSimpleAnthropic } from "../anthropic-COtDvgtt.mjs";
|
|
5
5
|
export { ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK, ANTHROPIC_CLAUDE_CODE_VERSION, ANTHROPIC_OMITTED_REASONING_TEXT, ANTHROPIC_SERVER_SIDE_FALLBACKS, ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, CLAUDE_OPUS_FALLBACK_MODEL_COST, applyAnthropicFallbackBoundary, applyAnthropicMessageDeltaUsage, applyAnthropicMessageStartUsage, applyAnthropicRefusal, applyAnthropicThinkingBindingControls, applyClaudeRequestContract, bindsClaudeThinkingPrefix, defaultsClaudeAdaptiveThinking, findActiveAnthropicToolTurnAssistantIndex, isAnthropicOAuthApiKey, logAnthropicThinkingDrops, mapAnthropicStopReason, normalizeAnthropicToolCallId, normalizeAnthropicToolChoice, omitFoundryBearerCredentialHeaders, prepareClaudeNoPrefillRequestContext, projectAnthropicTools, readAnthropicCacheWriteUsage, readAnthropicFallbackBoundary, readAnthropicInputTransformations, readAnthropicPromptUsageSnapshot, readAnthropicUsageTokenCount, readLastAnthropicIterationUsage, reconcileAnthropicToolChoice, requiresClaudeAdaptiveThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAnthropicFallbackServingModelCost, resolveAnthropicServerCompactionPlan, resolveAnthropicThinkingEffort, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, resolveModelBoundThinkingReplayMode, resolveOriginalAnthropicToolName, streamAnthropic, streamSimpleAnthropic, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, toClaudeCodeToolName, usesClaudeFable5MessagesContract, usesClaudeStreamingRefusalContract, usesFoundryBearerAuth };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { c as readOpenAIResponsesCompactionWindow, s as OpenAIResponsesCompactionOutput, t as OPENAI_RESPONSES_APIS } from "../openai-responses-contracts-
|
|
2
|
-
import { i as resolveOpenAIResponsesServerCompactionPlan, r as resolveOpenAIResponsesPayloadPolicy } from "../openai-responses-payload-policy-
|
|
1
|
+
import { c as readOpenAIResponsesCompactionWindow, s as OpenAIResponsesCompactionOutput, t as OPENAI_RESPONSES_APIS } from "../openai-responses-contracts-Dflvrfa8.mjs";
|
|
2
|
+
import { i as resolveOpenAIResponsesServerCompactionPlan, r as resolveOpenAIResponsesPayloadPolicy } from "../openai-responses-payload-policy-C7GsA1y0.mjs";
|
|
3
3
|
export { OPENAI_RESPONSES_APIS, type OpenAIResponsesCompactionOutput, readOpenAIResponsesCompactionWindow, resolveOpenAIResponsesPayloadPolicy, resolveOpenAIResponsesServerCompactionPlan };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as OPENAI_RESPONSES_APIS } from "../openai-responses-contracts-
|
|
2
|
-
import { c as resolveOpenAIResponsesServerCompactionPlan, r as readOpenAIResponsesCompactionWindow, s as resolveOpenAIResponsesPayloadPolicy } from "../openai-responses-compaction-window-
|
|
1
|
+
import { i as OPENAI_RESPONSES_APIS } from "../openai-responses-contracts-DWrfMODE.mjs";
|
|
2
|
+
import { c as resolveOpenAIResponsesServerCompactionPlan, r as readOpenAIResponsesCompactionWindow, s as resolveOpenAIResponsesPayloadPolicy } from "../openai-responses-compaction-window-D6P5oZP5.mjs";
|
|
3
3
|
export { OPENAI_RESPONSES_APIS, readOpenAIResponsesCompactionWindow, resolveOpenAIResponsesPayloadPolicy, resolveOpenAIResponsesServerCompactionPlan };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { G as SimpleStreamOptions, J as StreamFunction, K as StopReason, O as Model, d as Context
|
|
2
|
-
import { _ as resolveOpenAIModelReasoningEfforts, a as BaseOpenAIStreamOptions, b as
|
|
1
|
+
import { G as SimpleStreamOptions, J as StreamFunction, K as StopReason, O as Model, d as Context } from "../types-4_uVs5WH.mjs";
|
|
2
|
+
import { S as supportsOpenAITemperature, _ as resolveOpenAIModelReasoningEfforts, a as BaseOpenAIStreamOptions, b as resolveOpenAISupportedReasoningEfforts, d as OpenAIApiReasoningEffort, f as OpenAIReasoningEffort, g as normalizeOpenAIReasoningEffort, h as isOpenAIGpt56Model, l as codeModeToolSurfaceObserver, m as isOpenAIGpt55Model, o as CodeModeToolSurfaceObservation, p as isOpenAIGpt54MiniModel, s as OpenAICompletionsOptions, u as reasoningTagTextPolicy, v as resolveOpenAIReasoningEffortForModel, x as supportsOpenAIReasoningEffort, y as resolveOpenAIReasoningEffortMapping } from "../provider-options-DprLsWh9.mjs";
|
|
3
3
|
import { a as reconcileOpenAIResponsesToolChoice, i as reconcileOpenAICompletionsToolChoice, n as OpenAIToolProjection, r as projectOpenAITools, t as OpenAICompletionsToolChoice } from "../openai-tool-projection-793cE3QX.mjs";
|
|
4
|
-
import "../types-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-
|
|
8
|
-
import
|
|
4
|
+
import "../types-DkJfb4W3.mjs";
|
|
5
|
+
import { t as ResolvedOpenAICompletionsCompat } from "../openai-completions-compat-JE7gqxb9.mjs";
|
|
6
|
+
import { a as ResponsesPromptObservation, l as OpenAIRequestReasoningEffort, o as responsesPromptObserver } from "../openai-responses-contracts-Dflvrfa8.mjs";
|
|
7
|
+
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-CJ_xEevu.mjs";
|
|
8
|
+
import { a as resolveResponsesTerminalStopReason, i as readResponsesReasoningTokens, n as isResponsesOutputLimitToolCallError, r as mapResponsesTerminalUsage, t as ResponsesTerminalUsagePayload } from "../openai-responses-terminal-usage-Dl3J6zrf.mjs";
|
|
9
9
|
import { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
|
|
10
10
|
import { ChatCompletionMessageParam } from "openai/resources/chat/completions.js";
|
|
11
11
|
//#region packages/ai/src/providers/azure-deployment-map.d.ts
|
|
@@ -40,14 +40,11 @@ export declare const streamSimpleOpenAICompletions: StreamFunction<"openai-compl
|
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region packages/ai/src/providers/openai-responses.d.ts
|
|
42
42
|
export interface OpenAIResponsesOptions extends BaseOpenAIStreamOptions {
|
|
43
|
-
reasoningEffort?:
|
|
43
|
+
reasoningEffort?: OpenAIRequestReasoningEffort;
|
|
44
44
|
reasoningSummary?: "auto" | "detailed" | "concise" | null;
|
|
45
45
|
replayResponsesItemIds?: boolean;
|
|
46
46
|
serviceTier?: ResponseCreateParamsStreaming["service_tier"];
|
|
47
47
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Generate function for OpenAI Responses API
|
|
50
|
-
*/
|
|
51
48
|
export declare const streamOpenAIResponses: StreamFunction<"openai-responses", OpenAIResponsesOptions>;
|
|
52
49
|
export declare const streamSimpleOpenAIResponses: StreamFunction<"openai-responses", SimpleStreamOptions>;
|
|
53
50
|
//#endregion
|
|
@@ -88,47 +85,6 @@ export declare function resolveResponsesMessageSnapshotCollapse(params: {
|
|
|
88
85
|
nextPhase: string | undefined;
|
|
89
86
|
}): ResponsesMessageSnapshotCollapse;
|
|
90
87
|
//#endregion
|
|
91
|
-
//#region packages/ai/src/providers/openai-responses-terminal-usage.d.ts
|
|
92
|
-
/** Terminal usage payload, modeled structurally so untyped callers can pass raw records. */
|
|
93
|
-
export type ResponsesTerminalUsagePayload = {
|
|
94
|
-
input_tokens?: number | null;
|
|
95
|
-
output_tokens?: number | null;
|
|
96
|
-
total_tokens?: number | null;
|
|
97
|
-
input_tokens_details?: {
|
|
98
|
-
cached_tokens?: number | null;
|
|
99
|
-
cache_write_tokens?: number | null;
|
|
100
|
-
} | null;
|
|
101
|
-
output_tokens_details?: {
|
|
102
|
-
reasoning_tokens?: number | null;
|
|
103
|
-
} | null;
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* Split a terminal usage payload into the priced buckets.
|
|
107
|
-
*
|
|
108
|
-
* OpenAI includes cache reads and writes in `input_tokens`, so both are subtracted out of the
|
|
109
|
-
* billable input bucket. `total_tokens` comes from the payload, but never below the sum of the
|
|
110
|
-
* split buckets: proxies routinely omit it (reporting 0 would understate the turn), and a payload
|
|
111
|
-
* whose `cached_tokens` exceeds `input_tokens` clamps the input bucket, leaving the reported total
|
|
112
|
-
* short of what the buckets actually price.
|
|
113
|
-
*/
|
|
114
|
-
export declare function mapResponsesTerminalUsage(usage: ResponsesTerminalUsagePayload | undefined | null): Pick<Usage, "input" | "output" | "cacheRead" | "cacheWrite" | "contextUsage" | "totalTokens"> | undefined;
|
|
115
|
-
/** Reasoning tokens are reported by the agent path only; the package path does not track them. */
|
|
116
|
-
export declare function readResponsesReasoningTokens(usage: ResponsesTerminalUsagePayload | undefined | null): number | undefined;
|
|
117
|
-
/**
|
|
118
|
-
* Resolve the terminal stop reason, including the two overrides every Responses path shares: a
|
|
119
|
-
* content-filtered turn is a provider error rather than a truncated answer, and a turn that
|
|
120
|
-
* produced tool calls reports `toolUse` instead of a plain stop.
|
|
121
|
-
*/
|
|
122
|
-
export declare function resolveResponsesTerminalStopReason(params: {
|
|
123
|
-
status: OpenAI.Responses.ResponseStatus | undefined;
|
|
124
|
-
terminalEventType?: "response.completed" | "response.incomplete";
|
|
125
|
-
incompleteReason?: string;
|
|
126
|
-
hasToolCall: boolean;
|
|
127
|
-
}): {
|
|
128
|
-
stopReason: StopReason;
|
|
129
|
-
errorMessage?: string;
|
|
130
|
-
};
|
|
131
|
-
//#endregion
|
|
132
88
|
//#region packages/ai/src/providers/openai-responses-tool-call-tracker.d.ts
|
|
133
89
|
export type ResponsesToolCallIdentity = {
|
|
134
90
|
itemId?: string;
|
|
@@ -136,6 +92,7 @@ export type ResponsesToolCallIdentity = {
|
|
|
136
92
|
};
|
|
137
93
|
export type ResponsesToolCallState = ResponsesToolCallIdentity & {
|
|
138
94
|
argumentStreamReliable: boolean;
|
|
95
|
+
argumentsStreamed: boolean;
|
|
139
96
|
outputIndex?: number;
|
|
140
97
|
};
|
|
141
98
|
type ResponsesToolCallEvent = {
|
|
@@ -164,4 +121,4 @@ export declare function mapOpenAIStopReason(reason: string | null, options?: {
|
|
|
164
121
|
allowSingularToolCall?: boolean;
|
|
165
122
|
}): OpenAIStopReasonResult;
|
|
166
123
|
//#endregion
|
|
167
|
-
export { type CodeModeToolSurfaceObservation, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OpenAIApiReasoningEffort, type OpenAICompletionsOptions, OpenAICompletionsToolChoice, OpenAIReasoningEffort, OpenAIToolProjection, type ResponsesPromptObservation, clampOpenAIPromptCacheKey, codeModeToolSurfaceObserver, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, normalizeOpenAIReasoningEffort, projectOpenAITools, reasoningTagTextPolicy, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveOpenAIModelReasoningEfforts, resolveOpenAIPromptCacheParams, resolveOpenAIReasoningEffortForModel, resolveOpenAISupportedReasoningEfforts, responsesPromptObserver, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
|
|
124
|
+
export { type CodeModeToolSurfaceObservation, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OpenAIApiReasoningEffort, type OpenAICompletionsOptions, type OpenAICompletionsToolChoice, OpenAIReasoningEffort, type OpenAIToolProjection, type ResponsesPromptObservation, ResponsesTerminalUsagePayload, clampOpenAIPromptCacheKey, codeModeToolSurfaceObserver, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, isResponsesOutputLimitToolCallError, mapResponsesTerminalUsage, normalizeOpenAIReasoningEffort, projectOpenAITools, readResponsesReasoningTokens, reasoningTagTextPolicy, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveOpenAIModelReasoningEfforts, resolveOpenAIPromptCacheParams, resolveOpenAIReasoningEffortForModel, resolveOpenAIReasoningEffortMapping, resolveOpenAISupportedReasoningEfforts, resolveResponsesTerminalStopReason, responsesPromptObserver, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
|
package/dist/internal/openai.mjs
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
3
|
-
import { f as
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
1
|
+
import { a as resolveOpenAIModelReasoningEfforts, c as resolveOpenAISupportedReasoningEfforts, i as normalizeOpenAIReasoningEffort, l as supportsOpenAIReasoningEffort, n as isOpenAIGpt55Model, o as resolveOpenAIReasoningEffortForModel, r as isOpenAIGpt56Model, s as resolveOpenAIReasoningEffortMapping, t as isOpenAIGpt54MiniModel, u as supportsOpenAITemperature } from "../openai-reasoning-effort-NlFZmfEu.mjs";
|
|
2
|
+
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-1wfaIszn.mjs";
|
|
3
|
+
import { d as readResponsesReasoningTokens, f as resolveResponsesTerminalStopReason, l as isResponsesOutputLimitToolCallError, u as mapResponsesTerminalUsage } from "../diagnostics-Dm4bisWG.mjs";
|
|
4
|
+
import { a as codeModeToolSurfaceObserver, o as reasoningTagTextPolicy } from "../simple-options-C6cFWj_f.mjs";
|
|
5
|
+
import { f as projectOpenAITools, m as reconcileOpenAIResponsesToolChoice, p as reconcileOpenAICompletionsToolChoice } from "../openai-transport-params-DQeuAvBl.mjs";
|
|
6
|
+
import { a as convertMessages } from "../openai-completions-stream-Bu98b0Hv.mjs";
|
|
7
|
+
import { h as responsesPromptObserver } from "../openai-responses-contracts-DWrfMODE.mjs";
|
|
6
8
|
import { t as mapOpenAIStopReason } from "../openai-stop-reason-Drnn_6Qj.mjs";
|
|
7
|
-
import {
|
|
9
|
+
import { C as isResponsesTextContentPartType, S as isAzureResponsesTextDeltaEventType, T as resolveResponsesMessageSnapshotCollapse, _ as AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, b as OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, g as readResponsesToolCallItemIdentity, h as createResponsesToolCallTracker, v as AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, w as isResponsesTextDeltaEventType, x as isAzureResponsesTextDeltaEvent, y as OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE } from "../openai-responses-shared-CwsziD_m.mjs";
|
|
8
10
|
import { i as resolveAzureDeploymentNameFromMap, n as isTraditionalAzureOpenAIHost, r as parseAzureDeploymentNameMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "../azure-openai-responses-client-compat-C7K7QfUE.mjs";
|
|
9
|
-
import { n as streamOpenAICompletions, r as streamSimpleOpenAICompletions } from "../openai-completions-
|
|
10
|
-
import { n as streamOpenAIResponses, r as streamSimpleOpenAIResponses } from "../openai-responses-
|
|
11
|
-
export { AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, clampOpenAIPromptCacheKey, codeModeToolSurfaceObserver, convertMessages, createResponsesToolCallTracker, isAzureResponsesTextDeltaEvent, isAzureResponsesTextDeltaEventType, isOpenAICompatibleAzureResponsesBaseUrl, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, isResponsesTextContentPartType, isResponsesTextDeltaEventType, isTraditionalAzureOpenAIHost, mapOpenAIStopReason, mapResponsesTerminalUsage, normalizeOpenAIReasoningEffort, parseAzureDeploymentNameMap, projectOpenAITools, readResponsesReasoningTokens, readResponsesToolCallItemIdentity, reasoningTagTextPolicy, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveAzureDeploymentNameFromMap, resolveOpenAIModelReasoningEfforts, resolveOpenAIPromptCacheParams, resolveOpenAIReasoningEffortForModel, resolveOpenAISupportedReasoningEfforts, resolveResponsesMessageSnapshotCollapse, resolveResponsesTerminalStopReason, responsesPromptObserver, streamOpenAICompletions, streamOpenAIResponses, streamSimpleOpenAICompletions, streamSimpleOpenAIResponses, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
|
|
11
|
+
import { n as streamOpenAICompletions, r as streamSimpleOpenAICompletions } from "../openai-completions-DJ1Vm-CD.mjs";
|
|
12
|
+
import { n as streamOpenAIResponses, r as streamSimpleOpenAIResponses } from "../openai-responses-BejZzQCP.mjs";
|
|
13
|
+
export { AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, clampOpenAIPromptCacheKey, codeModeToolSurfaceObserver, convertMessages, createResponsesToolCallTracker, isAzureResponsesTextDeltaEvent, isAzureResponsesTextDeltaEventType, isOpenAICompatibleAzureResponsesBaseUrl, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, isResponsesOutputLimitToolCallError, isResponsesTextContentPartType, isResponsesTextDeltaEventType, isTraditionalAzureOpenAIHost, mapOpenAIStopReason, mapResponsesTerminalUsage, normalizeOpenAIReasoningEffort, parseAzureDeploymentNameMap, projectOpenAITools, readResponsesReasoningTokens, readResponsesToolCallItemIdentity, reasoningTagTextPolicy, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveAzureDeploymentNameFromMap, resolveOpenAIModelReasoningEfforts, resolveOpenAIPromptCacheParams, resolveOpenAIReasoningEffortForModel, resolveOpenAIReasoningEffortMapping, resolveOpenAISupportedReasoningEfforts, resolveResponsesMessageSnapshotCollapse, resolveResponsesTerminalStopReason, responsesPromptObserver, streamOpenAICompletions, streamOpenAIResponses, streamSimpleOpenAICompletions, streamSimpleOpenAIResponses, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "../index-
|
|
2
|
-
import { G as SimpleStreamOptions, H as ProviderStreamOptions, O as Model, Y as StreamOptions, a as AssistantMessage, d as Context, j as ModelThinkingLevel, n as Api, ot as Usage, s as AssistantMessageEventStreamContract } from "../types-
|
|
3
|
-
import { i as getEventStreamCompletion } from "../event-stream-
|
|
4
|
-
import { a as RegisteredApiProvider, t as ApiProvider } from "../api-registry-
|
|
5
|
-
import "../types-
|
|
1
|
+
import "../index-DaF2QbwS.mjs";
|
|
2
|
+
import { G as SimpleStreamOptions, H as ProviderStreamOptions, O as Model, Y as StreamOptions, a as AssistantMessage, d as Context, j as ModelThinkingLevel, n as Api, ot as Usage, s as AssistantMessageEventStreamContract } from "../types-4_uVs5WH.mjs";
|
|
3
|
+
import { i as getEventStreamCompletion } from "../event-stream-CCoa-qSI.mjs";
|
|
4
|
+
import { a as RegisteredApiProvider, t as ApiProvider } from "../api-registry-Ba2Cv-ut.mjs";
|
|
5
|
+
import "../types-DkJfb4W3.mjs";
|
|
6
6
|
import { t as sanitizeSurrogates } from "../sanitize-unicode-BZiVbGwK.mjs";
|
|
7
|
-
import { _ as parseTerminalToolCallArguments } from "../transport-stream-shared-
|
|
7
|
+
import { _ as parseTerminalToolCallArguments } from "../transport-stream-shared-BbUkFaHi.mjs";
|
|
8
8
|
//#region packages/ai/src/internal/default-runtime.d.ts
|
|
9
9
|
export declare const defaultApiRegistry: {
|
|
10
10
|
registerApiProvider: <TApi extends Api, TOptions extends StreamOptions>(provider: ApiProvider<TApi, TOptions>, sourceId?: string) => void;
|
|
@@ -134,8 +134,6 @@ export declare function decodeOpenAICodexJwtPayload(token: string): OpenAICodexJ
|
|
|
134
134
|
export declare function resolveOpenAICodexAccountId(token: string): string | null;
|
|
135
135
|
//#endregion
|
|
136
136
|
//#region packages/ai/src/utils/overflow.d.ts
|
|
137
|
-
/** Detects DS4-style raw token-count context overflow errors. */
|
|
138
|
-
export declare function isConfiguredContextSizeOverflowError(errorMessage: string): boolean;
|
|
139
137
|
declare const CONTEXT_OVERFLOW_PATTERN_SCOPES: {
|
|
140
138
|
readonly "assistant-error": RegExp[];
|
|
141
139
|
readonly "failover-explicit": RegExp[];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { a as isProviderRefusalAssistantError } from "../diagnostics-CPeq9F7y.mjs";
|
|
2
2
|
import { a as getEventStreamCompletion } from "../event-stream-D8PARQfL.mjs";
|
|
3
3
|
import { n as createApiRegistry, t as createLlmRuntime } from "../stream-CREqxHgU.mjs";
|
|
4
|
-
import { A as applyProviderReportedUsageCost, M as clampThinkingLevel, N as getSupportedThinkingLevels, P as modelsAreEqual, j as calculateCost, v as sanitizeSurrogates } from "../host-
|
|
4
|
+
import { A as applyProviderReportedUsageCost, M as clampThinkingLevel, N as getSupportedThinkingLevels, P as modelsAreEqual, j as calculateCost, v as sanitizeSurrogates } from "../host-B4MeUNBc.mjs";
|
|
5
5
|
import { n as getEnvApiKey, t as findEnvKeys } from "../env-api-keys-bktO00EJ.mjs";
|
|
6
|
-
import { D as repairJson, E as parseStreamingJson, O as headersToRecord, T as parseJsonWithRepair, h as parseTerminalToolCallArguments, k as shortHash, w as createToolArgumentPreviewSchedule } from "../transport-stream-shared-
|
|
6
|
+
import { D as repairJson, E as parseStreamingJson, O as headersToRecord, T as parseJsonWithRepair, h as parseTerminalToolCallArguments, k as shortHash, w as createToolArgumentPreviewSchedule } from "../transport-stream-shared-D-6FQSHm.mjs";
|
|
7
7
|
import { t as createDeferredEventBuffer } from "../deferred-event-buffer-DAvyP7qA.mjs";
|
|
8
8
|
import { n as onLlmRequestActivity, t as notifyLlmRequestActivity } from "../llm-request-activity-BjtkplhG.mjs";
|
|
9
|
-
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, n as createFirstStreamEventTimeoutError, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "../stream-first-event-timeout-
|
|
10
|
-
import { t as createReasoningTagTextPartitioner } from "../reasoning-tag-text-partitioner-
|
|
9
|
+
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, n as createFirstStreamEventTimeoutError, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "../stream-first-event-timeout-C9ZadkJW.mjs";
|
|
10
|
+
import { t as createReasoningTagTextPartitioner } from "../reasoning-tag-text-partitioner-Dy9IO8Dc.mjs";
|
|
11
11
|
import { t as createSseByteGuard } from "../streaming-byte-guard-CC-HMn_u.mjs";
|
|
12
12
|
import { n as registerSessionResourceCleanup, t as cleanupSessionResources } from "../session-resources-CkR4WWy1.mjs";
|
|
13
13
|
import { n as resolveOpenAICodexAccountId, t as decodeOpenAICodexJwtPayload } from "../openai-chatgpt-jwt-KWcgd0d_.mjs";
|
|
@@ -35,10 +35,6 @@ const { stream, complete, streamSimple, completeSimple } = defaultLlmRuntime;
|
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region packages/ai/src/utils/overflow.ts
|
|
37
37
|
const CONFIGURED_CONTEXT_SIZE_OVERFLOW_RE = /prompt has [\d,]+ tokens?, but the configured context size is [\d,]+ tokens?/i;
|
|
38
|
-
/** Detects DS4-style raw token-count context overflow errors. */
|
|
39
|
-
function isConfiguredContextSizeOverflowError(errorMessage) {
|
|
40
|
-
return CONFIGURED_CONTEXT_SIZE_OVERFLOW_RE.test(errorMessage);
|
|
41
|
-
}
|
|
42
38
|
const CONTEXT_OVERFLOW_PATTERN_SCOPES = {
|
|
43
39
|
"assistant-error": [
|
|
44
40
|
/prompt is too long/i,
|
|
@@ -199,4 +195,4 @@ function isContextOverflow(message, contextWindow) {
|
|
|
199
195
|
return false;
|
|
200
196
|
}
|
|
201
197
|
//#endregion
|
|
202
|
-
export { applyProviderReportedUsageCost, calculateCost, clampThinkingLevel, cleanupSessionResources, clearApiProviders, complete, completeSimple, createDeferredEventBuffer, createFirstStreamEventAbortController, createFirstStreamEventTimeoutError, createReasoningTagTextPartitioner, createSseByteGuard, createToolArgumentPreviewSchedule, decodeOpenAICodexJwtPayload, defaultApiRegistry, defaultLlmRuntime, findEnvKeys, getApiProvider, getApiProviders, getEnvApiKey, getEventStreamCompletion, getFirstStreamEventTimeoutHandler, getFirstStreamEventTimeoutMs, getSupportedThinkingLevels, headersToRecord,
|
|
198
|
+
export { applyProviderReportedUsageCost, calculateCost, clampThinkingLevel, cleanupSessionResources, clearApiProviders, complete, completeSimple, createDeferredEventBuffer, createFirstStreamEventAbortController, createFirstStreamEventTimeoutError, createReasoningTagTextPartitioner, createSseByteGuard, createToolArgumentPreviewSchedule, decodeOpenAICodexJwtPayload, defaultApiRegistry, defaultLlmRuntime, findEnvKeys, getApiProvider, getApiProviders, getEnvApiKey, getEventStreamCompletion, getFirstStreamEventTimeoutHandler, getFirstStreamEventTimeoutMs, getSupportedThinkingLevels, headersToRecord, isContextOverflow, matchesContextOverflowMessage, modelsAreEqual, notifyLlmRequestActivity, onLlmRequestActivity, parseJsonWithRepair, parseStreamingJson, parseTerminalToolCallArguments, registerSessionResourceCleanup, repairJson, resolveOpenAICodexAccountId, sanitizeSurrogates, shortHash, stream, streamSimple, withFirstStreamEventTimeout };
|