@openclaw/ai 2026.7.2-beta.7 → 2026.8.1-beta.2

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 (91) hide show
  1. package/dist/{anthropic-CH4UUnZr.mjs → anthropic-B6dLpq5L.mjs} +55 -203
  2. package/dist/{src-QkygScBs.mjs → anthropic-JsNA5KCu.mjs} +0 -1
  3. package/dist/anthropic-compaction-replay-8lJNKXOE.mjs +840 -0
  4. package/dist/anthropic-payload-policy-CiEuQS72.d.mts +49 -0
  5. package/dist/{api-registry-DlMgPR39.d.mts → api-registry-k3zTz0cV.d.mts} +1 -1
  6. package/dist/{azure-openai-responses-CImcwB83.mjs → azure-openai-responses-mxIOtUnn.mjs} +23 -29
  7. package/dist/diagnostics.d.mts +24 -1
  8. package/dist/diagnostics.mjs +2 -1
  9. package/dist/{event-stream-YjaPW20U.d.mts → event-stream-BP6AWT8j.d.mts} +4 -1
  10. package/dist/{event-stream-D8n2uFee.mjs → event-stream-uSMZJ3FA.mjs} +26 -5
  11. package/dist/event-stream.d.mts +1 -1
  12. package/dist/event-stream.mjs +1 -1
  13. package/dist/{google-CtSg0iTS.mjs → google-C7h2QzDX.mjs} +5 -5
  14. package/dist/{google-shared-DNBz5rcD.mjs → google-shared-B0Qr9OR7.mjs} +146 -89
  15. package/dist/google-thinking-level-C-V3tecN.mjs +9 -0
  16. package/dist/{google-vertex-31f1uS9L.mjs → google-vertex-Bhc3TjDl.mjs} +11 -7
  17. package/dist/{llm-request-activity-BjtkplhG.mjs → headers-DdOQtGuU.mjs} +9 -1
  18. package/dist/host-DTqNc7ad.mjs +466 -0
  19. package/dist/{host-B9GUmcra.d.mts → host-vWgMMhiJ.d.mts} +9 -4
  20. package/dist/index.d.mts +6 -6
  21. package/dist/index.mjs +7 -5
  22. package/dist/internal/anthropic.d.mts +29 -5
  23. package/dist/internal/anthropic.mjs +5 -5
  24. package/dist/internal/openai-responses-payload-policy.d.mts +3 -0
  25. package/dist/internal/openai-responses-payload-policy.mjs +3 -0
  26. package/dist/internal/openai.d.mts +6 -6
  27. package/dist/internal/openai.mjs +8 -7
  28. package/dist/internal/runtime.d.mts +17 -5
  29. package/dist/internal/runtime.mjs +85 -73
  30. package/dist/internal/shared.d.mts +1 -6
  31. package/dist/internal/shared.mjs +3 -5
  32. package/dist/{json-parse-BvXNt1-7.mjs → json-parse-CDnesDM_.mjs} +4 -6
  33. package/dist/{mistral-CWmpvWYh.mjs → mistral-CEWoQI_g.mjs} +45 -48
  34. package/dist/number-coercion-H9qHik3g.mjs +71 -0
  35. package/dist/openai-chatgpt-jwt-KWcgd0d_.mjs +19 -0
  36. package/dist/{openai-chatgpt-responses-B84Ibtrd.mjs → openai-chatgpt-responses-CrPmqERt.mjs} +284 -240
  37. package/dist/{openai-completions-DsOxhOD1.mjs → openai-completions-BPnt4Sml.mjs} +65 -99
  38. package/dist/{openai-completions-compat-DBWjXoMZ.d.mts → openai-completions-compat-Dt3dcawL.d.mts} +2 -2
  39. package/dist/{openai-responses-BT7A3sLu.mjs → openai-responses-DhIKtOup.mjs} +18 -41
  40. package/dist/openai-responses-contracts-CyfIkQi5.mjs +253 -0
  41. package/dist/openai-responses-contracts-XpZJxrRG.d.mts +68 -0
  42. package/dist/openai-responses-payload-policy-BDxV-W0c.mjs +206 -0
  43. package/dist/openai-responses-payload-policy-BSs371VM.d.mts +40 -0
  44. package/dist/openai-responses-prompt-observer-internal-DgNTYnRY.mjs +46 -0
  45. package/dist/{openai-responses-stream-internal-Cw5txaGW.mjs → openai-responses-shared-DXIt3iY5.mjs} +1406 -940
  46. package/dist/{openai-reasoning-compat-YgeLncHw.mjs → openai-stop-reason-BkFkqqK0.mjs} +204 -37
  47. package/dist/openai-tool-projection-CY04OcvQ.mjs +338 -0
  48. package/dist/provider-error-BUwEnjXq.mjs +429 -0
  49. package/dist/provider-error-CzNw4BWX.d.mts +12 -0
  50. package/dist/{provider-options-D8bB3z9b.d.mts → provider-options-B96RdNpH.d.mts} +9 -3
  51. package/dist/provider-transcript-transform-ePx-Bbfr.mjs +155 -0
  52. package/dist/provider-types.d.mts +31 -0
  53. package/dist/provider-types.mjs +8 -0
  54. package/dist/providers.d.mts +1 -1
  55. package/dist/providers.mjs +17 -19
  56. package/dist/{reasoning-tag-text-partitioner-CGDyLWUR.mjs → reasoning-tag-text-partitioner-rnPwX2pg.mjs} +14 -8
  57. package/dist/record-coerce-DdXsgUd_.mjs +23 -0
  58. package/dist/sanitize-unicode-BYqrYtC_.mjs +90 -0
  59. package/dist/session-resources-CkR4WWy1.mjs +21 -0
  60. package/dist/simple-options-D58D5Kvw.mjs +117 -0
  61. package/dist/src-D2H6yKkH.mjs +2 -0
  62. package/dist/{stream-first-event-timeout-BBys9hSb.mjs → stream-first-event-timeout-MK28puvq.mjs} +2 -2
  63. package/dist/string-coerce-fsri9iCu.mjs +34 -0
  64. package/dist/{tool-schema-json-projection-BwNu3nDi.mjs → tool-schema-json-projection-q5d7QX5c.mjs} +32 -7
  65. package/dist/transport-utils-DJqkxbhC.mjs +138 -0
  66. package/dist/transports.d.mts +166 -241
  67. package/dist/transports.mjs +1979 -1825
  68. package/dist/types-BDdaOVi2.mjs +6 -0
  69. package/dist/{types-bzp5k29J.d.mts → types-BHNrPS1l.d.mts} +23 -1
  70. package/dist/types.d.mts +4 -4
  71. package/dist/types.mjs +6 -4
  72. package/dist/utf16-slice-CvGodqok.mjs +29 -0
  73. package/dist/{validation-DAa_yFOM.mjs → validation-B61OhAio.mjs} +6 -6
  74. package/dist/{validation-B-j7cOYp.d.mts → validation-DT9SrFn3.d.mts} +1 -1
  75. package/dist/validation.d.mts +1 -1
  76. package/dist/validation.mjs +1 -1
  77. package/package.json +15 -1
  78. package/dist/anthropic-usage-DWU-x8MI.mjs +0 -459
  79. package/dist/error-coercion-DgxlWC0n.mjs +0 -15
  80. package/dist/headers-B_e4-1J0.mjs +0 -9
  81. package/dist/host-Dog2WQiR.mjs +0 -369
  82. package/dist/number-coercion-DvG7SNMg.mjs +0 -129
  83. package/dist/openai-chatgpt-jwt-DhAAzLkj.mjs +0 -39
  84. package/dist/openai-responses-shared-pXl6Wd8S.mjs +0 -392
  85. package/dist/openai-tool-projection-OhX64DoP.mjs +0 -215
  86. package/dist/provider-error-CAEvRjry.mjs +0 -47
  87. package/dist/sanitize-unicode-DT5o51ur.mjs +0 -26
  88. package/dist/simple-options-9lhRrN73.mjs +0 -50
  89. package/dist/tool-result-text-CTpIRbYd.mjs +0 -225
  90. package/dist/transform-messages-C8mBqZxF.mjs +0 -2
  91. package/dist/transport-stream-shared-D81p90xq.mjs +0 -297
