@ai-matrx/api 0.1.11 → 0.1.12

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 (124) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/account.d.cts +2 -2
  3. package/dist/account.d.ts +2 -2
  4. package/dist/agents.cjs +34 -16
  5. package/dist/agents.d.cts +106 -12
  6. package/dist/agents.d.ts +106 -12
  7. package/dist/agents.js +22 -7
  8. package/dist/ai.cjs +3 -3
  9. package/dist/ai.d.cts +3 -3
  10. package/dist/ai.d.ts +3 -3
  11. package/dist/ai.js +2 -2
  12. package/dist/apps.cjs +5 -5
  13. package/dist/apps.d.cts +2 -2
  14. package/dist/apps.d.ts +2 -2
  15. package/dist/apps.js +1 -1
  16. package/dist/architecture.cjs +74 -26
  17. package/dist/architecture.d.cts +246 -20
  18. package/dist/architecture.d.ts +246 -20
  19. package/dist/architecture.js +56 -16
  20. package/dist/audio.cjs +4 -4
  21. package/dist/audio.d.cts +2 -2
  22. package/dist/audio.d.ts +2 -2
  23. package/dist/audio.js +1 -1
  24. package/dist/chat.cjs +11 -11
  25. package/dist/chat.d.cts +7 -15
  26. package/dist/chat.d.ts +7 -15
  27. package/dist/chat.js +1 -1
  28. package/dist/{chunk-6KHHHBG5.js → chunk-ILLQUHLF.js} +30 -8
  29. package/dist/{chunk-2ZHIYXHV.cjs → chunk-U63KIQSS.cjs} +29 -6
  30. package/dist/code.cjs +18 -6
  31. package/dist/code.d.cts +35 -3
  32. package/dist/code.d.ts +35 -3
  33. package/dist/code.js +12 -2
  34. package/dist/commerce.d.cts +2 -2
  35. package/dist/commerce.d.ts +2 -2
  36. package/dist/communications.cjs +4 -4
  37. package/dist/communications.d.cts +2 -2
  38. package/dist/communications.d.ts +2 -2
  39. package/dist/communications.js +1 -1
  40. package/dist/computer.cjs +3 -3
  41. package/dist/computer.d.cts +2 -2
  42. package/dist/computer.d.ts +2 -2
  43. package/dist/computer.js +1 -1
  44. package/dist/content.cjs +43 -43
  45. package/dist/content.d.cts +133 -114
  46. package/dist/content.d.ts +133 -114
  47. package/dist/content.js +34 -34
  48. package/dist/crm.cjs +2 -2
  49. package/dist/crm.d.cts +20 -20
  50. package/dist/crm.d.ts +20 -20
  51. package/dist/crm.js +1 -1
  52. package/dist/data.cjs +73 -0
  53. package/dist/data.d.cts +466 -13
  54. package/dist/data.d.ts +466 -13
  55. package/dist/data.js +62 -1
  56. package/dist/education.cjs +4 -4
  57. package/dist/education.d.cts +2 -2
  58. package/dist/education.d.ts +2 -2
  59. package/dist/education.js +1 -1
  60. package/dist/files.cjs +21 -21
  61. package/dist/files.d.cts +14 -5
  62. package/dist/files.d.ts +14 -5
  63. package/dist/files.js +3 -3
  64. package/dist/human-resources.d.cts +2 -2
  65. package/dist/human-resources.d.ts +2 -2
  66. package/dist/{index-Gj30ybjE.d.cts → index-BSrN3TFD.d.cts} +5 -3
  67. package/dist/{index-Gj30ybjE.d.ts → index-BSrN3TFD.d.ts} +5 -3
  68. package/dist/index.cjs +73 -69
  69. package/dist/index.d.cts +2 -2
  70. package/dist/index.d.ts +2 -2
  71. package/dist/index.js +3 -3
  72. package/dist/integrations.cjs +113 -5
  73. package/dist/integrations.d.cts +389 -14
  74. package/dist/integrations.d.ts +389 -14
  75. package/dist/integrations.js +94 -4
  76. package/dist/intelligence.cjs +12 -6
  77. package/dist/intelligence.d.cts +69 -4
  78. package/dist/intelligence.d.ts +69 -4
  79. package/dist/intelligence.js +7 -2
  80. package/dist/knowledge.cjs +43 -43
  81. package/dist/knowledge.d.cts +4 -3
  82. package/dist/knowledge.d.ts +4 -3
  83. package/dist/knowledge.js +2 -2
  84. package/dist/legal.cjs +6 -6
  85. package/dist/legal.d.cts +2 -2
  86. package/dist/legal.d.ts +2 -2
  87. package/dist/legal.js +1 -1
  88. package/dist/marketing.cjs +134 -100
  89. package/dist/marketing.d.cts +151 -30
  90. package/dist/marketing.d.ts +151 -30
  91. package/dist/marketing.js +54 -26
  92. package/dist/masterwork.cjs +32 -32
  93. package/dist/masterwork.d.cts +2 -2
  94. package/dist/masterwork.d.ts +2 -2
  95. package/dist/masterwork.js +1 -1
  96. package/dist/media.cjs +11 -11
  97. package/dist/media.d.cts +11 -11
  98. package/dist/media.d.ts +11 -11
  99. package/dist/media.js +1 -1
  100. package/dist/platform.cjs +3 -3
  101. package/dist/platform.d.cts +2 -2
  102. package/dist/platform.d.ts +2 -2
  103. package/dist/platform.js +1 -1
  104. package/dist/publish.cjs +7 -7
  105. package/dist/publish.d.cts +4 -2
  106. package/dist/publish.d.ts +4 -2
  107. package/dist/publish.js +1 -1
  108. package/dist/schemas.d.cts +16 -3
  109. package/dist/schemas.d.ts +16 -3
  110. package/dist/stream.cjs +10 -10
  111. package/dist/stream.d.cts +1 -1
  112. package/dist/stream.d.ts +1 -1
  113. package/dist/stream.js +1 -1
  114. package/dist/types.d.cts +1366 -145
  115. package/dist/types.d.ts +1366 -145
  116. package/dist/web.cjs +26 -26
  117. package/dist/web.d.cts +29 -14
  118. package/dist/web.d.ts +29 -14
  119. package/dist/web.js +1 -1
  120. package/dist/workflows.cjs +19 -13
  121. package/dist/workflows.d.cts +39 -4
  122. package/dist/workflows.d.ts +39 -4
  123. package/dist/workflows.js +7 -2
  124. package/package.json +2 -2
package/dist/files.js CHANGED
@@ -1,4 +1,4 @@
1
- import { openStream, openJsonOrStream } from './chunk-6KHHHBG5.js';
1
+ import { openStream, openJsonOrStream } from './chunk-ILLQUHLF.js';
2
2
  import './chunk-PIPE5OML.js';
3
3
 
4
4
  // src/generated/files.ts
