@openclaw/ai 2026.8.1 → 2026.8.33
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-Djj7L1rx.mjs → anthropic-BNeFhAh3.mjs} +197 -185
- package/dist/{anthropic-compaction-replay-CY4tkD4V.mjs → anthropic-compaction-replay-B6sEzXhr.mjs} +24 -7
- package/dist/{anthropic-payload-policy-i_5_inWe.d.mts → anthropic-payload-policy-kkq8L7tJ.d.mts} +2 -2
- package/dist/{api-registry-C9-wZd_W.d.mts → api-registry-CAK4bNkq.d.mts} +2 -2
- package/dist/{azure-openai-responses-Bj3czHNa.mjs → azure-openai-responses-CPvqFff1.mjs} +6 -5
- package/dist/diagnostics.mjs +1 -1
- package/dist/event-stream-CDHaMazK.d.mts +1 -0
- package/dist/{event-stream-UhnxHuqt.d.mts → event-stream-DcQzYRWO.d.mts} +1 -1
- package/dist/event-stream.d.mts +2 -2
- package/dist/{google-0Ca6TYbw.mjs → google-B6pXyWB0.mjs} +7 -5
- package/dist/{google-shared-DVfL9COU.mjs → google-shared-C_3CT37v.mjs} +25 -23
- package/dist/{google-vertex-5dAMxprN.mjs → google-vertex-BA2c1toq.mjs} +7 -5
- package/dist/{host-DoPJJ1KD.d.mts → host-DL2Zd9ep.d.mts} +3 -3
- package/dist/{host-D51fmkH6.mjs → host-DhlhmyR6.mjs} +17 -2
- package/dist/index-DcGDVDnC.d.mts +118 -0
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +4 -4
- package/dist/internal/anthropic.d.mts +11 -6
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/openai-responses-payload-policy.d.mts +1 -1
- package/dist/internal/openai-responses-payload-policy.mjs +1 -1
- package/dist/internal/openai.d.mts +7 -7
- package/dist/internal/openai.mjs +10 -10
- package/dist/internal/runtime.d.mts +5 -5
- package/dist/internal/runtime.mjs +3 -3
- package/dist/internal/shared.d.mts +2 -2
- package/dist/internal/shared.mjs +3 -3
- package/dist/{mistral-BCnrI-kV.mjs → mistral-CTcM9TGz.mjs} +18 -13
- package/dist/{openai-chatgpt-responses-CGBGWSqr.mjs → openai-chatgpt-responses-QqHf1o9v.mjs} +17 -16
- package/dist/{openai-completions-BaTuwID7.mjs → openai-completions-BCmKwgsc.mjs} +17 -14
- package/dist/{openai-completions-compat-DB7FFq7k.d.mts → openai-completions-compat-BJE92duO.d.mts} +3 -3
- package/dist/{openai-completions-stream-Bpns6uNc.mjs → openai-completions-stream-0mm4YUag.mjs} +30 -27
- package/dist/openai-prompt-cache-BUJI5cW-.d.mts +16 -0
- package/dist/openai-prompt-cache-CGnVB74a.mjs +21 -0
- package/dist/{openai-responses-compaction-window-DwydGZI8.mjs → openai-responses-compaction-window-vuCaZYLS.mjs} +3 -3
- package/dist/{openai-responses-contracts-DgaR3t5T.d.mts → openai-responses-contracts-DFJOyjd1.d.mts} +6 -3
- package/dist/{openai-responses-1GBcQujk.mjs → openai-responses-pMJVxhHW.mjs} +11 -12
- package/dist/{openai-responses-prompt-observer-internal-_nhGTn2b.mjs → openai-responses-prompt-observer-internal-COaImuDp.mjs} +3 -3
- package/dist/{openai-responses-shared-zPmKnhF5.mjs → openai-responses-shared-CZTRmOFP.mjs} +27 -26
- package/dist/{openai-tool-schema-Dgl4H2MU.mjs → openai-tool-schema-DjS9-DHe.mjs} +14 -12
- package/dist/{provider-error-jZP5NMTZ.mjs → provider-error-BI8kIViN.mjs} +11 -11
- package/dist/{provider-options-HvA_slFa.d.mts → provider-options-CedgbINH.d.mts} +2 -2
- package/dist/{provider-transcript-transform-C01bQ5a3.mjs → provider-transcript-transform-BnsgCK8K.mjs} +1 -1
- package/dist/provider-types.d.mts +6 -6
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +10 -10
- package/dist/{reasoning-tag-text-partitioner-CwzKb0bA.mjs → reasoning-tag-text-partitioner-BsUX44Tq.mjs} +29 -19
- package/dist/{sanitize-unicode-DCkltN94.mjs → sanitize-unicode-Cfcaqa9V.mjs} +2 -8
- package/dist/{simple-options-DKx86yX9.mjs → simple-options-Bwi0x0bX.mjs} +2 -2
- package/dist/{src-Bu3FiFAG.mjs → src-BhgSqnbz.mjs} +88 -2
- package/dist/{tool-schema-json-projection-qvTEs5Am.mjs → tool-schema-json-projection-_gcOC21Y.mjs} +21 -31
- package/dist/{transport-stream-shared-NjwWNaRY.d.mts → transport-stream-shared-B38NWYTa.d.mts} +4 -4
- package/dist/{transport-stream-shared-CT5ycdzn.mjs → transport-stream-shared-y1YR1k5K.mjs} +2 -2
- package/dist/{transport-utils-BHx9z8Cl.mjs → transport-utils-DdLjoPMb.mjs} +2 -2
- package/dist/transports.d.mts +12 -9
- package/dist/transports.mjs +91 -73
- package/dist/types-DmdQ-xcq.d.mts +1 -0
- package/dist/{types-h38Azne1.d.mts → types-DmeScJQe.d.mts} +25 -13
- package/dist/types.d.mts +6 -6
- package/dist/types.mjs +3 -3
- package/dist/{validation-B61OhAio.mjs → validation-CJZtym2g.mjs} +7 -5
- package/dist/{validation-C68lP2uy.d.mts → validation-DPDgbaD3.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +2 -2
- package/dist/event-stream-C988TSLe.d.mts +0 -1
- package/dist/index-N3zr6__t.d.mts +0 -105
- package/dist/openai-prompt-cache-2uo_1OR1.d.mts +0 -7
- package/dist/openai-prompt-cache-mZTCdRPo.mjs +0 -12
- package/dist/types-DtGu2d3C.d.mts +0 -1
|
@@ -4,10 +4,9 @@ import { n as estimateBase64DecodedBytes } from "./base64-CEFBpSkN.mjs";
|
|
|
4
4
|
function isJsonOpeningDelimiter(char, openers) {
|
|
5
5
|
return (char === "{" || char === "[") && openers.includes(char);
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
function extractBalancedJsonPrefix(raw, opts = {}) {
|
|
7
|
+
function extractBalancedJsonAt(raw, opts, offset) {
|
|
9
8
|
const openers = opts.openers ?? ["{", "["];
|
|
10
|
-
let start =
|
|
9
|
+
let start = offset;
|
|
11
10
|
while (start < raw.length && !isJsonOpeningDelimiter(raw[start], openers)) start += 1;
|
|
12
11
|
const stack = [];
|
|
13
12
|
let inString = false;
|
|
@@ -35,14 +34,10 @@ function extractBalancedJsonPrefix(raw, opts = {}) {
|
|
|
35
34
|
function extractBalancedJsonFragments(raw, opts = {}) {
|
|
36
35
|
const fragments = [];
|
|
37
36
|
for (let offset = 0; offset < raw.length;) {
|
|
38
|
-
const fragment =
|
|
37
|
+
const fragment = extractBalancedJsonAt(raw, opts, offset);
|
|
39
38
|
if (!fragment) break;
|
|
40
|
-
fragments.push(
|
|
41
|
-
|
|
42
|
-
startIndex: offset + fragment.startIndex,
|
|
43
|
-
endIndex: offset + fragment.endIndex
|
|
44
|
-
});
|
|
45
|
-
offset += fragment.endIndex + 1;
|
|
39
|
+
fragments.push(fragment);
|
|
40
|
+
offset = fragment.endIndex + 1;
|
|
46
41
|
}
|
|
47
42
|
return fragments;
|
|
48
43
|
}
|
|
@@ -83,6 +78,11 @@ function stringifyObjectValue(value, stack, normalizeString) {
|
|
|
83
78
|
return `[${serializedEntries.join(",")}]`;
|
|
84
79
|
}
|
|
85
80
|
const record = value;
|
|
81
|
+
if (normalizeString === preserveString) {
|
|
82
|
+
const fields = [];
|
|
83
|
+
for (const key of Object.keys(record).toSorted()) fields.push(`${JSON.stringify(key)}:${stringifyStableValue(record[key], stack, normalizeString)}`);
|
|
84
|
+
return `{${fields.join(",")}}`;
|
|
85
|
+
}
|
|
86
86
|
const entries = Object.keys(record).map((key) => ({
|
|
87
87
|
key,
|
|
88
88
|
normalizedKey: normalizeString(key)
|
|
@@ -124,7 +124,7 @@ const CREDENTIAL_HEADER_RE = /\b((?:[A-Za-z][A-Za-z0-9_.-]*[_.-])?(?:api[_.-]?ke
|
|
|
124
124
|
const LOOSE_QUOTED_CREDENTIAL_PAIR_RE = /\b((?!(?:api|endpoint|method|model|provider|status|type)=)[A-Za-z][A-Za-z0-9_.-]{0,64})=(["'])([A-Za-z0-9+/._~%=-]{16,})\2/giu;
|
|
125
125
|
const LOOSE_CREDENTIAL_PAIR_RE = /\b((?!(?:api|endpoint|method|model|provider|status|type)=)[A-Za-z][A-Za-z0-9_.-]{0,64})=([A-Za-z0-9+/._~%=-]{16,})(?=[;&#'"\s]|$)/giu;
|
|
126
126
|
const MEDIA_DATA_URL_RE = /data:(?:audio|image|video)\/[a-z0-9.+-]+(?:;[^,;\s]+)*;base64,[ \t]*(?:\r?\n[ \t]*)?[a-z0-9+/_=-]+(?:[ \t]*\r?\n[ \t]*[a-z0-9+/_=-]+)*/giu;
|
|
127
|
-
const MAX_DIAGNOSTIC_JSON_LENGTH =
|
|
127
|
+
const MAX_DIAGNOSTIC_JSON_LENGTH = 16384;
|
|
128
128
|
const PLAIN_BRACKET_TAG_RE = /^\[[A-Za-z0-9][A-Za-z0-9 _.-]*\]$/u;
|
|
129
129
|
const JSON_ARRAY_START_RE = /\[\s*(?:[{"\d\]-]|true\b|false\b|null\b)/u;
|
|
130
130
|
const MALFORMED_JSON_RE = /\{|(?:"[^"]+"|\b(?:b64_json|data|(?:input|output)?(?:audio|image|video)[\w-]*))\s*:/iu;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./types-
|
|
1
|
+
import { J as StreamOptions } from "./types-DmeScJQe.mjs";
|
|
2
|
+
import "./types-DmdQ-xcq.mjs";
|
|
3
3
|
import OpenAI from "openai";
|
|
4
4
|
import Anthropic from "@anthropic-ai/sdk";
|
|
5
5
|
import { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as transformMessages } from "./host-
|
|
1
|
+
import { i as transformMessages } from "./host-DhlhmyR6.mjs";
|
|
2
2
|
//#region packages/ai/src/provider-transcript-transform.ts
|
|
3
3
|
const IMAGE_OMISSION = "(image omitted: model does not support images)";
|
|
4
4
|
const VIDEO_OMISSION = "(video omitted: provider does not support video input)";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as supportsClaudeNativeXhighEffort, _ as resolveClaudeSonnet5ModelIdentity, a as CLAUDE_FABLE_5_THINKING_PROFILE, b as supportsClaudeFastMode, c as bindsClaudeThinkingPrefix, d as resolveClaudeFable5ModelIdentity, f as resolveClaudeModelIdentity, g as resolveClaudeOpus5ModelIdentity, h as resolveClaudeOpus55ModelIdentity, 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, t as index_d_exports, u as requiresClaudeMandatoryAdaptiveThinking, v as supportsClaude1MContext, x as supportsClaudeNativeMaxEffort, y as supportsClaudeAdaptiveThinking } from "./index-DcGDVDnC.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
|
|
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 "./types-
|
|
3
|
+
import { $ as ThinkingLevel, A as ModelThinkingLevel, B as ProviderResponse, C as KnownImagesApi, D as Model, F as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, G as StopReason, H as RawModelCostConfig, I as PricingTier, J as StreamOptions, K as StreamFn, L as Provider, M as OpenAIResponsesCompat, N as OpenRouterRouting, O as ModelCostConfig, P as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, Q as ThinkingContent, R as ProviderImagesOptions, S as KnownApi, T as MaybePromise, U as RawPricingTier, W as SimpleStreamOptions, X as TextSignatureV1, Y as TextContent, Z as ThinkingBudgets, _ as ImagesModel, a as AssistantMessage, at as Usage, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as VercelGatewayRouting, d as Context, et as ThinkingLevelMap, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, it as Transport, j as OpenAICompletionsCompat, k as ModelCostRates, l as CacheRetention, m as ImagesContext, n as Api, nt as ToolCall, o as AssistantMessageEvent, ot as UserMessage, p as ImagesApi, r as AssistantDeliveryTtsFacts, rt as ToolResultMessage, s as AssistantMessageEventStreamContract, st as ValidateToolArgumentsFn, t as AnthropicMessagesCompat, tt as Tool, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderReplayState } from "./types-DmeScJQe.mjs";
|
|
4
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-DcQzYRWO.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-DPDgbaD3.mjs";
|
|
6
|
+
import "./types-DmdQ-xcq.mjs";
|
|
7
7
|
//#region packages/ai/src/provider-types.d.ts
|
|
8
8
|
export declare const PROVIDER_CONTEXT_HANDOFF: unique symbol;
|
|
9
9
|
export type VideoContent = Omit<ImageContent, "type"> & {
|
|
@@ -29,4 +29,4 @@ export type ProviderStreamFunction<TApi extends Api = Api, TOptions extends Stre
|
|
|
29
29
|
/** Resolves provider-only context without widening the canonical call contract. */
|
|
30
30
|
export declare function resolveProviderContext(context: Context | ProviderContext, options?: ProviderStreamOptions): Promise<ProviderContext>;
|
|
31
31
|
//#endregion
|
|
32
|
-
export type { AnthropicMessagesCompat, Api, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, ProviderContext as Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MaybePromise, ProviderMessage as Message, ProviderModel as Model, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, Provider, ProviderImagesOptions, ProviderReplayState, ProviderResponse, ProviderStreamFunction as StreamFunction, SimpleStreamOptions, StopReason, StreamFn, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
|
32
|
+
export type { AnthropicMessagesCompat, Api, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, ProviderContext as Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MaybePromise, ProviderMessage as Message, ProviderModel as Model, ModelCostConfig, ModelCostRates, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, PricingTier, Provider, ProviderImagesOptions, ProviderReplayState, ProviderResponse, ProviderStreamFunction as StreamFunction, RawModelCostConfig, RawPricingTier, SimpleStreamOptions, StopReason, StreamFn, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, bindsClaudeThinkingPrefix, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, normalizeModelCostConfig, normalizeResolvedPricing, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
package/dist/providers.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as ApiRegistry } from "./api-registry-
|
|
2
|
-
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-
|
|
1
|
+
import { n as ApiRegistry } from "./api-registry-CAK4bNkq.mjs";
|
|
2
|
+
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-BUJI5cW-.mjs";
|
|
3
3
|
//#region packages/ai/src/providers/register-builtins.d.ts
|
|
4
4
|
/** Source id used for built-in API provider registrations. */
|
|
5
5
|
export declare const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
|
package/dist/providers.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
2
|
-
import { n as projectProviderError } from "./provider-error-
|
|
3
|
-
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-
|
|
2
|
+
import { n as projectProviderError } from "./provider-error-BI8kIViN.mjs";
|
|
3
|
+
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-CGnVB74a.mjs";
|
|
4
4
|
//#region packages/ai/src/providers/register-builtins.ts
|
|
5
5
|
/** Source id used for built-in API provider registrations. */
|
|
6
6
|
const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
|
|
@@ -62,35 +62,35 @@ function createLazyRegistration(api, importModule, select) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
const registerBuiltIns = [
|
|
65
|
-
createLazyRegistration("anthropic-messages", () => import("./anthropic-
|
|
65
|
+
createLazyRegistration("anthropic-messages", () => import("./anthropic-BNeFhAh3.mjs").then((n) => n.t), (module) => ({
|
|
66
66
|
stream: module.streamAnthropic,
|
|
67
67
|
streamSimple: module.streamSimpleAnthropic
|
|
68
68
|
})),
|
|
69
|
-
createLazyRegistration("openai-completions", () => import("./openai-completions-
|
|
69
|
+
createLazyRegistration("openai-completions", () => import("./openai-completions-BCmKwgsc.mjs").then((n) => n.t), (module) => ({
|
|
70
70
|
stream: module.streamOpenAICompletions,
|
|
71
71
|
streamSimple: module.streamSimpleOpenAICompletions
|
|
72
72
|
})),
|
|
73
|
-
createLazyRegistration("mistral-conversations", () => import("./mistral-
|
|
73
|
+
createLazyRegistration("mistral-conversations", () => import("./mistral-CTcM9TGz.mjs"), (module) => ({
|
|
74
74
|
stream: module.streamMistral,
|
|
75
75
|
streamSimple: module.streamSimpleMistral
|
|
76
76
|
})),
|
|
77
|
-
createLazyRegistration("openai-responses", () => import("./openai-responses-
|
|
77
|
+
createLazyRegistration("openai-responses", () => import("./openai-responses-pMJVxhHW.mjs").then((n) => n.t), (module) => ({
|
|
78
78
|
stream: module.streamOpenAIResponses,
|
|
79
79
|
streamSimple: module.streamSimpleOpenAIResponses
|
|
80
80
|
})),
|
|
81
|
-
createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-
|
|
81
|
+
createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-CPvqFff1.mjs"), (module) => ({
|
|
82
82
|
stream: module.streamAzureOpenAIResponses,
|
|
83
83
|
streamSimple: module.streamSimpleAzureOpenAIResponses
|
|
84
84
|
})),
|
|
85
|
-
createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-
|
|
85
|
+
createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-QqHf1o9v.mjs"), (module) => ({
|
|
86
86
|
stream: module.streamOpenAICodexResponses,
|
|
87
87
|
streamSimple: module.streamSimpleOpenAICodexResponses
|
|
88
88
|
})),
|
|
89
|
-
createLazyRegistration("google-generative-ai", () => import("./google-
|
|
89
|
+
createLazyRegistration("google-generative-ai", () => import("./google-B6pXyWB0.mjs"), (module) => ({
|
|
90
90
|
stream: module.streamGoogle,
|
|
91
91
|
streamSimple: module.streamSimpleGoogle
|
|
92
92
|
})),
|
|
93
|
-
createLazyRegistration("google-vertex", () => import("./google-vertex-
|
|
93
|
+
createLazyRegistration("google-vertex", () => import("./google-vertex-BA2c1toq.mjs"), (module) => ({
|
|
94
94
|
stream: module.streamGoogleVertex,
|
|
95
95
|
streamSimple: module.streamSimpleGoogleVertex
|
|
96
96
|
}))
|
|
@@ -5375,7 +5375,9 @@ function factoryLabel(effects, ok, nok, type, markerType, stringType) {
|
|
|
5375
5375
|
* @type {State}
|
|
5376
5376
|
*/
|
|
5377
5377
|
function atBreak(code) {
|
|
5378
|
-
if (size > 999 || code === null || code === 91 || code === 93 && !seen ||
|
|
5378
|
+
if (size > 999 || code === null || code === 91 || code === 93 && !seen ||
|
|
5379
|
+
/* c8 ignore next 3 */
|
|
5380
|
+
code === 94 && !size && "_hiddenFootnoteSupport" in self.parser.constructs) return nok(code);
|
|
5379
5381
|
if (code === 93) {
|
|
5380
5382
|
effects.exit(stringType);
|
|
5381
5383
|
effects.enter(markerType);
|
|
@@ -9867,8 +9869,10 @@ function compiler(options) {
|
|
|
9867
9869
|
/** @type {Array<number>} */
|
|
9868
9870
|
const listStack = [];
|
|
9869
9871
|
let index = -1;
|
|
9870
|
-
while (++index < events.length) if (events[index][1].type === "listOrdered" || events[index][1].type === "listUnordered")
|
|
9871
|
-
|
|
9872
|
+
while (++index < events.length) if (events[index][1].type === "listOrdered" || events[index][1].type === "listUnordered") {
|
|
9873
|
+
if (events[index][0] === "enter") listStack.push(index);
|
|
9874
|
+
else index = prepareList(events, listStack.pop(), index);
|
|
9875
|
+
}
|
|
9872
9876
|
index = -1;
|
|
9873
9877
|
while (++index < events.length) {
|
|
9874
9878
|
const handler = config[events[index][0]];
|
|
@@ -10058,8 +10062,10 @@ function compiler(options) {
|
|
|
10058
10062
|
start: token.start,
|
|
10059
10063
|
end: token.end
|
|
10060
10064
|
}) + "): it’s not open");
|
|
10061
|
-
else if (open[0].type !== token.type)
|
|
10062
|
-
|
|
10065
|
+
else if (open[0].type !== token.type) {
|
|
10066
|
+
if (onExitError) onExitError.call(this, token, open[0]);
|
|
10067
|
+
else (open[1] || defaultOnError).call(this, token, open[0]);
|
|
10068
|
+
}
|
|
10063
10069
|
node.position.end = point(token.end);
|
|
10064
10070
|
}
|
|
10065
10071
|
/**
|
|
@@ -11416,19 +11422,21 @@ function resolveTable(events, context) {
|
|
|
11416
11422
|
}
|
|
11417
11423
|
cell[2] = index;
|
|
11418
11424
|
}
|
|
11419
|
-
} else if (token.type === "tableCellDivider")
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11425
|
+
} else if (token.type === "tableCellDivider") {
|
|
11426
|
+
if (inFirstCellAwaitingPipe) inFirstCellAwaitingPipe = false;
|
|
11427
|
+
else {
|
|
11428
|
+
if (lastCell[1] !== 0) {
|
|
11429
|
+
cell[0] = cell[1];
|
|
11430
|
+
currentCell = flushCell(map, context, lastCell, rowKind, void 0, currentCell);
|
|
11431
|
+
}
|
|
11432
|
+
lastCell = cell;
|
|
11433
|
+
cell = [
|
|
11434
|
+
lastCell[1],
|
|
11435
|
+
index,
|
|
11436
|
+
0,
|
|
11437
|
+
0
|
|
11438
|
+
];
|
|
11424
11439
|
}
|
|
11425
|
-
lastCell = cell;
|
|
11426
|
-
cell = [
|
|
11427
|
-
lastCell[1],
|
|
11428
|
-
index,
|
|
11429
|
-
0,
|
|
11430
|
-
0
|
|
11431
|
-
];
|
|
11432
11440
|
}
|
|
11433
11441
|
} else if (token.type === "tableHead") {
|
|
11434
11442
|
afterHeadAwaitingFirstBodyRow = true;
|
|
@@ -11821,8 +11829,10 @@ function reduceReasoningText(text, codeSpans, state, options) {
|
|
|
11821
11829
|
append(text.slice(cursor));
|
|
11822
11830
|
if (options.final && state.depth > 0 && state.pending) {
|
|
11823
11831
|
const pending = state.pending;
|
|
11824
|
-
if (!pending.containsPrivate)
|
|
11825
|
-
|
|
11832
|
+
if (!pending.containsPrivate) {
|
|
11833
|
+
if (options.mode === "static-preserve" || options.mode === "static-strict" && !pending.visibleBefore && !pending.protectedClose || options.mode === "visible" && !pending.protectedClose) emit("text", options.mode === "visible" && pending.visibleBefore ? pending.openTag + pending.content : pending.content);
|
|
11834
|
+
else emit("thinking", pending.content);
|
|
11835
|
+
}
|
|
11826
11836
|
state.depth = 0;
|
|
11827
11837
|
state.pending = void 0;
|
|
11828
11838
|
}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as requiresClaudeMandatoryAdaptiveThinking, p as resolveClaudeNativeThinkingLevelMap, t as calculateUsageCost } from "./src-BhgSqnbz.mjs";
|
|
2
2
|
//#region packages/ai/src/model-utils.ts
|
|
3
3
|
/** Calculates and stores model cost fields from token usage and per-million pricing. */
|
|
4
4
|
function calculateCost(model, usage) {
|
|
5
|
-
|
|
6
|
-
const cacheWrite5m = usage.cacheWrite - cacheWrite1h;
|
|
7
|
-
usage.cost.input = model.cost.input / 1e6 * usage.input;
|
|
8
|
-
usage.cost.output = model.cost.output / 1e6 * usage.output;
|
|
9
|
-
usage.cost.cacheRead = model.cost.cacheRead / 1e6 * usage.cacheRead;
|
|
10
|
-
usage.cost.cacheWrite = (model.cost.cacheWrite * cacheWrite5m + model.cost.input * 2 * cacheWrite1h) / 1e6;
|
|
11
|
-
usage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;
|
|
5
|
+
Object.assign(usage.cost, calculateUsageCost(usage, model.cost));
|
|
12
6
|
return usage.cost;
|
|
13
7
|
}
|
|
14
8
|
/** Replaces the catalog estimate when the provider reports an authoritative billed total. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as normalizeLowercaseStringOrEmpty } from "./utf16-slice-qz3nsy87.mjs";
|
|
2
|
-
import { t as sanitizeSurrogates } from "./sanitize-unicode-
|
|
3
|
-
import { r as copyProviderAcceptanceObserver } from "./transport-stream-shared-
|
|
2
|
+
import { t as sanitizeSurrogates } from "./sanitize-unicode-Cfcaqa9V.mjs";
|
|
3
|
+
import { r as copyProviderAcceptanceObserver } from "./transport-stream-shared-y1YR1k5K.mjs";
|
|
4
4
|
//#region packages/ai/src/utils/prompt-cache-stability.ts
|
|
5
5
|
/**
|
|
6
6
|
* Prompt-cache normalization helpers. They keep generated prompt sections
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./validation-
|
|
1
|
+
import "./validation-CJZtym2g.mjs";
|
|
2
2
|
//#region packages/llm-core/src/model-contracts/anthropic.ts
|
|
3
3
|
function normalizeClaudeModelId(modelId) {
|
|
4
4
|
const normalized = modelId?.trim().toLowerCase() ?? "";
|
|
@@ -51,6 +51,19 @@ function resolveClaudeMythos5ModelIdentity(ref) {
|
|
|
51
51
|
if (!match) return;
|
|
52
52
|
return normalized.slice((match.index ?? 0) + (match[0].startsWith("-") ? 1 : 0));
|
|
53
53
|
}
|
|
54
|
+
/** Resolve the Opus 5.5 contract without matching other Opus 5 generations. */
|
|
55
|
+
function resolveClaudeOpus55ModelIdentity(ref) {
|
|
56
|
+
const normalized = resolveClaudeModelIdentity(ref);
|
|
57
|
+
if (normalized === "opus-5-5") return "claude-opus-5-5";
|
|
58
|
+
return /^claude-opus-5-5(?=$|[^a-z0-9])/.test(normalized) ? normalized : void 0;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Prefix-bound thinking requires append-only runtime context. Extend this list
|
|
62
|
+
* only with live replay proof for the model (Mythos 5.1 remains unproven).
|
|
63
|
+
*/
|
|
64
|
+
function bindsClaudeThinkingPrefix(ref) {
|
|
65
|
+
return resolveClaudeOpus55ModelIdentity(ref) !== void 0 || /^claude-fable-5-1(?=$|[^a-z0-9])/.test(resolveClaudeModelIdentity(ref));
|
|
66
|
+
}
|
|
54
67
|
/** Return whether a Claude model requires adaptive thinking instead of manual budgets. */
|
|
55
68
|
function requiresClaudeMandatoryAdaptiveThinking(ref) {
|
|
56
69
|
const modelId = resolveClaudeModelIdentity(ref);
|
|
@@ -114,4 +127,77 @@ function resolveClaudeNativeThinkingLevelMap(ref) {
|
|
|
114
127
|
};
|
|
115
128
|
}
|
|
116
129
|
//#endregion
|
|
117
|
-
|
|
130
|
+
//#region packages/llm-core/src/usage-cost.ts
|
|
131
|
+
const sortedPricingTiers = /* @__PURE__ */ new WeakMap();
|
|
132
|
+
const finiteOrZero = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
133
|
+
function normalizeTieredPricing(raw) {
|
|
134
|
+
if (!raw || raw.length === 0) return;
|
|
135
|
+
const result = [];
|
|
136
|
+
for (const tier of raw) {
|
|
137
|
+
const range = tier.range;
|
|
138
|
+
const start = Array.isArray(range) && typeof range[0] === "number" ? range[0] : NaN;
|
|
139
|
+
if (!Number.isFinite(start)) continue;
|
|
140
|
+
const rawEnd = range.length >= 2 ? range[1] : null;
|
|
141
|
+
const end = typeof rawEnd === "number" && Number.isFinite(rawEnd) && rawEnd > start ? rawEnd : Infinity;
|
|
142
|
+
if (!Number.isFinite(tier.input) || !Number.isFinite(tier.output) || !Number.isFinite(tier.cacheRead) || !Number.isFinite(tier.cacheWrite)) continue;
|
|
143
|
+
result.push({
|
|
144
|
+
input: tier.input,
|
|
145
|
+
output: tier.output,
|
|
146
|
+
cacheRead: tier.cacheRead,
|
|
147
|
+
cacheWrite: tier.cacheWrite,
|
|
148
|
+
range: [start, end]
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
return result.length > 0 ? result.toSorted((a, b) => a.range[0] - b.range[0]) : void 0;
|
|
152
|
+
}
|
|
153
|
+
function normalizeModelCostConfig(cost) {
|
|
154
|
+
const normalizedTiers = normalizeTieredPricing(cost.tieredPricing);
|
|
155
|
+
return {
|
|
156
|
+
input: cost.input,
|
|
157
|
+
output: cost.output,
|
|
158
|
+
cacheRead: cost.cacheRead,
|
|
159
|
+
cacheWrite: cost.cacheWrite,
|
|
160
|
+
...normalizedTiers ? { tieredPricing: normalizedTiers } : {}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function normalizeResolvedPricing(cost) {
|
|
164
|
+
return normalizeModelCostConfig({
|
|
165
|
+
input: finiteOrZero(cost.input),
|
|
166
|
+
output: finiteOrZero(cost.output),
|
|
167
|
+
cacheRead: finiteOrZero(cost.cacheRead),
|
|
168
|
+
cacheWrite: finiteOrZero(cost.cacheWrite),
|
|
169
|
+
...cost.tieredPricing ? { tieredPricing: cost.tieredPricing } : {}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
function selectPricingRates(cost, promptTokens) {
|
|
173
|
+
const tiers = cost.tieredPricing;
|
|
174
|
+
if (!tiers?.length) return cost;
|
|
175
|
+
let sorted = sortedPricingTiers.get(tiers);
|
|
176
|
+
if (!sorted) {
|
|
177
|
+
sorted = normalizeTieredPricing(tiers) ?? [];
|
|
178
|
+
sortedPricingTiers.set(tiers, sorted);
|
|
179
|
+
}
|
|
180
|
+
if (promptTokens <= 0) return sorted[0] ?? cost;
|
|
181
|
+
return sorted.find((tier) => promptTokens >= tier.range[0] && promptTokens < tier.range[1]) ?? sorted.findLast((tier) => promptTokens >= tier.range[0]) ?? sorted[0] ?? cost;
|
|
182
|
+
}
|
|
183
|
+
/** Price one model call, selecting its tier before billing the separate token buckets. */
|
|
184
|
+
function calculateUsageCost(usage, pricing) {
|
|
185
|
+
const input = finiteOrZero(usage.input);
|
|
186
|
+
const output = finiteOrZero(usage.output);
|
|
187
|
+
const cacheRead = finiteOrZero(usage.cacheRead);
|
|
188
|
+
const cacheWrite = finiteOrZero(usage.cacheWrite);
|
|
189
|
+
const rates = selectPricingRates(pricing, input + cacheRead + cacheWrite);
|
|
190
|
+
const cacheWrite1h = Math.min(cacheWrite, Math.max(0, finiteOrZero(usage.cacheWrite1h)));
|
|
191
|
+
const cacheWrite5m = cacheWrite - cacheWrite1h;
|
|
192
|
+
const cost = {
|
|
193
|
+
input: input * rates.input / 1e6,
|
|
194
|
+
output: output * rates.output / 1e6,
|
|
195
|
+
cacheRead: cacheRead * rates.cacheRead / 1e6,
|
|
196
|
+
cacheWrite: (cacheWrite5m * rates.cacheWrite + cacheWrite1h * rates.input * 2) / 1e6,
|
|
197
|
+
total: 0
|
|
198
|
+
};
|
|
199
|
+
cost.total = cost.input + cost.output + cost.cacheRead + cost.cacheWrite;
|
|
200
|
+
return cost;
|
|
201
|
+
}
|
|
202
|
+
//#endregion
|
|
203
|
+
export { supportsClaude1MContext as _, CLAUDE_OPUS_5_THINKING_PROFILE as a, supportsClaudeNativeMaxEffort as b, requiresClaudeDefaultSampling as c, resolveClaudeModelIdentity as d, resolveClaudeMythos5ModelIdentity as f, resolveClaudeSonnet5ModelIdentity as g, resolveClaudeOpus5ModelIdentity as h, CLAUDE_FABLE_5_THINKING_PROFILE as i, requiresClaudeMandatoryAdaptiveThinking as l, resolveClaudeOpus55ModelIdentity as m, normalizeModelCostConfig as n, CLAUDE_SONNET_5_THINKING_PROFILE as o, resolveClaudeNativeThinkingLevelMap as p, normalizeResolvedPricing as r, bindsClaudeThinkingPrefix as s, calculateUsageCost as t, resolveClaudeFable5ModelIdentity as u, supportsClaudeAdaptiveThinking as v, supportsClaudeNativeXhighEffort as x, supportsClaudeFastMode as y };
|
package/dist/{tool-schema-json-projection-qvTEs5Am.mjs → tool-schema-json-projection-_gcOC21Y.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as isRecord } from "./utf16-slice-qz3nsy87.mjs";
|
|
2
|
-
import { n as getAiTransportHost } from "./host-
|
|
2
|
+
import { n as getAiTransportHost } from "./host-DhlhmyR6.mjs";
|
|
3
3
|
import { types } from "node:util";
|
|
4
4
|
//#region packages/ai/src/transports/host-policy.ts
|
|
5
5
|
function buildGuardedModelFetch(model, timeoutMs, options) {
|
|
@@ -37,18 +37,6 @@ function transformTransportMessages(messages, model, normalizeToolCallId, option
|
|
|
37
37
|
}
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region packages/ai/src/providers/tool-schema-json-projection.ts
|
|
40
|
-
function isJsonValue(value) {
|
|
41
|
-
if (value === null) return true;
|
|
42
|
-
switch (typeof value) {
|
|
43
|
-
case "boolean":
|
|
44
|
-
case "string": return true;
|
|
45
|
-
case "number": return Number.isFinite(value);
|
|
46
|
-
case "object":
|
|
47
|
-
if (Array.isArray(value)) return value.every(isJsonValue);
|
|
48
|
-
return Object.values(value).every(isJsonValue);
|
|
49
|
-
default: return false;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
40
|
function isNonFiniteNumberValue(value) {
|
|
53
41
|
if (typeof value === "number") return !Number.isFinite(value);
|
|
54
42
|
if (value === null || typeof value !== "object" || !types.isNumberObject(value)) return false;
|
|
@@ -61,11 +49,14 @@ function serializeToolInputSchema(value, path) {
|
|
|
61
49
|
let text;
|
|
62
50
|
try {
|
|
63
51
|
text = JSON.stringify(value, function(key, entry) {
|
|
64
|
-
const
|
|
65
|
-
|
|
52
|
+
const invalidNumber = nonFiniteNumber.path === null && isNonFiniteNumberValue(entry);
|
|
53
|
+
if (invalidNumber || entry && typeof entry === "object") {
|
|
54
|
+
const holderPath = paths.get(this);
|
|
55
|
+
const entryPath = isRoot ? path : holderPath === void 0 ? `${path}.${key}` : Array.isArray(this) ? `${holderPath}[${key}]` : `${holderPath}.${key}`;
|
|
56
|
+
if (invalidNumber) nonFiniteNumber.path = entryPath;
|
|
57
|
+
else paths.set(entry, entryPath);
|
|
58
|
+
}
|
|
66
59
|
isRoot = false;
|
|
67
|
-
if (nonFiniteNumber.path === null && isNonFiniteNumberValue(entry)) nonFiniteNumber.path = entryPath;
|
|
68
|
-
else if (entry && typeof entry === "object") paths.set(entry, entryPath);
|
|
69
60
|
return entry;
|
|
70
61
|
});
|
|
71
62
|
} catch {
|
|
@@ -82,13 +73,8 @@ function serializeToolInputSchema(value, path) {
|
|
|
82
73
|
schema: {},
|
|
83
74
|
violations: [`${nonFiniteNumber.path} is not JSON-serializable`]
|
|
84
75
|
};
|
|
85
|
-
const parsed = JSON.parse(text);
|
|
86
|
-
if (!isJsonValue(parsed)) return {
|
|
87
|
-
schema: {},
|
|
88
|
-
violations: [`${path} is not a JSON value`]
|
|
89
|
-
};
|
|
90
76
|
return {
|
|
91
|
-
schema:
|
|
77
|
+
schema: JSON.parse(text),
|
|
92
78
|
violations: []
|
|
93
79
|
};
|
|
94
80
|
}
|
|
@@ -100,17 +86,18 @@ const schemaMapKeywords = /* @__PURE__ */ new Set([
|
|
|
100
86
|
"patternProperties",
|
|
101
87
|
"properties"
|
|
102
88
|
]);
|
|
103
|
-
function
|
|
104
|
-
if (Array.isArray(schema)) return schema.
|
|
105
|
-
if (!isRecord(schema)) return
|
|
106
|
-
const violations = [];
|
|
89
|
+
function inspectJsonSchema(schema, path, violations) {
|
|
90
|
+
if (Array.isArray(schema)) return schema.every((entry, index) => inspectJsonSchema(entry, `${path}[${index}]`, violations));
|
|
91
|
+
if (!isRecord(schema)) return typeof schema !== "number" || Number.isFinite(schema);
|
|
107
92
|
for (const key of ["$dynamicRef", "$dynamicAnchor"]) if (key in schema) violations.push(`${path}.${key}`);
|
|
108
93
|
for (const [key, value] of Object.entries(schema)) {
|
|
94
|
+
if (typeof value === "number" && !Number.isFinite(value)) return false;
|
|
109
95
|
if (!value || typeof value !== "object") continue;
|
|
110
|
-
if (schemaMapKeywords.has(key) && isRecord(value))
|
|
111
|
-
|
|
96
|
+
if (schemaMapKeywords.has(key) && isRecord(value)) {
|
|
97
|
+
for (const [schemaName, childSchema] of Object.entries(value)) if (!inspectJsonSchema(childSchema, `${path}.${key}.${schemaName}`, violations)) return false;
|
|
98
|
+
} else if (!inspectJsonSchema(value, `${path}.${key}`, violations)) return false;
|
|
112
99
|
}
|
|
113
|
-
return
|
|
100
|
+
return true;
|
|
114
101
|
}
|
|
115
102
|
/** Projects one runtime tool input schema to JSON and reports runtime incompatibilities. */
|
|
116
103
|
function projectRuntimeToolInputSchema(schema, path = "parameters") {
|
|
@@ -118,7 +105,10 @@ function projectRuntimeToolInputSchema(schema, path = "parameters") {
|
|
|
118
105
|
const violations = [...projection.violations];
|
|
119
106
|
if (!isRecord(projection.schema)) violations.push(`${path} must be a JSON object schema`);
|
|
120
107
|
else if (projection.schema.type !== void 0 && projection.schema.type !== "object") violations.push(`${path}.type must be "object"`);
|
|
121
|
-
|
|
108
|
+
if (!inspectJsonSchema(projection.schema, path, violations)) return {
|
|
109
|
+
schema: {},
|
|
110
|
+
violations: [`${path} is not a JSON value`]
|
|
111
|
+
};
|
|
122
112
|
return {
|
|
123
113
|
schema: projection.schema,
|
|
124
114
|
violations
|
package/dist/{transport-stream-shared-NjwWNaRY.d.mts → transport-stream-shared-B38NWYTa.d.mts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import {
|
|
3
|
-
import { r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
4
|
-
import "./event-stream-
|
|
1
|
+
import "./index-DcGDVDnC.mjs";
|
|
2
|
+
import { B as ProviderResponse, D as Model, J as StreamOptions, a as AssistantMessage, at as Usage } from "./types-DmeScJQe.mjs";
|
|
3
|
+
import { r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-DcQzYRWO.mjs";
|
|
4
|
+
import "./event-stream-CDHaMazK.mjs";
|
|
5
5
|
import { t as ProviderErrorProjection } from "./provider-error-CzNw4BWX.mjs";
|
|
6
6
|
//#region packages/ai/src/utils/stream-first-event-timeout.d.ts
|
|
7
7
|
type StreamStage = "responses" | "completions";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as createAssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
2
2
|
import { a as asOptionalRecord, n as asNonArrayRecord, r as asNullableRecord } from "./utf16-slice-qz3nsy87.mjs";
|
|
3
|
-
import { t as sanitizeSurrogates } from "./sanitize-unicode-
|
|
4
|
-
import { n as projectProviderError } from "./provider-error-
|
|
3
|
+
import { t as sanitizeSurrogates } from "./sanitize-unicode-Cfcaqa9V.mjs";
|
|
4
|
+
import { n as projectProviderError } from "./provider-error-BI8kIViN.mjs";
|
|
5
5
|
//#region packages/ai/src/utils/headers.ts
|
|
6
6
|
/** Converts a Headers object to a plain record for provider request handling. */
|
|
7
7
|
function headersToRecord(headers) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as normalizeOptionalString, t as truncateUtf16Safe } from "./utf16-slice-qz3nsy87.mjs";
|
|
2
|
-
import { n as getAiTransportHost } from "./host-
|
|
2
|
+
import { n as getAiTransportHost } from "./host-DhlhmyR6.mjs";
|
|
3
3
|
import { c as parseStrictNonNegativeInteger, i as asFiniteNumberInRange, l as parseStrictPositiveInteger, s as parseStrictFiniteNumber } from "./base64-CEFBpSkN.mjs";
|
|
4
4
|
import { parseRetryAfterHttpDateMs } from "./internal/retry-after.mjs";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
@@ -96,7 +96,7 @@ async function readChunkWithIdleTimeout(reader, timeoutMs, onIdleTimeout) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
async function readResponseTextSnippet(response, options) {
|
|
99
|
-
const maxBytes = options?.maxBytes ??
|
|
99
|
+
const maxBytes = options?.maxBytes ?? 8192;
|
|
100
100
|
const maxChars = options?.maxChars ?? 200;
|
|
101
101
|
const reader = response.body?.getReader();
|
|
102
102
|
if (!reader) return;
|
package/dist/transports.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { D as Model,
|
|
3
|
-
import { n as ApiRegistry } from "./api-registry-
|
|
4
|
-
import { a as CodeModeToolSurfaceObservation, d as OpenAIToolProjection, i as BaseOpenAIStreamOptions, o as OpenAICompletionsOptions, s as OpenAIResponsesCompactionRejection } from "./provider-options-
|
|
5
|
-
import "./types-
|
|
6
|
-
import { a as resolveAnthropicPayloadPolicy, i as resolveAnthropicEphemeralCacheControl, n as applyAnthropicEphemeralCacheControlMarkers, o as resolveAnthropicServerCompactionPlan, r as applyAnthropicPayloadPolicyToParams, t as applyAnthropicCacheControlToMessages } from "./anthropic-payload-policy-
|
|
7
|
-
import { a as ReplayableResponseCompactionItem, c as OpenAIResponsesCompactionOutput, i as OpenAIResponsesRequestParams, n as OpenAIResponsesOptions, o as ResponsesPromptObservation, r as OpenAIResponsesReasoningReplayMetadata } from "./openai-responses-contracts-
|
|
1
|
+
import "./index-DcGDVDnC.mjs";
|
|
2
|
+
import { D as Model, K as StreamFn, Q as ThinkingContent, Y as TextContent, a as AssistantMessage, at as Usage, d as Context, j as OpenAICompletionsCompat, n as Api, nt as ToolCall, o as AssistantMessageEvent, z as ProviderReplayState } from "./types-DmeScJQe.mjs";
|
|
3
|
+
import { n as ApiRegistry } from "./api-registry-CAK4bNkq.mjs";
|
|
4
|
+
import { a as CodeModeToolSurfaceObservation, d as OpenAIToolProjection, i as BaseOpenAIStreamOptions, o as OpenAICompletionsOptions, s as OpenAIResponsesCompactionRejection } from "./provider-options-CedgbINH.mjs";
|
|
5
|
+
import "./types-DmdQ-xcq.mjs";
|
|
6
|
+
import { a as resolveAnthropicPayloadPolicy, i as resolveAnthropicEphemeralCacheControl, n as applyAnthropicEphemeralCacheControlMarkers, o as resolveAnthropicServerCompactionPlan, r as applyAnthropicPayloadPolicyToParams, t as applyAnthropicCacheControlToMessages } from "./anthropic-payload-policy-kkq8L7tJ.mjs";
|
|
7
|
+
import { a as ReplayableResponseCompactionItem, c as OpenAIResponsesCompactionOutput, i as OpenAIResponsesRequestParams, n as OpenAIResponsesOptions, o as ResponsesPromptObservation, r as OpenAIResponsesReasoningReplayMetadata } from "./openai-responses-contracts-DFJOyjd1.mjs";
|
|
8
8
|
import { i as resolveOpenAIResponsesServerCompactionPlan, n as resolveOpenAIResponsesCompactEndpointPlan, r as resolveOpenAIResponsesPayloadPolicy, t as applyOpenAIResponsesPayloadPolicy } from "./openai-responses-payload-policy-rLRPsSmB.mjs";
|
|
9
|
-
import { n as detectOpenAICompletionsCompat, r as resolveOpenAICompletionsCompat, t as ResolvedOpenAICompletionsCompat } from "./openai-completions-compat-
|
|
10
|
-
import { C as FirstStreamEventInternalOptions, _ as sanitizeNonEmptyTransportPayloadText, a as copyProviderAcceptanceObserver, b as withProviderAcceptanceObserver, c as failTransportStream, d as mergeTransportHeaders, f as mergeTransportMetadata, g as parseTerminalToolCallArguments, h as notifyProviderStreamOpened, i as coerceTransportToolCallArguments, l as finalizeTerminalToolCallArguments, m as notifyProviderHttpResponse, n as WritableTransportStream, o as createEmptyTransportUsage, p as notifyProviderHttpMetadata, r as assignTransportErrorDetails, s as createWritableTransportEventStream, t as ProviderAcceptance, u as finalizeTransportStream, v as sanitizeTransportPayloadText, x as withProviderResponseHook, y as transportAbortError } from "./transport-stream-shared-
|
|
9
|
+
import { n as detectOpenAICompletionsCompat, r as resolveOpenAICompletionsCompat, t as ResolvedOpenAICompletionsCompat } from "./openai-completions-compat-BJE92duO.mjs";
|
|
10
|
+
import { C as FirstStreamEventInternalOptions, _ as sanitizeNonEmptyTransportPayloadText, a as copyProviderAcceptanceObserver, b as withProviderAcceptanceObserver, c as failTransportStream, d as mergeTransportHeaders, f as mergeTransportMetadata, g as parseTerminalToolCallArguments, h as notifyProviderStreamOpened, i as coerceTransportToolCallArguments, l as finalizeTerminalToolCallArguments, m as notifyProviderHttpResponse, n as WritableTransportStream, o as createEmptyTransportUsage, p as notifyProviderHttpMetadata, r as assignTransportErrorDetails, s as createWritableTransportEventStream, t as ProviderAcceptance, u as finalizeTransportStream, v as sanitizeTransportPayloadText, x as withProviderResponseHook, y as transportAbortError } from "./transport-stream-shared-B38NWYTa.mjs";
|
|
11
11
|
import { r as sortPromptCacheToolsByName } from "./prompt-cache-stability-Cwcjv_fx.mjs";
|
|
12
12
|
import OpenAI from "openai";
|
|
13
13
|
import { ResponseCreateParamsStreaming, ResponseInput, ResponseInputItem as ResponseInputItem$1 } from "openai/resources/responses/responses.js";
|
|
@@ -137,6 +137,9 @@ export type MutableAssistantOutput = Omit<AssistantMessage, "content" | "usage">
|
|
|
137
137
|
export declare function parseOpenAICompletionsUsage(rawUsage: NonNullable<ChatCompletionChunk["usage"]> & {
|
|
138
138
|
cost?: unknown;
|
|
139
139
|
prompt_cache_hit_tokens?: number;
|
|
140
|
+
prompt_tokens_details?: {
|
|
141
|
+
cache_creation_input_tokens?: number;
|
|
142
|
+
};
|
|
140
143
|
}, model: Model, options?: {
|
|
141
144
|
includeReasoningTokens?: boolean;
|
|
142
145
|
}): MutableAssistantOutput["usage"];
|