@fabric-harness/sdk 6.14.1 → 6.15.0

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 (61) hide show
  1. package/dist/agent-definition.js +2 -2
  2. package/dist/agent-definition.js.map +1 -1
  3. package/dist/agent.d.ts.map +1 -1
  4. package/dist/agent.js +10 -0
  5. package/dist/agent.js.map +1 -1
  6. package/dist/channel-runtime.d.ts +1 -1
  7. package/dist/channel-runtime.d.ts.map +1 -1
  8. package/dist/channel-runtime.js.map +1 -1
  9. package/dist/channel.d.ts +9 -1
  10. package/dist/channel.d.ts.map +1 -1
  11. package/dist/channel.js +22 -9
  12. package/dist/channel.js.map +1 -1
  13. package/dist/conversation-ownership.d.ts +10 -4
  14. package/dist/conversation-ownership.d.ts.map +1 -1
  15. package/dist/conversation-ownership.js +27 -5
  16. package/dist/conversation-ownership.js.map +1 -1
  17. package/dist/env-model-provider.d.ts +38 -0
  18. package/dist/env-model-provider.d.ts.map +1 -0
  19. package/dist/env-model-provider.js +47 -0
  20. package/dist/env-model-provider.js.map +1 -0
  21. package/dist/experimental.d.ts +1 -0
  22. package/dist/experimental.d.ts.map +1 -1
  23. package/dist/experimental.js +1 -0
  24. package/dist/experimental.js.map +1 -1
  25. package/dist/index.d.ts +2 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +1 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/loop.d.ts +1 -0
  30. package/dist/loop.d.ts.map +1 -1
  31. package/dist/loop.js +9 -0
  32. package/dist/loop.js.map +1 -1
  33. package/dist/model.d.ts +3 -2
  34. package/dist/model.d.ts.map +1 -1
  35. package/dist/model.js +186 -33
  36. package/dist/model.js.map +1 -1
  37. package/dist/persistent-agent.d.ts +3 -0
  38. package/dist/persistent-agent.d.ts.map +1 -1
  39. package/dist/persistent-agent.js.map +1 -1
  40. package/dist/pi-loop-runtime.d.ts +2 -0
  41. package/dist/pi-loop-runtime.d.ts.map +1 -1
  42. package/dist/pi-loop-runtime.js +133 -10
  43. package/dist/pi-loop-runtime.js.map +1 -1
  44. package/dist/policy.d.ts +6 -0
  45. package/dist/policy.d.ts.map +1 -1
  46. package/dist/policy.js +23 -0
  47. package/dist/policy.js.map +1 -1
  48. package/dist/session.d.ts +4 -0
  49. package/dist/session.d.ts.map +1 -1
  50. package/dist/session.js +193 -120
  51. package/dist/session.js.map +1 -1
  52. package/dist/strict.d.ts +2 -1
  53. package/dist/strict.d.ts.map +1 -1
  54. package/dist/strict.js +1 -0
  55. package/dist/strict.js.map +1 -1
  56. package/dist/tools.d.ts +1 -1
  57. package/dist/tools.d.ts.map +1 -1
  58. package/dist/types.d.ts +10 -1
  59. package/dist/types.d.ts.map +1 -1
  60. package/dist/types.js.map +1 -1
  61. package/package.json +2 -2
