@openclaw/ai 2026.7.2-beta.4 → 2026.7.2-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/{anthropic-CrUDIBpM.mjs → anthropic-CQVj3le6.mjs} +53 -19
  2. package/dist/{anthropic-BoTnz8cv.d.mts → anthropic-SrGtwsJu.d.mts} +27 -1
  3. package/dist/{api-registry-BMphkFf1.d.mts → api-registry-DlMgPR39.d.mts} +1 -1
  4. package/dist/{azure-openai-responses-CbrpVeEv.mjs → azure-openai-responses-DIYgsqFM.mjs} +3 -4
  5. package/dist/error-coercion-DgxlWC0n.mjs +15 -0
  6. package/dist/{event-stream-Douf9dob.d.mts → event-stream-YjaPW20U.d.mts} +1 -1
  7. package/dist/event-stream.d.mts +1 -1
  8. package/dist/{tool-schema-json-projection-BwNu3nDi.mjs → github-copilot-headers-BCoBNmL7.mjs} +48 -1
  9. package/dist/{google-Cs62KA7t.mjs → google-f-A8xrae.mjs} +2 -2
  10. package/dist/{google-shared-CMLI-tCZ.mjs → google-shared-J6qvYINH.mjs} +5 -4
  11. package/dist/{google-vertex-B4SD3U0f.mjs → google-vertex-D3yMVXIY.mjs} +2 -2
  12. package/dist/{host-WvWBo4h8.d.mts → host-B9GUmcra.d.mts} +2 -2
  13. package/dist/index.d.mts +7 -7
  14. package/dist/index.mjs +2 -2
  15. package/dist/internal/anthropic.d.mts +15 -11
  16. package/dist/internal/anthropic.mjs +4 -4
  17. package/dist/internal/openai.d.mts +2 -1
  18. package/dist/internal/openai.mjs +4 -6
  19. package/dist/internal/runtime.d.mts +8 -32
  20. package/dist/internal/runtime.mjs +2 -3
  21. package/dist/internal/shared.d.mts +13 -8
  22. package/dist/internal/shared.mjs +2 -2
  23. package/dist/{mistral-D5Ps7Led.mjs → mistral-CKV-TOQj.mjs} +4 -3
  24. package/dist/number-coercion-DvG7SNMg.mjs +129 -0
  25. package/dist/{openai-CoGicoDt.d.mts → openai-BPor_3WI.d.mts} +35 -9
  26. package/dist/{openai-responses-shared-CzCurmY1.mjs → openai-D3PD6PE-.mjs} +1771 -745
  27. package/dist/{openai-chatgpt-responses-h0o5yV8Y.mjs → openai-chatgpt-responses-CedIj0hk.mjs} +19 -20
  28. package/dist/{openai-completions-exO8NFQf.mjs → openai-completions-CiSutyu0.mjs} +366 -227
  29. package/dist/openai-prompt-cache-2uo_1OR1.d.mts +7 -0
  30. package/dist/openai-prompt-cache-mZTCdRPo.mjs +12 -0
  31. package/dist/prompt-cache-stability-Cwcjv_fx.d.mts +13 -0
  32. package/dist/{provider-error-C4VvV_3t.mjs → provider-error-apVOZI6G.mjs} +8 -2
  33. package/dist/providers.d.mts +3 -2
  34. package/dist/providers.mjs +10 -9
  35. package/dist/{system-prompt-cache-boundary-CbHeV4_l.mjs → shared-CdjNZd35.mjs} +117 -9
  36. package/dist/{src-CXno1H5g.mjs → src-QkygScBs.mjs} +23 -4
  37. package/dist/stream-first-event-timeout-C3OgBjIk.mjs +12294 -0
  38. package/dist/stream-first-event-timeout-DvDeSucC.d.mts +29 -0
  39. package/dist/transport-stream-shared-BbMELSI4.mjs +297 -0
  40. package/dist/transports.d.mts +105 -102
  41. package/dist/transports.mjs +334 -1966
  42. package/dist/{types-AFwwWium.d.mts → types-bzp5k29J.d.mts} +7 -0
  43. package/dist/types.d.mts +5 -5
  44. package/dist/types.mjs +2 -2
  45. package/dist/{validation-sxvxC8J-.d.mts → validation-B-j7cOYp.d.mts} +1 -1
  46. package/dist/validation.d.mts +1 -1
  47. package/package.json +1 -2
  48. package/dist/azure-openai-responses-client-compat-C7K7QfUE.mjs +0 -62
  49. package/dist/github-copilot-headers-BsH5cqGj.mjs +0 -48
  50. package/dist/model-utils-1GiZ2_rr.mjs +0 -64
  51. package/dist/openai-responses-BHpmtUKo.mjs +0 -136
  52. package/dist/openai-tool-projection-ITOU9bG1.mjs +0 -200
  53. package/dist/reasoning-tag-text-partitioner-BlVe67g6.mjs +0 -400
  54. package/dist/stream-first-event-timeout-DP4xEyBY.mjs +0 -150
  55. package/npm-shrinkwrap.json +0 -638