@@ -134,9 +134,9 @@ var $pdfFromImages = { m: "POST", p: "/utilities/pdf/from-images", d: "aidream",
134
134
  function pdfFromImages(api, args, options) {
135
135
  return openStream(api, $pdfFromImages, args, options);
136
136
  }
137
- var $cleanDocumentContent = { m: "POST", p: "/utilities/pdf/clean-content/{doc_id}", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.clean_document_content" };
137
+ var $cleanDocumentContent = { m: "POST", p: "/utilities/pdf/clean-content/{doc_id}", d: "aidream", a: "guest", o: "required", s: "ndjson_or_json", n: "files.clean_document_content" };
138
138
  function cleanDocumentContent(api, args, options) {
139
- return openStream(api, $cleanDocumentContent, args, options);
139
+ return openJsonOrStream(api, $cleanDocumentContent, args, options);
140
140
  }
141
141
  var $listDocuments = { m: "GET", p: "/utilities/pdf/documents", d: "aidream", a: "guest", o: "optional", n: "files.list_documents" };
142
142
  function listDocuments(api, args, options) {
@@ -1,10 +1,10 @@
1
- import { A as Api, C as CallOptions } from './index-Gj30ybjE.cjs';
1
+ import { A as Api, C as CallOptions } from './index-BSrN3TFD.cjs';
2
2
  import { JsonValue } from './schemas.cjs';
3
3
  import '@ai-matrx/auth/credentials';
4
4
 
5
5
  /**
6
6
  * GENERATED by @ai-matrx/api scripts/generate.mjs from aidream/api-contract — never edit by hand.
7
- * CONTRACT_SHA256 7a09c07daad8cd41c7ae301d9ce90aace006a8f2d3a21dde98885807e5881da5
7
+ * CONTRACT_SHA256 2516265e2f8f78e7709d9315a452303f8c16b9ff2cddf7e89ab0ef55a93eaf31
8
8
  */
9
9
 
10
10
  /** E-13's body, byte-for-byte against the frozen stub. */
@@ -1,10 +1,10 @@
1
- import { A as Api, C as CallOptions } from './index-Gj30ybjE.js';
1
+ import { A as Api, C as CallOptions } from './index-BSrN3TFD.js';
2
2
  import { JsonValue } from './schemas.js';
3
3
  import '@ai-matrx/auth/credentials';
4
4
 
5
5
  /**
6
6
  * GENERATED by @ai-matrx/api scripts/generate.mjs from aidream/api-contract — never edit by hand.
7
- * CONTRACT_SHA256 7a09c07daad8cd41c7ae301d9ce90aace006a8f2d3a21dde98885807e5881da5
7
+ * CONTRACT_SHA256 2516265e2f8f78e7709d9315a452303f8c16b9ff2cddf7e89ab0ef55a93eaf31
8
8
  */
9
9
 
10
10
  /** E-13's body, byte-for-byte against the frozen stub. */
@@ -190,10 +190,10 @@ declare function readMatrxSseStream(stream: ReadableStream<Uint8Array>, options?
190
190
 
191
191
  /**
192
192
  * GENERATED by @ai-matrx/api scripts/generate.mjs from aidream/api-contract — never edit by hand.
193
- * CONTRACT_SHA256 7a09c07daad8cd41c7ae301d9ce90aace006a8f2d3a21dde98885807e5881da5
193
+ * CONTRACT_SHA256 2516265e2f8f78e7709d9315a452303f8c16b9ff2cddf7e89ab0ef55a93eaf31
194
194
  */
195
195
  /** The server contract's hash; the Python `matrx-api` and any native client carry the same value. */
196
- declare const CONTRACT_SHA256 = "7a09c07daad8cd41c7ae301d9ce90aace006a8f2d3a21dde98885807e5881da5";
196
+ declare const CONTRACT_SHA256 = "2516265e2f8f78e7709d9315a452303f8c16b9ff2cddf7e89ab0ef55a93eaf31";
197
197
  /** Which deployment answers (api-deployments.json): default base URLs and the existing env names that override them. */
198
198
  declare const DEPLOYMENTS: {
199
199
  readonly files: {
@@ -428,9 +428,11 @@ interface Api {
428
428
  }
429
429
  /** Build the one client. */
430
430
  declare function createApi(options?: CreateApiOptions): Api;
431
+ /** A response body that is bytes, not text: octet-stream, archives, PDFs, pictures, sound, video, fonts. */
432
+ declare function isBinaryType(contentType: string): boolean;
431
433
  /** Send a streaming operation and parse it per its contract stream kind. */
432
434
  declare function openStream<E>(api: Api, op: OperationDescriptor, args?: OperationArgs, options?: CallOptions): Promise<ApiStream<E>>;
433
435
  /** Send a conditional (`*_or_json`) operation: JSON when the server answered JSON, else the stream. */
434
436
  declare function openJsonOrStream<J, E>(api: Api, op: OperationDescriptor, args?: OperationArgs, options?: CallOptions): Promise<JsonOrStream<J, E>>;
435
437
 
436
- export { type Api as A, readMatrxSseStream as B, type CallOptions as C, DEPLOYMENTS as D, type Environment as E, type HttpMethod as H, type JsonOrStream as J, type MatrxStreamEnvelope as M, type NdjsonEvent as N, type OperationArgs as O, type ReadMatrxNdjsonOptions as R, type SseEvent as S, type UploadProgress as U, type ApiStream as a, type MatrxNdjsonIssue as b, type MatrxStreamEnvelopeObservation as c, type MatrxSseFrame as d, type ApiRequestInfo as e, type AuthTier as f, CONTRACT_SHA256 as g, type CreateApiOptions as h, DOMAINS as i, type DeploymentName as j, type OperationDescriptor as k, type OrgRule as l, type StreamKind as m, createApi as n, openJsonOrStream as o, openStream as p, DEFAULT_MATRX_NDJSON_READ_AHEAD as q, type MatrxNdjsonFramer as r, type MatrxNdjsonFramerOptions as s, type MatrxSseFramer as t, type ReadMatrxSseOptions as u, createMatrxNdjsonFramer as v, createMatrxSseFramer as w, normalizeMatrxStreamEnvelope as x, parseMatrxSseFrame as y, readMatrxNdjsonStream as z };
438
+ export { type Api as A, readMatrxNdjsonStream as B, type CallOptions as C, DEPLOYMENTS as D, type Environment as E, readMatrxSseStream as F, type HttpMethod as H, type JsonOrStream as J, type MatrxStreamEnvelope as M, type NdjsonEvent as N, type OperationArgs as O, type ReadMatrxNdjsonOptions as R, type SseEvent as S, type UploadProgress as U, type ApiStream as a, type MatrxNdjsonIssue as b, type MatrxStreamEnvelopeObservation as c, type MatrxSseFrame as d, type ApiRequestInfo as e, type AuthTier as f, CONTRACT_SHA256 as g, type CreateApiOptions as h, DOMAINS as i, type DeploymentName as j, type OperationDescriptor as k, type OrgRule as l, type StreamKind as m, createApi as n, isBinaryType as o, openJsonOrStream as p, openStream as q, DEFAULT_MATRX_NDJSON_READ_AHEAD as r, type MatrxNdjsonFramer as s, type MatrxNdjsonFramerOptions as t, type MatrxSseFramer as u, type ReadMatrxSseOptions as v, createMatrxNdjsonFramer as w, createMatrxSseFramer as x, normalizeMatrxStreamEnvelope as y, parseMatrxSseFrame as z };
@@ -190,10 +190,10 @@ declare function readMatrxSseStream(stream: ReadableStream<Uint8Array>, options?
190
190
 
191
191
  /**
192
192
  * GENERATED by @ai-matrx/api scripts/generate.mjs from aidream/api-contract — never edit by hand.
193
- * CONTRACT_SHA256 7a09c07daad8cd41c7ae301d9ce90aace006a8f2d3a21dde98885807e5881da5
193
+ * CONTRACT_SHA256 2516265e2f8f78e7709d9315a452303f8c16b9ff2cddf7e89ab0ef55a93eaf31
194
194
  */
195
195
  /** The server contract's hash; the Python `matrx-api` and any native client carry the same value. */
196
- declare const CONTRACT_SHA256 = "7a09c07daad8cd41c7ae301d9ce90aace006a8f2d3a21dde98885807e5881da5";
196
+ declare const CONTRACT_SHA256 = "2516265e2f8f78e7709d9315a452303f8c16b9ff2cddf7e89ab0ef55a93eaf31";
197
197
  /** Which deployment answers (api-deployments.json): default base URLs and the existing env names that override them. */
198
198
  declare const DEPLOYMENTS: {
199
199
  readonly files: {
@@ -428,9 +428,11 @@ interface Api {
428
428
  }
429
429
  /** Build the one client. */
430
430
  declare function createApi(options?: CreateApiOptions): Api;
431
+ /** A response body that is bytes, not text: octet-stream, archives, PDFs, pictures, sound, video, fonts. */
432
+ declare function isBinaryType(contentType: string): boolean;
431
433
  /** Send a streaming operation and parse it per its contract stream kind. */
432
434
  declare function openStream<E>(api: Api, op: OperationDescriptor, args?: OperationArgs, options?: CallOptions): Promise<ApiStream<E>>;
433
435
  /** Send a conditional (`*_or_json`) operation: JSON when the server answered JSON, else the stream. */
434
436
  declare function openJsonOrStream<J, E>(api: Api, op: OperationDescriptor, args?: OperationArgs, options?: CallOptions): Promise<JsonOrStream<J, E>>;
435
437
 
436
- export { type Api as A, readMatrxSseStream as B, type CallOptions as C, DEPLOYMENTS as D, type Environment as E, type HttpMethod as H, type JsonOrStream as J, type MatrxStreamEnvelope as M, type NdjsonEvent as N, type OperationArgs as O, type ReadMatrxNdjsonOptions as R, type SseEvent as S, type UploadProgress as U, type ApiStream as a, type MatrxNdjsonIssue as b, type MatrxStreamEnvelopeObservation as c, type MatrxSseFrame as d, type ApiRequestInfo as e, type AuthTier as f, CONTRACT_SHA256 as g, type CreateApiOptions as h, DOMAINS as i, type DeploymentName as j, type OperationDescriptor as k, type OrgRule as l, type StreamKind as m, createApi as n, openJsonOrStream as o, openStream as p, DEFAULT_MATRX_NDJSON_READ_AHEAD as q, type MatrxNdjsonFramer as r, type MatrxNdjsonFramerOptions as s, type MatrxSseFramer as t, type ReadMatrxSseOptions as u, createMatrxNdjsonFramer as v, createMatrxSseFramer as w, normalizeMatrxStreamEnvelope as x, parseMatrxSseFrame as y, readMatrxNdjsonStream as z };
438
+ export { type Api as A, readMatrxNdjsonStream as B, type CallOptions as C, DEPLOYMENTS as D, type Environment as E, readMatrxSseStream as F, type HttpMethod as H, type JsonOrStream as J, type MatrxStreamEnvelope as M, type NdjsonEvent as N, type OperationArgs as O, type ReadMatrxNdjsonOptions as R, type SseEvent as S, type UploadProgress as U, type ApiStream as a, type MatrxNdjsonIssue as b, type MatrxStreamEnvelopeObservation as c, type MatrxSseFrame as d, type ApiRequestInfo as e, type AuthTier as f, CONTRACT_SHA256 as g, type CreateApiOptions as h, DOMAINS as i, type DeploymentName as j, type OperationDescriptor as k, type OrgRule as l, type StreamKind as m, createApi as n, isBinaryType as o, openJsonOrStream as p, openStream as q, DEFAULT_MATRX_NDJSON_READ_AHEAD as r, type MatrxNdjsonFramer as s, type MatrxNdjsonFramerOptions as t, type MatrxSseFramer as u, type ReadMatrxSseOptions as v, createMatrxNdjsonFramer as w, createMatrxSseFramer as x, normalizeMatrxStreamEnvelope as y, parseMatrxSseFrame as z };
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkMVXD6WI6_cjs = require('./chunk-MVXD6WI6.cjs');
4
- var chunk2ZHIYXHV_cjs = require('./chunk-2ZHIYXHV.cjs');
4
+ var chunkU63KIQSS_cjs = require('./chunk-U63KIQSS.cjs');
5
5
  var chunkPKYPPATQ_cjs = require('./chunk-PKYPPATQ.cjs');
6
6
  var format = require('@ai-matrx/kit/format');
7
7
 
@@ -43,7 +43,7 @@ function buildMatrxRequestBody(body, scope) {
43
43
  }
44
44
  const bodyOrganizationId = base.organization_id;
45
45
  if (scope.organization_id !== void 0 && bodyOrganizationId !== void 0 && (typeof bodyOrganizationId !== "string" || bodyOrganizationId.trim() !== scope.organization_id)) {
46
- throw new chunk2ZHIYXHV_cjs.OrganizationContextError(
46
+ throw new chunkU63KIQSS_cjs.OrganizationContextError(
47
47
  "organization_context_mismatch",
48
48
  "Request body organization_id must match the request context organization."
49
49
  );
@@ -115,14 +115,14 @@ function parseMatrxNdjsonResponse(response, signal, hooks = {}) {
115
115
  };
116
116
  async function* events() {
117
117
  if (!response.body) {
118
- throw new chunk2ZHIYXHV_cjs.BackendApiError({
118
+ throw new chunkU63KIQSS_cjs.BackendApiError({
119
119
  code: "internal_error",
120
120
  detail: "Response has no body",
121
121
  userMessage: "No response received from server"
122
122
  });
123
123
  }
124
124
  try {
125
- for await (const envelope of chunk2ZHIYXHV_cjs.readMatrxNdjsonStream(response.body, {
125
+ for await (const envelope of chunkU63KIQSS_cjs.readMatrxNdjsonStream(response.body, {
126
126
  ...signal ? { signal } : {},
127
127
  ...hooks.onMalformedLine ? { onMalformedLine: hooks.onMalformedLine } : {},
128
128
  ...hooks.onUnknownEnvelope ? { onUnknownEnvelope: hooks.onUnknownEnvelope } : {}
@@ -134,7 +134,7 @@ function parseMatrxNdjsonResponse(response, signal, hooks = {}) {
134
134
  if (signal?.aborted || error instanceof Error && error.name === "AbortError") {
135
135
  return;
136
136
  }
137
- const transportError = error instanceof chunk2ZHIYXHV_cjs.BackendApiError ? error : new chunk2ZHIYXHV_cjs.StreamTransportError({
137
+ const transportError = error instanceof chunkU63KIQSS_cjs.BackendApiError ? error : new chunkU63KIQSS_cjs.StreamTransportError({
138
138
  detail: error instanceof Error ? error.message : "The response stream ended unexpectedly.",
139
139
  details: error,
140
140
  ...ids.requestId ? { requestId: ids.requestId } : {}
@@ -151,7 +151,7 @@ async function httpErrorFrom(response) {
151
151
  const serverDetail = await response.json().catch(() => void 0);
152
152
  return {
153
153
  type: response.status >= 400 && response.status < 500 ? "validation_error" : "http_error",
154
- message: chunk2ZHIYXHV_cjs.extractMatrxErrorMessage(serverDetail) ?? bareStatusSentence(response.status),
154
+ message: chunkU63KIQSS_cjs.extractMatrxErrorMessage(serverDetail) ?? bareStatusSentence(response.status),
155
155
  status: response.status,
156
156
  serverDetail
157
157
  };
@@ -159,7 +159,7 @@ async function httpErrorFrom(response) {
159
159
  async function executeMatrxCall(request, hooks = {}) {
160
160
  const upper = request.method.toUpperCase();
161
161
  const sendsBody = request.stream || upper !== "GET" && upper !== "HEAD";
162
- const { response } = await chunk2ZHIYXHV_cjs.sendOnWire({
162
+ const { response } = await chunkU63KIQSS_cjs.sendOnWire({
163
163
  url: request.url,
164
164
  method: request.method,
165
165
  headers: request.headers,
@@ -210,11 +210,11 @@ async function sendMatrxRequest(url, init = {}, options = {}) {
210
210
  headers[name] = value;
211
211
  });
212
212
  const fetchOptions = {};
213
- for (const key of chunk2ZHIYXHV_cjs.WIRE_FETCH_OPTION_KEYS) {
213
+ for (const key of chunkU63KIQSS_cjs.WIRE_FETCH_OPTION_KEYS) {
214
214
  if (init[key] !== void 0) fetchOptions[key] = init[key];
215
215
  }
216
216
  try {
217
- const { response } = await chunk2ZHIYXHV_cjs.sendOnWire({
217
+ const { response } = await chunkU63KIQSS_cjs.sendOnWire({
218
218
  url,
219
219
  method: init.method ?? "GET",
220
220
  fetchOptions,
@@ -232,8 +232,8 @@ async function sendMatrxRequest(url, init = {}, options = {}) {
232
232
  if (chunkPKYPPATQ_cjs.isNetError(error) && error.code === "aborted") {
233
233
  throw callerSignal?.reason instanceof Error ? callerSignal.reason : new DOMException("The request was cancelled.", "AbortError");
234
234
  }
235
- if (options.timeoutMs !== void 0 && chunkPKYPPATQ_cjs.isNetError(error) && error.code === "connect-timeout") {
236
- throw new chunk2ZHIYXHV_cjs.BackendApiError({
235
+ if (options.timeoutMs !== void 0 && chunkPKYPPATQ_cjs.isNetError(error) && (error.code === "connect-timeout" || error.code === "total-timeout")) {
236
+ throw new chunkU63KIQSS_cjs.BackendApiError({
237
237
  code: "request_timeout",
238
238
  detail: `${init.method ?? "GET"} ${url} exceeded ${options.timeoutMs}ms`,
239
239
  userMessage: "The request timed out \u2014 please retry.",
@@ -247,7 +247,7 @@ async function sendMatrxRequest(url, init = {}, options = {}) {
247
247
  }
248
248
  }
249
249
  async function readMatrxJsonResponse(response) {
250
- if (!response.ok) throw await chunk2ZHIYXHV_cjs.parseHttpError(response);
250
+ if (!response.ok) throw await chunkU63KIQSS_cjs.parseHttpError(response);
251
251
  if (response.status === 204) return null;
252
252
  return await response.json();
253
253
  }
@@ -257,7 +257,7 @@ function classifyStatus(status) {
257
257
  return status >= 400 && status < 500 ? "validation_error" : "http_error";
258
258
  }
259
259
  function normalizeMatrxError(err) {
260
- if (err instanceof chunk2ZHIYXHV_cjs.OrganizationContextError) {
260
+ if (err instanceof chunkU63KIQSS_cjs.OrganizationContextError) {
261
261
  return {
262
262
  type: "validation_error",
263
263
  message: err.message,
@@ -269,7 +269,7 @@ function normalizeMatrxError(err) {
269
269
  if (err instanceof DOMException && err.name === "AbortError") {
270
270
  return { type: "abort_error", message: "Request was cancelled." };
271
271
  }
272
- if (err instanceof chunk2ZHIYXHV_cjs.MatrxApiError) {
272
+ if (err instanceof chunkU63KIQSS_cjs.MatrxApiError) {
273
273
  return {
274
274
  type: classifyStatus(err.status),
275
275
  message: honestTransportMessage(err.message, err.status),
@@ -279,7 +279,7 @@ function normalizeMatrxError(err) {
279
279
  name: err.name
280
280
  };
281
281
  }
282
- if (err instanceof chunk2ZHIYXHV_cjs.BackendApiError) {
282
+ if (err instanceof chunkU63KIQSS_cjs.BackendApiError) {
283
283
  return {
284
284
  type: "network_error",
285
285
  message: honestTransportMessage(
@@ -375,26 +375,26 @@ function createMatrxTransport(options) {
375
375
  }
376
376
  const resolve = resolveTarget ?? (() => ({ baseUrl }));
377
377
  const resolveVersion = () => {
378
- if (aiApiVersion === void 0) return chunk2ZHIYXHV_cjs.MATRX_AI_API_VERSION_DEFAULT;
378
+ if (aiApiVersion === void 0) return chunkU63KIQSS_cjs.MATRX_AI_API_VERSION_DEFAULT;
379
379
  return typeof aiApiVersion === "function" ? aiApiVersion() : aiApiVersion;
380
380
  };
381
381
  const resolveOrganizationId = (callOrganizationId) => {
382
382
  if (organizationId === void 0) return null;
383
- if (callOrganizationId !== null) return chunk2ZHIYXHV_cjs.requireOrganizationContext(callOrganizationId);
383
+ if (callOrganizationId !== null) return chunkU63KIQSS_cjs.requireOrganizationContext(callOrganizationId);
384
384
  const candidate = typeof organizationId === "function" ? organizationId() : organizationId;
385
- return chunk2ZHIYXHV_cjs.requireOrganizationContext(candidate);
385
+ return chunkU63KIQSS_cjs.requireOrganizationContext(candidate);
386
386
  };
387
387
  return {
388
388
  async fetch(path, init) {
389
389
  const target = await resolve(init);
390
390
  const callOrganizationId = readOrganizationHeader(init.headers);
391
- const versionedPath = chunk2ZHIYXHV_cjs.applyAiApiVersion(path, resolveVersion());
391
+ const versionedPath = chunkU63KIQSS_cjs.applyAiApiVersion(path, resolveVersion());
392
392
  const url = `${target.baseUrl}${versionedPath}`;
393
393
  const policyHeaders = stripContentType(target.policyHeaders ?? {});
394
394
  let overHeaders = callOrganizationId === null ? policyHeaders : stripOrganizationHeader(policyHeaders);
395
395
  const orgId = resolveOrganizationId(callOrganizationId);
396
396
  if (orgId !== null) {
397
- overHeaders = chunk2ZHIYXHV_cjs.applyOrganizationContextHeader(overHeaders, orgId);
397
+ overHeaders = chunkU63KIQSS_cjs.applyOrganizationContextHeader(overHeaders, orgId);
398
398
  }
399
399
  const wireHeaders = callOrganizationId === null ? { ...init.headers } : stripOrganizationHeader({ ...init.headers });
400
400
  const info = {
@@ -407,7 +407,7 @@ function createMatrxTransport(options) {
407
407
  diagnostics?.onRequest?.(info);
408
408
  let response;
409
409
  try {
410
- ({ response } = await chunk2ZHIYXHV_cjs.sendOnWire(
410
+ ({ response } = await chunkU63KIQSS_cjs.sendOnWire(
411
411
  {
412
412
  url,
413
413
  method: init.method,
@@ -432,11 +432,11 @@ function createMatrxTransport(options) {
432
432
  }
433
433
  if (!response.ok && !expectedErrorStatuses?.includes(response.status)) {
434
434
  const serverDetail = await response.clone().json().catch(() => void 0);
435
- const code = chunk2ZHIYXHV_cjs.extractMatrxErrorCode(serverDetail);
435
+ const code = chunkU63KIQSS_cjs.extractMatrxErrorCode(serverDetail);
436
436
  diagnostics?.onError?.(
437
437
  {
438
438
  type: classifyStatus(response.status),
439
- message: chunk2ZHIYXHV_cjs.extractMatrxErrorMessage(serverDetail) ?? `HTTP ${response.status}`,
439
+ message: chunkU63KIQSS_cjs.extractMatrxErrorMessage(serverDetail) ?? `HTTP ${response.status}`,
440
440
  status: response.status,
441
441
  serverDetail,
442
442
  ...code ? { code } : {}
@@ -715,7 +715,7 @@ async function readServerDetail(response) {
715
715
  }
716
716
  }
717
717
  async function throwApiError(path, response) {
718
- throw new chunk2ZHIYXHV_cjs.MatrxApiError({
718
+ throw new chunkU63KIQSS_cjs.MatrxApiError({
719
719
  status: response.status,
720
720
  path,
721
721
  serverDetail: await readServerDetail(response)
@@ -736,7 +736,7 @@ function toRunHandle(response, options) {
736
736
  return {
737
737
  requestId: response.headers.get("X-Request-ID"),
738
738
  conversationId: response.headers.get("X-Conversation-ID"),
739
- events: chunk2ZHIYXHV_cjs.readMatrxNdjsonStream(response.body, {
739
+ events: chunkU63KIQSS_cjs.readMatrxNdjsonStream(response.body, {
740
740
  ...options.signal ? { signal: options.signal } : {},
741
741
  ...options.maxReadAhead !== void 0 ? { maxReadAhead: options.maxReadAhead } : {},
742
742
  ...options.onMalformedLine ? { onMalformedLine: options.onMalformedLine } : {},
@@ -759,7 +759,7 @@ async function requestStream(transport, path, options) {
759
759
  });
760
760
  if (!response.ok) return throwApiError(path, response);
761
761
  if (!response.body) {
762
- throw new chunk2ZHIYXHV_cjs.MatrxApiError({
762
+ throw new chunkU63KIQSS_cjs.MatrxApiError({
763
763
  status: response.status,
764
764
  path,
765
765
  serverDetail: { code: "missing_response_body" },
@@ -819,7 +819,7 @@ async function getRuntimeOperationStatus(transport, requestId, options = {}) {
819
819
  { method: "GET", ...options.signal ? { signal: options.signal } : {} }
820
820
  );
821
821
  } catch (error) {
822
- if (error instanceof chunk2ZHIYXHV_cjs.MatrxApiError && error.status === 404) return null;
822
+ if (error instanceof chunkU63KIQSS_cjs.MatrxApiError && error.status === 404) return null;
823
823
  throw error;
824
824
  }
825
825
  }
@@ -834,7 +834,7 @@ async function getRuntimeOperationsByLink(transport, linkKind, linkId, options =
834
834
  { method: "GET", ...options.signal ? { signal: options.signal } : {} }
835
835
  );
836
836
  } catch (error) {
837
- if (error instanceof chunk2ZHIYXHV_cjs.MatrxApiError && error.status === 404) return null;
837
+ if (error instanceof chunkU63KIQSS_cjs.MatrxApiError && error.status === 404) return null;
838
838
  throw error;
839
839
  }
840
840
  }
@@ -875,7 +875,7 @@ async function* followRuntimeOperationEvents(transport, executionId, options = {
875
875
  ...options.signal ? { signal: options.signal } : {}
876
876
  }
877
877
  );
878
- const frames = chunk2ZHIYXHV_cjs.readMatrxSseStream(
878
+ const frames = chunkU63KIQSS_cjs.readMatrxSseStream(
879
879
  response.body,
880
880
  options.onIncomplete ? { onIncomplete: options.onIncomplete } : {}
881
881
  );
@@ -1078,7 +1078,7 @@ async function openMatrxStream(transport, path, options = {}) {
1078
1078
  return toRunHandle(response, options);
1079
1079
  }
1080
1080
  function withRunOrganization(transport, organizationId) {
1081
- const orgId = chunk2ZHIYXHV_cjs.requireOrganizationContext(organizationId);
1081
+ const orgId = chunkU63KIQSS_cjs.requireOrganizationContext(organizationId);
1082
1082
  return {
1083
1083
  fetch: (path, init) => transport.fetch(path, {
1084
1084
  ...init,
@@ -1105,7 +1105,7 @@ async function followWorkflowRunEvents(transport, runId, options) {
1105
1105
  throw error;
1106
1106
  }
1107
1107
  try {
1108
- for await (const frame of chunk2ZHIYXHV_cjs.readMatrxSseStream(
1108
+ for await (const frame of chunkU63KIQSS_cjs.readMatrxSseStream(
1109
1109
  response.body
1110
1110
  )) {
1111
1111
  if (frame.event === "end") return { ended: true };
@@ -1151,7 +1151,7 @@ async function resumeOrRejoin(transport, resumeCall, options) {
1151
1151
  } catch (error) {
1152
1152
  const target = readLiveRunRejoin(error);
1153
1153
  if (!target) {
1154
- if (error instanceof chunk2ZHIYXHV_cjs.MatrxApiError && isResumeConflict(error)) {
1154
+ if (error instanceof chunkU63KIQSS_cjs.MatrxApiError && isResumeConflict(error)) {
1155
1155
  return { kind: "resume_conflict", error };
1156
1156
  }
1157
1157
  throw error;
@@ -1567,7 +1567,7 @@ async function reportProviderSessionUsage(transport, usage, options = {}) {
1567
1567
  });
1568
1568
  return "ok";
1569
1569
  } catch (error) {
1570
- if (error instanceof chunk2ZHIYXHV_cjs.MatrxApiError) {
1570
+ if (error instanceof chunkU63KIQSS_cjs.MatrxApiError) {
1571
1571
  const status = error.status;
1572
1572
  if (status >= 400 && status < 500 && status !== 401 && status !== 408 && status !== 425 && status !== 429) {
1573
1573
  console.warn(`[provider-usage] server refused ${usage.provider} usage ${usage.usage_id} (${status})`);
@@ -2267,147 +2267,151 @@ Object.defineProperty(exports, "toCredentialsPort", {
2267
2267
  });
2268
2268
  Object.defineProperty(exports, "BackendApiError", {
2269
2269
  enumerable: true,
2270
- get: function () { return chunk2ZHIYXHV_cjs.BackendApiError; }
2270
+ get: function () { return chunkU63KIQSS_cjs.BackendApiError; }
2271
2271
  });
2272
2272
  Object.defineProperty(exports, "CONTRACT_SHA256", {
2273
2273
  enumerable: true,
2274
- get: function () { return chunk2ZHIYXHV_cjs.CONTRACT_SHA256; }
2274
+ get: function () { return chunkU63KIQSS_cjs.CONTRACT_SHA256; }
2275
2275
  });
2276
2276
  Object.defineProperty(exports, "DEPLOYMENTS", {
2277
2277
  enumerable: true,
2278
- get: function () { return chunk2ZHIYXHV_cjs.DEPLOYMENTS; }
2278
+ get: function () { return chunkU63KIQSS_cjs.DEPLOYMENTS; }
2279
2279
  });
2280
2280
  Object.defineProperty(exports, "DOMAINS", {
2281
2281
  enumerable: true,
2282
- get: function () { return chunk2ZHIYXHV_cjs.DOMAINS; }
2282
+ get: function () { return chunkU63KIQSS_cjs.DOMAINS; }
2283
2283
  });
2284
2284
  Object.defineProperty(exports, "MATRX_AI_API_VERSION_DEFAULT", {
2285
2285
  enumerable: true,
2286
- get: function () { return chunk2ZHIYXHV_cjs.MATRX_AI_API_VERSION_DEFAULT; }
2286
+ get: function () { return chunkU63KIQSS_cjs.MATRX_AI_API_VERSION_DEFAULT; }
2287
2287
  });
2288
2288
  Object.defineProperty(exports, "MatrxApiError", {
2289
2289
  enumerable: true,
2290
- get: function () { return chunk2ZHIYXHV_cjs.MatrxApiError; }
2290
+ get: function () { return chunkU63KIQSS_cjs.MatrxApiError; }
2291
2291
  });
2292
2292
  Object.defineProperty(exports, "OrganizationContextError", {
2293
2293
  enumerable: true,
2294
- get: function () { return chunk2ZHIYXHV_cjs.OrganizationContextError; }
2294
+ get: function () { return chunkU63KIQSS_cjs.OrganizationContextError; }
2295
2295
  });
2296
2296
  Object.defineProperty(exports, "StreamTransportError", {
2297
2297
  enumerable: true,
2298
- get: function () { return chunk2ZHIYXHV_cjs.StreamTransportError; }
2298
+ get: function () { return chunkU63KIQSS_cjs.StreamTransportError; }
2299
2299
  });
2300
2300
  Object.defineProperty(exports, "V2_COVERED_AI_PATH_TEMPLATES", {
2301
2301
  enumerable: true,
2302
- get: function () { return chunk2ZHIYXHV_cjs.V2_COVERED_AI_PATH_TEMPLATES; }
2302
+ get: function () { return chunkU63KIQSS_cjs.V2_COVERED_AI_PATH_TEMPLATES; }
2303
2303
  });
2304
2304
  Object.defineProperty(exports, "aiVersionPathOverrides", {
2305
2305
  enumerable: true,
2306
- get: function () { return chunk2ZHIYXHV_cjs.aiVersionPathOverrides; }
2306
+ get: function () { return chunkU63KIQSS_cjs.aiVersionPathOverrides; }
2307
2307
  });
2308
2308
  Object.defineProperty(exports, "applyAiApiVersion", {
2309
2309
  enumerable: true,
2310
- get: function () { return chunk2ZHIYXHV_cjs.applyAiApiVersion; }
2310
+ get: function () { return chunkU63KIQSS_cjs.applyAiApiVersion; }
2311
2311
  });
2312
2312
  Object.defineProperty(exports, "applyOrganizationContextHeader", {
2313
2313
  enumerable: true,
2314
- get: function () { return chunk2ZHIYXHV_cjs.applyOrganizationContextHeader; }
2314
+ get: function () { return chunkU63KIQSS_cjs.applyOrganizationContextHeader; }
2315
2315
  });
2316
2316
  Object.defineProperty(exports, "assertOrganizationMatchesOperation", {
2317
2317
  enumerable: true,
2318
- get: function () { return chunk2ZHIYXHV_cjs.assertOrganizationMatchesOperation; }
2318
+ get: function () { return chunkU63KIQSS_cjs.assertOrganizationMatchesOperation; }
2319
2319
  });
2320
2320
  Object.defineProperty(exports, "assertQueryOrganizationMatchesContext", {
2321
2321
  enumerable: true,
2322
- get: function () { return chunk2ZHIYXHV_cjs.assertQueryOrganizationMatchesContext; }
2322
+ get: function () { return chunkU63KIQSS_cjs.assertQueryOrganizationMatchesContext; }
2323
2323
  });
2324
2324
  Object.defineProperty(exports, "createApi", {
2325
2325
  enumerable: true,
2326
- get: function () { return chunk2ZHIYXHV_cjs.createApi; }
2326
+ get: function () { return chunkU63KIQSS_cjs.createApi; }
2327
2327
  });
2328
2328
  Object.defineProperty(exports, "createOrganizationOperation", {
2329
2329
  enumerable: true,
2330
- get: function () { return chunk2ZHIYXHV_cjs.createOrganizationOperation; }
2330
+ get: function () { return chunkU63KIQSS_cjs.createOrganizationOperation; }
2331
2331
  });
2332
2332
  Object.defineProperty(exports, "describeBackendFailure", {
2333
2333
  enumerable: true,
2334
- get: function () { return chunk2ZHIYXHV_cjs.describeBackendFailure; }
2334
+ get: function () { return chunkU63KIQSS_cjs.describeBackendFailure; }
2335
2335
  });
2336
2336
  Object.defineProperty(exports, "extractMatrxErrorCode", {
2337
2337
  enumerable: true,
2338
- get: function () { return chunk2ZHIYXHV_cjs.extractMatrxErrorCode; }
2338
+ get: function () { return chunkU63KIQSS_cjs.extractMatrxErrorCode; }
2339
2339
  });
2340
2340
  Object.defineProperty(exports, "extractMatrxErrorMessage", {
2341
2341
  enumerable: true,
2342
- get: function () { return chunk2ZHIYXHV_cjs.extractMatrxErrorMessage; }
2342
+ get: function () { return chunkU63KIQSS_cjs.extractMatrxErrorMessage; }
2343
2343
  });
2344
2344
  Object.defineProperty(exports, "fetchWithMatrxProtocolFallback", {
2345
2345
  enumerable: true,
2346
- get: function () { return chunk2ZHIYXHV_cjs.fetchWithMatrxProtocolFallback; }
2346
+ get: function () { return chunkU63KIQSS_cjs.fetchWithMatrxProtocolFallback; }
2347
2347
  });
2348
2348
  Object.defineProperty(exports, "getUserMessage", {
2349
2349
  enumerable: true,
2350
- get: function () { return chunk2ZHIYXHV_cjs.getUserMessage; }
2350
+ get: function () { return chunkU63KIQSS_cjs.getUserMessage; }
2351
+ });
2352
+ Object.defineProperty(exports, "isBinaryType", {
2353
+ enumerable: true,
2354
+ get: function () { return chunkU63KIQSS_cjs.isBinaryType; }
2351
2355
  });
2352
2356
  Object.defineProperty(exports, "isCoveredAiPath", {
2353
2357
  enumerable: true,
2354
- get: function () { return chunk2ZHIYXHV_cjs.isCoveredAiPath; }
2358
+ get: function () { return chunkU63KIQSS_cjs.isCoveredAiPath; }
2355
2359
  });
2356
2360
  Object.defineProperty(exports, "isGenericUserMessage", {
2357
2361
  enumerable: true,
2358
- get: function () { return chunk2ZHIYXHV_cjs.isGenericUserMessage; }
2362
+ get: function () { return chunkU63KIQSS_cjs.isGenericUserMessage; }
2359
2363
  });
2360
2364
  Object.defineProperty(exports, "isStreamTransportLost", {
2361
2365
  enumerable: true,
2362
- get: function () { return chunk2ZHIYXHV_cjs.isStreamTransportLost; }
2366
+ get: function () { return chunkU63KIQSS_cjs.isStreamTransportLost; }
2363
2367
  });
2364
2368
  Object.defineProperty(exports, "isV2Path", {
2365
2369
  enumerable: true,
2366
- get: function () { return chunk2ZHIYXHV_cjs.isV2Path; }
2370
+ get: function () { return chunkU63KIQSS_cjs.isV2Path; }
2367
2371
  });
2368
2372
  Object.defineProperty(exports, "openJsonOrStream", {
2369
2373
  enumerable: true,
2370
- get: function () { return chunk2ZHIYXHV_cjs.openJsonOrStream; }
2374
+ get: function () { return chunkU63KIQSS_cjs.openJsonOrStream; }
2371
2375
  });
2372
2376
  Object.defineProperty(exports, "openStream", {
2373
2377
  enumerable: true,
2374
- get: function () { return chunk2ZHIYXHV_cjs.openStream; }
2378
+ get: function () { return chunkU63KIQSS_cjs.openStream; }
2375
2379
  });
2376
2380
  Object.defineProperty(exports, "parseCallApiError", {
2377
2381
  enumerable: true,
2378
- get: function () { return chunk2ZHIYXHV_cjs.parseCallApiError; }
2382
+ get: function () { return chunkU63KIQSS_cjs.parseCallApiError; }
2379
2383
  });
2380
2384
  Object.defineProperty(exports, "parseHttpError", {
2381
2385
  enumerable: true,
2382
- get: function () { return chunk2ZHIYXHV_cjs.parseHttpError; }
2386
+ get: function () { return chunkU63KIQSS_cjs.parseHttpError; }
2383
2387
  });
2384
2388
  Object.defineProperty(exports, "parseHttpErrorBody", {
2385
2389
  enumerable: true,
2386
- get: function () { return chunk2ZHIYXHV_cjs.parseHttpErrorBody; }
2390
+ get: function () { return chunkU63KIQSS_cjs.parseHttpErrorBody; }
2387
2391
  });
2388
2392
  Object.defineProperty(exports, "parsePersistedBackendError", {
2389
2393
  enumerable: true,
2390
- get: function () { return chunk2ZHIYXHV_cjs.parsePersistedBackendError; }
2394
+ get: function () { return chunkU63KIQSS_cjs.parsePersistedBackendError; }
2391
2395
  });
2392
2396
  Object.defineProperty(exports, "parseStreamError", {
2393
2397
  enumerable: true,
2394
- get: function () { return chunk2ZHIYXHV_cjs.parseStreamError; }
2398
+ get: function () { return chunkU63KIQSS_cjs.parseStreamError; }
2395
2399
  });
2396
2400
  Object.defineProperty(exports, "requireOrganizationContext", {
2397
2401
  enumerable: true,
2398
- get: function () { return chunk2ZHIYXHV_cjs.requireOrganizationContext; }
2402
+ get: function () { return chunkU63KIQSS_cjs.requireOrganizationContext; }
2399
2403
  });
2400
2404
  Object.defineProperty(exports, "toV1FallbackUrl", {
2401
2405
  enumerable: true,
2402
- get: function () { return chunk2ZHIYXHV_cjs.toV1FallbackUrl; }
2406
+ get: function () { return chunkU63KIQSS_cjs.toV1FallbackUrl; }
2403
2407
  });
2404
2408
  Object.defineProperty(exports, "toV2Path", {
2405
2409
  enumerable: true,
2406
- get: function () { return chunk2ZHIYXHV_cjs.toV2Path; }
2410
+ get: function () { return chunkU63KIQSS_cjs.toV2Path; }
2407
2411
  });
2408
2412
  Object.defineProperty(exports, "unwrapUpstreamError", {
2409
2413
  enumerable: true,
2410
- get: function () { return chunk2ZHIYXHV_cjs.unwrapUpstreamError; }
2414
+ get: function () { return chunkU63KIQSS_cjs.unwrapUpstreamError; }
2411
2415
  });
2412
2416
  Object.defineProperty(exports, "AbortedError", {
2413
2417
  enumerable: true,
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MatrxStreamEnvelope, b as MatrxNdjsonIssue, U as UploadProgress, c as MatrxStreamEnvelopeObservation, d as MatrxSseFrame } from './index-Gj30ybjE.cjs';
2
- export { A as Api, e as ApiRequestInfo, a as ApiStream, f as AuthTier, g as CONTRACT_SHA256, C as CallOptions, h as CreateApiOptions, D as DEPLOYMENTS, i as DOMAINS, j as DeploymentName, E as Environment, H as HttpMethod, J as JsonOrStream, N as NdjsonEvent, O as OperationArgs, k as OperationDescriptor, l as OrgRule, S as SseEvent, m as StreamKind, n as createApi, o as openJsonOrStream, p as openStream } from './index-Gj30ybjE.cjs';
1
+ import { M as MatrxStreamEnvelope, b as MatrxNdjsonIssue, U as UploadProgress, c as MatrxStreamEnvelopeObservation, d as MatrxSseFrame } from './index-BSrN3TFD.cjs';
2
+ export { A as Api, e as ApiRequestInfo, a as ApiStream, f as AuthTier, g as CONTRACT_SHA256, C as CallOptions, h as CreateApiOptions, D as DEPLOYMENTS, i as DOMAINS, j as DeploymentName, E as Environment, H as HttpMethod, J as JsonOrStream, N as NdjsonEvent, O as OperationArgs, k as OperationDescriptor, l as OrgRule, S as SseEvent, m as StreamKind, n as createApi, o as isBinaryType, p as openJsonOrStream, q as openStream } from './index-BSrN3TFD.cjs';
3
3
  import { CredentialsPort } from '@ai-matrx/auth/credentials';
4
4
  export { API_KEY_PREFIX, CredentialsPort, CredentialsSetting, MATRX_HEADERS, MatrxCredential, MatrxCredentialKind, credentialToHeaders, toCredentialsPort } from '@ai-matrx/auth/credentials';
5
5
  import { ResilientFetchOptions, ResilientFetchResult } from './net.cjs';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MatrxStreamEnvelope, b as MatrxNdjsonIssue, U as UploadProgress, c as MatrxStreamEnvelopeObservation, d as MatrxSseFrame } from './index-Gj30ybjE.js';
2
- export { A as Api, e as ApiRequestInfo, a as ApiStream, f as AuthTier, g as CONTRACT_SHA256, C as CallOptions, h as CreateApiOptions, D as DEPLOYMENTS, i as DOMAINS, j as DeploymentName, E as Environment, H as HttpMethod, J as JsonOrStream, N as NdjsonEvent, O as OperationArgs, k as OperationDescriptor, l as OrgRule, S as SseEvent, m as StreamKind, n as createApi, o as openJsonOrStream, p as openStream } from './index-Gj30ybjE.js';
1
+ import { M as MatrxStreamEnvelope, b as MatrxNdjsonIssue, U as UploadProgress, c as MatrxStreamEnvelopeObservation, d as MatrxSseFrame } from './index-BSrN3TFD.js';
2
+ export { A as Api, e as ApiRequestInfo, a as ApiStream, f as AuthTier, g as CONTRACT_SHA256, C as CallOptions, h as CreateApiOptions, D as DEPLOYMENTS, i as DOMAINS, j as DeploymentName, E as Environment, H as HttpMethod, J as JsonOrStream, N as NdjsonEvent, O as OperationArgs, k as OperationDescriptor, l as OrgRule, S as SseEvent, m as StreamKind, n as createApi, o as isBinaryType, p as openJsonOrStream, q as openStream } from './index-BSrN3TFD.js';
3
3
  import { CredentialsPort } from '@ai-matrx/auth/credentials';
4
4
  export { API_KEY_PREFIX, CredentialsPort, CredentialsSetting, MATRX_HEADERS, MatrxCredential, MatrxCredentialKind, credentialToHeaders, toCredentialsPort } from '@ai-matrx/auth/credentials';
5
5
  import { ResilientFetchOptions, ResilientFetchResult } from './net.js';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { API_KEY_PREFIX, MATRX_HEADERS, credentialToHeaders, toCredentialsPort } from './chunk-7MZPBCFV.js';
2
- import { OrganizationContextError, sendOnWire, WIRE_FETCH_OPTION_KEYS, BackendApiError, parseHttpError, MatrxApiError, applyAiApiVersion, applyOrganizationContextHeader, extractMatrxErrorCode, extractMatrxErrorMessage, readMatrxNdjsonStream, readMatrxSseStream, requireOrganizationContext, MATRX_AI_API_VERSION_DEFAULT, StreamTransportError } from './chunk-6KHHHBG5.js';
3
- export { BackendApiError, CONTRACT_SHA256, DEPLOYMENTS, DOMAINS, MATRX_AI_API_VERSION_DEFAULT, MatrxApiError, OrganizationContextError, StreamTransportError, V2_COVERED_AI_PATH_TEMPLATES, aiVersionPathOverrides, applyAiApiVersion, applyOrganizationContextHeader, assertOrganizationMatchesOperation, assertQueryOrganizationMatchesContext, createApi, createOrganizationOperation, describeBackendFailure, extractMatrxErrorCode, extractMatrxErrorMessage, fetchWithMatrxProtocolFallback, getUserMessage, isCoveredAiPath, isGenericUserMessage, isStreamTransportLost, isV2Path, openJsonOrStream, openStream, parseCallApiError, parseHttpError, parseHttpErrorBody, parsePersistedBackendError, parseStreamError, requireOrganizationContext, toV1FallbackUrl, toV2Path, unwrapUpstreamError } from './chunk-6KHHHBG5.js';
2
+ import { OrganizationContextError, sendOnWire, WIRE_FETCH_OPTION_KEYS, BackendApiError, parseHttpError, MatrxApiError, applyAiApiVersion, applyOrganizationContextHeader, extractMatrxErrorCode, extractMatrxErrorMessage, readMatrxNdjsonStream, readMatrxSseStream, requireOrganizationContext, MATRX_AI_API_VERSION_DEFAULT, StreamTransportError } from './chunk-ILLQUHLF.js';
3
+ export { BackendApiError, CONTRACT_SHA256, DEPLOYMENTS, DOMAINS, MATRX_AI_API_VERSION_DEFAULT, MatrxApiError, OrganizationContextError, StreamTransportError, V2_COVERED_AI_PATH_TEMPLATES, aiVersionPathOverrides, applyAiApiVersion, applyOrganizationContextHeader, assertOrganizationMatchesOperation, assertQueryOrganizationMatchesContext, createApi, createOrganizationOperation, describeBackendFailure, extractMatrxErrorCode, extractMatrxErrorMessage, fetchWithMatrxProtocolFallback, getUserMessage, isBinaryType, isCoveredAiPath, isGenericUserMessage, isStreamTransportLost, isV2Path, openJsonOrStream, openStream, parseCallApiError, parseHttpError, parseHttpErrorBody, parsePersistedBackendError, parseStreamError, requireOrganizationContext, toV1FallbackUrl, toV2Path, unwrapUpstreamError } from './chunk-ILLQUHLF.js';
4
4
  import { isNetError, extractErrorMessage } from './chunk-PIPE5OML.js';
5
5
  export { AbortedError, ConnectTimeoutError, HeartbeatTimeoutError, HttpError, NetError, NetworkError, OfflineError, TotalTimeoutError, extractErrorMessage, isNetError, isTransportFailure, monitorStream, resilientFetch, toNetError, withRetry } from './chunk-PIPE5OML.js';
6
6
  import { formatDurationSeconds } from '@ai-matrx/kit/format';
@@ -232,7 +232,7 @@ async function sendMatrxRequest(url, init = {}, options = {}) {
232
232
  if (isNetError(error) && error.code === "aborted") {
233
233
  throw callerSignal?.reason instanceof Error ? callerSignal.reason : new DOMException("The request was cancelled.", "AbortError");
234
234
  }
235
- if (options.timeoutMs !== void 0 && isNetError(error) && error.code === "connect-timeout") {
235
+ if (options.timeoutMs !== void 0 && isNetError(error) && (error.code === "connect-timeout" || error.code === "total-timeout")) {
236
236
  throw new BackendApiError({
237
237
  code: "request_timeout",
238
238
  detail: `${init.method ?? "GET"} ${url} exceeded ${options.timeoutMs}ms`,