@openclaw/ai 2026.8.1-beta.3 → 2026.9.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{anthropic-B8KwTtlb.mjs → anthropic-DI4PZKKB.mjs} +18 -16
- package/dist/{anthropic-compaction-replay-4Zx7-aCr.mjs → anthropic-compaction-replay-nhKaCXu6.mjs} +8 -12
- package/dist/{anthropic-payload-policy-CSx7MoKH.d.mts → anthropic-payload-policy-B_0n0enE.d.mts} +2 -1
- package/dist/{api-registry-DFxSnFqG.d.mts → api-registry-CTd8NzcD.d.mts} +2 -1
- package/dist/{azure-openai-responses-Aa4mVcYG.mjs → azure-openai-responses-D8dI0ekg.mjs} +3 -3
- package/dist/diagnostics.d.mts +0 -1
- package/dist/diagnostics.mjs +1 -1
- package/dist/event-stream-BKp4fOt_.d.mts +1 -0
- package/dist/{event-stream-D91-ohD_.d.mts → event-stream-LiXePESD.d.mts} +1 -2
- package/dist/event-stream.d.mts +2 -1
- package/dist/{google-yDRnipeq.mjs → google-Od-LLdVK.mjs} +3 -3
- package/dist/{google-shared-M1dl64nz.mjs → google-shared-Bgr9lFPw.mjs} +14 -7
- package/dist/{google-vertex-DCJHM_a5.mjs → google-vertex-aerRSXc4.mjs} +4 -4
- package/dist/{host-DF_yxOsA.mjs → host-D51fmkH6.mjs} +4 -8
- package/dist/{host-DJq_FGcz.d.mts → host-DsbPMFU6.d.mts} +3 -3
- package/dist/index-Qbej8io0.d.mts +3 -0
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +2 -3
- package/dist/internal/anthropic.d.mts +5 -4
- package/dist/internal/anthropic.mjs +4 -4
- package/dist/internal/openai-responses-payload-policy.d.mts +1 -1
- package/dist/internal/openai-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.d.mts +5 -5
- package/dist/internal/openai.mjs +8 -7
- package/dist/internal/runtime.d.mts +16 -5
- package/dist/internal/runtime.mjs +6 -6
- package/dist/internal/shared.d.mts +2 -2
- package/dist/internal/shared.mjs +3 -3
- package/dist/{json-parse-CDnesDM_.mjs → json-parse-BuAJEbdW.mjs} +18 -2
- package/dist/{mistral-D6hRXI7A.mjs → mistral-EiHdymeb.mjs} +17 -21
- package/dist/{openai-chatgpt-responses-C339VIfT.mjs → openai-chatgpt-responses-DHpF9o1e.mjs} +28 -11
- package/dist/openai-completions-EFPiUGfS.mjs +399 -0
- package/dist/{openai-completions-compat-B0KTleXp.d.mts → openai-completions-compat-BefmHT26.d.mts} +3 -3
- package/dist/openai-completions-stream-DUlGwRMz.mjs +1621 -0
- package/dist/{openai-responses-BXEcr-Tp.mjs → openai-responses-BogP8OjX.mjs} +6 -5
- package/dist/{openai-responses-contracts-CD75pQ0m.d.mts → openai-responses-contracts-Dvj_UtPy.d.mts} +3 -3
- package/dist/{openai-responses-contracts-DvILoqBk.mjs → openai-responses-contracts-QUY12X0B.mjs} +4 -18
- package/dist/{openai-responses-payload-policy-BDo8CQsx.mjs → openai-responses-payload-policy-D8EdimYe.mjs} +3 -7
- package/dist/{openai-responses-prompt-observer-internal-BG-1AsBI.mjs → openai-responses-prompt-observer-internal-Cd4hJG-S.mjs} +3 -2
- package/dist/{openai-responses-shared-Cvt5MgEm.mjs → openai-responses-shared-DJThc6jW.mjs} +150 -1362
- package/dist/openai-stop-reason-Drnn_6Qj.mjs +28 -0
- package/dist/openai-tool-schema-ho-hIkQf.mjs +1695 -0
- package/dist/{provider-error-C8mBRJDl.mjs → provider-error-DDOs_Bz0.mjs} +1 -3
- package/dist/{provider-options-Cc5ZQ6Aa.d.mts → provider-options-MdMBLzlU.d.mts} +4 -3
- package/dist/{provider-transcript-transform--gtf0ZbR.mjs → provider-transcript-transform-C01bQ5a3.mjs} +1 -1
- package/dist/provider-types.d.mts +5 -3
- package/dist/providers.d.mts +1 -2
- package/dist/providers.mjs +9 -9
- package/dist/{sanitize-unicode-BP7HLLZn.mjs → sanitize-unicode-DCkltN94.mjs} +1 -2
- package/dist/simple-options-CFj7x3J4.mjs +118 -0
- package/dist/{anthropic-BQXQudmA.mjs → src-Bu3FiFAG.mjs} +1 -0
- package/dist/{streaming-byte-guard-BrbkbwUu.mjs → streaming-byte-guard-CC-HMn_u.mjs} +5 -6
- package/dist/string-normalization--fwJ4S2q.mjs +16 -0
- package/dist/{tool-schema-json-projection-FEr-jOoZ.mjs → tool-schema-json-projection-qvTEs5Am.mjs} +2 -2
- package/dist/{simple-options-oqsXB6U3.mjs → transport-stream-shared-ljShVIZB.mjs} +10 -118
- package/dist/transport-stream-shared-rvaCyFYt.d.mts +138 -0
- package/dist/{transport-utils-Bv0FHkd0.mjs → transport-utils-LJ1_rbi-.mjs} +8 -5
- package/dist/transports.d.mts +23 -117
- package/dist/transports.mjs +43 -1038
- package/dist/{types-DTAP49HF.d.mts → types-DhLoJbFm.d.mts} +34 -17
- package/dist/types-GiAjXatj.d.mts +1 -0
- package/dist/types.d.mts +4 -3
- package/dist/types.mjs +1 -2
- package/dist/utf16-slice-qz3nsy87.mjs +84 -0
- package/dist/{validation-DYNNrU9u.d.mts → validation-Dk7q7NMN.d.mts} +1 -2
- package/dist/validation.d.mts +1 -1
- package/package.json +5 -5
- package/dist/event-stream-BVVgDSdq.d.mts +0 -1
- package/dist/headers-B_e4-1J0.mjs +0 -9
- package/dist/index-BVVgDSdq.d.mts +0 -1
- package/dist/openai-completions-D88orSJ9.mjs +0 -632
- package/dist/openai-stop-reason-9OONKyAm.mjs +0 -579
- package/dist/openai-tool-projection-CHGLt03m.mjs +0 -426
- package/dist/record-coerce-DdXsgUd_.mjs +0 -23
- package/dist/src-D2H6yKkH.mjs +0 -2
- package/dist/stream-first-event-timeout-DvDeSucC.d.mts +0 -29
- package/dist/string-coerce-fsri9iCu.mjs +0 -34
- package/dist/types-BVVgDSdq.d.mts +0 -1
- package/dist/utf16-slice-CvGodqok.mjs +0 -29
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { n as getEnvApiKey, r as __exportAll } from "./env-api-keys-DrgeBuva.mjs";
|
|
2
|
-
import { d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, p as supportsClaudeAdaptiveThinking, u as resolveClaudeOpus5ModelIdentity } from "./
|
|
2
|
+
import { d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, p as supportsClaudeAdaptiveThinking, u as resolveClaudeOpus5ModelIdentity } from "./src-Bu3FiFAG.mjs";
|
|
3
3
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { a as
|
|
7
|
-
import { n as projectProviderError } from "./provider-error-
|
|
4
|
+
import { o as isRecord } from "./utf16-slice-qz3nsy87.mjs";
|
|
5
|
+
import { r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-DCkltN94.mjs";
|
|
6
|
+
import { S as usesClaudeStreamingRefusalContract, _ as prepareClaudeNoPrefillRequestContext, a as describeToolResultMediaPlaceholder, c as extractToolResultText, d as isImageWithMediaPayload, f as ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK, g as mapAnthropicStopReason, m as applyClaudeRequestContract, n as getAiTransportHost, p as ANTHROPIC_CLAUDE_CODE_VERSION, r as resolveAiTransportHeaderSentinels, s as extractToolResultBlockText, v as requiresClaudeAdaptiveThinking, x as usesClaudeFable5MessagesContract, y as resolveAnthropicThinkingEffort } from "./host-D51fmkH6.mjs";
|
|
7
|
+
import { n as projectProviderError } from "./provider-error-DDOs_Bz0.mjs";
|
|
8
8
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { c as splitSystemPromptCacheBoundary, l as stripSystemPromptCacheBoundary, n as buildBaseOptions, r as clampMaxTokensToModel, t as adjustMaxTokensForThinking } from "./simple-options-CFj7x3J4.mjs";
|
|
10
|
+
import { t as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./transport-utils-LJ1_rbi-.mjs";
|
|
11
|
+
import { A as resolveAnthropicImageMediaType, C as readAnthropicFallbackBoundary, D as usesFoundryBearerAuth, E as omitFoundryBearerCredentialHeaders, O as createAnthropicInlineImageBudget, S as applyAnthropicFallbackBoundary, T as applyAnthropicRefusal, _ as ANTHROPIC_OMITTED_REASONING_TEXT, a as applyAnthropicMessageDeltaUsage, b as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, d as normalizeAnthropicToolCallId, f as normalizeAnthropicToolChoice, g as toClaudeCodeToolName, h as resolveOriginalAnthropicToolName, i as suppressAnthropicCompaction, j as applyAnthropicCacheControlToMessages, k as normalizeAnthropicInlineContent, m as reconcileAnthropicToolChoice, n as createCompactionCapture, o as applyAnthropicMessageStartUsage, p as projectAnthropicTools, r as isAnthropicReplayRejection, t as buildAnthropicReplayPlan, v as findActiveAnthropicToolTurnAssistantIndex, w as resolveAnthropicFallbackServingModelCost, y as ANTHROPIC_SERVER_SIDE_FALLBACKS } from "./anthropic-compaction-replay-nhKaCXu6.mjs";
|
|
12
|
+
import { _ as transportAbortError, f as notifyProviderHttpResponse, s as finalizeTerminalToolCallArguments } from "./transport-stream-shared-ljShVIZB.mjs";
|
|
11
13
|
import { t as createDeferredEventBuffer } from "./deferred-event-buffer-DAvyP7qA.mjs";
|
|
12
|
-
import { n as parseStreamingJson, t as
|
|
14
|
+
import { n as parseJsonWithRepair, r as parseStreamingJson, t as createToolArgumentPreviewSchedule } from "./json-parse-BuAJEbdW.mjs";
|
|
13
15
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-BjtkplhG.mjs";
|
|
14
|
-
import { t as
|
|
15
|
-
import { t as transformProviderMessages } from "./provider-transcript-transform--gtf0ZbR.mjs";
|
|
16
|
+
import { t as transformProviderMessages } from "./provider-transcript-transform-C01bQ5a3.mjs";
|
|
16
17
|
import { i as resolveCloudflareBaseUrl, n as hasCopilotVisionInput, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-NCJtz9i0.mjs";
|
|
17
18
|
import Anthropic from "@anthropic-ai/sdk";
|
|
18
19
|
import { Stream } from "@anthropic-ai/sdk/core/streaming.js";
|
|
@@ -109,22 +110,20 @@ const ANTHROPIC_MESSAGE_EVENTS = /* @__PURE__ */ new Set([
|
|
|
109
110
|
]);
|
|
110
111
|
async function* iterateAnthropicEvents(response, requireMessageStop = false) {
|
|
111
112
|
if (!response.body) throw new Error("Attempted to iterate over an Anthropic response with no body");
|
|
112
|
-
let sawMessageStart = false;
|
|
113
113
|
let sawMessageEnd = false;
|
|
114
114
|
for await (const sse of Stream.rawEvents(response)) {
|
|
115
115
|
if (sse.event === "error") throw new Error(sse.data);
|
|
116
116
|
if (!ANTHROPIC_MESSAGE_EVENTS.has(sse.event ?? "")) continue;
|
|
117
117
|
try {
|
|
118
118
|
const event = parseJsonWithRepair(sse.data);
|
|
119
|
-
if (event.type === "
|
|
120
|
-
else if (event.type === "message_stop") sawMessageEnd = true;
|
|
119
|
+
if (event.type === "message_stop") sawMessageEnd = true;
|
|
121
120
|
yield event;
|
|
122
121
|
} catch (error) {
|
|
123
122
|
if (error instanceof SyntaxError) throw new Error(MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE, { cause: error });
|
|
124
123
|
throw error;
|
|
125
124
|
}
|
|
126
125
|
}
|
|
127
|
-
if (
|
|
126
|
+
if (requireMessageStop && !sawMessageEnd) throw new Error("Anthropic stream ended before message_stop");
|
|
128
127
|
}
|
|
129
128
|
const streamAnthropic = (model, context, options) => {
|
|
130
129
|
const stream = new AssistantMessageEventStream();
|
|
@@ -205,9 +204,11 @@ const streamAnthropic = (model, context, options) => {
|
|
|
205
204
|
});
|
|
206
205
|
const blocks = output.content;
|
|
207
206
|
const blockIndexes = /* @__PURE__ */ new Map();
|
|
207
|
+
const toolArgumentPreviewSchedules = /* @__PURE__ */ new WeakMap();
|
|
208
208
|
const sealedToolCalls = [];
|
|
209
209
|
const compactionCapture = createCompactionCapture(output, model, requestOptions);
|
|
210
|
-
|
|
210
|
+
const requireMessageStop = refusalBuffer !== void 0 || model.provider === "anthropic" && isAnthropicPublicEndpoint(model.baseUrl);
|
|
211
|
+
for await (const event of iterateAnthropicEvents(response, requireMessageStop)) if (event.type === "message_start") {
|
|
211
212
|
output.responseId = event.message.id;
|
|
212
213
|
output.responseModel = event.message.model;
|
|
213
214
|
messageStartPromptUsage = applyAnthropicMessageStartUsage(output.usage, event.message.usage);
|
|
@@ -316,6 +317,7 @@ const streamAnthropic = (model, context, options) => {
|
|
|
316
317
|
};
|
|
317
318
|
output.content.push(block);
|
|
318
319
|
blockIndexes.set(event.index, output.content.length - 1);
|
|
320
|
+
toolArgumentPreviewSchedules.set(block, createToolArgumentPreviewSchedule());
|
|
319
321
|
eventSink.push({
|
|
320
322
|
type: "toolcall_start",
|
|
321
323
|
contentIndex: output.content.length - 1,
|
|
@@ -354,7 +356,7 @@ const streamAnthropic = (model, context, options) => {
|
|
|
354
356
|
const block = index === void 0 ? void 0 : blocks[index];
|
|
355
357
|
if (index !== void 0 && block?.type === "toolCall") {
|
|
356
358
|
block.partialJson = (block.partialJson ?? "") + event.delta.partial_json;
|
|
357
|
-
block.arguments = parseStreamingJson(block.partialJson);
|
|
359
|
+
if (toolArgumentPreviewSchedules.get(block)?.(block.partialJson.length)) block.arguments = parseStreamingJson(block.partialJson);
|
|
358
360
|
eventSink.push({
|
|
359
361
|
type: "toolcall_delta",
|
|
360
362
|
contentIndex: index,
|
package/dist/{anthropic-compaction-replay-4Zx7-aCr.mjs → anthropic-compaction-replay-nhKaCXu6.mjs}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { o as resolveClaudeFable5ModelIdentity, s as resolveClaudeModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "./
|
|
2
|
-
import {
|
|
3
|
-
import { n as getAiTransportHost } from "./host-
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import { r as asNonNegativeFiniteNumber, s as parseStrictPositiveInteger } from "./number-coercion-H9qHik3g.mjs";
|
|
1
|
+
import { o as resolveClaudeFable5ModelIdentity, s as resolveClaudeModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "./src-Bu3FiFAG.mjs";
|
|
2
|
+
import { l as normalizeNullableString, o as isRecord, u as normalizeOptionalLowercaseString } from "./utf16-slice-qz3nsy87.mjs";
|
|
3
|
+
import { n as getAiTransportHost } from "./host-D51fmkH6.mjs";
|
|
4
|
+
import { a as estimateBase64DecodedBytes } from "./provider-error-DDOs_Bz0.mjs";
|
|
5
|
+
import { r as asNonNegativeFiniteNumber } from "./number-coercion-H9qHik3g.mjs";
|
|
7
6
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import { a as resolveProviderEndpoint, o as resolveProviderRequestCapabilities, t as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-
|
|
7
|
+
import { c as splitSystemPromptCacheBoundary, f as sortPromptCacheToolsByName, l as stripSystemPromptCacheBoundary } from "./simple-options-CFj7x3J4.mjs";
|
|
8
|
+
import { a as resolveProviderEndpoint, o as resolveProviderRequestCapabilities, t as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-qvTEs5Am.mjs";
|
|
9
|
+
import { s as parsePositiveInteger } from "./transport-utils-LJ1_rbi-.mjs";
|
|
10
10
|
import { t as shortHash } from "./hash-CHgqbJmD.mjs";
|
|
11
11
|
//#region packages/ai/src/transports/anthropic-payload-policy.ts
|
|
12
12
|
/**
|
|
@@ -16,10 +16,6 @@ import { t as shortHash } from "./hash-CHgqbJmD.mjs";
|
|
|
16
16
|
*/
|
|
17
17
|
const ANTHROPIC_CACHE_CONTROL_LIMIT = 4;
|
|
18
18
|
const ANTHROPIC_COMPACT_THRESHOLD_MIN = 5e4;
|
|
19
|
-
function parsePositiveInteger(value) {
|
|
20
|
-
if (typeof value === "number" && Number.isFinite(value) && value > 0) return Math.floor(value);
|
|
21
|
-
return typeof value === "string" ? parseStrictPositiveInteger(value) : void 0;
|
|
22
|
-
}
|
|
23
19
|
/** Resolve the Anthropic input-token trigger, including the API's minimum. */
|
|
24
20
|
function resolveAnthropicCompactThreshold(contextWindow, configured) {
|
|
25
21
|
const configuredThreshold = parsePositiveInteger(configured);
|
package/dist/{anthropic-payload-policy-CSx7MoKH.d.mts → anthropic-payload-policy-B_0n0enE.d.mts}
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { D as Model } from "./types-
|
|
1
|
+
import { D as Model } from "./types-DhLoJbFm.mjs";
|
|
2
|
+
import "./index-Qbej8io0.mjs";
|
|
2
3
|
//#region packages/ai/src/transports/anthropic-payload-policy.d.ts
|
|
3
4
|
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
|
4
5
|
type AnthropicServiceTier = "auto" | "standard_only";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { D as Model, H as StreamFunction, U as StreamOptions, d as Context, n as Api, s as AssistantMessageEventStreamContract, z as SimpleStreamOptions } from "./types-
|
|
1
|
+
import { D as Model, H as StreamFunction, U as StreamOptions, d as Context, n as Api, s as AssistantMessageEventStreamContract, z as SimpleStreamOptions } from "./types-DhLoJbFm.mjs";
|
|
2
|
+
import "./index-Qbej8io0.mjs";
|
|
2
3
|
//#region packages/ai/src/api-registry.d.ts
|
|
3
4
|
/** Runtime stream adapter signature stored in the API provider registry. */
|
|
4
5
|
type ApiStreamFunction = (model: Model, context: Context, options?: StreamOptions) => AssistantMessageEventStreamContract;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as getEnvApiKey } from "./env-api-keys-DrgeBuva.mjs";
|
|
2
2
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
3
|
-
import { n as getAiTransportHost } from "./host-
|
|
3
|
+
import { n as getAiTransportHost } from "./host-D51fmkH6.mjs";
|
|
4
4
|
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-mZTCdRPo.mjs";
|
|
5
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
6
|
-
import { a as resolveResponsesReasoningEffort, i as createResponsesAssistantOutput, o as runResponsesStreamLifecycle, r as convertResponsesMessages, t as applyCommonResponsesParams } from "./openai-responses-shared-
|
|
5
|
+
import { n as buildBaseOptions } from "./simple-options-CFj7x3J4.mjs";
|
|
6
|
+
import { a as resolveResponsesReasoningEffort, i as createResponsesAssistantOutput, o as runResponsesStreamLifecycle, r as convertResponsesMessages, t as applyCommonResponsesParams } from "./openai-responses-shared-DJThc6jW.mjs";
|
|
7
7
|
import { i as resolveAzureDeploymentNameFromMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-C7K7QfUE.mjs";
|
|
8
8
|
import OpenAI, { AzureOpenAI } from "openai";
|
|
9
9
|
//#region packages/ai/src/providers/azure-openai-responses.ts
|
package/dist/diagnostics.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { a as extractDiagnosticError, i as createAssistantMessageDiagnostic, n as DiagnosticErrorInfo, o as formatThrownValue, r as appendAssistantMessageDiagnostic, t as AssistantMessageDiagnostic } from "./diagnostics-BaTA9eVl.mjs";
|
|
2
2
|
import { n as ProviderErrorRedactor, r as configureProviderErrorRedactor } from "./provider-error-CzNw4BWX.mjs";
|
|
3
|
-
|
|
4
3
|
//#region packages/ai/src/utils/credential-redaction.d.ts
|
|
5
4
|
type DiagnosticMediaField = {
|
|
6
5
|
kind: "context";
|
package/dist/diagnostics.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-COpOtRwq.mjs";
|
|
2
|
-
import { r as projectDiagnosticValue, t as configureProviderErrorRedactor } from "./provider-error-
|
|
2
|
+
import { r as projectDiagnosticValue, t as configureProviderErrorRedactor } from "./provider-error-DDOs_Bz0.mjs";
|
|
3
3
|
export { appendAssistantMessageDiagnostic, configureProviderErrorRedactor, createAssistantMessageDiagnostic, extractDiagnosticError, formatThrownValue, projectDiagnosticValue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./event-stream-LiXePESD.mjs";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { a as AssistantMessage, o as AssistantMessageEvent, s as AssistantMessageEventStreamContract } from "./types-
|
|
2
|
-
|
|
1
|
+
import { a as AssistantMessage, o as AssistantMessageEvent, s as AssistantMessageEventStreamContract } from "./types-DhLoJbFm.mjs";
|
|
3
2
|
//#region packages/llm-core/src/utils/event-stream.d.ts
|
|
4
3
|
/** Generic async-iterable event stream with a separately awaited final result. */
|
|
5
4
|
declare class EventStream<T, R = T> implements AsyncIterable<T> {
|
package/dist/event-stream.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
1
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-LiXePESD.mjs";
|
|
2
|
+
import "./event-stream-BKp4fOt_.mjs";
|
|
2
3
|
export { AssistantMessageEventStream, EventStream, createAssistantMessageEventStream };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as getEnvApiKey } from "./env-api-keys-DrgeBuva.mjs";
|
|
2
2
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
3
|
-
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-
|
|
4
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
5
|
-
import { i as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-
|
|
3
|
+
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-D51fmkH6.mjs";
|
|
4
|
+
import { n as buildBaseOptions } from "./simple-options-CFj7x3J4.mjs";
|
|
5
|
+
import { i as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-Bgr9lFPw.mjs";
|
|
6
6
|
import { GoogleGenAI } from "@google/genai";
|
|
7
7
|
//#region packages/ai/src/providers/google.ts
|
|
8
8
|
let toolCallCounter = 0;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { i as clampThinkingLevel, r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-
|
|
2
|
-
import { a as describeToolResultMediaPlaceholder, c as extractToolResultText, d as isImageWithMediaPayload } from "./host-
|
|
3
|
-
import {
|
|
1
|
+
import { i as clampThinkingLevel, r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-DCkltN94.mjs";
|
|
2
|
+
import { a as describeToolResultMediaPlaceholder, c as extractToolResultText, d as isImageWithMediaPayload } from "./host-D51fmkH6.mjs";
|
|
3
|
+
import { f as sortPromptCacheToolsByName, l as stripSystemPromptCacheBoundary } from "./simple-options-CFj7x3J4.mjs";
|
|
4
|
+
import { _ as transportAbortError, n as coerceTransportToolCallArguments, p as notifyProviderStreamOpened, t as assignTransportErrorDetails } from "./transport-stream-shared-ljShVIZB.mjs";
|
|
4
5
|
import { t as googleFlashSupportsMinimalThinking } from "./google-thinking-level-C-V3tecN.mjs";
|
|
5
|
-
import { t as transformProviderMessages } from "./provider-transcript-transform
|
|
6
|
+
import { t as transformProviderMessages } from "./provider-transcript-transform-C01bQ5a3.mjs";
|
|
6
7
|
import { FinishReason, FunctionCallingConfigMode, ThinkingLevel } from "@google/genai";
|
|
7
8
|
//#region packages/ai/src/providers/google-shared.ts
|
|
8
9
|
/**
|
|
9
10
|
* Shared utilities for Google Generative AI and Google Vertex providers.
|
|
10
11
|
*/
|
|
12
|
+
const GOOGLE_MODEL_RESOURCE_PREFIX = /^(?:(?:projects\/[^/]+\/locations\/[^/]+\/)?publishers\/google\/models\/|google\/|models\/)/u;
|
|
11
13
|
/**
|
|
12
14
|
* Determines whether a streamed Gemini `Part` should be treated as "thinking".
|
|
13
15
|
*
|
|
@@ -83,6 +85,7 @@ function convertMessages(model, context) {
|
|
|
83
85
|
const transformedMessages = transformProviderMessages(context.messages, model, normalizeToolCallId);
|
|
84
86
|
const requiresToolCallThoughtSignature = model.provider !== "google-gemini-cli" && (isGemini3ProModel(model) || isGemini3FlashModel(model));
|
|
85
87
|
const pendingToolResultImageTurns = [];
|
|
88
|
+
const sameRouteToolCallIds = /* @__PURE__ */ new Set();
|
|
86
89
|
let activeToolResultParts;
|
|
87
90
|
const flushToolResultRun = () => {
|
|
88
91
|
contents.push(...pendingToolResultImageTurns);
|
|
@@ -130,6 +133,7 @@ function convertMessages(model, context) {
|
|
|
130
133
|
});
|
|
131
134
|
else parts.push({ text: sanitizeSurrogates(block.thinking) });
|
|
132
135
|
} else if (block.type === "toolCall") {
|
|
136
|
+
if (isSameProviderAndModel && model.provider !== "google-gemini-cli") sameRouteToolCallIds.add(block.id);
|
|
133
137
|
const args = coerceTransportToolCallArguments(block.arguments);
|
|
134
138
|
const thoughtSignature = resolveThoughtSignature(isSameProviderAndModel, block.thoughtSignature) ?? (!sawFunctionCall && requiresToolCallThoughtSignature ? "skip_thought_signature_validator" : void 0);
|
|
135
139
|
sawFunctionCall = true;
|
|
@@ -137,7 +141,7 @@ function convertMessages(model, context) {
|
|
|
137
141
|
functionCall: {
|
|
138
142
|
name: block.name,
|
|
139
143
|
args,
|
|
140
|
-
...requiresToolCallId(model.id) ? { id: block.id } : {}
|
|
144
|
+
...sameRouteToolCallIds.has(block.id) || requiresToolCallId(model.id) ? { id: block.id } : {}
|
|
141
145
|
},
|
|
142
146
|
...thoughtSignature && { thoughtSignature }
|
|
143
147
|
};
|
|
@@ -160,7 +164,7 @@ function convertMessages(model, context) {
|
|
|
160
164
|
mimeType: imageBlock.mimeType,
|
|
161
165
|
data: imageBlock.data
|
|
162
166
|
} }));
|
|
163
|
-
const includeId = requiresToolCallId(model.id);
|
|
167
|
+
const includeId = sameRouteToolCallIds.has(msg.toolCallId) || requiresToolCallId(model.id);
|
|
164
168
|
const functionResponsePart = { functionResponse: {
|
|
165
169
|
name: msg.toolName,
|
|
166
170
|
response: msg.isError ? { error: responseValue } : { output: responseValue },
|
|
@@ -410,6 +414,7 @@ function mapStopReason(reason) {
|
|
|
410
414
|
case FinishReason.OTHER:
|
|
411
415
|
case FinishReason.LANGUAGE:
|
|
412
416
|
case FinishReason.MALFORMED_FUNCTION_CALL:
|
|
417
|
+
case FinishReason.TOO_MANY_TOOL_CALLS:
|
|
413
418
|
case FinishReason.UNEXPECTED_TOOL_CALL:
|
|
414
419
|
case FinishReason.NO_IMAGE: return "error";
|
|
415
420
|
default: throw new Error(`Unhandled stop reason: ${String(reason)}`);
|
|
@@ -453,6 +458,8 @@ async function consumeGoogleGenerateContentStream(params) {
|
|
|
453
458
|
};
|
|
454
459
|
for await (const chunk of params.chunks) {
|
|
455
460
|
params.output.responseId ||= chunk.responseId;
|
|
461
|
+
const responseModel = chunk.modelVersion?.trim();
|
|
462
|
+
if (responseModel && params.model.id.replace(GOOGLE_MODEL_RESOURCE_PREFIX, "") !== responseModel.replace(GOOGLE_MODEL_RESOURCE_PREFIX, "")) params.output.responseModel ||= responseModel;
|
|
456
463
|
if (chunk.usageMetadata) {
|
|
457
464
|
for (const field of Object.keys(knownUsage)) {
|
|
458
465
|
const value = chunk.usageMetadata[field];
|
|
@@ -588,7 +595,7 @@ async function consumeGoogleGenerateContentStream(params) {
|
|
|
588
595
|
});
|
|
589
596
|
}
|
|
590
597
|
}
|
|
591
|
-
if (candidate?.finishReason) {
|
|
598
|
+
if (candidate?.finishReason && candidate.finishReason !== FinishReason.FINISH_REASON_UNSPECIFIED) {
|
|
592
599
|
sawTerminalReason = true;
|
|
593
600
|
params.output.stopReason = mapStopReason(candidate.finishReason);
|
|
594
601
|
if (params.output.stopReason === "error") {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-
|
|
4
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
5
|
-
import { i as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-
|
|
2
|
+
import { d as normalizeOptionalString } from "./utf16-slice-qz3nsy87.mjs";
|
|
3
|
+
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-D51fmkH6.mjs";
|
|
4
|
+
import { n as buildBaseOptions } from "./simple-options-CFj7x3J4.mjs";
|
|
5
|
+
import { i as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-Bgr9lFPw.mjs";
|
|
6
6
|
import { GoogleGenAI, ResourceScope } from "@google/genai";
|
|
7
7
|
//#region packages/ai/src/providers/google-vertex.ts
|
|
8
8
|
const API_VERSION = "v1";
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, o as resolveClaudeFable5ModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "./
|
|
2
|
-
import "./
|
|
3
|
-
import {
|
|
4
|
-
import { i as clampThinkingLevel, t as sanitizeSurrogates } from "./sanitize-unicode-BP7HLLZn.mjs";
|
|
5
|
-
import { a as isRecord } from "./record-coerce-DdXsgUd_.mjs";
|
|
6
|
-
import { t as truncateUtf16Safe } from "./utf16-slice-CvGodqok.mjs";
|
|
1
|
+
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, o as resolveClaudeFable5ModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "./src-Bu3FiFAG.mjs";
|
|
2
|
+
import { c as normalizeLowercaseStringOrEmpty, o as isRecord, t as truncateUtf16Safe } from "./utf16-slice-qz3nsy87.mjs";
|
|
3
|
+
import { i as clampThinkingLevel, t as sanitizeSurrogates } from "./sanitize-unicode-DCkltN94.mjs";
|
|
7
4
|
//#region packages/ai/src/providers/anthropic-model-contract.ts
|
|
8
5
|
const ANTHROPIC_CLAUDE_CODE_VERSION = "2.1.75";
|
|
9
6
|
const ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK = `x-anthropic-billing-header: cc_version=${ANTHROPIC_CLAUDE_CODE_VERSION}; cc_entrypoint=sdk-cli;`;
|
|
@@ -257,8 +254,7 @@ function describeUnsupportedToolResultMedia(blocks, support) {
|
|
|
257
254
|
return omittedImage ? "[unsupported tool-result image omitted]" : void 0;
|
|
258
255
|
}
|
|
259
256
|
function formatToolResultText(params) {
|
|
260
|
-
const
|
|
261
|
-
const body = trimmed ? `${trimmed}${params.omittedMediaPlaceholder ? `\n${params.omittedMediaPlaceholder}` : ""}` : params.omittedMediaPlaceholder ?? params.mediaPlaceholder ?? "(no tool output)";
|
|
257
|
+
const body = params.text.trim() ? `${params.text}${params.omittedMediaPlaceholder ? `\n${params.omittedMediaPlaceholder}` : ""}` : params.omittedMediaPlaceholder ?? params.mediaPlaceholder ?? "(no tool output)";
|
|
262
258
|
return `${params.isError ? "[tool error] " : ""}${body}`;
|
|
263
259
|
}
|
|
264
260
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as Model, V as StreamFn, d as Context, n as Api } from "./types-
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { D as Model, V as StreamFn, d as Context, n as Api } from "./types-DhLoJbFm.mjs";
|
|
2
|
+
import "./index-Qbej8io0.mjs";
|
|
3
|
+
import { n as ApiRegistry } from "./api-registry-CTd8NzcD.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 {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, f as supportsClaude1MContext, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, m as supportsClaudeFastMode, n as CLAUDE_OPUS_5_THINKING_PROFILE, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, r as CLAUDE_SONNET_5_THINKING_PROFILE, s as resolveClaudeModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as resolveClaudeOpus5ModelIdentity } from "./anthropic-BECQCNdF.mjs";
|
|
2
2
|
import { a as extractDiagnosticError, i as createAssistantMessageDiagnostic, n as DiagnosticErrorInfo, o as formatThrownValue, r as appendAssistantMessageDiagnostic, t as AssistantMessageDiagnostic } from "./diagnostics-BaTA9eVl.mjs";
|
|
3
|
-
import { $ as Transport, A as OpenAIResponsesCompat, B as StopReason, C as KnownImagesApi, D as Model, E as Message, F as ProviderImagesOptions, G as TextSignatureV1, H as StreamFunction, I as ProviderReplayState, J as ThinkingLevel, K as ThinkingBudgets, L as ProviderResponse, M as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, N as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, O as ModelThinkingLevel, P as Provider, Q as ToolResultMessage, R as ProviderStreamOptions, S as KnownApi, T as MaybePromise, U as StreamOptions, V as StreamFn, W as TextContent, X as Tool, Y as ThinkingLevelMap, Z as ToolCall, _ as ImagesModel, a as AssistantMessage, b as ImagesProvider, c as AssistantMessageEventStreamLike, d as Context, et as Usage, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, j as OpenRouterRouting, k as OpenAICompletionsCompat, l as CacheRetention, m as ImagesContext, n as Api, nt as ValidateToolArgumentsFn, o as AssistantMessageEvent, p as ImagesApi, q as ThinkingContent, r as AssistantDeliveryTtsFacts, rt as VercelGatewayRouting, s as AssistantMessageEventStreamContract, t as AnthropicMessagesCompat, tt as UserMessage, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as SimpleStreamOptions } from "./types-
|
|
4
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
5
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
6
|
-
import
|
|
7
|
-
import { a as
|
|
8
|
-
|
|
3
|
+
import { $ as Transport, A as OpenAIResponsesCompat, B as StopReason, C as KnownImagesApi, D as Model, E as Message, F as ProviderImagesOptions, G as TextSignatureV1, H as StreamFunction, I as ProviderReplayState, J as ThinkingLevel, K as ThinkingBudgets, L as ProviderResponse, M as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, N as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, O as ModelThinkingLevel, P as Provider, Q as ToolResultMessage, R as ProviderStreamOptions, S as KnownApi, T as MaybePromise, U as StreamOptions, V as StreamFn, W as TextContent, X as Tool, Y as ThinkingLevelMap, Z as ToolCall, _ as ImagesModel, a as AssistantMessage, b as ImagesProvider, c as AssistantMessageEventStreamLike, d as Context, et as Usage, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, j as OpenRouterRouting, k as OpenAICompletionsCompat, l as CacheRetention, m as ImagesContext, n as Api, nt as ValidateToolArgumentsFn, o as AssistantMessageEvent, p as ImagesApi, q as ThinkingContent, r as AssistantDeliveryTtsFacts, rt as VercelGatewayRouting, s as AssistantMessageEventStreamContract, t as AnthropicMessagesCompat, tt as UserMessage, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as SimpleStreamOptions } from "./types-DhLoJbFm.mjs";
|
|
4
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-LiXePESD.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-Dk7q7NMN.mjs";
|
|
6
|
+
import "./index-Qbej8io0.mjs";
|
|
7
|
+
import { a as RegisteredApiProvider, i as ApiStreamSimpleFunction, n as ApiRegistry, o as createApiRegistry, r as ApiStreamFunction, t as ApiProvider } from "./api-registry-CTd8NzcD.mjs";
|
|
8
|
+
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-DsbPMFU6.mjs";
|
|
9
9
|
//#region packages/ai/src/stream.d.ts
|
|
10
10
|
/** Creates an isolated LLM runtime backed by the supplied provider registry. */
|
|
11
11
|
declare function createLlmRuntime(registry?: ApiRegistry): {
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, f as supportsClaude1MContext, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, m as supportsClaudeFastMode, n as CLAUDE_OPUS_5_THINKING_PROFILE, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, r as CLAUDE_SONNET_5_THINKING_PROFILE, s as resolveClaudeModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as resolveClaudeOpus5ModelIdentity } from "./
|
|
1
|
+
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, f as supportsClaude1MContext, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, m as supportsClaudeFastMode, n as CLAUDE_OPUS_5_THINKING_PROFILE, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, r as CLAUDE_SONNET_5_THINKING_PROFILE, s as resolveClaudeModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as resolveClaudeOpus5ModelIdentity } from "./src-Bu3FiFAG.mjs";
|
|
2
2
|
import { n as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, t as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE } from "./types-BDdaOVi2.mjs";
|
|
3
3
|
import { i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-COpOtRwq.mjs";
|
|
4
4
|
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
5
5
|
import { n as validateToolCall, t as validateToolArguments } from "./validation-B61OhAio.mjs";
|
|
6
|
-
import "./src-D2H6yKkH.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-D51fmkH6.mjs";
|
|
9
8
|
export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, EventStream, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, appendAssistantMessageDiagnostic, configureAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, createLlmRuntime, extractDiagnosticError, formatThrownValue, getAiTransportHost, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, s as resolveClaudeModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "../anthropic-BECQCNdF.mjs";
|
|
2
2
|
import { t as AssistantMessageDiagnostic } from "../diagnostics-BaTA9eVl.mjs";
|
|
3
|
-
import { B as StopReason, D as Model, H as StreamFunction, d as Context, et as Usage, z as SimpleStreamOptions } from "../types-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
3
|
+
import { B as StopReason, D as Model, H as StreamFunction, d as Context, et as Usage, z as SimpleStreamOptions } from "../types-DhLoJbFm.mjs";
|
|
4
|
+
import "../index-Qbej8io0.mjs";
|
|
5
|
+
import { n as AnthropicOptions, r as AnthropicThinkingDisplay, t as AnthropicEffort } from "../provider-options-MdMBLzlU.mjs";
|
|
6
|
+
import "../types-GiAjXatj.mjs";
|
|
7
|
+
import { o as resolveAnthropicServerCompactionPlan } from "../anthropic-payload-policy-B_0n0enE.mjs";
|
|
7
8
|
//#region packages/ai/src/providers/anthropic.d.ts
|
|
8
9
|
type AnthropicCompactionOptions = AnthropicOptions & {
|
|
9
10
|
anthropicServerCompaction?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, s as resolveClaudeModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "../
|
|
2
|
-
import { S as usesClaudeStreamingRefusalContract, _ as prepareClaudeNoPrefillRequestContext, b as resolveModelBoundThinkingReplayMode, f as ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK, g as mapAnthropicStopReason, h as defaultsClaudeAdaptiveThinking, m as applyClaudeRequestContract, p as ANTHROPIC_CLAUDE_CODE_VERSION, v as requiresClaudeAdaptiveThinking, x as usesClaudeFable5MessagesContract, y as resolveAnthropicThinkingEffort } from "../host-
|
|
3
|
-
import { C as readAnthropicFallbackBoundary, D as usesFoundryBearerAuth, E as omitFoundryBearerCredentialHeaders, I as resolveAnthropicServerCompactionPlan, S as applyAnthropicFallbackBoundary, T as applyAnthropicRefusal, _ as ANTHROPIC_OMITTED_REASONING_TEXT, a as applyAnthropicMessageDeltaUsage, b as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, c as readAnthropicPromptUsageSnapshot, d as normalizeAnthropicToolCallId, f as normalizeAnthropicToolChoice, g as toClaudeCodeToolName, h as resolveOriginalAnthropicToolName, l as readAnthropicUsageTokenCount, m as reconcileAnthropicToolChoice, o as applyAnthropicMessageStartUsage, p as projectAnthropicTools, s as readAnthropicCacheWriteUsage, u as readLastAnthropicIterationUsage, v as findActiveAnthropicToolTurnAssistantIndex, w as resolveAnthropicFallbackServingModelCost, x as CLAUDE_OPUS_FALLBACK_MODEL_COST, y as ANTHROPIC_SERVER_SIDE_FALLBACKS } from "../anthropic-compaction-replay-
|
|
4
|
-
import { n as streamAnthropic, r as streamSimpleAnthropic } from "../anthropic-
|
|
1
|
+
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, s as resolveClaudeModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "../src-Bu3FiFAG.mjs";
|
|
2
|
+
import { S as usesClaudeStreamingRefusalContract, _ as prepareClaudeNoPrefillRequestContext, b as resolveModelBoundThinkingReplayMode, f as ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK, g as mapAnthropicStopReason, h as defaultsClaudeAdaptiveThinking, m as applyClaudeRequestContract, p as ANTHROPIC_CLAUDE_CODE_VERSION, v as requiresClaudeAdaptiveThinking, x as usesClaudeFable5MessagesContract, y as resolveAnthropicThinkingEffort } from "../host-D51fmkH6.mjs";
|
|
3
|
+
import { C as readAnthropicFallbackBoundary, D as usesFoundryBearerAuth, E as omitFoundryBearerCredentialHeaders, I as resolveAnthropicServerCompactionPlan, S as applyAnthropicFallbackBoundary, T as applyAnthropicRefusal, _ as ANTHROPIC_OMITTED_REASONING_TEXT, a as applyAnthropicMessageDeltaUsage, b as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, c as readAnthropicPromptUsageSnapshot, d as normalizeAnthropicToolCallId, f as normalizeAnthropicToolChoice, g as toClaudeCodeToolName, h as resolveOriginalAnthropicToolName, l as readAnthropicUsageTokenCount, m as reconcileAnthropicToolChoice, o as applyAnthropicMessageStartUsage, p as projectAnthropicTools, s as readAnthropicCacheWriteUsage, u as readLastAnthropicIterationUsage, v as findActiveAnthropicToolTurnAssistantIndex, w as resolveAnthropicFallbackServingModelCost, x as CLAUDE_OPUS_FALLBACK_MODEL_COST, y as ANTHROPIC_SERVER_SIDE_FALLBACKS } from "../anthropic-compaction-replay-nhKaCXu6.mjs";
|
|
4
|
+
import { n as streamAnthropic, r as streamSimpleAnthropic } from "../anthropic-DI4PZKKB.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, applyClaudeRequestContract, defaultsClaudeAdaptiveThinking, findActiveAnthropicToolTurnAssistantIndex, mapAnthropicStopReason, normalizeAnthropicToolCallId, normalizeAnthropicToolChoice, omitFoundryBearerCredentialHeaders, prepareClaudeNoPrefillRequestContext, projectAnthropicTools, readAnthropicCacheWriteUsage, readAnthropicFallbackBoundary, 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 { t as OPENAI_RESPONSES_APIS } from "../openai-responses-contracts-
|
|
1
|
+
import { t as OPENAI_RESPONSES_APIS } from "../openai-responses-contracts-Dvj_UtPy.mjs";
|
|
2
2
|
import { i as resolveOpenAIResponsesServerCompactionPlan } from "../openai-responses-payload-policy-CNGFT9zr.mjs";
|
|
3
3
|
export { OPENAI_RESPONSES_APIS, resolveOpenAIResponsesServerCompactionPlan };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as OPENAI_RESPONSES_APIS } from "../openai-responses-contracts-
|
|
2
|
-
import { i as resolveOpenAIResponsesServerCompactionPlan } from "../openai-responses-payload-policy-
|
|
1
|
+
import { i as OPENAI_RESPONSES_APIS } from "../openai-responses-contracts-QUY12X0B.mjs";
|
|
2
|
+
import { i as resolveOpenAIResponsesServerCompactionPlan } from "../openai-responses-payload-policy-D8EdimYe.mjs";
|
|
3
3
|
export { OPENAI_RESPONSES_APIS, resolveOpenAIResponsesServerCompactionPlan };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { B as StopReason, D as Model, H as StreamFunction, d as Context, et as Usage, z as SimpleStreamOptions } from "../types-
|
|
2
|
-
import { C as supportsOpenAITemperature, S as supportsOpenAIReasoningEffort, _ as isOpenAIGpt55Model, a as CodeModeToolSurfaceObservation, b as resolveOpenAIReasoningEffortForModel, c as codeModeToolSurfaceObserver, d as projectOpenAITools, f as reconcileOpenAICompletionsToolChoice, g as isOpenAIGpt54MiniModel, h as OpenAIReasoningEffort, i as BaseOpenAIStreamOptions, l as OpenAICompletionsToolChoice, m as OpenAIApiReasoningEffort, o as OpenAICompletionsOptions, p as reconcileOpenAIResponsesToolChoice, u as OpenAIToolProjection, v as isOpenAIGpt56Model, x as resolveOpenAISupportedReasoningEfforts, y as normalizeOpenAIReasoningEffort } from "../provider-options-
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import { B as StopReason, D as Model, H as StreamFunction, d as Context, et as Usage, z as SimpleStreamOptions } from "../types-DhLoJbFm.mjs";
|
|
2
|
+
import { C as supportsOpenAITemperature, S as supportsOpenAIReasoningEffort, _ as isOpenAIGpt55Model, a as CodeModeToolSurfaceObservation, b as resolveOpenAIReasoningEffortForModel, c as codeModeToolSurfaceObserver, d as projectOpenAITools, f as reconcileOpenAICompletionsToolChoice, g as isOpenAIGpt54MiniModel, h as OpenAIReasoningEffort, i as BaseOpenAIStreamOptions, l as OpenAICompletionsToolChoice, m as OpenAIApiReasoningEffort, o as OpenAICompletionsOptions, p as reconcileOpenAIResponsesToolChoice, u as OpenAIToolProjection, v as isOpenAIGpt56Model, x as resolveOpenAISupportedReasoningEfforts, y as normalizeOpenAIReasoningEffort } from "../provider-options-MdMBLzlU.mjs";
|
|
3
|
+
import "../types-GiAjXatj.mjs";
|
|
4
|
+
import { o as ResponsesPromptObservation, s as responsesPromptObserver } from "../openai-responses-contracts-Dvj_UtPy.mjs";
|
|
5
|
+
import { t as ResolvedOpenAICompletionsCompat } from "../openai-completions-compat-BefmHT26.mjs";
|
|
5
6
|
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-2uo_1OR1.mjs";
|
|
6
7
|
import OpenAI from "openai";
|
|
7
8
|
import { TSchema } from "typebox";
|
|
8
9
|
import { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
|
|
9
10
|
import { ChatCompletionMessageParam } from "openai/resources/chat/completions.js";
|
|
10
|
-
|
|
11
11
|
//#region packages/ai/src/providers/agent-tools-parameter-schema.d.ts
|
|
12
12
|
/**
|
|
13
13
|
* Narrow structural view of the host's model compat config. packages/ai must stay
|
package/dist/internal/openai.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { S as supportsOpenAITemperature, _ as isOpenAIGpt56Model, b as resolveOpenAISupportedReasoningEfforts, g as isOpenAIGpt55Model, h as isOpenAIGpt54MiniModel, m as responsesPromptObserver, v as normalizeOpenAIReasoningEffort, x as supportsOpenAIReasoningEffort, y as resolveOpenAIReasoningEffortForModel } from "../openai-responses-contracts-DvILoqBk.mjs";
|
|
2
1
|
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-mZTCdRPo.mjs";
|
|
3
|
-
import { t as projectRuntimeToolInputSchema } from "../tool-schema-json-projection-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { t as projectRuntimeToolInputSchema } from "../tool-schema-json-projection-qvTEs5Am.mjs";
|
|
3
|
+
import { g as convertMessages } from "../openai-completions-stream-DUlGwRMz.mjs";
|
|
4
|
+
import { A as isAzureResponsesTextDeltaEvent, D as AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, E as AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, M as isResponsesTextContentPartType, N as isResponsesTextDeltaEventType, O as OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, P as resolveResponsesMessageSnapshotCollapse, T as readResponsesToolCallItemIdentity, d as resolveResponsesTerminalStopReason, j as isAzureResponsesTextDeltaEventType, k as OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, l as mapResponsesTerminalUsage, u as readResponsesReasoningTokens, w as createResponsesToolCallTracker } from "../openai-responses-shared-DJThc6jW.mjs";
|
|
6
5
|
import { t as codeModeToolSurfaceObserver } from "../provider-options-AvldWZt8.mjs";
|
|
7
|
-
import { n as
|
|
6
|
+
import { _ as cleanSchemaForGemini, a as resolveOpenAIProjectedToolsStrictToolFlag, b as reconcileOpenAIResponsesToolChoice, c as extractToolSchemaModelCompat, d as shouldOmitEmptyArrayItems, f as stripUnsupportedSchemaKeywords, g as GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS, h as findLlamacppGbnfSchemaViolations, i as normalizeStrictOpenAIJsonSchema, l as normalizeToolParameterSchema, m as cleanSchemaForLlamacppGbnf, n as isStrictOpenAIJsonSchemaCompatible, o as findOpenAIStrictSchemaViolations, p as LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD, r as normalizeOpenAIStrictToolParameters, s as normalizeOpenAIStrictCompatSchema, t as findOpenAIStrictToolProjectionDiagnostics, u as resolveUnsupportedToolSchemaKeywords, v as projectOpenAITools, y as reconcileOpenAICompletionsToolChoice } from "../openai-tool-schema-ho-hIkQf.mjs";
|
|
7
|
+
import { S as supportsOpenAITemperature, _ as isOpenAIGpt56Model, b as resolveOpenAISupportedReasoningEfforts, g as isOpenAIGpt55Model, h as isOpenAIGpt54MiniModel, m as responsesPromptObserver, v as normalizeOpenAIReasoningEffort, x as supportsOpenAIReasoningEffort, y as resolveOpenAIReasoningEffortForModel } from "../openai-responses-contracts-QUY12X0B.mjs";
|
|
8
|
+
import { t as mapOpenAIStopReason } from "../openai-stop-reason-Drnn_6Qj.mjs";
|
|
8
9
|
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-
|
|
10
|
+
import { n as streamOpenAICompletions, r as streamSimpleOpenAICompletions } from "../openai-completions-EFPiUGfS.mjs";
|
|
11
|
+
import { n as streamOpenAIResponses, r as streamSimpleOpenAIResponses } from "../openai-responses-BogP8OjX.mjs";
|
|
11
12
|
export { AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS, LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, clampOpenAIPromptCacheKey, cleanSchemaForGemini, cleanSchemaForLlamacppGbnf, codeModeToolSurfaceObserver, convertMessages, createResponsesToolCallTracker, extractToolSchemaModelCompat, findLlamacppGbnfSchemaViolations, findOpenAIStrictSchemaViolations, findOpenAIStrictToolProjectionDiagnostics, isAzureResponsesTextDeltaEvent, isAzureResponsesTextDeltaEventType, isOpenAICompatibleAzureResponsesBaseUrl, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, isResponsesTextContentPartType, isResponsesTextDeltaEventType, isStrictOpenAIJsonSchemaCompatible, isTraditionalAzureOpenAIHost, mapOpenAIStopReason, mapResponsesTerminalUsage, normalizeOpenAIReasoningEffort, normalizeOpenAIStrictCompatSchema, normalizeOpenAIStrictToolParameters, normalizeStrictOpenAIJsonSchema, normalizeToolParameterSchema, parseAzureDeploymentNameMap, projectOpenAITools, projectRuntimeToolInputSchema, readResponsesReasoningTokens, readResponsesToolCallItemIdentity, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveAzureDeploymentNameFromMap, resolveOpenAIProjectedToolsStrictToolFlag, resolveOpenAIReasoningEffortForModel, resolveOpenAISupportedReasoningEfforts, resolveResponsesMessageSnapshotCollapse, resolveResponsesTerminalStopReason, resolveUnsupportedToolSchemaKeywords, responsesPromptObserver, shouldOmitEmptyArrayItems, streamOpenAICompletions, streamOpenAIResponses, streamSimpleOpenAICompletions, streamSimpleOpenAIResponses, stripUnsupportedSchemaKeywords, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { D as Model, O as ModelThinkingLevel, R as ProviderStreamOptions, U as StreamOptions, a as AssistantMessage, d as Context, et as Usage, n as Api, s as AssistantMessageEventStreamContract, z as SimpleStreamOptions } from "../types-
|
|
2
|
-
import
|
|
1
|
+
import { D as Model, O as ModelThinkingLevel, R as ProviderStreamOptions, U as StreamOptions, a as AssistantMessage, d as Context, et as Usage, n as Api, s as AssistantMessageEventStreamContract, z as SimpleStreamOptions } from "../types-DhLoJbFm.mjs";
|
|
2
|
+
import "../index-Qbej8io0.mjs";
|
|
3
|
+
import { a as RegisteredApiProvider, t as ApiProvider } from "../api-registry-CTd8NzcD.mjs";
|
|
4
|
+
import "../types-GiAjXatj.mjs";
|
|
3
5
|
import { t as sanitizeSurrogates } from "../sanitize-unicode-BZiVbGwK.mjs";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
+
import { C as FirstStreamEventInternalOptions, D as getFirstStreamEventTimeoutHandler, E as createFirstStreamEventTimeoutError, O as getFirstStreamEventTimeoutMs, S as FirstStreamEventAbortController, T as createFirstStreamEventAbortController, g as parseTerminalToolCallArguments, k as withFirstStreamEventTimeout, w as FirstStreamEventTimeoutContext } from "../transport-stream-shared-rvaCyFYt.mjs";
|
|
6
7
|
//#region packages/ai/src/internal/default-runtime.d.ts
|
|
7
8
|
declare const defaultApiRegistry: {
|
|
8
9
|
registerApiProvider: <TApi extends Api, TOptions extends StreamOptions>(provider: ApiProvider<TApi, TOptions>, sourceId?: string) => void;
|
|
@@ -98,6 +99,16 @@ declare function parseJsonWithRepair(json: string): unknown;
|
|
|
98
99
|
* @returns Parsed object or empty object if parsing fails
|
|
99
100
|
*/
|
|
100
101
|
declare function parseStreamingJson(partialJson: string | undefined): Record<string, unknown>;
|
|
102
|
+
/** Returns true when the streamed argument buffer crossed its next preview checkpoint. */
|
|
103
|
+
type ToolArgumentPreviewSchedule = (accumulatedChars: number) => boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Streamed tool-call arguments are preview-only; the terminal parse re-reads
|
|
106
|
+
* the full buffer authoritatively at content_block_stop. Reparsing every delta
|
|
107
|
+
* scans an ever-growing buffer and makes assembly quadratic in the argument
|
|
108
|
+
* size, so refresh previews on a geometric length schedule instead — bounded
|
|
109
|
+
* staleness, linear total parse work.
|
|
110
|
+
*/
|
|
111
|
+
declare function createToolArgumentPreviewSchedule(): ToolArgumentPreviewSchedule;
|
|
101
112
|
//#endregion
|
|
102
113
|
//#region packages/ai/src/utils/llm-request-activity.d.ts
|
|
103
114
|
declare function notifyLlmRequestActivity(signal: AbortSignal | undefined): void;
|
|
@@ -235,4 +246,4 @@ type SseByteGuard = {
|
|
|
235
246
|
};
|
|
236
247
|
declare function createSseByteGuard(reader: ReadableStreamDefaultReader<Uint8Array>, opts: ReadSseStreamWithLimitOptions): SseByteGuard;
|
|
237
248
|
//#endregion
|
|
238
|
-
export { ContextOverflowMessageScope, FirstStreamEventAbortController, FirstStreamEventInternalOptions, FirstStreamEventTimeoutContext, OpenAICodexJwtPayload, ReadSseStreamWithLimitOptions, type ReasoningTagTextDelta, type ReasoningTagTextPartitioner, SessionResourceCleanup, SseByteGuard, SseStreamOverflow, applyProviderReportedUsageCost, calculateCost, clampThinkingLevel, cleanupSessionResources, clearApiProviders, complete, completeSimple, createDeferredEventBuffer, createFirstStreamEventAbortController, createFirstStreamEventTimeoutError, createReasoningTagTextPartitioner, createSseByteGuard, decodeOpenAICodexJwtPayload, defaultApiRegistry, defaultLlmRuntime, findEnvKeys, getApiProvider, getApiProviders, getEnvApiKey, getFirstStreamEventTimeoutHandler, getFirstStreamEventTimeoutMs, getSupportedThinkingLevels, headersToRecord, isConfiguredContextSizeOverflowError, isContextOverflow, matchesContextOverflowMessage, modelsAreEqual, notifyLlmRequestActivity, onLlmRequestActivity, parseJsonWithRepair, parseStreamingJson, registerSessionResourceCleanup, repairJson, resolveOpenAICodexAccountId, sanitizeSurrogates, shortHash, stream, streamSimple, withFirstStreamEventTimeout };
|
|
249
|
+
export { ContextOverflowMessageScope, FirstStreamEventAbortController, FirstStreamEventInternalOptions, FirstStreamEventTimeoutContext, OpenAICodexJwtPayload, ReadSseStreamWithLimitOptions, type ReasoningTagTextDelta, type ReasoningTagTextPartitioner, SessionResourceCleanup, SseByteGuard, SseStreamOverflow, ToolArgumentPreviewSchedule, applyProviderReportedUsageCost, calculateCost, clampThinkingLevel, cleanupSessionResources, clearApiProviders, complete, completeSimple, createDeferredEventBuffer, createFirstStreamEventAbortController, createFirstStreamEventTimeoutError, createReasoningTagTextPartitioner, createSseByteGuard, createToolArgumentPreviewSchedule, decodeOpenAICodexJwtPayload, defaultApiRegistry, defaultLlmRuntime, findEnvKeys, getApiProvider, getApiProviders, getEnvApiKey, getFirstStreamEventTimeoutHandler, getFirstStreamEventTimeoutMs, getSupportedThinkingLevels, headersToRecord, isConfiguredContextSizeOverflowError, isContextOverflow, matchesContextOverflowMessage, modelsAreEqual, notifyLlmRequestActivity, onLlmRequestActivity, parseJsonWithRepair, parseStreamingJson, parseTerminalToolCallArguments, registerSessionResourceCleanup, repairJson, resolveOpenAICodexAccountId, sanitizeSurrogates, shortHash, stream, streamSimple, withFirstStreamEventTimeout };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { n as getEnvApiKey, t as findEnvKeys } from "../env-api-keys-DrgeBuva.mjs";
|
|
2
2
|
import { n as createApiRegistry, t as createLlmRuntime } from "../stream-CREqxHgU.mjs";
|
|
3
|
-
import { a as getSupportedThinkingLevels, i as clampThinkingLevel, n as applyProviderReportedUsageCost, o as modelsAreEqual, r as calculateCost, t as sanitizeSurrogates } from "../sanitize-unicode-
|
|
4
|
-
import {
|
|
3
|
+
import { a as getSupportedThinkingLevels, i as clampThinkingLevel, n as applyProviderReportedUsageCost, o as modelsAreEqual, r as calculateCost, t as sanitizeSurrogates } from "../sanitize-unicode-DCkltN94.mjs";
|
|
4
|
+
import { C as headersToRecord, m as parseTerminalToolCallArguments } from "../transport-stream-shared-ljShVIZB.mjs";
|
|
5
5
|
import { t as createDeferredEventBuffer } from "../deferred-event-buffer-DAvyP7qA.mjs";
|
|
6
|
-
import { n as
|
|
6
|
+
import { i as repairJson, n as parseJsonWithRepair, r as parseStreamingJson, t as createToolArgumentPreviewSchedule } from "../json-parse-BuAJEbdW.mjs";
|
|
7
7
|
import { n as onLlmRequestActivity, t as notifyLlmRequestActivity } from "../llm-request-activity-BjtkplhG.mjs";
|
|
8
8
|
import { t as shortHash } from "../hash-CHgqbJmD.mjs";
|
|
9
9
|
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, n as createFirstStreamEventTimeoutError, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "../stream-first-event-timeout-MK28puvq.mjs";
|
|
10
10
|
import { t as createReasoningTagTextPartitioner } from "../reasoning-tag-text-partitioner-5ygO2rZc.mjs";
|
|
11
11
|
import { n as registerSessionResourceCleanup, t as cleanupSessionResources } from "../session-resources-CkR4WWy1.mjs";
|
|
12
12
|
import { n as resolveOpenAICodexAccountId, t as decodeOpenAICodexJwtPayload } from "../openai-chatgpt-jwt-KWcgd0d_.mjs";
|
|
13
|
-
import { t as createSseByteGuard } from "../streaming-byte-guard-
|
|
13
|
+
import { t as createSseByteGuard } from "../streaming-byte-guard-CC-HMn_u.mjs";
|
|
14
14
|
//#region packages/ai/src/internal/default-runtime.ts
|
|
15
15
|
const DEFAULT_RUNTIME_KEY = Symbol.for("openclaw.ai.defaultRuntime");
|
|
16
16
|
function resolveDefaultRuntime() {
|
|
@@ -88,7 +88,7 @@ const CONTEXT_OVERFLOW_PATTERN_SCOPES = {
|
|
|
88
88
|
/exceed context limit/i,
|
|
89
89
|
/exceeds the model'?s maximum context/i,
|
|
90
90
|
/max_tokens[\s\S]*exceed[\s\S]*context/i,
|
|
91
|
-
/input length[\s\S]*exceed[\s\S]*context/i,
|
|
91
|
+
/input(?: length[\s\S]*exceed[\s\S]*context| \([\d,]+\s*tokens?\) is longer than (?:the )?model'?s context length)/i,
|
|
92
92
|
/413[\s\S]*too large/i,
|
|
93
93
|
/context_window_exceeded/i,
|
|
94
94
|
/input length [\d,]+\s+tokens? exceeds the model limit/i,
|
|
@@ -198,4 +198,4 @@ function isContextOverflow(message, contextWindow) {
|
|
|
198
198
|
return false;
|
|
199
199
|
}
|
|
200
200
|
//#endregion
|
|
201
|
-
export { applyProviderReportedUsageCost, calculateCost, clampThinkingLevel, cleanupSessionResources, clearApiProviders, complete, completeSimple, createDeferredEventBuffer, createFirstStreamEventAbortController, createFirstStreamEventTimeoutError, createReasoningTagTextPartitioner, createSseByteGuard, decodeOpenAICodexJwtPayload, defaultApiRegistry, defaultLlmRuntime, findEnvKeys, getApiProvider, getApiProviders, getEnvApiKey, getFirstStreamEventTimeoutHandler, getFirstStreamEventTimeoutMs, getSupportedThinkingLevels, headersToRecord, isConfiguredContextSizeOverflowError, isContextOverflow, matchesContextOverflowMessage, modelsAreEqual, notifyLlmRequestActivity, onLlmRequestActivity, parseJsonWithRepair, parseStreamingJson, registerSessionResourceCleanup, repairJson, resolveOpenAICodexAccountId, sanitizeSurrogates, shortHash, stream, streamSimple, withFirstStreamEventTimeout };
|
|
201
|
+
export { applyProviderReportedUsageCost, calculateCost, clampThinkingLevel, cleanupSessionResources, clearApiProviders, complete, completeSimple, createDeferredEventBuffer, createFirstStreamEventAbortController, createFirstStreamEventTimeoutError, createReasoningTagTextPartitioner, createSseByteGuard, createToolArgumentPreviewSchedule, decodeOpenAICodexJwtPayload, defaultApiRegistry, defaultLlmRuntime, findEnvKeys, getApiProvider, getApiProviders, getEnvApiKey, getFirstStreamEventTimeoutHandler, getFirstStreamEventTimeoutMs, getSupportedThinkingLevels, headersToRecord, isConfiguredContextSizeOverflowError, isContextOverflow, matchesContextOverflowMessage, modelsAreEqual, notifyLlmRequestActivity, onLlmRequestActivity, parseJsonWithRepair, parseStreamingJson, parseTerminalToolCallArguments, registerSessionResourceCleanup, repairJson, resolveOpenAICodexAccountId, sanitizeSurrogates, shortHash, stream, streamSimple, withFirstStreamEventTimeout };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { D as Model, E as Message, J as ThinkingLevel, K as ThinkingBudgets, U as StreamOptions, a as AssistantMessage, n as Api, z as SimpleStreamOptions } from "../types-
|
|
1
|
+
import { D as Model, E as Message, J as ThinkingLevel, K as ThinkingBudgets, U as StreamOptions, a as AssistantMessage, n as Api, z as SimpleStreamOptions } from "../types-DhLoJbFm.mjs";
|
|
2
|
+
import "../types-GiAjXatj.mjs";
|
|
2
3
|
import { t as sanitizeSurrogates } from "../sanitize-unicode-BZiVbGwK.mjs";
|
|
3
4
|
import { n as normalizeStructuredPromptSection, r as sortPromptCacheToolsByName, t as normalizePromptCapabilityIds } from "../prompt-cache-stability-Cwcjv_fx.mjs";
|
|
4
|
-
|
|
5
5
|
//#region packages/ai/src/providers/simple-options.d.ts
|
|
6
6
|
type FirstEventStreamOptions = {
|
|
7
7
|
firstEventTimeoutMs?: number;
|