@ai-matrx/api 0.1.10 → 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 +12 -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-FLANGLCG.js → chunk-ILLQUHLF.js} +41 -9
  29. package/dist/{chunk-SPASYIUH.cjs → chunk-U63KIQSS.cjs} +41 -7
  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 +77 -68
  69. package/dist/index.d.cts +2 -2
  70. package/dist/index.d.ts +2 -2
  71. package/dist/index.js +8 -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 +24167 -524
  115. package/dist/types.d.ts +24167 -524
  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-FLANGLCG.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 chunkSPASYIUH_cjs = require('./chunk-SPASYIUH.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 chunkSPASYIUH_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 chunkSPASYIUH_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 chunkSPASYIUH_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 chunkSPASYIUH_cjs.BackendApiError ? error : new chunkSPASYIUH_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: chunkSPASYIUH_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 chunkSPASYIUH_cjs.sendOnWire({
162
+ const { response } = await chunkU63KIQSS_cjs.sendOnWire({
163
163
  url: request.url,
164
164
  method: request.method,
165
165
  headers: request.headers,
@@ -209,10 +209,15 @@ async function sendMatrxRequest(url, init = {}, options = {}) {
209
209
  new Headers(init.headers ?? {}).forEach((value, name) => {
210
210
  headers[name] = value;
211
211
  });
212
+ const fetchOptions = {};
213
+ for (const key of chunkU63KIQSS_cjs.WIRE_FETCH_OPTION_KEYS) {
214
+ if (init[key] !== void 0) fetchOptions[key] = init[key];
215
+ }
212
216
  try {
213
- const { response } = await chunkSPASYIUH_cjs.sendOnWire({
217
+ const { response } = await chunkU63KIQSS_cjs.sendOnWire({
214
218
  url,
215
219
  method: init.method ?? "GET",
220
+ fetchOptions,
216
221
  headers,
217
222
  ...init.body !== void 0 && init.body !== null ? { body: init.body } : {},
218
223
  ...callerSignal ? { signal: callerSignal } : {},
@@ -227,8 +232,8 @@ async function sendMatrxRequest(url, init = {}, options = {}) {
227
232
  if (chunkPKYPPATQ_cjs.isNetError(error) && error.code === "aborted") {
228
233
  throw callerSignal?.reason instanceof Error ? callerSignal.reason : new DOMException("The request was cancelled.", "AbortError");
229
234
  }
230
- if (options.timeoutMs !== void 0 && chunkPKYPPATQ_cjs.isNetError(error) && error.code === "connect-timeout") {
231
- throw new chunkSPASYIUH_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({
232
237
  code: "request_timeout",
233
238
  detail: `${init.method ?? "GET"} ${url} exceeded ${options.timeoutMs}ms`,
234
239
  userMessage: "The request timed out \u2014 please retry.",
@@ -242,7 +247,7 @@ async function sendMatrxRequest(url, init = {}, options = {}) {
242
247
  }
243
248
  }
244
249
  async function readMatrxJsonResponse(response) {
245
- if (!response.ok) throw await chunkSPASYIUH_cjs.parseHttpError(response);
250
+ if (!response.ok) throw await chunkU63KIQSS_cjs.parseHttpError(response);
246
251
  if (response.status === 204) return null;
247
252
  return await response.json();
248
253
  }
@@ -252,7 +257,7 @@ function classifyStatus(status) {
252
257
  return status >= 400 && status < 500 ? "validation_error" : "http_error";
253
258
  }
254
259
  function normalizeMatrxError(err) {
255
- if (err instanceof chunkSPASYIUH_cjs.OrganizationContextError) {
260
+ if (err instanceof chunkU63KIQSS_cjs.OrganizationContextError) {
256
261
  return {
257
262
  type: "validation_error",
258
263
  message: err.message,
@@ -264,7 +269,7 @@ function normalizeMatrxError(err) {
264
269
  if (err instanceof DOMException && err.name === "AbortError") {
265
270
  return { type: "abort_error", message: "Request was cancelled." };
266
271
  }
267
- if (err instanceof chunkSPASYIUH_cjs.MatrxApiError) {
272
+ if (err instanceof chunkU63KIQSS_cjs.MatrxApiError) {
268
273
  return {
269
274
  type: classifyStatus(err.status),
270
275
  message: honestTransportMessage(err.message, err.status),
@@ -274,7 +279,7 @@ function normalizeMatrxError(err) {
274
279
  name: err.name
275
280
  };
276
281
  }
277
- if (err instanceof chunkSPASYIUH_cjs.BackendApiError) {
282
+ if (err instanceof chunkU63KIQSS_cjs.BackendApiError) {
278
283
  return {
279
284
  type: "network_error",
280
285
  message: honestTransportMessage(
@@ -370,26 +375,26 @@ function createMatrxTransport(options) {
370
375
  }
371
376
  const resolve = resolveTarget ?? (() => ({ baseUrl }));
372
377
  const resolveVersion = () => {
373
- if (aiApiVersion === void 0) return chunkSPASYIUH_cjs.MATRX_AI_API_VERSION_DEFAULT;
378
+ if (aiApiVersion === void 0) return chunkU63KIQSS_cjs.MATRX_AI_API_VERSION_DEFAULT;
374
379
  return typeof aiApiVersion === "function" ? aiApiVersion() : aiApiVersion;
375
380
  };
376
381
  const resolveOrganizationId = (callOrganizationId) => {
377
382
  if (organizationId === void 0) return null;
378
- if (callOrganizationId !== null) return chunkSPASYIUH_cjs.requireOrganizationContext(callOrganizationId);
383
+ if (callOrganizationId !== null) return chunkU63KIQSS_cjs.requireOrganizationContext(callOrganizationId);
379
384
  const candidate = typeof organizationId === "function" ? organizationId() : organizationId;
380
- return chunkSPASYIUH_cjs.requireOrganizationContext(candidate);
385
+ return chunkU63KIQSS_cjs.requireOrganizationContext(candidate);
381
386
  };
382
387
  return {
383
388
  async fetch(path, init) {
384
389
  const target = await resolve(init);
385
390
  const callOrganizationId = readOrganizationHeader(init.headers);
386
- const versionedPath = chunkSPASYIUH_cjs.applyAiApiVersion(path, resolveVersion());
391
+ const versionedPath = chunkU63KIQSS_cjs.applyAiApiVersion(path, resolveVersion());
387
392
  const url = `${target.baseUrl}${versionedPath}`;
388
393
  const policyHeaders = stripContentType(target.policyHeaders ?? {});
389
394
  let overHeaders = callOrganizationId === null ? policyHeaders : stripOrganizationHeader(policyHeaders);
390
395
  const orgId = resolveOrganizationId(callOrganizationId);
391
396
  if (orgId !== null) {
392
- overHeaders = chunkSPASYIUH_cjs.applyOrganizationContextHeader(overHeaders, orgId);
397
+ overHeaders = chunkU63KIQSS_cjs.applyOrganizationContextHeader(overHeaders, orgId);
393
398
  }
394
399
  const wireHeaders = callOrganizationId === null ? { ...init.headers } : stripOrganizationHeader({ ...init.headers });
395
400
  const info = {
@@ -402,7 +407,7 @@ function createMatrxTransport(options) {
402
407
  diagnostics?.onRequest?.(info);
403
408
  let response;
404
409
  try {
405
- ({ response } = await chunkSPASYIUH_cjs.sendOnWire(
410
+ ({ response } = await chunkU63KIQSS_cjs.sendOnWire(
406
411
  {
407
412
  url,
408
413
  method: init.method,
@@ -427,11 +432,11 @@ function createMatrxTransport(options) {
427
432
  }
428
433
  if (!response.ok && !expectedErrorStatuses?.includes(response.status)) {
429
434
  const serverDetail = await response.clone().json().catch(() => void 0);
430
- const code = chunkSPASYIUH_cjs.extractMatrxErrorCode(serverDetail);
435
+ const code = chunkU63KIQSS_cjs.extractMatrxErrorCode(serverDetail);
431
436
  diagnostics?.onError?.(
432
437
  {
433
438
  type: classifyStatus(response.status),
434
- message: chunkSPASYIUH_cjs.extractMatrxErrorMessage(serverDetail) ?? `HTTP ${response.status}`,
439
+ message: chunkU63KIQSS_cjs.extractMatrxErrorMessage(serverDetail) ?? `HTTP ${response.status}`,
435
440
  status: response.status,
436
441
  serverDetail,
437
442
  ...code ? { code } : {}
@@ -710,7 +715,7 @@ async function readServerDetail(response) {
710
715
  }
711
716
  }
712
717
  async function throwApiError(path, response) {
713
- throw new chunkSPASYIUH_cjs.MatrxApiError({
718
+ throw new chunkU63KIQSS_cjs.MatrxApiError({
714
719
  status: response.status,
715
720
  path,
716
721
  serverDetail: await readServerDetail(response)
@@ -731,7 +736,7 @@ function toRunHandle(response, options) {
731
736
  return {
732
737
  requestId: response.headers.get("X-Request-ID"),
733
738
  conversationId: response.headers.get("X-Conversation-ID"),
734
- events: chunkSPASYIUH_cjs.readMatrxNdjsonStream(response.body, {
739
+ events: chunkU63KIQSS_cjs.readMatrxNdjsonStream(response.body, {
735
740
  ...options.signal ? { signal: options.signal } : {},
736
741
  ...options.maxReadAhead !== void 0 ? { maxReadAhead: options.maxReadAhead } : {},
737
742
  ...options.onMalformedLine ? { onMalformedLine: options.onMalformedLine } : {},
@@ -754,7 +759,7 @@ async function requestStream(transport, path, options) {
754
759
  });
755
760
  if (!response.ok) return throwApiError(path, response);
756
761
  if (!response.body) {
757
- throw new chunkSPASYIUH_cjs.MatrxApiError({
762
+ throw new chunkU63KIQSS_cjs.MatrxApiError({
758
763
  status: response.status,
759
764
  path,
760
765
  serverDetail: { code: "missing_response_body" },
@@ -814,7 +819,7 @@ async function getRuntimeOperationStatus(transport, requestId, options = {}) {
814
819
  { method: "GET", ...options.signal ? { signal: options.signal } : {} }
815
820
  );
816
821
  } catch (error) {
817
- if (error instanceof chunkSPASYIUH_cjs.MatrxApiError && error.status === 404) return null;
822
+ if (error instanceof chunkU63KIQSS_cjs.MatrxApiError && error.status === 404) return null;
818
823
  throw error;
819
824
  }
820
825
  }
@@ -829,7 +834,7 @@ async function getRuntimeOperationsByLink(transport, linkKind, linkId, options =
829
834
  { method: "GET", ...options.signal ? { signal: options.signal } : {} }
830
835
  );
831
836
  } catch (error) {
832
- if (error instanceof chunkSPASYIUH_cjs.MatrxApiError && error.status === 404) return null;
837
+ if (error instanceof chunkU63KIQSS_cjs.MatrxApiError && error.status === 404) return null;
833
838
  throw error;
834
839
  }
835
840
  }
@@ -870,7 +875,7 @@ async function* followRuntimeOperationEvents(transport, executionId, options = {
870
875
  ...options.signal ? { signal: options.signal } : {}
871
876
  }
872
877
  );
873
- const frames = chunkSPASYIUH_cjs.readMatrxSseStream(
878
+ const frames = chunkU63KIQSS_cjs.readMatrxSseStream(
874
879
  response.body,
875
880
  options.onIncomplete ? { onIncomplete: options.onIncomplete } : {}
876
881
  );
@@ -1073,7 +1078,7 @@ async function openMatrxStream(transport, path, options = {}) {
1073
1078
  return toRunHandle(response, options);
1074
1079
  }
1075
1080
  function withRunOrganization(transport, organizationId) {
1076
- const orgId = chunkSPASYIUH_cjs.requireOrganizationContext(organizationId);
1081
+ const orgId = chunkU63KIQSS_cjs.requireOrganizationContext(organizationId);
1077
1082
  return {
1078
1083
  fetch: (path, init) => transport.fetch(path, {
1079
1084
  ...init,
@@ -1100,7 +1105,7 @@ async function followWorkflowRunEvents(transport, runId, options) {
1100
1105
  throw error;
1101
1106
  }
1102
1107
  try {
1103
- for await (const frame of chunkSPASYIUH_cjs.readMatrxSseStream(
1108
+ for await (const frame of chunkU63KIQSS_cjs.readMatrxSseStream(
1104
1109
  response.body
1105
1110
  )) {
1106
1111
  if (frame.event === "end") return { ended: true };
@@ -1146,7 +1151,7 @@ async function resumeOrRejoin(transport, resumeCall, options) {
1146
1151
  } catch (error) {
1147
1152
  const target = readLiveRunRejoin(error);
1148
1153
  if (!target) {
1149
- if (error instanceof chunkSPASYIUH_cjs.MatrxApiError && isResumeConflict(error)) {
1154
+ if (error instanceof chunkU63KIQSS_cjs.MatrxApiError && isResumeConflict(error)) {
1150
1155
  return { kind: "resume_conflict", error };
1151
1156
  }
1152
1157
  throw error;
@@ -1562,7 +1567,7 @@ async function reportProviderSessionUsage(transport, usage, options = {}) {
1562
1567
  });
1563
1568
  return "ok";
1564
1569
  } catch (error) {
1565
- if (error instanceof chunkSPASYIUH_cjs.MatrxApiError) {
1570
+ if (error instanceof chunkU63KIQSS_cjs.MatrxApiError) {
1566
1571
  const status = error.status;
1567
1572
  if (status >= 400 && status < 500 && status !== 401 && status !== 408 && status !== 425 && status !== 429) {
1568
1573
  console.warn(`[provider-usage] server refused ${usage.provider} usage ${usage.usage_id} (${status})`);
@@ -2262,147 +2267,151 @@ Object.defineProperty(exports, "toCredentialsPort", {
2262
2267
  });
2263
2268
  Object.defineProperty(exports, "BackendApiError", {
2264
2269
  enumerable: true,
2265
- get: function () { return chunkSPASYIUH_cjs.BackendApiError; }
2270
+ get: function () { return chunkU63KIQSS_cjs.BackendApiError; }
2266
2271
  });
2267
2272
  Object.defineProperty(exports, "CONTRACT_SHA256", {
2268
2273
  enumerable: true,
2269
- get: function () { return chunkSPASYIUH_cjs.CONTRACT_SHA256; }
2274
+ get: function () { return chunkU63KIQSS_cjs.CONTRACT_SHA256; }
2270
2275
  });
2271
2276
  Object.defineProperty(exports, "DEPLOYMENTS", {
2272
2277
  enumerable: true,
2273
- get: function () { return chunkSPASYIUH_cjs.DEPLOYMENTS; }
2278
+ get: function () { return chunkU63KIQSS_cjs.DEPLOYMENTS; }
2274
2279
  });
2275
2280
  Object.defineProperty(exports, "DOMAINS", {
2276
2281
  enumerable: true,
2277
- get: function () { return chunkSPASYIUH_cjs.DOMAINS; }
2282
+ get: function () { return chunkU63KIQSS_cjs.DOMAINS; }
2278
2283
  });
2279
2284
  Object.defineProperty(exports, "MATRX_AI_API_VERSION_DEFAULT", {
2280
2285
  enumerable: true,
2281
- get: function () { return chunkSPASYIUH_cjs.MATRX_AI_API_VERSION_DEFAULT; }
2286
+ get: function () { return chunkU63KIQSS_cjs.MATRX_AI_API_VERSION_DEFAULT; }
2282
2287
  });
2283
2288
  Object.defineProperty(exports, "MatrxApiError", {
2284
2289
  enumerable: true,
2285
- get: function () { return chunkSPASYIUH_cjs.MatrxApiError; }
2290
+ get: function () { return chunkU63KIQSS_cjs.MatrxApiError; }
2286
2291
  });
2287
2292
  Object.defineProperty(exports, "OrganizationContextError", {
2288
2293
  enumerable: true,
2289
- get: function () { return chunkSPASYIUH_cjs.OrganizationContextError; }
2294
+ get: function () { return chunkU63KIQSS_cjs.OrganizationContextError; }
2290
2295
  });
2291
2296
  Object.defineProperty(exports, "StreamTransportError", {
2292
2297
  enumerable: true,
2293
- get: function () { return chunkSPASYIUH_cjs.StreamTransportError; }
2298
+ get: function () { return chunkU63KIQSS_cjs.StreamTransportError; }
2294
2299
  });
2295
2300
  Object.defineProperty(exports, "V2_COVERED_AI_PATH_TEMPLATES", {
2296
2301
  enumerable: true,
2297
- get: function () { return chunkSPASYIUH_cjs.V2_COVERED_AI_PATH_TEMPLATES; }
2302
+ get: function () { return chunkU63KIQSS_cjs.V2_COVERED_AI_PATH_TEMPLATES; }
2298
2303
  });
2299
2304
  Object.defineProperty(exports, "aiVersionPathOverrides", {
2300
2305
  enumerable: true,
2301
- get: function () { return chunkSPASYIUH_cjs.aiVersionPathOverrides; }
2306
+ get: function () { return chunkU63KIQSS_cjs.aiVersionPathOverrides; }
2302
2307
  });
2303
2308
  Object.defineProperty(exports, "applyAiApiVersion", {
2304
2309
  enumerable: true,
2305
- get: function () { return chunkSPASYIUH_cjs.applyAiApiVersion; }
2310
+ get: function () { return chunkU63KIQSS_cjs.applyAiApiVersion; }
2306
2311
  });
2307
2312
  Object.defineProperty(exports, "applyOrganizationContextHeader", {
2308
2313
  enumerable: true,
2309
- get: function () { return chunkSPASYIUH_cjs.applyOrganizationContextHeader; }
2314
+ get: function () { return chunkU63KIQSS_cjs.applyOrganizationContextHeader; }
2310
2315
  });
2311
2316
  Object.defineProperty(exports, "assertOrganizationMatchesOperation", {
2312
2317
  enumerable: true,
2313
- get: function () { return chunkSPASYIUH_cjs.assertOrganizationMatchesOperation; }
2318
+ get: function () { return chunkU63KIQSS_cjs.assertOrganizationMatchesOperation; }
2314
2319
  });
2315
2320
  Object.defineProperty(exports, "assertQueryOrganizationMatchesContext", {
2316
2321
  enumerable: true,
2317
- get: function () { return chunkSPASYIUH_cjs.assertQueryOrganizationMatchesContext; }
2322
+ get: function () { return chunkU63KIQSS_cjs.assertQueryOrganizationMatchesContext; }
2318
2323
  });
2319
2324
  Object.defineProperty(exports, "createApi", {
2320
2325
  enumerable: true,
2321
- get: function () { return chunkSPASYIUH_cjs.createApi; }
2326
+ get: function () { return chunkU63KIQSS_cjs.createApi; }
2322
2327
  });
2323
2328
  Object.defineProperty(exports, "createOrganizationOperation", {
2324
2329
  enumerable: true,
2325
- get: function () { return chunkSPASYIUH_cjs.createOrganizationOperation; }
2330
+ get: function () { return chunkU63KIQSS_cjs.createOrganizationOperation; }
2326
2331
  });
2327
2332
  Object.defineProperty(exports, "describeBackendFailure", {
2328
2333
  enumerable: true,
2329
- get: function () { return chunkSPASYIUH_cjs.describeBackendFailure; }
2334
+ get: function () { return chunkU63KIQSS_cjs.describeBackendFailure; }
2330
2335
  });
2331
2336
  Object.defineProperty(exports, "extractMatrxErrorCode", {
2332
2337
  enumerable: true,
2333
- get: function () { return chunkSPASYIUH_cjs.extractMatrxErrorCode; }
2338
+ get: function () { return chunkU63KIQSS_cjs.extractMatrxErrorCode; }
2334
2339
  });
2335
2340
  Object.defineProperty(exports, "extractMatrxErrorMessage", {
2336
2341
  enumerable: true,
2337
- get: function () { return chunkSPASYIUH_cjs.extractMatrxErrorMessage; }
2342
+ get: function () { return chunkU63KIQSS_cjs.extractMatrxErrorMessage; }
2338
2343
  });
2339
2344
  Object.defineProperty(exports, "fetchWithMatrxProtocolFallback", {
2340
2345
  enumerable: true,
2341
- get: function () { return chunkSPASYIUH_cjs.fetchWithMatrxProtocolFallback; }
2346
+ get: function () { return chunkU63KIQSS_cjs.fetchWithMatrxProtocolFallback; }
2342
2347
  });
2343
2348
  Object.defineProperty(exports, "getUserMessage", {
2344
2349
  enumerable: true,
2345
- get: function () { return chunkSPASYIUH_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; }
2346
2355
  });
2347
2356
  Object.defineProperty(exports, "isCoveredAiPath", {
2348
2357
  enumerable: true,
2349
- get: function () { return chunkSPASYIUH_cjs.isCoveredAiPath; }
2358
+ get: function () { return chunkU63KIQSS_cjs.isCoveredAiPath; }
2350
2359
  });
2351
2360
  Object.defineProperty(exports, "isGenericUserMessage", {
2352
2361
  enumerable: true,
2353
- get: function () { return chunkSPASYIUH_cjs.isGenericUserMessage; }
2362
+ get: function () { return chunkU63KIQSS_cjs.isGenericUserMessage; }
2354
2363
  });
2355
2364
  Object.defineProperty(exports, "isStreamTransportLost", {
2356
2365
  enumerable: true,
2357
- get: function () { return chunkSPASYIUH_cjs.isStreamTransportLost; }
2366
+ get: function () { return chunkU63KIQSS_cjs.isStreamTransportLost; }
2358
2367
  });
2359
2368
  Object.defineProperty(exports, "isV2Path", {
2360
2369
  enumerable: true,
2361
- get: function () { return chunkSPASYIUH_cjs.isV2Path; }
2370
+ get: function () { return chunkU63KIQSS_cjs.isV2Path; }
2362
2371
  });
2363
2372
  Object.defineProperty(exports, "openJsonOrStream", {
2364
2373
  enumerable: true,
2365
- get: function () { return chunkSPASYIUH_cjs.openJsonOrStream; }
2374
+ get: function () { return chunkU63KIQSS_cjs.openJsonOrStream; }
2366
2375
  });
2367
2376
  Object.defineProperty(exports, "openStream", {
2368
2377
  enumerable: true,
2369
- get: function () { return chunkSPASYIUH_cjs.openStream; }
2378
+ get: function () { return chunkU63KIQSS_cjs.openStream; }
2370
2379
  });
2371
2380
  Object.defineProperty(exports, "parseCallApiError", {
2372
2381
  enumerable: true,
2373
- get: function () { return chunkSPASYIUH_cjs.parseCallApiError; }
2382
+ get: function () { return chunkU63KIQSS_cjs.parseCallApiError; }
2374
2383
  });
2375
2384
  Object.defineProperty(exports, "parseHttpError", {
2376
2385
  enumerable: true,
2377
- get: function () { return chunkSPASYIUH_cjs.parseHttpError; }
2386
+ get: function () { return chunkU63KIQSS_cjs.parseHttpError; }
2378
2387
  });
2379
2388
  Object.defineProperty(exports, "parseHttpErrorBody", {
2380
2389
  enumerable: true,
2381
- get: function () { return chunkSPASYIUH_cjs.parseHttpErrorBody; }
2390
+ get: function () { return chunkU63KIQSS_cjs.parseHttpErrorBody; }
2382
2391
  });
2383
2392
  Object.defineProperty(exports, "parsePersistedBackendError", {
2384
2393
  enumerable: true,
2385
- get: function () { return chunkSPASYIUH_cjs.parsePersistedBackendError; }
2394
+ get: function () { return chunkU63KIQSS_cjs.parsePersistedBackendError; }
2386
2395
  });
2387
2396
  Object.defineProperty(exports, "parseStreamError", {
2388
2397
  enumerable: true,
2389
- get: function () { return chunkSPASYIUH_cjs.parseStreamError; }
2398
+ get: function () { return chunkU63KIQSS_cjs.parseStreamError; }
2390
2399
  });
2391
2400
  Object.defineProperty(exports, "requireOrganizationContext", {
2392
2401
  enumerable: true,
2393
- get: function () { return chunkSPASYIUH_cjs.requireOrganizationContext; }
2402
+ get: function () { return chunkU63KIQSS_cjs.requireOrganizationContext; }
2394
2403
  });
2395
2404
  Object.defineProperty(exports, "toV1FallbackUrl", {
2396
2405
  enumerable: true,
2397
- get: function () { return chunkSPASYIUH_cjs.toV1FallbackUrl; }
2406
+ get: function () { return chunkU63KIQSS_cjs.toV1FallbackUrl; }
2398
2407
  });
2399
2408
  Object.defineProperty(exports, "toV2Path", {
2400
2409
  enumerable: true,
2401
- get: function () { return chunkSPASYIUH_cjs.toV2Path; }
2410
+ get: function () { return chunkU63KIQSS_cjs.toV2Path; }
2402
2411
  });
2403
2412
  Object.defineProperty(exports, "unwrapUpstreamError", {
2404
2413
  enumerable: true,
2405
- get: function () { return chunkSPASYIUH_cjs.unwrapUpstreamError; }
2414
+ get: function () { return chunkU63KIQSS_cjs.unwrapUpstreamError; }
2406
2415
  });
2407
2416
  Object.defineProperty(exports, "AbortedError", {
2408
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, BackendApiError, parseHttpError, MatrxApiError, applyAiApiVersion, applyOrganizationContextHeader, extractMatrxErrorCode, extractMatrxErrorMessage, readMatrxNdjsonStream, readMatrxSseStream, requireOrganizationContext, MATRX_AI_API_VERSION_DEFAULT, StreamTransportError } from './chunk-FLANGLCG.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-FLANGLCG.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';
@@ -209,10 +209,15 @@ async function sendMatrxRequest(url, init = {}, options = {}) {
209
209
  new Headers(init.headers ?? {}).forEach((value, name) => {
210
210
  headers[name] = value;
211
211
  });
212
+ const fetchOptions = {};
213
+ for (const key of WIRE_FETCH_OPTION_KEYS) {
214
+ if (init[key] !== void 0) fetchOptions[key] = init[key];
215
+ }
212
216
  try {
213
217
  const { response } = await sendOnWire({
214
218
  url,
215
219
  method: init.method ?? "GET",
220
+ fetchOptions,
216
221
  headers,
217
222
  ...init.body !== void 0 && init.body !== null ? { body: init.body } : {},
218
223
  ...callerSignal ? { signal: callerSignal } : {},
@@ -227,7 +232,7 @@ async function sendMatrxRequest(url, init = {}, options = {}) {
227
232
  if (isNetError(error) && error.code === "aborted") {
228
233
  throw callerSignal?.reason instanceof Error ? callerSignal.reason : new DOMException("The request was cancelled.", "AbortError");
229
234
  }
230
- 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")) {
231
236
  throw new BackendApiError({
232
237
  code: "request_timeout",
233
238
  detail: `${init.method ?? "GET"} ${url} exceeded ${options.timeoutMs}ms`,