@@ -1,9 +1,15 @@
1
- import { w as truncateUtf16Safe } from "./system-prompt-cache-boundary-CbHeV4_l.mjs";
1
+ import { D as truncateUtf16Safe } from "./shared-CdjNZd35.mjs";
2
2
  //#region packages/ai/src/utils/provider-error.ts
3
3
  const MAX_ERROR_BODY_LENGTH = 4e3;
4
4
  function stringify(value) {
5
+ const seen = /* @__PURE__ */ new WeakSet();
5
6
  try {
6
- return JSON.stringify(value) ?? String(value);
7
+ return JSON.stringify(value, (_key, candidate) => {
8
+ if (typeof candidate !== "object" || candidate === null) return candidate;
9
+ if (seen.has(candidate)) return "[Circular]";
10
+ seen.add(candidate);
11
+ return candidate;
12
+ }) ?? String(value);
7
13
  } catch {
8
14
  return String(value);
9
15
  }
@@ -1,4 +1,5 @@
1
- import { n as ApiRegistry } from "./api-registry-BMphkFf1.mjs";
1
+ import { n as ApiRegistry } from "./api-registry-DlMgPR39.mjs";
2
+ import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-2uo_1OR1.mjs";
2
3
 
3
4
  //#region packages/ai/src/providers/register-builtins.d.ts
4
5
  /** Source id used for built-in API provider registrations. */
@@ -8,4 +9,4 @@ declare function registerBuiltInApiProviders(registry: ApiRegistry): void;
8
9
  /** Restores the built-in provider registry state for tests. */
9
10
  declare function resetApiProviders(registry: ApiRegistry): void;
10
11
  //#endregion
11
- export { BUILT_IN_API_PROVIDER_SOURCE_ID, registerBuiltInApiProviders, resetApiProviders };
12
+ export { BUILT_IN_API_PROVIDER_SOURCE_ID, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, clampOpenAIPromptCacheKey, registerBuiltInApiProviders, resetApiProviders };
@@ -1,4 +1,5 @@
1
1
  import { t as AssistantMessageEventStream } from "./event-stream-D8n2uFee.mjs";
2
+ import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-mZTCdRPo.mjs";
2
3
  //#region packages/ai/src/providers/register-builtins.ts
3
4
  /** Source id used for built-in API provider registrations. */
4
5
  const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
@@ -63,35 +64,35 @@ function createLazyRegistration(api, importModule, select) {
63
64
  };
64
65
  }