package/dist/model.js CHANGED
@@ -478,6 +478,7 @@ export class OpenAICompatibleModelProvider {
478
478
  await this.rateLimiter.acquire(this.rateLimitKey, request.signal ? { signal: request.signal } : undefined);
479
479
  const token = await this.authToken();
480
480
  const headers = await this.requestHeaders();
481
+ const secrets = [token, ...extractHeaderSecrets(headers)];
481
482
  const init = {
482
483
  method: "POST",
483
484
  ...(request.signal !== undefined ? { signal: request.signal } : {}),
@@ -499,14 +500,14 @@ export class OpenAICompatibleModelProvider {
499
500
  const response = await this.fetchImpl(`${this.baseUrl}/chat/completions`, init);
500
501
  if (!response.ok) {
501
502
  const body = await response.text();
502
- throw formatProviderHttpError(this.name, model, response.status, response.statusText, body, response.headers);
503
+ throw formatProviderHttpError(this.name, model, response.status, response.statusText, body, response.headers, secrets);
503
504
  }
504
505
  let json;
505
506
  try {
506
507
  json = (await response.json());
507
508
  }
508
509
  catch (error) {
509
- const message = error instanceof Error ? error.message : String(error);
510
+ const message = redactProviderText(error instanceof Error ? error.message : String(error), secrets);
510
511
  throw new Error(`${this.name}: failed to parse response as JSON: ${message}`);
511
512
  }
512
513
  const result = openAIChatCompletionToModelResponse(json);
@@ -521,6 +522,7 @@ export class OpenAICompatibleModelProvider {
521
522
  await this.rateLimiter.acquire(this.rateLimitKey, request.signal ? { signal: request.signal } : undefined);
522
523
  const token = await this.authToken();
523
524
  const headers = await this.requestHeaders();
525
+ const secrets = [token, ...extractHeaderSecrets(headers)];
524
526
  const init = {
525
527
  method: "POST",
526
528
  ...(request.signal !== undefined ? { signal: request.signal } : {}),
@@ -545,7 +547,7 @@ export class OpenAICompatibleModelProvider {
545
547
  const response = await this.fetchImpl(`${this.baseUrl}/chat/completions`, init);
546
548
  if (!response.ok || !response.body) {
547
549
  const body = await response.text();
548
- throw formatProviderHttpError(this.name, model, response.status, response.statusText, body, response.headers);
550
+ throw formatProviderHttpError(this.name, model, response.status, response.statusText, body, response.headers, secrets);
549
551
  }
550
552
  const text = [];
551
553
  const thinking = [];
@@ -671,7 +673,7 @@ export class AzureOpenAIModelProvider {
671
673
  }),
672
674
  });
673
675
  if (!response.ok)
674
- throw formatProviderHttpError(this.name, this.deployment, response.status, response.statusText, await response.text(), response.headers);
676
+ throw formatProviderHttpError(this.name, this.deployment, response.status, response.statusText, await response.text(), response.headers, [this.apiKey, ...extractHeaderSecrets(this.headers)]);
675
677
  const result = openAIChatCompletionToModelResponse((await response.json()));
676
678
  priceAdapterUsage(`azure-openai/${this.deployment}`, result.usage);
677
679
  return result;
@@ -704,7 +706,7 @@ export class GeminiModelProvider {
704
706
  body: JSON.stringify({ ...toGeminiRequest(request, model), ...this.extraBody }),
705
707
  });
706
708
  if (!response.ok)
707
- throw formatProviderHttpError(this.name, model, response.status, response.statusText, await response.text(), response.headers);
709
+ throw formatProviderHttpError(this.name, model, response.status, response.statusText, await response.text(), response.headers, [this.apiKey, ...extractHeaderSecrets(this.headers)]);
708
710
  const result = geminiResponseToModelResponse((await response.json()));
709
711
  priceAdapterUsage(`gemini/${model}`, result.usage);
710
712
  return result;
@@ -744,7 +746,7 @@ export class VertexAIModelProvider {
744
746
  body: JSON.stringify({ ...toGeminiRequest(request, model), ...this.extraBody }),
745
747
  });
746
748
  if (!response.ok)
747
- throw formatProviderHttpError(this.name, model, response.status, response.statusText, await response.text(), response.headers);
749
+ throw formatProviderHttpError(this.name, model, response.status, response.statusText, await response.text(), response.headers, [this.accessToken, ...extractHeaderSecrets(this.headers)]);
748
750
  const result = geminiResponseToModelResponse((await response.json()));
749
751
  priceAdapterUsage(`gemini/${model}`, result.usage);
750
752
  return result;
@@ -797,7 +799,12 @@ export class BedrockModelProvider {
797
799
  body,
798
800
  });
799
801
  if (!response.ok)
800
- throw formatProviderHttpError(this.name, model, response.status, response.statusText, await response.text(), response.headers);
802
+ throw formatProviderHttpError(this.name, model, response.status, response.statusText, await response.text(), response.headers, [
803
+ this.accessKeyId,
804
+ this.secretAccessKey,
805
+ this.sessionToken,
806
+ ...extractHeaderSecrets(headers),
807
+ ]);
801
808
  const result = bedrockResponseToModelResponse((await response.json()));
802
809
  priceAdapterUsage(`bedrock/${model}`, result.usage);
803
810
  return result;
@@ -834,7 +841,7 @@ export class CohereModelProvider {
834
841
  body: JSON.stringify({ model, messages: request.messages.map(toCohereMessage), ...this.extraBody }),
835
842
  });
