@openclaw/ai 2026.11.5 → 2026.11.10-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/README.md +15 -3
- package/dist/{anthropic-CNEzO12C.mjs → anthropic-CBz5v2U3.mjs} +16 -15
- package/dist/{anthropic-payload-policy-DVk38bnY.d.mts → anthropic-payload-policy-BTrHSS_v.d.mts} +4 -8
- package/dist/{anthropic-stream-lifecycle-DJUtasDB.mjs → anthropic-stream-lifecycle-96vq-4V9.mjs} +154 -88
- package/dist/{anthropic-tool-projection-DcvsDiyX.mjs → anthropic-tool-projection-A9GceDnD.mjs} +4 -5
- package/dist/{anthropic-tool-projection-DKAlondV.d.mts → anthropic-tool-projection-DCOX8qai.d.mts} +1 -3
- package/dist/{api-registry-DY2MLUyg.d.mts → api-registry-DUEK-a3o.d.mts} +2 -4
- package/dist/{assistant-message-events-CHMJgbhs.mjs → assistant-message-events-DtSjIQmB.mjs} +1 -2
- package/dist/{assistant-output-C3czmoN4.mjs → assistant-output-kYOaiso5.mjs} +2 -3
- package/dist/{azure-openai-responses-client-compat-D0dvJMbZ.mjs → azure-deployment-map-hwDQc3uL.mjs} +2 -16
- package/dist/{azure-openai-responses-DRkduRmW.mjs → azure-openai-responses-CZheDTt_.mjs} +12 -12
- package/dist/azure-openai-responses-client-compat-DLsS6V6z.mjs +13 -0
- package/dist/{base64-C8CdcsjU.mjs → base64-FdymvxN9.mjs} +1 -2
- package/dist/cloudflare-BCLfDuew.mjs +15 -0
- package/dist/{credential-redaction-DrgndwTJ.d.mts → credential-redaction-BNv5SWQz.d.mts} +0 -2
- package/dist/{deferred-event-buffer-tIGkTkTm.mjs → deferred-event-buffer-BgT1IIfq.mjs} +1 -2
- package/dist/{diagnostics-CloVGQiK.mjs → diagnostics-BNlb1zlT.mjs} +12 -19
- package/dist/{diagnostics-o1PrVNQb.mjs → diagnostics-DP1SXgAW.mjs} +1 -2
- package/dist/diagnostics.d.mts +6 -10
- package/dist/diagnostics.mjs +3 -3
- package/dist/{env-api-keys-BuHc86ya.mjs → env-api-keys-DlUbTgKq.mjs} +1 -2
- package/dist/{event-stream-BYmtRe8-.d.mts → event-stream-BJS9Q8G_.d.mts} +1 -3
- package/dist/{event-stream-X2gmsUWv.mjs → event-stream-Bf6cK7-d.mjs} +1 -2
- package/dist/event-stream-CPiqa8PI.d.mts +1 -0
- package/dist/event-stream.d.mts +2 -2
- package/dist/event-stream.mjs +1 -1
- package/dist/{expect-lbe3Hgrh.mjs → expect-DqyhV9d8.mjs} +1 -2
- package/dist/github-copilot-headers-CqLRrd-i.mjs +22 -0
- package/dist/{github-copilot-request-facts-BZ_EMo7X.mjs → github-copilot-request-facts-BxuLEdNF.mjs} +2 -3
- package/dist/{google-DqG05iBa.mjs → google-BUgkXPYL.mjs} +6 -7
- package/dist/{google-interactions-BE7cxFPc.mjs → google-interactions-84f0xFly.mjs} +36 -25
- package/dist/{google-messages-p2iBzsAp.mjs → google-messages-Dip5zphv.mjs} +16 -20
- package/dist/{google-provider-stream-DZ6tqteU.mjs → google-provider-stream-COaKMdQv.mjs} +14 -15
- package/dist/{google-shared-BMYt1xSI.mjs → google-shared-Dooy5JJL.mjs} +11 -14
- package/dist/{google-vertex-CAq2q1Ln.mjs → google-vertex--S8AlXUD.mjs} +4 -5
- package/dist/{google-video-slots-Bxt-OXO8.mjs → google-video-slots-CzdrKzrO.mjs} +2 -3
- package/dist/{host-DqX-64Pb.mjs → host-Cf7zb-48.mjs} +73 -89
- package/dist/{host-ccbwPC3A.d.mts → host-Dgpzj407.d.mts} +3 -5
- package/dist/{host-policy-Bk85E9ue.mjs → host-policy-B1qzS7Xe.mjs} +2 -3
- package/dist/{index-Bczt0MnO.d.mts → index-BDF5kurq.d.mts} +10 -10
- package/dist/index.d.mts +8 -10
- package/dist/index.mjs +11 -11
- package/dist/internal/anthropic.d.mts +10 -21
- package/dist/internal/anthropic.mjs +6 -6
- package/dist/internal/google-model-family.d.mts +1 -3
- package/dist/internal/google-model-family.mjs +2 -3
- package/dist/internal/google.d.mts +3 -5
- package/dist/internal/google.mjs +1 -1
- package/dist/internal/model-request-body.d.mts +5 -5
- package/dist/internal/model-request-body.mjs +19 -6
- package/dist/internal/openai-completions-compat.d.mts +1 -3
- package/dist/internal/openai-completions-compat.mjs +2 -2
- package/dist/internal/openai-responses-payload-policy.d.mts +2 -4
- package/dist/internal/openai-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.d.mts +10 -32
- package/dist/internal/openai.mjs +12 -11
- package/dist/internal/reasoning-tag-text-partitioner.d.mts +0 -4
- package/dist/internal/reasoning-tag-text-partitioner.mjs +64 -125
- package/dist/internal/retry-after.d.mts +1 -1
- package/dist/internal/retry-after.mjs +1 -2
- package/dist/internal/runtime.d.mts +9 -43
- package/dist/internal/runtime.mjs +14 -15
- package/dist/internal/session-resources.d.mts +11 -0
- package/dist/{session-resources-vKvGIE3J.mjs → internal/session-resources.mjs} +2 -3
- package/dist/internal/shared.d.mts +17 -26
- package/dist/internal/shared.mjs +10 -10
- package/dist/internal/tool-schema.d.mts +2 -22
- package/dist/internal/tool-schema.mjs +3 -3
- package/dist/{llm-request-activity-DzaHoRAU.mjs → llm-request-activity-v1liRqNt.mjs} +1 -2
- package/dist/{mistral-DIGInqJI.mjs → mistral-BAps5cN2.mjs} +713 -299
- package/dist/{model-transport-url-BdksnBqu.d.mts → model-transport-url-Dad-sfx2.d.mts} +0 -4
- package/dist/{number-coercion-C7HsBgUL.mjs → number-coercion-BO6bhGm6.mjs} +2 -3
- package/dist/{observe-async-iterator-DgmegcZR.mjs → observe-async-iterator-DdOlbgrr.mjs} +1 -2
- package/dist/{observe-async-iterator-AlARO5wS.d.mts → observe-async-iterator-DeB_Vxes.d.mts} +14 -7
- package/dist/openai-BtJTmLWF.mjs +21460 -0
- package/dist/{openai-chatgpt-jwt-KWcgd0d_.mjs → openai-chatgpt-jwt-v5F5jJmX.mjs} +1 -2
- package/dist/{openai-chatgpt-responses-C6rEZcsZ.mjs → openai-chatgpt-responses-CYXMKG89.mjs} +53 -49
- package/dist/{openai-completions-B93R3N3b.mjs → openai-completions-Bi4Ghg3V.mjs} +6 -7
- package/dist/{openai-completions-compat-CJ-NsDzg.d.mts → openai-completions-compat-BJBQ682M.d.mts} +10 -5
- package/dist/{openai-completions-compat-CS3dlDBR.mjs → openai-completions-compat-DZLGotNt.mjs} +19 -16
- package/dist/{openai-completions-reasoning-replay-BwT1xwRI.mjs → openai-completions-reasoning-replay-DyH5XzNo.mjs} +1 -2
- package/dist/{openai-completions-transport-DHTFq-BM.mjs → openai-completions-transport-otONaRhv.mjs} +160 -527
- package/dist/{openai-prompt-cache-BZGaIWYh.d.mts → openai-prompt-cache-C5rwtmA_.d.mts} +2 -4
- package/dist/{openai-prompt-cache-3H_Fz0ya.mjs → openai-prompt-cache-CJv1bvw0.mjs} +3 -5
- package/dist/openai-provider-client-apBsWo9b.mjs +51 -0
- package/dist/{openai-responses-DSxPKV0U.mjs → openai-responses-CiIAm8fJ.mjs} +14 -14
- package/dist/{openai-responses-compaction-replay-DXF5BjD2.d.mts → openai-responses-compaction-replay-CUw4owu9.d.mts} +6 -7
- package/dist/{openai-responses-contracts-Cb1IIRRG.d.mts → openai-responses-contracts-bYtvXSvv.d.mts} +7 -12
- package/dist/{openai-responses-contracts-xU-n9AJJ.mjs → openai-responses-contracts-eppTI5DQ.mjs} +11 -18
- package/dist/{openai-responses-endpoint-CqO3ejTe.mjs → openai-responses-endpoint-AeVu3HmP.mjs} +80 -34
- package/dist/{openai-responses-payload-policy-BsQaD-gD.d.mts → openai-responses-payload-policy-Cihgy9fC.d.mts} +0 -2
- package/dist/{openai-responses-request-lifecycle-C_3FKkl7.mjs → openai-responses-request-lifecycle-DfE4xNHj.mjs} +120 -20
- package/dist/{openai-responses-shared-En3Jf0Vg.mjs → openai-responses-shared-BAJzOqwt.mjs} +1649 -312
- package/dist/{openai-responses-terminal-usage-D7IhRA6i.d.mts → openai-responses-terminal-usage-BYXQTt9u.d.mts} +2 -4
- package/dist/openai-responses-websocket-DywDiO81.mjs +8143 -0
- package/dist/{openai-stop-reason-8s70vDXj.mjs → openai-stop-reason-cA0GUHlU.mjs} +4 -3
- package/dist/{openai-tool-schema-CvxySRyf.mjs → openai-tool-schema-Ca74_fkR.mjs} +17 -26
- package/dist/openai.LICENSE +201 -0
- package/dist/{otel-B2u5HGvm.mjs → otel-C5Cn7IFQ.mjs} +8 -8
- package/dist/{overflow-CpApyjG2.mjs → overflow-CM0yZomw.mjs} +2 -3
- package/dist/{positive-integer-DiqE5vNi.mjs → positive-integer-AM4ltyhP.mjs} +2 -3
- package/dist/{prompt-cache-stability-w-ICeyOI.mjs → prompt-cache-stability-oTx0nIsh.mjs} +3 -4
- package/dist/{prompt-cache-stability-Cwcjv_fx.d.mts → prompt-cache-stability-xNfkD-3g.d.mts} +0 -2
- package/dist/{provider-error-DD-fo4Rz.mjs → provider-error-B7aKA_dg.mjs} +24 -23
- package/dist/{provider-error-CnaWYTRY.d.mts → provider-error-DZMru0Jv.d.mts} +0 -2
- package/dist/{provider-options-BQ2Msop2.d.mts → provider-options-CR_UfgUE.d.mts} +15 -11
- package/dist/{provider-replay-context--QGWotXx.mjs → provider-replay-context-CHJQzB0n.mjs} +3 -4
- package/dist/{provider-transcript-transform-Hr1kCoMX.mjs → provider-transcript-transform-C-WfgiLJ.mjs} +2 -3
- package/dist/{provider-transport-turn-state-DyaOKAYm.mjs → provider-transport-turn-state-BdMA1v46.mjs} +4 -27
- package/dist/{provider-types-B1e98js5.d.mts → provider-types-CfiTmXyw.d.mts} +3 -5
- package/dist/provider-types.d.mts +7 -7
- package/dist/provider-types.mjs +1 -2
- package/dist/providers.d.mts +2 -4
- package/dist/providers.mjs +14 -15
- package/dist/{record-coerce-BQaoiN3r.mjs → record-coerce-BgUo6bj4.mjs} +1 -2
- package/dist/{request-headers-DO4Mqhw1.mjs → request-headers-DJ4QrMC_.mjs} +1 -2
- package/dist/{required-api-key-2zZTkmsi.mjs → required-api-key-BniLGxy4.mjs} +2 -3
- package/dist/{retry-after-DnHBlFS2.d.mts → retry-after-f3ZIm8TA.d.mts} +0 -2
- package/dist/rolldown-runtime-DYf_mQCB.mjs +34 -0
- package/dist/{sanitize-unicode-CRGuMONI.mjs → sanitize-unicode-B3kUqQ-q.mjs} +1 -2
- package/dist/{sanitize-unicode-BISmUlUv.d.mts → sanitize-unicode-DlVtgmsw.d.mts} +2 -6
- package/dist/{session-affinity-DA4WHv1h.mjs → session-affinity-Czm9tjAm.mjs} +1 -2
- package/dist/{simple-options-CQNPKCEb.mjs → simple-options-D8CTqHvk.mjs} +40 -16
- package/dist/src-CNWvILd1.mjs +2 -0
- package/dist/{src-CQ7nH2mL.mjs → src-CmBmaGOV.mjs} +87 -20
- package/dist/{stable-stringify-CchQEmeA.mjs → stable-stringify-CGB-o900.mjs} +10 -8
- package/dist/{stream-DM-q0y5H.mjs → stream-BEE5qy7Z.mjs} +5 -7
- package/dist/{stream-first-event-timeout-B7RcufAV.mjs → stream-first-event-timeout-CWiv_y--.mjs} +2 -3
- package/dist/{streaming-byte-guard-DBXr1XYn.mjs → streaming-byte-guard-gOcUrHJF.mjs} +1 -2
- package/dist/{string-coerce-BCuWMIrk.mjs → string-coerce-CpcyRbc6.mjs} +1 -2
- package/dist/{string-normalization-B8TDDBX_.mjs → string-normalization-CS77PHD3.mjs} +2 -3
- package/dist/{telemetry-DJibfNKZ.mjs → telemetry-Cd4i-clM.mjs} +6 -8
- package/dist/{tool-schema-json-projection-BSHb4gaJ.mjs → tool-schema-json-projection-C13fPskA.mjs} +11 -16
- package/dist/{transport-stream-shared-CBVh6QEc.mjs → transport-stream-shared-DEpLe9fG.mjs} +24 -30
- package/dist/{transport-stream-shared-D3IAU4jn.d.mts → transport-stream-shared-DW4DoJLv.d.mts} +7 -8
- package/dist/{transport-utils-rxOHnq9y.mjs → transport-utils-Cx9L80PZ.mjs} +6 -8
- package/dist/transports.d.mts +29 -82
- package/dist/transports.mjs +39 -38
- package/dist/{types-BVdTf0YV.d.mts → types-BNp71XKW.d.mts} +11 -6
- package/dist/types-CwcLeW-7.d.mts +1 -0
- package/dist/{types-OVEWUaDh.mjs → types-DIBUKaTM.mjs} +1 -2
- package/dist/types.d.mts +7 -7
- package/dist/types.mjs +9 -9
- package/dist/{usage-CJH5D6Ea.mjs → usage-B8ggJtuG.mjs} +1 -2
- package/dist/{validation-QmyD0E5A.d.mts → validation-BFNWNeUl.d.mts} +1 -3
- package/dist/{validation-DGXqfvkj.mjs → validation-BO7nCOKO.mjs} +5 -8
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/dist/ws.LICENSE +20 -0
- package/dist/x509-transport-state-D4gFbgWG.mjs +40 -0
- package/package.json +13 -7
- package/dist/.source-module-urls/fe058cc430242ce2ab0dfbcbe153e240a52cf9c3072c3dc0a73e5f956b6ba49b.json +0 -1
- package/dist/cloudflare-BJ2_Xabx.mjs +0 -39
- package/dist/event-stream-B4ZcSvsu.d.mts +0 -1
- package/dist/rolldown-runtime-D7D4PA-g.mjs +0 -13
- package/dist/src-BUsVkrNt.mjs +0 -105
- package/dist/types-Cb3-5WM9.d.mts +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./
|
|
3
|
-
|
|
1
|
+
import { i as asOptionalRecord } from "./record-coerce-BgUo6bj4.mjs";
|
|
2
|
+
import "./diagnostics-DP1SXgAW.mjs";
|
|
3
|
+
import "./validation-BO7nCOKO.mjs";
|
|
4
|
+
// packages/llm-core/src/model-contracts/anthropic.ts
|
|
4
5
|
function readListedClaudeCapability(ref, capability) {
|
|
5
6
|
const listed = ref.params?.claudeCapabilities;
|
|
6
7
|
if (typeof listed !== "object" || listed === null) return;
|
|
@@ -73,11 +74,58 @@ function resolveClaudeMythos5ModelIdentity(ref) {
|
|
|
73
74
|
return matchClaudeModelIdentity(resolveClaudeModelIdentity(ref), /(?:^|-)claude-mythos-5(?=$|[^a-z0-9])/);
|
|
74
75
|
}
|
|
75
76
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
77
|
+
* Canonical Claude id for contract checks, with bare family aliases expanded.
|
|
78
|
+
* Undefined for ids that do not name a Claude model.
|
|
79
|
+
*/
|
|
80
|
+
function resolveClaudeContractId(ref) {
|
|
81
|
+
const identity = resolveClaudeModelIdentity(ref);
|
|
82
|
+
if (identity.startsWith("claude-")) return identity;
|
|
83
|
+
return resolveClaudeOpus5ModelIdentity(ref) ?? resolveClaudeSonnet5ModelIdentity(ref) ?? resolveClaudeHaiku55ModelIdentity(ref);
|
|
84
|
+
}
|
|
85
|
+
function release(...ids) {
|
|
86
|
+
return String.raw`(?:${ids.join("|")})(?!-\d(?!\d))`;
|
|
87
|
+
}
|
|
88
|
+
function releases(...patterns) {
|
|
89
|
+
return new RegExp(String.raw`(?:^|-)(?:${patterns.join("|")})(?=$|[^a-z0-9])`);
|
|
90
|
+
}
|
|
91
|
+
const PRE_CLAUDE_5 = String.raw`claude-(?:3|(?:opus|sonnet|haiku)-4)`;
|
|
92
|
+
/** Generations whose thinking survives edits to earlier turns (no prefix check). */
|
|
93
|
+
const CLAUDE_UNBOUND_THINKING = releases(PRE_CLAUDE_5, release("claude-opus-5", "claude-sonnet-5", "claude-fable-5", "claude-mythos-5"), release("claude-mythos-preview"));
|
|
94
|
+
/** Generations that can run with thinking off (disabled or between-tools). */
|
|
95
|
+
const CLAUDE_OPTIONAL_THINKING = releases(PRE_CLAUDE_5, release("claude-opus-5", "claude-sonnet-5", "claude-sonnet-5-5", "claude-haiku-5-5"));
|
|
96
|
+
/** Generations that predate adaptive thinking. */
|
|
97
|
+
const CLAUDE_WITHOUT_ADAPTIVE_THINKING = releases(String.raw`claude-(?:3|(?:opus|sonnet|haiku)-4(?:-[0-5](?!\d))?(?!-\d(?!\d)))`);
|
|
98
|
+
/** Generations that predate the Claude 5 request contract (refusal stop reasons, adaptive default). */
|
|
99
|
+
const CLAUDE_BEFORE_5_CONTRACT = releases(PRE_CLAUDE_5, release("claude-mythos-preview"));
|
|
100
|
+
/** Generations whose requests keep a trailing assistant prefill. */
|
|
101
|
+
const CLAUDE_ASSISTANT_PREFILL = releases(PRE_CLAUDE_5, release("claude-mythos-preview", "claude-fable-5", "claude-fable-5-1"), release("claude-mythos-5", "claude-mythos-5-1"));
|
|
102
|
+
/**
|
|
103
|
+
* Released generations without native fast mode (`speed: "fast"`), verified live on
|
|
104
|
+
* 2026-11-10: the API answers "does not support the `speed` parameter". Opus 4.6 accepts
|
|
105
|
+
* the field but serves standard speed. Later models are offered fast mode; a rejection
|
|
106
|
+
* falls back to standard speed and is remembered (see readUnsupportedClaudeFastModeModel).
|
|
107
|
+
*/
|
|
108
|
+
const CLAUDE_WITHOUT_FAST_MODE = releases(String.raw`claude-(?:3|haiku-4|sonnet-4|opus-4(?!-8(?!\d)))`, release("claude-sonnet-5", "claude-sonnet-5-5", "claude-haiku-5-5"), release("claude-fable-5", "claude-fable-5-1"), release("claude-mythos-5", "claude-mythos-5-1", "claude-mythos-preview"));
|
|
109
|
+
/** Generations that still accept caller-selected temperature, top_p, and top_k. */
|
|
110
|
+
const CLAUDE_SAMPLING_PARAMETERS = releases(String.raw`claude-(?:3|haiku-4|sonnet-4|opus-4(?!-[78](?!\d)))`);
|
|
111
|
+
/**
|
|
112
|
+
* Whether thinking blocks are valid only after the exact request prefix that
|
|
113
|
+
* produced them, so runtime context must be appended instead of re-rendered.
|
|
114
|
+
* Every Claude model is prefix-bound except the closed list of older generations.
|
|
78
115
|
*/
|
|
79
116
|
function bindsClaudeThinkingPrefix(ref) {
|
|
80
|
-
|
|
117
|
+
const id = resolveClaudeContractId(ref);
|
|
118
|
+
return id !== void 0 && !CLAUDE_UNBOUND_THINKING.test(id);
|
|
119
|
+
}
|
|
120
|
+
/** Whether a Claude model follows the Claude 5 request contract (streamed refusals, adaptive by default). */
|
|
121
|
+
function usesClaude5RequestContract(ref) {
|
|
122
|
+
const id = resolveClaudeContractId(ref);
|
|
123
|
+
return id !== void 0 && !CLAUDE_BEFORE_5_CONTRACT.test(id);
|
|
124
|
+
}
|
|
125
|
+
/** Whether a Claude model rejects a trailing assistant prefill. */
|
|
126
|
+
function rejectsClaudeAssistantPrefill(ref) {
|
|
127
|
+
const id = resolveClaudeContractId(ref);
|
|
128
|
+
return id !== void 0 && !CLAUDE_ASSISTANT_PREFILL.test(id);
|
|
81
129
|
}
|
|
82
130
|
/** Return whether Claude accepts operator instructions within conversation history. */
|
|
83
131
|
function supportsClaudeInHistorySystemMessages(ref) {
|
|
@@ -87,8 +135,8 @@ function supportsClaudeInHistorySystemMessages(ref) {
|
|
|
87
135
|
function requiresClaudeMandatoryAdaptiveThinking(ref) {
|
|
88
136
|
const disabledThinking = readListedClaudeCapability(ref, "disabledThinking");
|
|
89
137
|
if (disabledThinking !== void 0) return !disabledThinking && !requiresClaudeBetweenToolsThinking(ref) && supportsClaudeAdaptiveThinking(ref);
|
|
90
|
-
const
|
|
91
|
-
return
|
|
138
|
+
const id = resolveClaudeContractId(ref);
|
|
139
|
+
return id !== void 0 && !CLAUDE_OPTIONAL_THINKING.test(id);
|
|
92
140
|
}
|
|
93
141
|
/** Resolve Claude Sonnet 5 through aliases, direct ids, cloud ids, or deployment metadata. */
|
|
94
142
|
function resolveClaudeSonnet5ModelIdentity(ref) {
|
|
@@ -122,26 +170,34 @@ function resolveClaudeOpus55ModelIdentity(ref) {
|
|
|
122
170
|
if (normalized === "opus" || normalized === "opus-5-5") return "claude-opus-5-5";
|
|
123
171
|
return /^claude-opus-5-5(?=$|[^a-z0-9])/.test(normalized) ? normalized : void 0;
|
|
124
172
|
}
|
|
125
|
-
|
|
173
|
+
/**
|
|
174
|
+
* Whether the id names a released Claude generation with adaptive thinking.
|
|
175
|
+
* Unlike {@link supportsClaudeAdaptiveThinking}, unknown Claude ids answer false,
|
|
176
|
+
* so providers can tell a released model from one they must map onto a template.
|
|
177
|
+
*/
|
|
178
|
+
function isReleasedAdaptiveClaudeGeneration(ref) {
|
|
126
179
|
const modelId = resolveClaudeModelIdentity(ref);
|
|
127
180
|
return resolveClaudeHaiku55ModelIdentity(ref) !== void 0 || resolveClaudeOpus5ModelIdentity(ref) !== void 0 || resolveClaudeSonnet5ModelIdentity(ref) !== void 0 || /(?:^|-)claude-(?:fable-5|mythos-(?:5|preview)|opus-4-(?:6|7|8)|sonnet-4-6)(?=$|[^a-z0-9])/.test(modelId);
|
|
128
181
|
}
|
|
129
182
|
/** Return whether a Claude model supports adaptive thinking. */
|
|
130
183
|
function supportsClaudeAdaptiveThinking(ref) {
|
|
131
|
-
|
|
184
|
+
const listed = readListedClaudeCapability(ref, "adaptiveThinking");
|
|
185
|
+
if (listed !== void 0) return listed;
|
|
186
|
+
const id = resolveClaudeContractId(ref);
|
|
187
|
+
return id !== void 0 && !CLAUDE_WITHOUT_ADAPTIVE_THINKING.test(id);
|
|
132
188
|
}
|
|
133
189
|
/** Return whether a Claude model has a native 1M-token context window. */
|
|
134
190
|
function supportsClaude1MContext(ref) {
|
|
135
|
-
return
|
|
191
|
+
return isReleasedAdaptiveClaudeGeneration(ref);
|
|
136
192
|
}
|
|
137
193
|
/** Return whether Anthropic documents threshold compaction (`compact_20260112`) for a Claude model. */
|
|
138
194
|
function supportsClaudeServerCompaction(ref) {
|
|
139
|
-
return
|
|
195
|
+
return readListedClaudeCapability(ref, "serverCompaction") ?? isReleasedAdaptiveClaudeGeneration(ref);
|
|
140
196
|
}
|
|
141
197
|
/** Return whether a Claude model supports Anthropic's native fast mode. */
|
|
142
198
|
function supportsClaudeFastMode(ref) {
|
|
143
|
-
const
|
|
144
|
-
return
|
|
199
|
+
const id = resolveClaudeContractId(ref);
|
|
200
|
+
return id !== void 0 && !CLAUDE_WITHOUT_FAST_MODE.test(id);
|
|
145
201
|
}
|
|
146
202
|
/** Return whether a Claude model supports native max effort. */
|
|
147
203
|
function supportsClaudeNativeMaxEffort(ref) {
|
|
@@ -159,8 +215,8 @@ function supportsClaudeNativeXhighEffort(ref) {
|
|
|
159
215
|
}
|
|
160
216
|
/** Return whether a Claude model rejects caller-selected sampling parameters. */
|
|
161
217
|
function requiresClaudeDefaultSampling(ref) {
|
|
162
|
-
const
|
|
163
|
-
return
|
|
218
|
+
const id = resolveClaudeContractId(ref);
|
|
219
|
+
return id !== void 0 && !CLAUDE_SAMPLING_PARAMETERS.test(id);
|
|
164
220
|
}
|
|
165
221
|
/**
|
|
166
222
|
* Fill native Claude effort mappings only when the provider did not publish a
|
|
@@ -174,8 +230,7 @@ function resolveClaudeNativeThinkingLevelMap(ref) {
|
|
|
174
230
|
max: "max"
|
|
175
231
|
};
|
|
176
232
|
}
|
|
177
|
-
|
|
178
|
-
//#region packages/llm-core/src/usage-cost.ts
|
|
233
|
+
// packages/llm-core/src/usage-cost.ts
|
|
179
234
|
const sortedPricingTiers = /* @__PURE__ */ new WeakMap();
|
|
180
235
|
const finiteOrZero = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
181
236
|
function normalizeTieredPricing(raw) {
|
|
@@ -247,5 +302,17 @@ function calculateUsageCost(usage, pricing) {
|
|
|
247
302
|
cost.total = cost.input + cost.output + cost.cacheRead + cost.cacheWrite;
|
|
248
303
|
return cost;
|
|
249
304
|
}
|
|
250
|
-
|
|
251
|
-
|
|
305
|
+
function extractEmbeddingUsage(payload) {
|
|
306
|
+
const usage = asOptionalRecord(asOptionalRecord(payload)?.usage);
|
|
307
|
+
const promptTokens = normalizeUsageCount(usage?.prompt_tokens);
|
|
308
|
+
const totalTokens = normalizeUsageCount(usage?.total_tokens);
|
|
309
|
+
if (promptTokens === void 0 && totalTokens === void 0) return;
|
|
310
|
+
return {
|
|
311
|
+
promptTokens: promptTokens ?? totalTokens ?? 0,
|
|
312
|
+
totalTokens: totalTokens ?? promptTokens ?? 0
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
function normalizeUsageCount(value) {
|
|
316
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : void 0;
|
|
317
|
+
}
|
|
318
|
+
export { supportsClaudeNativeMaxEffort as A, resolveClaudeOpus5ModelIdentity as C, supportsClaudeAdaptiveThinking as D, supportsClaude1MContext as E, supportsClaudeServerCompaction as M, usesClaude5RequestContract as N, supportsClaudeFastMode as O, resolveClaudeOpus55ModelIdentity as S, resolveClaudeSonnet5ModelIdentity as T, resolveClaudeFable5ModelIdentity as _, CLAUDE_FABLE_5_THINKING_PROFILE as a, resolveClaudeMythos5ModelIdentity as b, CLAUDE_OPUS_5_THINKING_PROFILE as c, bindsClaudeThinkingPrefix as d, isReleasedAdaptiveClaudeGeneration as f, requiresClaudeMandatoryAdaptiveThinking as g, requiresClaudeDefaultSampling as h, normalizeResolvedPricing as i, supportsClaudeNativeXhighEffort as j, supportsClaudeInHistorySystemMessages as k, CLAUDE_SONNET_55_THINKING_PROFILE as l, requiresClaudeBetweenToolsThinking as m, extractEmbeddingUsage as n, CLAUDE_HAIKU_55_THINKING_PROFILE as o, rejectsClaudeAssistantPrefill as p, normalizeModelCostConfig as r, CLAUDE_OPUS_55_THINKING_PROFILE as s, calculateUsageCost as t, CLAUDE_SONNET_5_THINKING_PROFILE as u, resolveClaudeHaiku55ModelIdentity as v, resolveClaudeSonnet55ModelIdentity as w, resolveClaudeNativeThinkingLevelMap as x, resolveClaudeModelIdentity as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/normalization-core/src/stable-stringify.ts
|
|
2
2
|
const preserveString = (value) => value;
|
|
3
3
|
/** Deterministically stringifies values, optionally normalizing strings before key ordering. */
|
|
4
4
|
function stableStringify(value, normalizeString = preserveString) {
|
|
@@ -17,12 +17,17 @@ function stringifyStableValue(value, stack, normalizeString, write) {
|
|
|
17
17
|
if (stack.has(value)) return JSON.stringify("[Circular]");
|
|
18
18
|
stack.add(value);
|
|
19
19
|
try {
|
|
20
|
-
if (value instanceof
|
|
20
|
+
if (value instanceof Date) return `Date(${Number.isNaN(value.getTime()) ? "null" : JSON.stringify(normalizeString(value.toISOString()))})`;
|
|
21
|
+
if (value instanceof RegExp) return `RegExp(${JSON.stringify(normalizeString(value.toString()))})`;
|
|
22
|
+
if (value instanceof Set || value instanceof Map) {
|
|
23
|
+
const entries = Array.from(value, (entry) => stringifyStableValue(entry, stack, normalizeString)).toSorted(compareStableStrings);
|
|
24
|
+
return `${value instanceof Set ? "Set" : "Map"}([${entries.join(",")}])`;
|
|
25
|
+
}
|
|
26
|
+
if (value instanceof Error || value instanceof Uint8Array) return stringifyStableValue(value instanceof Error ? {
|
|
21
27
|
name: value.name,
|
|
22
28
|
message: value.message,
|
|
23
29
|
stack: value.stack
|
|
24
|
-
}
|
|
25
|
-
if (value instanceof Uint8Array) return stringifyStableValue({
|
|
30
|
+
} : {
|
|
26
31
|
type: "Uint8Array",
|
|
27
32
|
data: encodeBase64(value)
|
|
28
33
|
}, stack, normalizeString, write);
|
|
@@ -38,9 +43,7 @@ function stringifyStableValue(value, stack, normalizeString, write) {
|
|
|
38
43
|
write("]");
|
|
39
44
|
return "";
|
|
40
45
|
}
|
|
41
|
-
|
|
42
|
-
for (const entry of value) serializedEntries.push(stringifyStableValue(entry, stack, normalizeString));
|
|
43
|
-
return `[${serializedEntries.join(",")}]`;
|
|
46
|
+
return `[${Array.from(value, (entry) => stringifyStableValue(entry, stack, normalizeString)).join(",")}]`;
|
|
44
47
|
}
|
|
45
48
|
const record = value;
|
|
46
49
|
const keys = Object.keys(record);
|
|
@@ -80,5 +83,4 @@ function encodeBase64(value) {
|
|
|
80
83
|
function compareStableStrings(left, right) {
|
|
81
84
|
return left < right ? -1 : left > right ? 1 : 0;
|
|
82
85
|
}
|
|
83
|
-
//#endregion
|
|
84
86
|
export { writeStableStringify as n, stableStringify as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as bindAssistantMessageEventStream, o as getEventStreamCompletion } from "./event-stream-
|
|
2
|
-
import { i as getDefaultAiTransportHost, n as createAiTransportHost, o as runWithAiTransportHost, s as supportsScopedAiTransportHosts } from "./host-
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { i as bindAssistantMessageEventStream, o as getEventStreamCompletion } from "./event-stream-Bf6cK7-d.mjs";
|
|
2
|
+
import { i as getDefaultAiTransportHost, n as createAiTransportHost, o as runWithAiTransportHost, s as supportsScopedAiTransportHosts } from "./host-Cf7zb-48.mjs";
|
|
3
|
+
import { cleanupSessionResources } from "./internal/session-resources.mjs";
|
|
4
|
+
// packages/ai/src/api-registry.ts
|
|
5
5
|
function wrapStream(api, stream) {
|
|
6
6
|
return (model, context, options) => {
|
|
7
7
|
if (model.api !== api) throw new Error(`Mismatched api: ${model.api} expected ${api}`);
|
|
@@ -38,8 +38,7 @@ function createApiRegistry() {
|
|
|
38
38
|
clearApiProviders: () => providers.clear()
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
//#region packages/ai/src/stream.ts
|
|
41
|
+
// packages/ai/src/stream.ts
|
|
43
42
|
function retainUnscopedStreamLifetime(stream, runWithHost) {
|
|
44
43
|
let releaseLifetime;
|
|
45
44
|
const lifetime = new Promise((resolve) => {
|
|
@@ -219,5 +218,4 @@ function createNodeLlmRuntime(registry = createApiRegistry(), transportHost = {}
|
|
|
219
218
|
if (!supportsScopedAiTransportHosts()) throw new Error("Explicit AI transport hosts require Node.js async context support");
|
|
220
219
|
return createRuntime(registry, transportHost);
|
|
221
220
|
}
|
|
222
|
-
//#endregion
|
|
223
221
|
export { createNodeLlmRuntime as n, createApiRegistry as r, createLlmRuntime as t };
|
package/dist/{stream-first-event-timeout-B7RcufAV.mjs → stream-first-event-timeout-CWiv_y--.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as clampTimerTimeoutMs } from "./number-coercion-
|
|
2
|
-
|
|
1
|
+
import { a as clampTimerTimeoutMs } from "./number-coercion-BO6bhGm6.mjs";
|
|
2
|
+
// packages/ai/src/utils/stream-first-event-timeout.ts
|
|
3
3
|
function getFirstStreamEventTimeoutMs(options) {
|
|
4
4
|
return options?.firstEventTimeoutMs;
|
|
5
5
|
}
|
|
@@ -72,5 +72,4 @@ function withFirstStreamEventTimeout(stream, context) {
|
|
|
72
72
|
}
|
|
73
73
|
} };
|
|
74
74
|
}
|
|
75
|
-
//#endregion
|
|
76
75
|
export { withFirstStreamEventTimeout as a, getFirstStreamEventTimeoutMs as i, createFirstStreamEventTimeoutError as n, getFirstStreamEventTimeoutHandler as r, createFirstStreamEventAbortController as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/ai/src/utils/streaming-byte-guard.ts
|
|
2
2
|
function createSseByteGuard(reader, opts) {
|
|
3
3
|
if (!Number.isFinite(opts.maxBytes) || opts.maxBytes < 0) throw new RangeError(`maxBytes must be a non-negative finite number: ${opts.maxBytes}`);
|
|
4
4
|
const onOverflow = opts.onOverflow ?? ((params) => /* @__PURE__ */ new Error(`SSE stream exceeds ${params.maxBytes} bytes (received ${params.size})`));
|
|
@@ -56,5 +56,4 @@ function boundResponseBody(response, options) {
|
|
|
56
56
|
}
|
|
57
57
|
}), response);
|
|
58
58
|
}
|
|
59
|
-
//#endregion
|
|
60
59
|
export { createSseByteGuard as n, boundResponseBody as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/normalization-core/src/string-coerce.ts
|
|
2
2
|
/** Reads a value only when it is already a string, preserving whitespace. */
|
|
3
3
|
function readStringValue(value) {
|
|
4
4
|
return typeof value === "string" ? value : void 0;
|
|
@@ -59,5 +59,4 @@ function normalizeFastMode(raw) {
|
|
|
59
59
|
function hasNonEmptyString(value) {
|
|
60
60
|
return normalizeOptionalString(value) !== void 0;
|
|
61
61
|
}
|
|
62
|
-
//#endregion
|
|
63
62
|
export { normalizeOptionalLowercaseString as a, readNonEmptyStringPreservingWhitespace as c, normalizeNullableString as i, readStringValue as l, normalizeFastMode as n, normalizeOptionalString as o, normalizeLowercaseStringOrEmpty as r, normalizeStringifiedOptionalString as s, hasNonEmptyString as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as normalizeOptionalString } from "./string-coerce-
|
|
2
|
-
|
|
1
|
+
import { o as normalizeOptionalString } from "./string-coerce-CpcyRbc6.mjs";
|
|
2
|
+
// packages/normalization-core/src/string-normalization.ts
|
|
3
3
|
/** Retains runtime string entries from arrays without normalizing their contents. */
|
|
4
4
|
function filterStringEntries(value) {
|
|
5
5
|
return Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
|
|
@@ -28,5 +28,4 @@ function normalizeTrimmedStringList(value) {
|
|
|
28
28
|
function normalizeUniqueTrimmedStringList(value) {
|
|
29
29
|
return uniqueStrings(normalizeTrimmedStringList(value));
|
|
30
30
|
}
|
|
31
|
-
//#endregion
|
|
32
31
|
export { uniqueValues as i, normalizeStringEntries as n, normalizeUniqueTrimmedStringList as r, filterStringEntries as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { OTEL_SERVICE_NAME } from "./otel-
|
|
2
|
-
import { i as getRegisteredTracerProvider } from "./mistral-
|
|
1
|
+
import { OTEL_SERVICE_NAME } from "./otel-C5Cn7IFQ.mjs";
|
|
2
|
+
import { i as getRegisteredTracerProvider } from "./mistral-BAps5cN2.mjs";
|
|
3
3
|
import { trace } from "@opentelemetry/api";
|
|
4
|
-
|
|
4
|
+
// node_modules/.pnpm/@mistralai+mistralai@3.4.0_@aws-sdk+client-s3@3.1161.0_@azure+identity@4.14.1_supports-_16bd8ad5369b63d330551c8b3f594697/node_modules/@mistralai/mistralai/esm/extra/observability/redaction-policies.js
|
|
5
5
|
/**
|
|
6
6
|
* Redaction policies for client-side redaction of telemetry spans.
|
|
7
7
|
*
|
|
@@ -37,6 +37,7 @@ const DEFAULT_PII_SECRET_PATTERNS = [
|
|
|
37
37
|
/\bsk-ant-[A-Za-z0-9\-_]{20,}\b/g,
|
|
38
38
|
/\bsk-proj-[A-Za-z0-9\-_]{20,}\b/g,
|
|
39
39
|
/\bhf_[A-Za-z0-9]{30,}\b/g,
|
|
40
|
+
/\bmstrl_[0-9A-Za-z]{32}_[0-9A-Za-z]{6}\b/g,
|
|
40
41
|
/\bgithub_pat_[A-Za-z0-9_]{22,}\b/g,
|
|
41
42
|
/\bglpat-[A-Za-z0-9\-=_]{20,22}\b/g,
|
|
42
43
|
/\bshp(?:at|ca|pa|ss)_[a-fA-F0-9]{32}\b/g,
|
|
@@ -146,8 +147,7 @@ function redactTextCounting(text, patterns, redactedValue = DEFAULT_REDACTED_VAL
|
|
|
146
147
|
});
|
|
147
148
|
return [redacted, total];
|
|
148
149
|
}
|
|
149
|
-
|
|
150
|
-
//#region node_modules/.pnpm/@mistralai+mistralai@2.7.0_@opentelemetry+api@1.9.1_@opentelemetry+exporter-trace-otlp-_ef8dce160c897b96339bfd78f5c612fa/node_modules/@mistralai/mistralai/esm/extra/observability/redaction.js
|
|
150
|
+
// node_modules/.pnpm/@mistralai+mistralai@3.4.0_@aws-sdk+client-s3@3.1161.0_@azure+identity@4.14.1_supports-_16bd8ad5369b63d330551c8b3f594697/node_modules/@mistralai/mistralai/esm/extra/observability/redaction.js
|
|
151
151
|
/**
|
|
152
152
|
* Client-side redaction of telemetry spans before they are exported.
|
|
153
153
|
*
|
|
@@ -272,8 +272,7 @@ function redactStatus(status, policy) {
|
|
|
272
272
|
if (message !== void 0) redacted.message = message;
|
|
273
273
|
return redacted;
|
|
274
274
|
}
|
|
275
|
-
|
|
276
|
-
//#region node_modules/.pnpm/@mistralai+mistralai@2.7.0_@opentelemetry+api@1.9.1_@opentelemetry+exporter-trace-otlp-_ef8dce160c897b96339bfd78f5c612fa/node_modules/@mistralai/mistralai/esm/extra/observability/telemetry.js
|
|
275
|
+
// node_modules/.pnpm/@mistralai+mistralai@3.4.0_@aws-sdk+client-s3@3.1161.0_@azure+identity@4.14.1_supports-_16bd8ad5369b63d330551c8b3f594697/node_modules/@mistralai/mistralai/esm/extra/observability/telemetry.js
|
|
277
276
|
const MISTRAL_SDK_TELEMETRY_ENV = "MISTRAL_SDK_TELEMETRY";
|
|
278
277
|
const MISTRAL_TELEMETRY_BASE_URL = "https://api.mistral.ai";
|
|
279
278
|
const MISTRAL_TELEMETRY_TRACES_PATH = "/telemetry/v1/traces";
|
|
@@ -578,5 +577,4 @@ function createResource(moduleExports, attributes) {
|
|
|
578
577
|
const resource = new Resource(attributes);
|
|
579
578
|
return (Resource.default?.())?.merge?.(resource) ?? resource;
|
|
580
579
|
}
|
|
581
|
-
//#endregion
|
|
582
580
|
export { MISTRAL_OTLP_TRACES_ENDPOINT_ENV, MISTRAL_SDK_TELEMETRY_ENV, MISTRAL_TELEMETRY_BASE_URL, MISTRAL_TELEMETRY_ENDPOINT, MISTRAL_TELEMETRY_TRACES_PATH, TELEMETRY_PROVIDER_DEDICATED, TELEMETRY_PROVIDER_GLOBAL, TelemetryConfigurationError, _createTelemetryTracerProvider, configureTelemetry, configureTelemetryForHook, flushTelemetry, getTelemetryTracer, setTracerProvider, shutdownTelemetry };
|
package/dist/{tool-schema-json-projection-BSHb4gaJ.mjs → tool-schema-json-projection-C13fPskA.mjs}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { a as asRecord, o as isRecord } from "./record-coerce-
|
|
2
|
-
import { r as parseLocalSchemaRefPointer } from "./validation-
|
|
3
|
-
import { o as normalizeOptionalString } from "./string-coerce-
|
|
4
|
-
import { r as getAiTransportHost } from "./host-
|
|
5
|
-
import "./
|
|
6
|
-
import
|
|
1
|
+
import { a as asRecord, o as isRecord } from "./record-coerce-BgUo6bj4.mjs";
|
|
2
|
+
import { r as parseLocalSchemaRefPointer } from "./validation-BO7nCOKO.mjs";
|
|
3
|
+
import { o as normalizeOptionalString } from "./string-coerce-CpcyRbc6.mjs";
|
|
4
|
+
import { r as getAiTransportHost } from "./host-Cf7zb-48.mjs";
|
|
5
|
+
import { n as writeStableStringify, t as stableStringify } from "./stable-stringify-CGB-o900.mjs";
|
|
6
|
+
import "./src-CNWvILd1.mjs";
|
|
7
7
|
import { Buffer } from "node:buffer";
|
|
8
8
|
import { createHash, hash } from "node:crypto";
|
|
9
9
|
import { types } from "node:util";
|
|
10
|
-
|
|
10
|
+
// packages/normalization-core/src/node-crypto.ts
|
|
11
11
|
function sha256Hex(input) {
|
|
12
12
|
return hash("sha256", input, "hex");
|
|
13
13
|
}
|
|
@@ -40,8 +40,7 @@ function redactIdentifier(value, opts) {
|
|
|
40
40
|
const len = opts?.len ?? 12;
|
|
41
41
|
return `sha256:${sha256HexPrefixCore(trimmed, Number.isFinite(len) ? Math.max(1, Math.floor(len)) : 12)}`;
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
//#region packages/ai/src/providers/schema-walk.ts
|
|
43
|
+
// packages/ai/src/providers/schema-walk.ts
|
|
45
44
|
const SCHEMA_MAP_KEYS = /* @__PURE__ */ new Set([
|
|
46
45
|
"$defs",
|
|
47
46
|
"definitions",
|
|
@@ -79,8 +78,7 @@ function walkSchemaValue(schema, visitObject) {
|
|
|
79
78
|
if (!schema || typeof schema !== "object") return schema;
|
|
80
79
|
return Array.isArray(schema) ? schema.map((entry) => walkSchemaValue(entry, visitObject)) : visitObject(asRecord(schema));
|
|
81
80
|
}
|
|
82
|
-
|
|
83
|
-
//#region packages/ai/src/providers/tool-schema-depth.ts
|
|
81
|
+
// packages/ai/src/providers/tool-schema-depth.ts
|
|
84
82
|
/** Schema nodes and expanded references share this budget; containers are transparent. */
|
|
85
83
|
const MAX_TOOL_SCHEMA_DEPTH = 128;
|
|
86
84
|
/** Classify children after toJSON when serializing, or directly when normalizing. */
|
|
@@ -168,8 +166,7 @@ function truncateToolSchemaDepth(schema, toolName) {
|
|
|
168
166
|
if (truncated) reportToolSchemaTruncation(schema, toolName);
|
|
169
167
|
return inheritToolSchemaTruncation(schema, normalized, truncated);
|
|
170
168
|
}
|
|
171
|
-
|
|
172
|
-
//#region packages/ai/src/providers/tool-schema-refs.ts
|
|
169
|
+
// packages/ai/src/providers/tool-schema-refs.ts
|
|
173
170
|
function setOwnSchemaProperty(target, key, value) {
|
|
174
171
|
Object.defineProperty(target, key, {
|
|
175
172
|
value,
|
|
@@ -315,8 +312,7 @@ function canPreserveRootSchemaRefs(schema) {
|
|
|
315
312
|
}
|
|
316
313
|
return visit(schema) && hasRefs;
|
|
317
314
|
}
|
|
318
|
-
|
|
319
|
-
//#region packages/ai/src/providers/tool-schema-json-projection.ts
|
|
315
|
+
// packages/ai/src/providers/tool-schema-json-projection.ts
|
|
320
316
|
const publishedSchemas = /* @__PURE__ */ new WeakMap();
|
|
321
317
|
function getPublishedRuntimeToolInputSchema(schema) {
|
|
322
318
|
return schema !== null && typeof schema === "object" ? publishedSchemas.get(schema) : void 0;
|
|
@@ -472,5 +468,4 @@ function prepareRuntimeToolInputSchema(schema, path, toolName) {
|
|
|
472
468
|
} } : {}
|
|
473
469
|
};
|
|
474
470
|
}
|
|
475
|
-
//#endregion
|
|
476
471
|
export { sha256Hex as C, redactIdentifier as S, SCHEMA_ARRAY_KEYS as _, SCHEMA_LITERAL_KEYS as a, SCHEMA_OBJECT_KEYS as b, extendSchemaDefs as c, MAX_TOOL_SCHEMA_DEPTH as d, inheritToolSchemaTruncation as f, wasToolSchemaTruncated as g, truncateToolSchemaDepth as h, publishRuntimeToolInputSchema as i, inlineLocalToolSchemaRefs as l, toolSchemaChildPosition as m, prepareRuntimeToolInputSchema as n, canPreserveRootSchemaRefs as o, reportToolSchemaTruncation as p, projectRuntimeToolInputSchema as r, copySchemaMeta as s, getPublishedRuntimeToolInputSchema as t, setOwnSchemaProperty as u, SCHEMA_MAP_KEYS as v, sha256StableValue as w, walkSchemaValue as x, SCHEMA_NESTED_KEYS as y };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { a as projectDiagnosticValue, n as projectProviderError, r as readTransportDiagnosticLabel } from "./provider-error-
|
|
6
|
-
import { l as isTransientNetworkError } from "./diagnostics-
|
|
7
|
-
import { t as createZeroUsage } from "./usage-
|
|
8
|
-
import { t as sanitizeSurrogates } from "./sanitize-unicode-
|
|
1
|
+
import { i as asOptionalRecord, n as asNullableRecord, t as asNonArrayRecord } from "./record-coerce-BgUo6bj4.mjs";
|
|
2
|
+
import { n as createAssistantMessageDiagnostic, t as appendAssistantMessageDiagnostic } from "./diagnostics-DP1SXgAW.mjs";
|
|
3
|
+
import { a as createAssistantMessageEventStream } from "./event-stream-Bf6cK7-d.mjs";
|
|
4
|
+
import { A as headersToRecord, r as getAiTransportHost } from "./host-Cf7zb-48.mjs";
|
|
5
|
+
import { a as projectDiagnosticValue, n as projectProviderError, r as readTransportDiagnosticLabel } from "./provider-error-B7aKA_dg.mjs";
|
|
6
|
+
import { l as isTransientNetworkError } from "./diagnostics-BNlb1zlT.mjs";
|
|
7
|
+
import { t as createZeroUsage } from "./usage-B8ggJtuG.mjs";
|
|
8
|
+
import { t as sanitizeSurrogates } from "./sanitize-unicode-B3kUqQ-q.mjs";
|
|
9
9
|
import { parse } from "partial-json";
|
|
10
|
-
|
|
10
|
+
// packages/retry/src/index.ts
|
|
11
11
|
const MAX_TIMER_TIMEOUT_MS = 2147e6;
|
|
12
12
|
function createAbortError(message, options) {
|
|
13
13
|
const error = new Error(message, options);
|
|
@@ -129,7 +129,6 @@ function toRetryError(value, fallbackMessage = "Non-Error thrown") {
|
|
|
129
129
|
return error;
|
|
130
130
|
}
|
|
131
131
|
function createRetryRunner(runtime = {}) {
|
|
132
|
-
const runtimeSleep = runtime.sleep ?? defaultSleep;
|
|
133
132
|
const runtimeRandom = runtime.random ?? Math.random;
|
|
134
133
|
const createFailure = runtime.createFailure ?? ((errors) => toRetryError(errors.at(-1) ?? /* @__PURE__ */ new Error("Retry failed")));
|
|
135
134
|
return async function retryAsync(fn, attemptsOrOptions = 3, initialDelayMs = 300) {
|
|
@@ -142,7 +141,7 @@ function createRetryRunner(runtime = {}) {
|
|
|
142
141
|
const maxDelayMs = resolved.maxDelayMs > 0 ? resolved.maxDelayMs : Number.POSITIVE_INFINITY;
|
|
143
142
|
const retryAfterMaxDelayMs = options.retryAfterMaxDelayMs === void 0 ? maxDelayMs : Math.max(minDelayMs, resolveRetryDelayMs(clampNumber(options.retryAfterMaxDelayMs, maxDelayMs, 0)));
|
|
144
143
|
const random = options.random ?? runtimeRandom;
|
|
145
|
-
const sleep = options.sleep ??
|
|
144
|
+
const sleep = options.sleep ?? defaultSleep;
|
|
146
145
|
const shouldRetry = options.shouldRetry ?? (() => true);
|
|
147
146
|
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) try {
|
|
148
147
|
return await fn();
|
|
@@ -150,7 +149,7 @@ function createRetryRunner(runtime = {}) {
|
|
|
150
149
|
attemptErrors.push(err);
|
|
151
150
|
if (attempt >= maxAttempts || runtime.shouldRetry?.(err) === false || !shouldRetry(err, attempt)) break;
|
|
152
151
|
if (numeric) {
|
|
153
|
-
await
|
|
152
|
+
await defaultSleep(resolveRetryDelayMs(initialDelayMs * 2 ** (attempt - 1)));
|
|
154
153
|
continue;
|
|
155
154
|
}
|
|
156
155
|
const context = {
|
|
@@ -180,8 +179,7 @@ function createRetryRunner(runtime = {}) {
|
|
|
180
179
|
};
|
|
181
180
|
}
|
|
182
181
|
createRetryRunner();
|
|
183
|
-
|
|
184
|
-
//#region packages/ai/src/utils/json-parse.ts
|
|
182
|
+
// packages/ai/src/utils/json-parse.ts
|
|
185
183
|
const SIMPLE_JSON_ESCAPES = /* @__PURE__ */ new Set([
|
|
186
184
|
"\"",
|
|
187
185
|
"\\",
|
|
@@ -307,8 +305,7 @@ function createToolArgumentPreviewSchedule() {
|
|
|
307
305
|
return true;
|
|
308
306
|
};
|
|
309
307
|
}
|
|
310
|
-
|
|
311
|
-
//#region packages/ai/src/utils/hash.ts
|
|
308
|
+
// packages/ai/src/utils/hash.ts
|
|
312
309
|
/** Fast deterministic hash to shorten long strings */
|
|
313
310
|
function shortHash(str) {
|
|
314
311
|
let h1 = 3735928559;
|
|
@@ -322,8 +319,7 @@ function shortHash(str) {
|
|
|
322
319
|
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
323
320
|
return (h2 >>> 0).toString(36) + (h1 >>> 0).toString(36);
|
|
324
321
|
}
|
|
325
|
-
|
|
326
|
-
//#region packages/ai/src/transports/json-unsafe-integers.ts
|
|
322
|
+
// packages/ai/src/transports/json-unsafe-integers.ts
|
|
327
323
|
/**
|
|
328
324
|
* JSON parsing helpers that preserve integer literals larger than
|
|
329
325
|
* Number.MAX_SAFE_INTEGER as strings before JSON.parse can round them.
|
|
@@ -352,8 +348,7 @@ function parseJsonObjectPreservingUnsafeIntegers(value) {
|
|
|
352
348
|
}
|
|
353
349
|
return asNullableRecord(value);
|
|
354
350
|
}
|
|
355
|
-
|
|
356
|
-
//#region packages/ai/src/transports/transport-stream-shared.ts
|
|
351
|
+
// packages/ai/src/transports/transport-stream-shared.ts
|
|
357
352
|
/** A single synchronous scanner per stream; undefined requests the next reader result. */
|
|
358
353
|
function* decodeSseFrames(limit) {
|
|
359
354
|
const decoder = new TextDecoder();
|
|
@@ -405,19 +400,18 @@ function* decodeSseFrames(limit) {
|
|
|
405
400
|
};
|
|
406
401
|
if (boundaryEnd < 0) break;
|
|
407
402
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
const last = pending.charCodeAt(split - 1);
|
|
403
|
+
let split = buffer.length;
|
|
404
|
+
while (split > start && buffer.length - split < 3) {
|
|
405
|
+
const last = buffer.charCodeAt(split - 1);
|
|
412
406
|
if (last !== 10 && last !== 13) break;
|
|
413
407
|
split--;
|
|
414
408
|
}
|
|
415
|
-
if (split >
|
|
416
|
-
const part =
|
|
409
|
+
if (split > start) {
|
|
410
|
+
const part = buffer.slice(start, split);
|
|
417
411
|
parts.push(part);
|
|
418
412
|
if (limit) partsLength += lengthOf(part);
|
|
419
413
|
}
|
|
420
|
-
tail =
|
|
414
|
+
tail = buffer.slice(split);
|
|
421
415
|
if (limit) assertWithinLimit(partsLength + lengthOf(tail));
|
|
422
416
|
if (done) return;
|
|
423
417
|
}
|
|
@@ -610,8 +604,9 @@ async function awaitProviderLifecycleCallback(callback, signal) {
|
|
|
610
604
|
if (!callback) return;
|
|
611
605
|
const callbackPromise = Promise.resolve().then(callback);
|
|
612
606
|
getAiTransportHost().observePendingProviderWork?.(callbackPromise);
|
|
613
|
-
await racePromiseWithAbortSignal(callbackPromise, signal, transportAbortError);
|
|
607
|
+
const result = await racePromiseWithAbortSignal(callbackPromise, signal, transportAbortError);
|
|
614
608
|
if (signal?.aborted) throw transportAbortError(signal);
|
|
609
|
+
return result;
|
|
615
610
|
}
|
|
616
611
|
function startProviderStreamCancellation(cancelStream, error) {
|
|
617
612
|
const reason = error instanceof Error ? error : new Error(String(error));
|
|
@@ -751,5 +746,4 @@ function failTransportStream(params) {
|
|
|
751
746
|
});
|
|
752
747
|
stream.end();
|
|
753
748
|
}
|
|
754
|
-
|
|
755
|
-
export { parseStreamingJson as A, withProviderResponseHook as C, shortHash as D, quoteUnsafeIntegerLiterals as E, createAbortError as M, racePromiseWithAbortSignal as N, createToolArgumentPreviewSchedule as O, raceWithTimeout as P, withProviderAcceptanceObserver as S, parseJsonPreservingUnsafeIntegers as T, parseTerminalToolCallArguments as _, createEmptyTransportUsage as a, throwIfModelStreamAborted as b, failTransportStream as c, iterateModelStream as d, iterateSseFrames as f, notifyProviderStreamOpened as g, notifyProviderHttpResponse as h, copyProviderAcceptanceObserver as i, repairJson as j, parseJsonWithRepair as k, finalizeTerminalToolCallArguments as l, notifyProviderHttpMetadata as m, assignTransportErrorDetails as n, createWritableTransportEventStream as o, mergeTransportHeaders as p, coerceTransportToolCallArguments as r, decodeSseFrames as s, IncompleteToolCallError as t, finalizeTransportStream as u, sanitizeNonEmptyTransportPayloadText as v, parseJsonObjectPreservingUnsafeIntegers as w, transportAbortError as x, sanitizeTransportPayloadText as y };
|
|
749
|
+
export { parseJsonWithRepair as A, withProviderAcceptanceObserver as C, quoteUnsafeIntegerLiterals as D, parseJsonPreservingUnsafeIntegers as E, raceWithTimeout as F, repairJson as M, createAbortError as N, shortHash as O, racePromiseWithAbortSignal as P, transportAbortError as S, parseJsonObjectPreservingUnsafeIntegers as T, notifyProviderStreamOpened as _, copyProviderAcceptanceObserver as a, sanitizeTransportPayloadText as b, decodeSseFrames as c, finalizeTransportStream as d, iterateModelStream as f, notifyProviderHttpResponse as g, notifyProviderHttpMetadata as h, coerceTransportToolCallArguments as i, parseStreamingJson as j, createToolArgumentPreviewSchedule as k, failTransportStream as l, mergeTransportHeaders as m, assignTransportErrorDetails as n, createEmptyTransportUsage as o, iterateSseFrames as p, awaitProviderLifecycleCallback as r, createWritableTransportEventStream as s, IncompleteToolCallError as t, finalizeTerminalToolCallArguments as u, parseTerminalToolCallArguments as v, withProviderResponseHook as w, throwIfModelStreamAborted as x, sanitizeNonEmptyTransportPayloadText as y };
|
package/dist/{transport-stream-shared-D3IAU4jn.d.mts → transport-stream-shared-DW4DoJLv.d.mts}
RENAMED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { M as ModelRequestHeaders, W as ProviderResponse, a as AssistantMessage, at as StreamOptions, gt as Usage, k as Model } from "./types-
|
|
2
|
-
import "./index-
|
|
3
|
-
import { r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
4
|
-
import "./event-stream-
|
|
5
|
-
import { t as ProviderErrorProjection } from "./provider-error-
|
|
6
|
-
//#region packages/ai/src/transports/transport-stream-shared.d.ts
|
|
1
|
+
import { M as ModelRequestHeaders, W as ProviderResponse, a as AssistantMessage, at as StreamOptions, gt as Usage, k as Model } from "./types-BNp71XKW.mjs";
|
|
2
|
+
import "./index-BDF5kurq.mjs";
|
|
3
|
+
import { r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-BJS9Q8G_.mjs";
|
|
4
|
+
import "./event-stream-CPiqa8PI.mjs";
|
|
5
|
+
import { t as ProviderErrorProjection } from "./provider-error-DZMru0Jv.mjs";
|
|
7
6
|
/** A single synchronous scanner per stream; undefined requests the next reader result. */
|
|
8
7
|
declare function decodeSseFrames(limit?: {
|
|
9
8
|
max: number;
|
|
@@ -76,6 +75,7 @@ type ProviderStreamCancel = (reason: Error) => void | Promise<void>;
|
|
|
76
75
|
declare function withProviderAcceptanceObserver<T extends object>(options: T, observer: ProviderAcceptanceObserver): T;
|
|
77
76
|
/** Preserve the private provider acceptance observer when a built-in wrapper rebuilds options. */
|
|
78
77
|
declare function copyProviderAcceptanceObserver<T extends object>(source: unknown, target: T): T;
|
|
78
|
+
declare function awaitProviderLifecycleCallback<T>(callback: (() => T | Promise<T>) | undefined, signal?: AbortSignal): Promise<T | undefined>;
|
|
79
79
|
/** Report observed HTTP metadata; rejected responses use only onResponse. */
|
|
80
80
|
declare function notifyProviderHttpMetadata(params: {
|
|
81
81
|
options?: ProviderAcceptanceOptions;
|
|
@@ -125,5 +125,4 @@ declare function failTransportStream(params: {
|
|
|
125
125
|
diagnostic?: TransportFailureDiagnostic;
|
|
126
126
|
cleanup?: () => void;
|
|
127
127
|
}): void;
|
|
128
|
-
|
|
129
|
-
export { transportAbortError as C, throwIfModelStreamAborted as S, withProviderResponseHook as T, notifyProviderHttpResponse as _, coerceTransportToolCallArguments as a, sanitizeNonEmptyTransportPayloadText as b, createWritableTransportEventStream as c, finalizeTerminalToolCallArguments as d, finalizeTransportStream as f, notifyProviderHttpMetadata as g, mergeTransportHeaders as h, assignTransportErrorDetails as i, decodeSseFrames as l, iterateSseFrames as m, ProviderAcceptance as n, copyProviderAcceptanceObserver as o, iterateModelStream as p, WritableTransportStream as r, createEmptyTransportUsage as s, IncompleteToolCallError as t, failTransportStream as u, notifyProviderStreamOpened as v, withProviderAcceptanceObserver as w, sanitizeTransportPayloadText as x, parseTerminalToolCallArguments as y };
|
|
128
|
+
export { throwIfModelStreamAborted as C, withProviderResponseHook as E, sanitizeTransportPayloadText as S, withProviderAcceptanceObserver as T, notifyProviderHttpMetadata as _, awaitProviderLifecycleCallback as a, parseTerminalToolCallArguments as b, createEmptyTransportUsage as c, failTransportStream as d, finalizeTerminalToolCallArguments as f, mergeTransportHeaders as g, iterateSseFrames as h, assignTransportErrorDetails as i, createWritableTransportEventStream as l, iterateModelStream as m, ProviderAcceptance as n, coerceTransportToolCallArguments as o, finalizeTransportStream as p, WritableTransportStream as r, copyProviderAcceptanceObserver as s, IncompleteToolCallError as t, decodeSseFrames as u, notifyProviderHttpResponse as v, transportAbortError as w, sanitizeNonEmptyTransportPayloadText as x, notifyProviderStreamOpened as y };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as getAiTransportHost } from "./host-
|
|
2
|
-
import "./src-
|
|
1
|
+
import { r as getAiTransportHost } from "./host-Cf7zb-48.mjs";
|
|
2
|
+
import "./src-CNWvILd1.mjs";
|
|
3
3
|
import "./internal/retry-after.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import "./positive-integer-
|
|
6
|
-
|
|
4
|
+
import { F as raceWithTimeout } from "./transport-stream-shared-DEpLe9fG.mjs";
|
|
5
|
+
import "./positive-integer-AM4ltyhP.mjs";
|
|
6
|
+
// packages/normalization-core/src/response-bytes.ts
|
|
7
7
|
async function consumeResponseBytes(options) {
|
|
8
8
|
let size = 0;
|
|
9
9
|
while (true) {
|
|
@@ -26,8 +26,7 @@ async function consumeResponseBytes(options) {
|
|
|
26
26
|
options.onChunk(value);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
//#region packages/ai/src/transports/transport-utils.ts
|
|
29
|
+
// packages/ai/src/transports/transport-utils.ts
|
|
31
30
|
const MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE = "OpenClaw transport error: malformed_streaming_fragment";
|
|
32
31
|
/** Keep provider payloads out of parse errors without replacing unrelated failures. */
|
|
33
32
|
function streamFragmentError(cause, ErrorType = Error) {
|
|
@@ -93,5 +92,4 @@ async function readAnthropicMessagesErrorSnippet(response) {
|
|
|
93
92
|
if (!collapsed) return;
|
|
94
93
|
return truncated ? `${collapsed}…` : collapsed;
|
|
95
94
|
}
|
|
96
|
-
//#endregion
|
|
97
95
|
export { streamFragmentError as a, resolveModelHeaderSentinels as i, isCodeModeModelVisibleToolName as n, supportsModelTools as o, readAnthropicMessagesErrorSnippet as r, consumeResponseBytes as s, MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE as t };
|