65
66
  const registerBuiltIns = [
66
- createLazyRegistration("anthropic-messages", () => import("./anthropic-CrUDIBpM.mjs").then((n) => n.t), (module) => ({
67
+ createLazyRegistration("anthropic-messages", () => import("./anthropic-CQVj3le6.mjs").then((n) => n.t), (module) => ({
67
68
  stream: module.streamAnthropic,
68
69
  streamSimple: module.streamSimpleAnthropic
69
70
  })),
70
- createLazyRegistration("openai-completions", () => import("./openai-completions-exO8NFQf.mjs").then((n) => n.n), (module) => ({
71
+ createLazyRegistration("openai-completions", () => import("./openai-completions-CiSutyu0.mjs").then((n) => n.n), (module) => ({
71
72
  stream: module.streamOpenAICompletions,
72
73
  streamSimple: module.streamSimpleOpenAICompletions
73
74
  })),
74
- createLazyRegistration("mistral-conversations", () => import("./mistral-D5Ps7Led.mjs"), (module) => ({
75
+ createLazyRegistration("mistral-conversations", () => import("./mistral-CKV-TOQj.mjs"), (module) => ({
75
76
  stream: module.streamMistral,
76
77
  streamSimple: module.streamSimpleMistral
77
78
  })),
78
- createLazyRegistration("openai-responses", () => import("./openai-responses-BHpmtUKo.mjs").then((n) => n.t), (module) => ({
79
+ createLazyRegistration("openai-responses", () => import("./openai-D3PD6PE-.mjs").then((n) => n.t), (module) => ({
79
80
  stream: module.streamOpenAIResponses,
80
81
  streamSimple: module.streamSimpleOpenAIResponses
81
82
  })),
82
- createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-CbrpVeEv.mjs"), (module) => ({
83
+ createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-DIYgsqFM.mjs"), (module) => ({
83
84
  stream: module.streamAzureOpenAIResponses,
84
85
  streamSimple: module.streamSimpleAzureOpenAIResponses
85
86
  })),
86
- createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-h0o5yV8Y.mjs"), (module) => ({
87
+ createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-CedIj0hk.mjs"), (module) => ({
87
88
  stream: module.streamOpenAICodexResponses,
88
89
  streamSimple: module.streamSimpleOpenAICodexResponses
89
90
  })),
90
- createLazyRegistration("google-generative-ai", () => import("./google-Cs62KA7t.mjs"), (module) => ({
91
+ createLazyRegistration("google-generative-ai", () => import("./google-f-A8xrae.mjs"), (module) => ({
91
92
  stream: module.streamGoogle,
92
93
  streamSimple: module.streamSimpleGoogle
93
94
  })),
94
- createLazyRegistration("google-vertex", () => import("./google-vertex-B4SD3U0f.mjs"), (module) => ({
95
+ createLazyRegistration("google-vertex", () => import("./google-vertex-D3yMVXIY.mjs"), (module) => ({
95
96
  stream: module.streamGoogleVertex,
96
97
  streamSimple: module.streamSimpleGoogleVertex
97
98
  }))
@@ -106,4 +107,4 @@ function resetApiProviders(registry) {
106
107
  registerBuiltInApiProviders(registry);
107
108
  }
108
109
  //#endregion
109
- export { BUILT_IN_API_PROVIDER_SOURCE_ID, registerBuiltInApiProviders, resetApiProviders };
110
+ export { BUILT_IN_API_PROVIDER_SOURCE_ID, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, clampOpenAIPromptCacheKey, registerBuiltInApiProviders, resetApiProviders };
@@ -1,4 +1,4 @@
1
- import { a as resolveClaudeFable5ModelIdentity, i as requiresClaudeMandatoryAdaptiveThinking, l as resolveClaudeSonnet5ModelIdentity, r as requiresClaudeDefaultSampling, s as resolveClaudeMythos5ModelIdentity } from "./src-CXno1H5g.mjs";
1
+ import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, i as requiresClaudeDefaultSampling, o as resolveClaudeFable5ModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "./src-QkygScBs.mjs";
2
2
  import { n as getAiTransportHost } from "./host-XYGZcgO8.mjs";
3
3
  import { t as sanitizeSurrogates } from "./sanitize-unicode-DT5o51ur.mjs";
4
4
  //#region packages/ai/src/providers/simple-options.ts
@@ -236,6 +236,10 @@ function normalizeOptionalLowercaseString(value) {
236
236
  function normalizeLowercaseStringOrEmpty(value) {
237
237
  return normalizeOptionalLowercaseString(value) ?? "";
238
238
  }
239
+ /** Type guard for strings that remain non-empty after trimming. */
240
+ function hasNonEmptyString(value) {
241
+ return normalizeOptionalString(value) !== void 0;
242
+ }
239
243
  //#endregion
240
244
  //#region packages/ai/src/providers/anthropic-model-contract.ts
241
245
  function normalizeModelId(modelId) {
@@ -256,7 +260,7 @@ function usesClaudeFable5MessagesContract(model) {
256
260
  /** Return whether streamed output must wait for the terminal refusal decision. */
257
261
  function usesClaudeStreamingRefusalContract(model) {
258
262
  if (normalizeApi(model.api) !== "anthropic-messages") return false;
259
- return resolveClaudeFable5ModelIdentity(model) !== void 0 || resolveClaudeMythos5ModelIdentity(model) !== void 0 || resolveClaudeSonnet5ModelIdentity(model) !== void 0;
263
+ return resolveClaudeFable5ModelIdentity(model) !== void 0 || resolveClaudeMythos5ModelIdentity(model) !== void 0 || resolveClaudeOpus5ModelIdentity(model) !== void 0 || resolveClaudeSonnet5ModelIdentity(model) !== void 0;
260
264
  }
261
265
  function requiresClaudeAdaptiveThinking(model) {
262
266
  if (normalizeApi(model.api) !== "anthropic-messages") return false;
@@ -264,11 +268,11 @@ function requiresClaudeAdaptiveThinking(model) {
264
268
  }
265
269
  /** Return whether omitted thinking should default to adaptive/high. */
266
270
  function defaultsClaudeAdaptiveThinking(model) {
267
- return requiresClaudeAdaptiveThinking(model) || normalizeApi(model.api) === "anthropic-messages" && resolveClaudeSonnet5ModelIdentity(model) !== void 0;
271
+ return requiresClaudeAdaptiveThinking(model) || normalizeApi(model.api) === "anthropic-messages" && (resolveClaudeOpus5ModelIdentity(model) !== void 0 || resolveClaudeSonnet5ModelIdentity(model) !== void 0);
268
272
  }
269
- /** Remove Sonnet 5 assistant prefills while preserving completed tool-use turns. */
270
- function prepareClaudeSonnet5RequestContext(model, context) {
271
- if (!resolveClaudeSonnet5ModelIdentity(model)) return context;
273
+ /** Remove unsupported assistant prefills while preserving completed tool-use turns. */
274
+ function prepareClaudeNoPrefillRequestContext(model, context) {
275
+ if (!resolveClaudeOpus5ModelIdentity(model) && !resolveClaudeSonnet5ModelIdentity(model)) return context;
272
276
  let end = context.messages.length;
273
277
  while (end > 0) {
274
278
  const message = context.messages[end - 1];
@@ -282,12 +286,13 @@ function prepareClaudeSonnet5RequestContext(model, context) {
282
286
  }
283
287
  function applyClaudeRequestContract(params, model) {
284
288
  if (normalizeApi(model.api) !== "anthropic-messages") return;
289
+ const opus5 = resolveClaudeOpus5ModelIdentity(model) !== void 0;
285
290
  const sonnet5 = resolveClaudeSonnet5ModelIdentity(model) !== void 0;
286
- if (!requiresClaudeDefaultSampling(model) && !sonnet5) return;
291
+ if (!requiresClaudeDefaultSampling(model) && !opus5 && !sonnet5) return;
287
292
  delete params.temperature;
288
293
  delete params.top_p;
289
294
  delete params.top_k;
290
- if (sonnet5) delete params.service_tier;
295
+ if (opus5 || sonnet5) delete params.service_tier;
291
296
  }
292
297
  function resolveReplayModelBoundIdentity(ref) {
293
298
  if (normalizeApi(ref.api) !== "anthropic-messages") return;
@@ -299,6 +304,8 @@ function resolveReplayModelBoundIdentity(ref) {
299
304
  if (fableIdentity) return `fable:${fableIdentity}`;
300
305
  const mythosIdentity = resolveClaudeMythos5ModelIdentity(modelRef);
301
306
  if (mythosIdentity) return `mythos:${mythosIdentity}`;
307
+ const opusIdentity = resolveClaudeOpus5ModelIdentity(modelRef);
308
+ if (opusIdentity) return `opus:${opusIdentity}`;
302
309
  const sonnetIdentity = resolveClaudeSonnet5ModelIdentity(modelRef);
303
310
  return sonnetIdentity ? `sonnet:${sonnetIdentity}` : void 0;
304
311
  }
@@ -473,6 +480,15 @@ function transformMessages(messages, model, normalizeToolCallId) {
473
480
  * deterministic across platform newlines, trailing whitespace, and input
474
481
  * ordering.
475
482
  */
483
+ /** Canonicalizes provider tool order without relying on host locale settings. */
484
+ function sortPromptCacheToolsByName(tools) {
485
+ const compareText = (left, right) => {
486
+ const leftText = left ?? "";
487
+ const rightText = right ?? "";
488
+ return leftText < rightText ? -1 : leftText > rightText ? 1 : 0;
489
+ };
490
+ return tools.toSorted((left, right) => compareText(left.wireName ?? left.name, right.wireName ?? right.name) || compareText(left.description, right.description));
491
+ }
476
492
  /** Normalize structured prompt text before hashing or snapshot comparison. */
477
493
  function normalizeStructuredPromptSection(text) {
478
494
  return sanitizeSurrogates(text).replace(/\r\n?/g, "\n").replace(/[ \t]+$/gm, "").trim();
@@ -523,4 +539,96 @@ function prependSystemPromptAdditionAfterCacheBoundary(params) {
523
539
  return `${split.stablePrefix}${SYSTEM_PROMPT_CACHE_BOUNDARY}${systemPromptAddition}\n\n${dynamicSuffix}`;
524
540
  }
525
541
  //#endregion
526
- export { isImageWithMediaPayload as C, buildBaseOptions as D, adjustMaxTokensForThinking as E, clampMaxTokensToModel as O, hasMediaPayload as S, isRecord as T, normalizeOptionalString as _, stripSystemPromptCacheBoundary as a, extractToolResultBlockText as b, transformMessages as c, prepareClaudeSonnet5RequestContext as d, requiresClaudeAdaptiveThinking as f, normalizeLowercaseStringOrEmpty as g, usesClaudeStreamingRefusalContract as h, splitSystemPromptCacheBoundary as i, clampReasoning as k, applyClaudeRequestContract as l, usesClaudeFable5MessagesContract as m, ensureSystemPromptCacheBoundary as n, normalizePromptCapabilityIds as o, resolveModelBoundThinkingReplayMode as p, prependSystemPromptAdditionAfterCacheBoundary as r, normalizeStructuredPromptSection as s, SYSTEM_PROMPT_CACHE_BOUNDARY as t, defaultsClaudeAdaptiveThinking as u, readStringValue as v, truncateUtf16Safe as w, extractToolResultText as x, describeToolResultMediaPlaceholder as y };
542
+ //#region packages/ai/src/utils/tls-certificate-errors.ts
543
+ const HOSTNAME_MISMATCH_CODES = /* @__PURE__ */ new Set(["ERR_TLS_CERT_ALTNAME_INVALID", "HOSTNAME_MISMATCH"]);
544
+ const CERTIFICATE_INVALID_CODES = /* @__PURE__ */ new Set([
545
+ "CERT_CHAIN_TOO_LONG",
546
+ "CERT_HAS_EXPIRED",
547
+ "CERT_NOT_YET_VALID",
548
+ "CERT_REJECTED",
549
+ "CERT_REVOKED",
550
+ "CERT_SIGNATURE_FAILURE",
551
+ "CERT_UNTRUSTED",
552
+ "CRL_HAS_EXPIRED",
553
+ "CRL_NOT_YET_VALID",
554
+ "CRL_SIGNATURE_FAILURE",
555
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
556
+ "ERROR_IN_CERT_NOT_AFTER_FIELD",
557
+ "ERROR_IN_CERT_NOT_BEFORE_FIELD",
558
+ "ERROR_IN_CRL_LAST_UPDATE_FIELD",
559
+ "ERROR_IN_CRL_NEXT_UPDATE_FIELD",
560
+ "INVALID_CA",
561
+ "INVALID_PURPOSE",
562
+ "PATH_LENGTH_EXCEEDED",
563
+ "SELF_SIGNED_CERT_IN_CHAIN",
564
+ "UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY",
565
+ "UNABLE_TO_DECRYPT_CERT_SIGNATURE",
566
+ "UNABLE_TO_DECRYPT_CRL_SIGNATURE",
567
+ "UNABLE_TO_GET_CRL",
568
+ "UNABLE_TO_GET_ISSUER_CERT",
569
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
570
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE"
571
+ ]);
572
+ const HOSTNAME_MISMATCH_PATTERNS = [
573
+ /hostname\/ip does not match certificate(?:'s)? altnames/i,
574
+ /hostname mismatch/i,
575
+ /host: .+ is not in the cert(?:ificate)?(?:'s)? altnames/i
576
+ ];
577
+ const CERTIFICATE_INVALID_PATTERNS = [
578
+ /certificate has expired/i,
579
+ /certificate is not yet valid/i,
580
+ /self[- ]signed certificate/i,
581
+ /unable to get local issuer certificate/i,
582
+ /unable to verify the first certificate/i
583
+ ];
584
+ const MAX_TLS_ERROR_DEPTH = 8;
585
+ function classifyCode(code) {
586
+ if (HOSTNAME_MISMATCH_CODES.has(code)) return "hostname_mismatch";
587
+ return CERTIFICATE_INVALID_CODES.has(code) ? "certificate_invalid" : null;
588
+ }
589
+ function classifyMessage(message) {
590
+ if (HOSTNAME_MISMATCH_PATTERNS.some((pattern) => pattern.test(message))) return "hostname_mismatch";
591
+ return CERTIFICATE_INVALID_PATTERNS.some((pattern) => pattern.test(message)) ? "certificate_invalid" : null;
592
+ }
593
+ function inspectTlsCertificateErrorInternal(error, seen, depth) {
594
+ if (depth > MAX_TLS_ERROR_DEPTH) return null;
595
+ if (typeof error === "string") {
596
+ const kind = classifyMessage(error);
597
+ return kind ? {
598
+ kind,
599
+ message: error
600
+ } : null;
601
+ }
602
+ if (!error || typeof error !== "object" || seen.has(error)) return null;
603
+ seen.add(error);
604
+ const candidate = error;
605
+ const code = typeof candidate.code === "string" ? candidate.code.trim().toUpperCase() : void 0;
606
+ const message = typeof candidate.message === "string" && candidate.message.trim() ? candidate.message : void 0;
607
+ const codeKind = code ? classifyCode(code) : null;
608
+ if (code && codeKind) return {
609
+ kind: codeKind,
610
+ code,
611
+ message: message ?? code
612
+ };
613
+ const nestedErrors = Array.isArray(candidate.errors) ? candidate.errors : [];
614
+ for (const nested of [
615
+ candidate.cause,
616
+ candidate.error,
617
+ ...nestedErrors
618
+ ]) {
619
+ if (nested === void 0 || nested === error) continue;
620
+ const details = inspectTlsCertificateErrorInternal(nested, seen, depth + 1);
621
+ if (details) return details;
622
+ }
623
+ const messageKind = message ? classifyMessage(message) : null;
624
+ return messageKind && message ? {
625
+ kind: messageKind,
626
+ message
627
+ } : null;
628
+ }
629
+ /** Classify deterministic Node/OpenSSL certificate validation failures. */
630
+ function inspectTlsCertificateError(error) {
631
+ return inspectTlsCertificateErrorInternal(error, /* @__PURE__ */ new Set(), 0);
632
+ }
633
+ //#endregion
634
+ export { buildBaseOptions as A, extractToolResultBlockText as C, truncateUtf16Safe as D, isImageWithMediaPayload as E, clampReasoning as M, isRecord as O, describeToolResultMediaPlaceholder as S, hasMediaPayload as T, usesClaudeStreamingRefusalContract as _, splitSystemPromptCacheBoundary as a, normalizeOptionalString as b, normalizeStructuredPromptSection as c, applyClaudeRequestContract as d, defaultsClaudeAdaptiveThinking as f, usesClaudeFable5MessagesContract as g, resolveModelBoundThinkingReplayMode as h, prependSystemPromptAdditionAfterCacheBoundary as i, clampMaxTokensToModel as j, adjustMaxTokensForThinking as k, sortPromptCacheToolsByName as l, requiresClaudeAdaptiveThinking as m, SYSTEM_PROMPT_CACHE_BOUNDARY as n, stripSystemPromptCacheBoundary as o, prepareClaudeNoPrefillRequestContext as p, ensureSystemPromptCacheBoundary as r, normalizePromptCapabilityIds as s, inspectTlsCertificateError as t, transformMessages as u, hasNonEmptyString as v, extractToolResultText as w, readStringValue as x, normalizeLowercaseStringOrEmpty as y };
@@ -31,6 +31,7 @@ const CLAUDE_SONNET_5_THINKING_PROFILE = {
31
31
  ],
32
32
  defaultLevel: "high"
33
33
  };
34
+ const CLAUDE_OPUS_5_THINKING_PROFILE = CLAUDE_SONNET_5_THINKING_PROFILE;
34
35
  /** Resolve the canonical normalized Claude model id for one runtime model ref. */
35
36
  function resolveClaudeModelIdentity(ref) {
36
37
  const normalized = normalizeClaudeModelId((typeof ref.params?.canonicalModelId === "string" ? ref.params.canonicalModelId : void 0) ?? ref.id);
@@ -63,20 +64,38 @@ function resolveClaudeSonnet5ModelIdentity(ref) {
63
64
  if (!match) return;
64
65
  return normalized.slice((match.index ?? 0) + (match[0].startsWith("-") ? 1 : 0));
65
66
  }
67
+ /** Resolve Claude Opus 5 through aliases, direct ids, cloud ids, or deployment metadata. */
68
+ function resolveClaudeOpus5ModelIdentity(ref) {
69
+ const normalized = resolveClaudeModelIdentity(ref);
70
+ if (normalized === "opus" || normalized === "opus-5") return "claude-opus-5";
71
+ const match = /(?:^|-)claude-opus-5(?=$|[^a-z0-9])/.exec(normalized);
72
+ if (!match) return;
73
+ return normalized.slice((match.index ?? 0) + (match[0].startsWith("-") ? 1 : 0));
74
+ }
66
75
  /** Return whether a Claude model supports adaptive thinking. */
67
76
  function supportsClaudeAdaptiveThinking(ref) {
68
77
  const modelId = resolveClaudeModelIdentity(ref);
69
- return /(?:^|-)claude-(?:fable-5|mythos-(?:5|preview)|opus-4-(?:6|7|8)|sonnet-(?:5|4-6))(?=$|[^a-z0-9])/.test(modelId);
78
+ return resolveClaudeOpus5ModelIdentity(ref) !== void 0 || /(?:^|-)claude-(?:fable-5|mythos-(?:5|preview)|opus-4-(?:6|7|8)|sonnet-(?:5|4-6))(?=$|[^a-z0-9])/.test(modelId);
79
+ }
80
+ /** Return whether a Claude model has a native 1M-token context window. */
81
+ function supportsClaude1MContext(ref) {
82
+ const modelId = resolveClaudeModelIdentity(ref);
83
+ return resolveClaudeOpus5ModelIdentity(ref) !== void 0 || /(?:^|-)claude-(?:fable-5|mythos-(?:5|preview)|opus-4-(?:6|7|8)|sonnet-(?:5|4-6))(?=$|[^a-z0-9])/.test(modelId);
84
+ }
85
+ /** Return whether a Claude model supports Anthropic's native fast mode. */
86
+ function supportsClaudeFastMode(ref) {
87
+ const modelId = resolveClaudeModelIdentity(ref);
88
+ return resolveClaudeOpus5ModelIdentity(ref) !== void 0 || /(?:^|-)claude-opus-4-8(?=$|[^a-z0-9])/.test(modelId);
70
89
  }
71
90
  /** Return whether a Claude model supports native max effort. */
72
91
  function supportsClaudeNativeMaxEffort(ref) {
73
92
  const modelId = resolveClaudeModelIdentity(ref);
74
- return /(?:^|-)claude-(?:fable-5|mythos-5|opus-4-(?:6|7|8)|sonnet-(?:5|4-6))(?=$|[^a-z0-9])/.test(modelId);
93
+ return resolveClaudeOpus5ModelIdentity(ref) !== void 0 || /(?:^|-)claude-(?:fable-5|mythos-5|opus-4-(?:6|7|8)|sonnet-(?:5|4-6))(?=$|[^a-z0-9])/.test(modelId);
75
94
  }
76
95
  /** Return whether a Claude model supports native xhigh effort. */
77
96
  function supportsClaudeNativeXhighEffort(ref) {
78
97
  const modelId = resolveClaudeModelIdentity(ref);
79
- return /(?:^|-)claude-(?:fable-5|mythos-5|opus-4-(?:7|8)|sonnet-5)(?=$|[^a-z0-9])/.test(modelId);
98
+ return resolveClaudeOpus5ModelIdentity(ref) !== void 0 || /(?:^|-)claude-(?:fable-5|mythos-5|opus-4-(?:7|8)|sonnet-5)(?=$|[^a-z0-9])/.test(modelId);
80
99
  }
81
100
  /** Return whether a Claude model rejects caller-selected sampling parameters. */
82
101
  function requiresClaudeDefaultSampling(ref) {
@@ -96,4 +115,4 @@ function resolveClaudeNativeThinkingLevelMap(ref) {
96
115
  };
97
116
  }
98
117
  //#endregion
99
- export { resolveClaudeFable5ModelIdentity as a, resolveClaudeNativeThinkingLevelMap as c, supportsClaudeNativeMaxEffort as d, supportsClaudeNativeXhighEffort as f, requiresClaudeMandatoryAdaptiveThinking as i, resolveClaudeSonnet5ModelIdentity as l, CLAUDE_SONNET_5_THINKING_PROFILE as n, resolveClaudeModelIdentity as o, requiresClaudeDefaultSampling as r, resolveClaudeMythos5ModelIdentity as s, CLAUDE_FABLE_5_THINKING_PROFILE as t, supportsClaudeAdaptiveThinking as u };
118
+ export { requiresClaudeMandatoryAdaptiveThinking as a, resolveClaudeMythos5ModelIdentity as c, resolveClaudeSonnet5ModelIdentity as d, supportsClaude1MContext as f, supportsClaudeNativeXhighEffort as g, supportsClaudeNativeMaxEffort as h, requiresClaudeDefaultSampling as i, resolveClaudeNativeThinkingLevelMap as l, supportsClaudeFastMode as m, CLAUDE_OPUS_5_THINKING_PROFILE as n, resolveClaudeFable5ModelIdentity as o, supportsClaudeAdaptiveThinking as p, CLAUDE_SONNET_5_THINKING_PROFILE as r, resolveClaudeModelIdentity as s, CLAUDE_FABLE_5_THINKING_PROFILE as t, resolveClaudeOpus5ModelIdentity as u };