@@ -0,0 +1,138 @@
1
+ import { a as normalizeOptionalString } from "./string-coerce-fsri9iCu.mjs";
2
+ import { n as getAiTransportHost } from "./host-DTqNc7ad.mjs";
3
+ import { t as truncateUtf16Safe } from "./utf16-slice-CvGodqok.mjs";
4
+ import { a as parseStrictFiniteNumber, n as asFiniteNumberInRange, o as parseStrictNonNegativeInteger } from "./number-coercion-H9qHik3g.mjs";
5
+ import { parseRetryAfterHttpDateMs } from "./internal/retry-after.mjs";
6
+ import { createHash } from "node:crypto";
7
+ //#region packages/ai/src/transports/transport-utils.ts
8
+ const MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE = "OpenClaw transport error: malformed_streaming_fragment";
9
+ const NON_LATIN_RE = /[\u2E80-\u9FFF\uA000-\uA4FF\uAC00-\uD7AF\uF900-\uFAFF\uFF01-\uFF60\uFFE0-\uFFE6\u{20000}-\u{2FA1F}]/gu;
10
+ const CJK_SURROGATE_HIGH_RE = /[\uD840-\uD87E][\uDC00-\uDFFF]/g;
11
+ function sha256Hex(value) {
12
+ return createHash("sha256").update(value).digest("hex");
13
+ }
14
+ function sha256HexPrefix(value, length) {
15
+ return sha256Hex(value).slice(0, length);
16
+ }
17
+ function redactIdentifier(value, opts) {
18
+ const trimmed = normalizeOptionalString(value);
19
+ if (!trimmed) return "-";
20
+ return `sha256:${sha256HexPrefix(trimmed, Number.isFinite(opts?.len) ? Math.max(1, Math.floor(opts?.len ?? 12)) : 12)}`;
21
+ }
22
+ function redactSensitiveText(text, _options) {
23
+ return getAiTransportHost().redactToolPayloadText(text);
24
+ }
25
+ function resolveSecretSentinel(value) {
26
+ return getAiTransportHost().resolveSecretSentinel(value);
27
+ }
28
+ function resolveModelHeaderSentinels(model) {
29
+ if (!model.headers) return model;
30
+ let headers;
31
+ for (const [name, value] of Object.entries(model.headers)) {
32
+ const resolved = resolveSecretSentinel(value);
33
+ if (resolved !== value) {
34
+ headers ??= { ...model.headers };
35
+ headers[name] = resolved;
36
+ }
37
+ }
38
+ return headers ? {
39
+ ...model,
40
+ headers
41
+ } : model;
42
+ }
43
+ function createAbortError(message, options) {
44
+ const error = new Error(message, options);
45
+ error.name = "AbortError";
46
+ return error;
47
+ }
48
+ function estimateStringChars(text) {
49
+ if (!text) return 0;
50
+ const nonLatinCount = (text.match(NON_LATIN_RE) ?? []).length;
51
+ return (nonLatinCount === 0 ? text.length : text.length - (text.match(CJK_SURROGATE_HIGH_RE) ?? []).length) + nonLatinCount * 3;
52
+ }
53
+ function supportsModelTools(model) {
54
+ return (model.compat && typeof model.compat === "object" ? model.compat : void 0)?.supportsTools !== false;
55
+ }
56
+ function isCodeModeModelVisibleToolName(name, visibleToolNames) {
57
+ return visibleToolNames.has(name);
58
+ }
59
+ function isGoogleGemini3Model(modelId, family) {
60
+ const normalized = modelId.trim().toLowerCase();
61
+ const suffix = family === "pro" ? "pro" : "flash";
62
+ return new RegExp(`(?:^|/)gemini-(?:3(?:\\.\\d+)?-${suffix}|${suffix}${family === "flash" ? "(?:-lite)?" : ""}-latest)(?:-|$)`).test(normalized);
63
+ }
64
+ function isGoogleGemini3ProModel(modelId) {
65
+ return isGoogleGemini3Model(modelId, "pro");
66
+ }
67
+ function isGoogleGemini3FlashModel(modelId) {
68
+ return isGoogleGemini3Model(modelId, "flash");
69
+ }
70
+ function parseRetryAfterSeconds(headers) {
71
+ const retryAfterMs = headers.get("retry-after-ms");
72
+ if (retryAfterMs) {
73
+ const trimmed = retryAfterMs.trim();
74
+ if (/^\d+(?:\.\d+)?$/.test(trimmed)) {
75
+ const milliseconds = asFiniteNumberInRange(parseStrictFiniteNumber(trimmed), {
76
+ min: 0,
77
+ max: Number.MAX_SAFE_INTEGER
78
+ });
79
+ return milliseconds === void 0 ? Number.POSITIVE_INFINITY : milliseconds / 1e3;
80
+ }
81
+ }
82
+ const retryAfter = headers.get("retry-after")?.trim();
83
+ if (!retryAfter) return;
84
+ if (/^\d+$/.test(retryAfter)) return parseStrictNonNegativeInteger(retryAfter) ?? Number.POSITIVE_INFINITY;
85
+ const retryAt = parseRetryAfterHttpDateMs(retryAfter);
86
+ return retryAt === void 0 ? void 0 : Math.max(0, (retryAt - Date.now()) / 1e3);
87
+ }
88
+ async function readChunkWithIdleTimeout(reader, timeoutMs, onIdleTimeout) {
89
+ let timer;
90
+ try {
91
+ return await Promise.race([reader.read(), new Promise((_resolve, reject) => {
92
+ timer = setTimeout(() => reject(onIdleTimeout?.({ chunkTimeoutMs: timeoutMs }) ?? /* @__PURE__ */ new Error("Read timed out")), timeoutMs);
93
+ })]);
94
+ } finally {
95
+ if (timer) clearTimeout(timer);
96
+ }
97
+ }
98
+ async function readResponseTextSnippet(response, options) {
99
+ const maxBytes = options?.maxBytes ?? 8 * 1024;
100
+ const maxChars = options?.maxChars ?? 200;
101
+ const reader = response.body?.getReader();
102
+ if (!reader) return;
103
+ const chunks = [];
104
+ let bytes = 0;
105
+ let truncated = false;
106
+ try {
107
+ while (bytes < maxBytes) {
108
+ const result = options?.chunkTimeoutMs ? await readChunkWithIdleTimeout(reader, options.chunkTimeoutMs, options.onIdleTimeout) : await reader.read();
109
+ if (result.done) break;
110
+ if (!result.value?.length) continue;
111
+ const remaining = maxBytes - bytes;
112
+ chunks.push(result.value.subarray(0, remaining));
113
+ bytes += Math.min(result.value.length, remaining);
114
+ if (result.value.length >= remaining) {
115
+ truncated = true;
116
+ await reader.cancel().catch(() => void 0);
117
+ break;
118
+ }
119
+ }
120
+ } catch (error) {
121
+ await reader.cancel(error).catch(() => void 0);
122
+ throw error;
123
+ } finally {
124
+ reader.releaseLock();
125
+ }
126
+ const merged = new Uint8Array(bytes);
127
+ let offset = 0;
128
+ for (const chunk of chunks) {
129
+ merged.set(chunk, offset);
130
+ offset += chunk.length;
131
+ }
132
+ const collapsed = new TextDecoder().decode(merged).replace(/\s+/g, " ").trim();
133
+ if (!collapsed) return;
134
+ if (collapsed.length > maxChars) return `${truncateUtf16Safe(collapsed, maxChars)}…`;
135
+ return truncated ? `${collapsed}…` : collapsed;
136
+ }
137
+ //#endregion
138
+ export { isGoogleGemini3FlashModel as a, readResponseTextSnippet as c, resolveModelHeaderSentinels as d, resolveSecretSentinel as f, isCodeModeModelVisibleToolName as i, redactIdentifier as l, supportsModelTools as m, createAbortError as n, isGoogleGemini3ProModel as o, sha256Hex as p, estimateStringChars as r, parseRetryAfterSeconds as s, MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE as t, redactSensitiveText as u };