836
843
  if (!response.ok)
837
- throw formatProviderHttpError(this.name, model, response.status, response.statusText, await response.text(), response.headers);
844
+ throw formatProviderHttpError(this.name, model, response.status, response.statusText, await response.text(), response.headers, [this.apiKey, ...extractHeaderSecrets(this.headers)]);
838
845
  const result = cohereResponseToModelResponse((await response.json()));
839
846
  priceAdapterUsage(`cohere/${model}`, result.usage);
840
847
  return result;
@@ -931,7 +938,7 @@ export class AnthropicModelProvider {
931
938
  }),
932
939
  });
933
940
  if (!response.ok)
934
- throw formatProviderHttpError(this.name, model, response.status, response.statusText, await response.text(), response.headers);
941
+ throw formatProviderHttpError(this.name, model, response.status, response.statusText, await response.text(), response.headers, [this.apiKey, ...extractHeaderSecrets(this.headers)]);
935
942
  const result = anthropicResponseToModelResponse((await response.json()));
936
943
  priceAdapterUsage(`anthropic/${model}`, result.usage);
937
944
  return result;
@@ -966,8 +973,9 @@ export class AnthropicModelProvider {
966
973
  ...this.extraBody,
967
974
  }),
968
975
  });
976
+ const secrets = [this.apiKey, ...extractHeaderSecrets(this.headers)];
969
977
  if (!response.ok || !response.body)
970
- throw formatProviderHttpError(this.name, model, response.status, response.statusText, await response.text(), response.headers);
978
+ throw formatProviderHttpError(this.name, model, response.status, response.statusText, await response.text(), response.headers, secrets);
971
979
  const text = [];
972
980
  const thinking = [];
973
981
  const toolCallBuffers = new Map();
@@ -984,7 +992,7 @@ export class AnthropicModelProvider {
984
992
  if (!data)
985
993
  continue;
986
994
  if (type === "error")
987
- throw anthropicStreamError(this.name, model, data);
995
+ throw anthropicStreamError(this.name, model, data, secrets);
988
996
  if (type === "content_block_start") {
989
997
  const idx = typeof data.index === "number" ? data.index : 0;
990
998
  const block = data.content_block;
@@ -1952,12 +1960,13 @@ function priceAdapterUsage(modelRef, usage) {
1952
1960
  * the matching HTTP status, so overloaded and server errors stay retryable
1953
1961
  * and invalid requests do not retry.
1954
1962
  */
1955
- function anthropicStreamError(provider, model, data) {
1963
+ function anthropicStreamError(provider, model, data, secrets) {
1956
1964
  const error = (data.error ?? {});
1957
- const type = typeof error.type === "string" ? error.type : "error";
1958
- const status = ANTHROPIC_STREAM_ERROR_STATUS[type] ?? 400;
1959
- const message = typeof error.message === "string" ? error.message : type;
1960
- return new ProviderHttpError(`${provider} model ${model}: stream error ${type}: ${message}`, provider, status, type, JSON.stringify(data));
1965
+ const rawType = typeof error.type === "string" ? error.type : "error";
1966
+ const status = ANTHROPIC_STREAM_ERROR_STATUS[rawType] ?? 400;
1967
+ const type = redactProviderText(rawType, secrets);
1968
+ const message = typeof error.message === "string" ? redactProviderText(error.message, secrets) : type;
1969
+ return new ProviderHttpError(`${provider} model ${model}: stream error ${type}: ${message}`, provider, status, type, redactProviderText(JSON.stringify(data), secrets));
1961
1970
  }
1962
1971
  // HTTP statuses Anthropic documents for each error type, so a mid-stream
1963
1972
  // error frame classifies for retry exactly like the same error as a response.
@@ -2013,27 +2022,161 @@ async function* decodeAnthropicSSE(stream) {
2013
2022
  reader.releaseLock();
2014
2023
  }
2015
2024
  }
2025
+ const REDACTED_CREDENTIAL = "[REDACTED]";
2026
+ const SECRET_HEADER_NAME_RE = /(?:authorization|api[-_]?key|subscription[-_]?key|client[-_]?key|private[-_]?key|secret|password|passwd|credential|cookie|token$)/i;
2027
+ const AUTH_SCHEME_VALUE_RE = /^(?:Bearer|Basic)\s+(.+)$/i;
2028
+ const AWS_SIGNATURE_VALUE_RE = /Signature=([0-9a-f]{16,})/i;
2029
+ // Unambiguous credential shapes redacted even when no explicit secret was
2030
+ // passed (for example, direct `new ProviderHttpError(...)` calls or tokens
2031
+ // transformed by an intermediary proxy). The Bearer/Basic rule requires a
2032
+ // token-like value (8+ chars with a digit, token symbol, or mixed case, or
2033
+ // 20+ chars) so prose like "Bearer token required" or "Basic authentication"
2034
+ // is not mangled.
2035
+ const PROVIDER_CREDENTIAL_PATTERNS = [
2036
+ [
2037
+ /\b(Bearer|Basic)\s+(?=(?:[A-Za-z0-9._~+/=-]*[0-9_+/=-]|[A-Za-z0-9._~+/=-]*[a-z][A-Z]|[A-Za-z0-9._~+/=-]{20,}))[A-Za-z0-9._~+/=-]{7,}[A-Za-z0-9_~+/=-]/g,
2038
+ `$1 ${REDACTED_CREDENTIAL}`,
2039
+ ],
2040
+ [/\bsk-[A-Za-z0-9_-]{8,}/g, REDACTED_CREDENTIAL],
2041
+ [/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g, REDACTED_CREDENTIAL],
2042
+ [/\bdapi[0-9a-f]{16,}(?:-\d+)?\b/gi, REDACTED_CREDENTIAL],
2043
+ ];
2044
+ const REDACTION_PLACEHOLDER_SPLIT_RE = /(\[REDACTED\]|\[attachment data redacted\])/g;
2045
+ const MIN_PRE_ATTACHMENT_SECRET_LENGTH = 6;
2046
+ /**
2047
+ * Extract credential values from request headers whose names indicate auth
2048
+ * material. Also extracts the bare token after `Bearer`/`Basic` and the AWS
2049
+ * SigV4 `Signature=` value so echoes of just the token are redacted too.
2050
+ */
2051
+ function extractHeaderSecrets(headers) {
2052
+ if (!headers)
2053
+ return [];
2054
+ const secrets = [];
2055
+ for (const [name, raw] of Object.entries(headers)) {
2056
+ if (!SECRET_HEADER_NAME_RE.test(name))
2057
+ continue;
2058
+ const trimmed = raw.trim();
2059
+ if (!trimmed)
2060
+ continue;
2061
+ secrets.push(trimmed);
2062
+ const schemeMatch = AUTH_SCHEME_VALUE_RE.exec(trimmed);
2063
+ const bare = schemeMatch?.[1]?.trim();
2064
+ if (bare)
2065
+ secrets.push(bare);
2066
+ const sigMatch = AWS_SIGNATURE_VALUE_RE.exec(trimmed);
2067
+ if (sigMatch?.[1])
2068
+ secrets.push(sigMatch[1]);
2069
+ }
2070
+ return secrets;
2071
+ }
2072
+ /**
2073
+ * Expand caller-supplied credentials into the literal, URL-encoded, and
2074
+ * JSON-escaped forms a provider response may echo, longest first so a
2075
+ * longer encoding is replaced before any shorter substring.
2076
+ */
2077
+ function expandSecretVariants(secrets) {
2078
+ const long = new Set();
2079
+ const short = new Set();
2080
+ for (const raw of secrets ?? []) {
2081
+ if (typeof raw !== "string" || raw.length === 0)
2082
+ continue;
2083
+ const urlEncoded = encodeURIComponent(raw);
2084
+ const urlEncodedLower = urlEncoded.replace(/%[0-9A-F]{2}/g, (match) => match.toLowerCase());
2085
+ const jsonEscaped = JSON.stringify(raw).slice(1, -1);
2086
+ for (const candidate of [raw, urlEncoded, urlEncodedLower, jsonEscaped]) {
2087
+ if (candidate.length === 0)
2088
+ continue;
2089
+ if (candidate.length >= MIN_PRE_ATTACHMENT_SECRET_LENGTH) {
2090
+ long.add(candidate);
2091
+ }
2092
+ else {
2093
+ short.add(candidate);
2094
+ }
2095
+ }
2096
+ }
2097
+ const byLengthDesc = (a, b) => b.length - a.length;
2098
+ return {
2099
+ long: [...long].sort(byLengthDesc),
2100
+ short: [...short].sort(byLengthDesc),
2101
+ };
2102
+ }
2103
+ function escapeRegExp(value) {
2104
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2105
+ }
2106
+ function replaceExactSecrets(text, secrets) {
2107
+ let out = text;
2108
+ for (const secret of secrets) {
2109
+ if (out.includes(secret))
2110
+ out = out.split(secret).join(REDACTED_CREDENTIAL);
2111
+ }
2112
+ return out;
2113
+ }
2114
+ /**
2115
+ * Redact short (<6 char) credentials only on non-alphanumeric boundaries so
2116
+ * local placeholder keys like `"x"` or `"none"` do not mangle unrelated
2117
+ * diagnostic words like `"context"` or `"exceeded"`.
2118
+ */
2119
+ function replaceShortExactSecrets(text, secrets) {
2120
+ let out = text;
2121
+ for (const secret of secrets) {
2122
+ if (!out.includes(secret))
2123
+ continue;
2124
+ const re = new RegExp(`(?<![A-Za-z0-9])${escapeRegExp(secret)}(?![A-Za-z0-9])`, "g");
2125
+ out = out.replace(re, REDACTED_CREDENTIAL);
2126
+ }
2127
+ return out;
2128
+ }
2129
+ /**
2130
+ * Redact echoed credentials and attachment payloads from provider-supplied
2131
+ * text.
2132
+ *
2133
+ * Exact credentials of 6+ chars and unambiguous credential patterns run before
2134
+ * `redactAttachmentPayloads`, so a long OAuth JWT (whose payload segment can
2135
+ * exceed 256 base64url chars) is redacted whole rather than leaving its header
2136
+ * or signature exposed. Attachment payload redaction runs before short (<6
2137
+ * char) credentials so a 1-char test key cannot split a base64 attachment run
2138
+ * into unredacted fragments, and short credentials match only on token
2139
+ * boundaries outside existing placeholders.
2140
+ */
2141
+ function redactProviderText(text, secrets) {
2142
+ if (!text)
2143
+ return text;
2144
+ const { long, short } = expandSecretVariants(secrets);
2145
+ let out = replaceExactSecrets(text, long);
2146
+ for (const [pattern, replacement] of PROVIDER_CREDENTIAL_PATTERNS) {
2147
+ out = out.replace(pattern, replacement);
2148
+ }
2149
+ out = redactAttachmentPayloads(out);
2150
+ if (short.length > 0) {
2151
+ out = out
2152
+ .split(REDACTION_PLACEHOLDER_SPLIT_RE)
2153
+ .map((part, index) => (index % 2 === 1 ? part : replaceShortExactSecrets(part, short)))
2154
+ .join("");
2155
+ }
2156
+ return out;
2157
+ }
2016
2158
  export class ProviderHttpError extends Error {
2017
2159
  provider;
2018
2160
  status;
2019
- statusText;
2020
2161
  /**
2021
2162
  * Wait duration extracted from a `Retry-After` response header on 429
2022
2163
  * responses. When set, the resilience wrapper waits exactly this long
2023
2164
  * instead of using exponential backoff.
2024
2165
  */
2025
2166
  retryAfterMs;
2026
- /** Response body, with echoed attachment payloads redacted. */
2167
+ /** HTTP status text, with echoed attachment payloads and credentials redacted. */
2168
+ statusText;
2169
+ /** Response body, with echoed attachment payloads and credentials redacted. */
2027
2170
  body;
2028
2171
  constructor(message, provider, status, statusText, body, retryAfterMs) {
2029
2172
  // A 4xx body often quotes the rejected request, including image and PDF
2030
- // data URLs. Neither the message nor the body may carry those bytes into
2031
- // logs, session entries, or events.
2032
- super(redactAttachmentPayloads(message));
2173
+ // data URLs or echoed credentials. Neither the message, status text, nor
2174
+ // body may carry those bytes into logs, session entries, or events.
2175
+ super(redactProviderText(message));
2033
2176
  this.provider = provider;
2034
2177
  this.status = status;
2035
- this.statusText = statusText;
2036
- this.body = redactAttachmentPayloads(body);
2178
+ this.statusText = redactProviderText(statusText);
2179
+ this.body = redactProviderText(body);
2037
2180
  this.name = "ProviderHttpError";
2038
2181
  if (retryAfterMs !== undefined && Number.isFinite(retryAfterMs) && retryAfterMs > 0) {
2039
2182
  this.retryAfterMs = retryAfterMs;
@@ -2114,28 +2257,38 @@ function hmacHex(key, value) {
2114
2257
  function awsSigningKey(secret, date, region, service) {
2115
2258
  return hmac(hmac(hmac(hmac(`AWS4${secret}`, date), region), service), "aws4_request");
2116
2259
  }
2117
- function formatProviderHttpError(provider, model, status, statusText, body, headers) {
2260
+ function formatProviderHttpError(provider, model, status, statusText, body, headers, secrets) {
2118
2261
  const retryAfterMs = headers ? parseRetryAfterMs(headers.get("retry-after")) : undefined;
2119
2262
  let parsedMessage;
2120
2263
  let code;
2121
2264
  try {
2122
2265
  const parsed = JSON.parse(body);
2123
- parsedMessage = parsed.error?.message;
2124
- code = parsed.error?.code ?? parsed.error?.type;
2266
+ if (typeof parsed?.error?.message === "string")
2267
+ parsedMessage = parsed.error.message;
2268
+ if (typeof parsed?.error?.code === "string")
2269
+ code = parsed.error.code;
2270
+ else if (typeof parsed?.error?.type === "string")
2271
+ code = parsed.error.type;
2125
2272
  }
2126
2273
  catch { }
2127
- const details = parsedMessage ?? body.slice(0, 500);
2274
+ // Redact the full response before truncating to 500 chars so a secret that
2275
+ // crosses the cut cannot leak its prefix.
2276
+ const redactedBody = redactProviderText(body, secrets);
2277
+ const redactedStatusText = redactProviderText(statusText, secrets);
2278
+ const details = parsedMessage !== undefined
2279
+ ? redactProviderText(parsedMessage, secrets)
2280
+ : redactedBody.slice(0, 500);
2128
2281
  if (status === 401 || status === 403)
2129
- return new ProviderHttpError(`${provider}: authentication/authorization failed for model "${model ?? "unknown"}" (${status}). Check API key and provider permissions. ${details}`, provider, status, statusText, body);
2282
+ return new ProviderHttpError(`${provider}: authentication/authorization failed for model "${model ?? "unknown"}" (${status}). Check API key and provider permissions. ${details}`, provider, status, redactedStatusText, redactedBody);
2130
2283
  if (status === 400 && /model/i.test(details))
2131
- return new ProviderHttpError(`${provider}: provider rejected model "${model ?? "unknown"}". Check FABRIC_MODEL/model access/base URL. ${details}`, provider, status, statusText, body);
2284
+ return new ProviderHttpError(`${provider}: provider rejected model "${model ?? "unknown"}". Check FABRIC_MODEL/model access/base URL. ${details}`, provider, status, redactedStatusText, redactedBody);
2132
2285
  if (status === 400 &&
2133
2286
  (/schema|function|tool/i.test(details) || code === "invalid_function_parameters"))
2134
- return new ProviderHttpError(`${provider}: provider rejected a tool schema. Run fabric-harness doctor --tools. ${details}`, provider, status, statusText, body);
2287
+ return new ProviderHttpError(`${provider}: provider rejected a tool schema. Run fabric-harness doctor --tools. ${details}`, provider, status, redactedStatusText, redactedBody);
2135
2288
  if (status === 429)
2136
- return new ProviderHttpError(`${provider}: rate limited for model "${model ?? "unknown"}". ${details}`, provider, status, statusText, body, retryAfterMs);
2289
+ return new ProviderHttpError(`${provider}: rate limited for model "${model ?? "unknown"}". ${details}`, provider, status, redactedStatusText, redactedBody, retryAfterMs);
2137
2290
  if (status >= 500)
2138
- return new ProviderHttpError(`${provider}: provider unavailable (${status} ${statusText}). ${details}`, provider, status, statusText, body, retryAfterMs);
2139
- return new ProviderHttpError(`${provider}: ${status} ${statusText}: ${details}`, provider, status, statusText, body, retryAfterMs);
2291
+ return new ProviderHttpError(`${provider}: provider unavailable (${status} ${redactedStatusText}). ${details}`, provider, status, redactedStatusText, redactedBody, retryAfterMs);
2292
+ return new ProviderHttpError(`${provider}: ${status} ${redactedStatusText}: ${details}`, provider, status, redactedStatusText, redactedBody, retryAfterMs);
2140
2293
  }
2141
2294
  //# sourceMappingURL=model.js.map