@ai-matrx/api 0.1.24 → 0.1.25

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 (134) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/dist/account.d.cts +2 -2
  3. package/dist/account.d.ts +2 -2
  4. package/dist/agents.cjs +11 -11
  5. package/dist/agents.d.cts +2 -2
  6. package/dist/agents.d.ts +2 -2
  7. package/dist/agents.js +1 -1
  8. package/dist/ai.cjs +2 -2
  9. package/dist/ai.d.cts +2 -2
  10. package/dist/ai.d.ts +2 -2
  11. package/dist/ai.js +1 -1
  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 +93 -41
  17. package/dist/architecture.d.cts +232 -40
  18. package/dist/architecture.d.ts +232 -40
  19. package/dist/architecture.js +72 -29
  20. package/dist/audio.cjs +151 -220
  21. package/dist/audio.d.cts +2 -2
  22. package/dist/audio.d.ts +2 -2
  23. package/dist/audio.js +2 -186
  24. package/dist/chat.cjs +11 -11
  25. package/dist/chat.d.cts +2 -2
  26. package/dist/chat.d.ts +2 -2
  27. package/dist/chat.js +1 -1
  28. package/dist/chunk-3HS6725N.js +186 -0
  29. package/dist/{chunk-ZOZOF5DN.cjs → chunk-HM5A33QV.cjs} +1 -1
  30. package/dist/chunk-HPR4EWCK.cjs +224 -0
  31. package/dist/chunk-OAPV5ZK5.js +1107 -0
  32. package/dist/{chunk-E3PGCGP7.js → chunk-OYD4PTWW.js} +1 -1
  33. package/dist/chunk-PFEPI7C3.js +128 -0
  34. package/dist/chunk-SZMLSYJK.cjs +1334 -0
  35. package/dist/chunk-UOIMSC67.cjs +154 -0
  36. package/dist/code.cjs +6 -6
  37. package/dist/code.d.cts +5 -4
  38. package/dist/code.d.ts +5 -4
  39. package/dist/code.js +1 -1
  40. package/dist/commerce.d.cts +2 -2
  41. package/dist/commerce.d.ts +2 -2
  42. package/dist/communications.cjs +4 -4
  43. package/dist/communications.d.cts +4 -2
  44. package/dist/communications.d.ts +4 -2
  45. package/dist/communications.js +1 -1
  46. package/dist/computer.cjs +4 -4
  47. package/dist/computer.d.cts +2 -2
  48. package/dist/computer.d.ts +2 -2
  49. package/dist/computer.js +1 -1
  50. package/dist/content.cjs +10 -4
  51. package/dist/content.d.cts +14 -3
  52. package/dist/content.d.ts +14 -3
  53. package/dist/content.js +7 -2
  54. package/dist/crm.cjs +2 -2
  55. package/dist/crm.d.cts +2 -2
  56. package/dist/crm.d.ts +2 -2
  57. package/dist/crm.js +1 -1
  58. package/dist/data.cjs +50 -3
  59. package/dist/data.d.cts +199 -3
  60. package/dist/data.d.ts +199 -3
  61. package/dist/data.js +41 -2
  62. package/dist/education.cjs +4 -4
  63. package/dist/education.d.cts +2 -2
  64. package/dist/education.d.ts +2 -2
  65. package/dist/education.js +1 -1
  66. package/dist/files.cjs +907 -1330
  67. package/dist/files.d.cts +2 -2
  68. package/dist/files.d.ts +2 -2
  69. package/dist/files.js +2 -1107
  70. package/dist/human-resources.d.cts +2 -2
  71. package/dist/human-resources.d.ts +2 -2
  72. package/dist/{index-BgjdVvrS.d.cts → index-BluxzzHL.d.cts} +2 -2
  73. package/dist/{index-BgjdVvrS.d.ts → index-BluxzzHL.d.ts} +2 -2
  74. package/dist/index.cjs +62 -58
  75. package/dist/index.d.cts +2 -2
  76. package/dist/index.d.ts +2 -2
  77. package/dist/index.js +7 -3
  78. package/dist/integrations.cjs +51 -5
  79. package/dist/integrations.d.cts +136 -4
  80. package/dist/integrations.d.ts +136 -4
  81. package/dist/integrations.js +42 -4
  82. package/dist/intelligence.cjs +6 -6
  83. package/dist/intelligence.d.cts +2 -2
  84. package/dist/intelligence.d.ts +2 -2
  85. package/dist/intelligence.js +1 -1
  86. package/dist/knowledge.cjs +42 -42
  87. package/dist/knowledge.d.cts +3 -3
  88. package/dist/knowledge.d.ts +3 -3
  89. package/dist/knowledge.js +1 -1
  90. package/dist/legal.cjs +6 -6
  91. package/dist/legal.d.cts +2 -2
  92. package/dist/legal.d.ts +2 -2
  93. package/dist/legal.js +1 -1
  94. package/dist/marketing.cjs +97 -81
  95. package/dist/marketing.d.cts +81 -8
  96. package/dist/marketing.d.ts +81 -8
  97. package/dist/marketing.js +19 -6
  98. package/dist/masterwork.cjs +32 -32
  99. package/dist/masterwork.d.cts +2 -2
  100. package/dist/masterwork.d.ts +2 -2
  101. package/dist/masterwork.js +1 -1
  102. package/dist/media.cjs +11 -11
  103. package/dist/media.d.cts +9 -9
  104. package/dist/media.d.ts +9 -9
  105. package/dist/media.js +1 -1
  106. package/dist/platform.cjs +103 -150
  107. package/dist/platform.d.cts +2 -2
  108. package/dist/platform.d.ts +2 -2
  109. package/dist/platform.js +2 -128
  110. package/dist/publish.cjs +7 -7
  111. package/dist/publish.d.cts +2 -2
  112. package/dist/publish.d.ts +2 -2
  113. package/dist/publish.js +1 -1
  114. package/dist/recording.cjs +278 -0
  115. package/dist/recording.d.cts +44 -0
  116. package/dist/recording.d.ts +44 -0
  117. package/dist/recording.js +275 -0
  118. package/dist/schemas.d.cts +4 -1
  119. package/dist/schemas.d.ts +4 -1
  120. package/dist/stream.cjs +10 -10
  121. package/dist/stream.d.cts +1 -1
  122. package/dist/stream.d.ts +1 -1
  123. package/dist/stream.js +1 -1
  124. package/dist/types.d.cts +735 -32
  125. package/dist/types.d.ts +735 -32
  126. package/dist/web.cjs +26 -26
  127. package/dist/web.d.cts +2 -2
  128. package/dist/web.d.ts +2 -2
  129. package/dist/web.js +1 -1
  130. package/dist/workflows.cjs +32 -14
  131. package/dist/workflows.d.cts +132 -40
  132. package/dist/workflows.d.ts +132 -40
  133. package/dist/workflows.js +18 -3
  134. package/package.json +15 -4
@@ -1,10 +1,10 @@
1
- import { A as Api, C as CallOptions } from './index-BgjdVvrS.cjs';
1
+ import { A as Api, C as CallOptions } from './index-BluxzzHL.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 a7cc7154fd90de65bc0e3e819210f0337696cb50814b5a366e64ecb1b00412e4
7
+ * CONTRACT_SHA256 118778e288a723f4114c0f189d3f0d25d8f399fdb49d9bbac475b5fcb9d808f6
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-BgjdVvrS.js';
1
+ import { A as Api, C as CallOptions } from './index-BluxzzHL.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 a7cc7154fd90de65bc0e3e819210f0337696cb50814b5a366e64ecb1b00412e4
7
+ * CONTRACT_SHA256 118778e288a723f4114c0f189d3f0d25d8f399fdb49d9bbac475b5fcb9d808f6
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 a7cc7154fd90de65bc0e3e819210f0337696cb50814b5a366e64ecb1b00412e4
193
+ * CONTRACT_SHA256 118778e288a723f4114c0f189d3f0d25d8f399fdb49d9bbac475b5fcb9d808f6
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 = "a7cc7154fd90de65bc0e3e819210f0337696cb50814b5a366e64ecb1b00412e4";
196
+ declare const CONTRACT_SHA256 = "118778e288a723f4114c0f189d3f0d25d8f399fdb49d9bbac475b5fcb9d808f6";
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: {
@@ -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 a7cc7154fd90de65bc0e3e819210f0337696cb50814b5a366e64ecb1b00412e4
193
+ * CONTRACT_SHA256 118778e288a723f4114c0f189d3f0d25d8f399fdb49d9bbac475b5fcb9d808f6
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 = "a7cc7154fd90de65bc0e3e819210f0337696cb50814b5a366e64ecb1b00412e4";
196
+ declare const CONTRACT_SHA256 = "118778e288a723f4114c0f189d3f0d25d8f399fdb49d9bbac475b5fcb9d808f6";
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: {
package/dist/index.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  var chunkFNIYADWI_cjs = require('./chunk-FNIYADWI.cjs');
4
4
  var chunkMVXD6WI6_cjs = require('./chunk-MVXD6WI6.cjs');
5
- var chunkZOZOF5DN_cjs = require('./chunk-ZOZOF5DN.cjs');
5
+ var chunkHM5A33QV_cjs = require('./chunk-HM5A33QV.cjs');
6
6
  var chunk2SXAAKGV_cjs = require('./chunk-2SXAAKGV.cjs');
7
7
  var format = require('@ai-matrx/kit/format');
8
8
 
@@ -44,7 +44,7 @@ function buildMatrxRequestBody(body, scope) {
44
44
  }
45
45
  const bodyOrganizationId = base.organization_id;
46
46
  if (scope.organization_id !== void 0 && bodyOrganizationId !== void 0 && (typeof bodyOrganizationId !== "string" || bodyOrganizationId.trim() !== scope.organization_id)) {
47
- throw new chunkZOZOF5DN_cjs.OrganizationContextError(
47
+ throw new chunkHM5A33QV_cjs.OrganizationContextError(
48
48
  "organization_context_mismatch",
49
49
  "Request body organization_id must match the request context organization."
50
50
  );
@@ -116,14 +116,14 @@ function parseMatrxNdjsonResponse(response, signal, hooks = {}) {
116
116
  };
117
117
  async function* events() {
118
118
  if (!response.body) {
119
- throw new chunkZOZOF5DN_cjs.BackendApiError({
119
+ throw new chunkHM5A33QV_cjs.BackendApiError({
120
120
  code: "internal_error",
121
121
  detail: "Response has no body",
122
122
  userMessage: "No response received from server"
123
123
  });
124
124
  }
125
125
  try {
126
- for await (const envelope of chunkZOZOF5DN_cjs.readMatrxNdjsonStream(response.body, {
126
+ for await (const envelope of chunkHM5A33QV_cjs.readMatrxNdjsonStream(response.body, {
127
127
  ...signal ? { signal } : {},
128
128
  ...hooks.onMalformedLine ? { onMalformedLine: hooks.onMalformedLine } : {},
129
129
  ...hooks.onUnknownEnvelope ? { onUnknownEnvelope: hooks.onUnknownEnvelope } : {}
@@ -135,7 +135,7 @@ function parseMatrxNdjsonResponse(response, signal, hooks = {}) {
135
135
  if (signal?.aborted || error instanceof Error && error.name === "AbortError") {
136
136
  return;
137
137
  }
138
- const transportError = error instanceof chunkZOZOF5DN_cjs.BackendApiError ? error : new chunkZOZOF5DN_cjs.StreamTransportError({
138
+ const transportError = error instanceof chunkHM5A33QV_cjs.BackendApiError ? error : new chunkHM5A33QV_cjs.StreamTransportError({
139
139
  detail: error instanceof Error ? error.message : "The response stream ended unexpectedly.",
140
140
  details: error,
141
141
  ...ids.requestId ? { requestId: ids.requestId } : {}
@@ -152,7 +152,7 @@ async function httpErrorFrom(response) {
152
152
  const serverDetail = await response.json().catch(() => void 0);
153
153
  return {
154
154
  type: response.status >= 400 && response.status < 500 ? "validation_error" : "http_error",
155
- message: chunkZOZOF5DN_cjs.extractMatrxErrorMessage(serverDetail) ?? bareStatusSentence(response.status),
155
+ message: chunkHM5A33QV_cjs.extractMatrxErrorMessage(serverDetail) ?? bareStatusSentence(response.status),
156
156
  status: response.status,
157
157
  serverDetail
158
158
  };
@@ -160,7 +160,7 @@ async function httpErrorFrom(response) {
160
160
  async function executeMatrxCall(request, hooks = {}) {
161
161
  const upper = request.method.toUpperCase();
162
162
  const sendsBody = request.stream || upper !== "GET" && upper !== "HEAD";
163
- const { response } = await chunkZOZOF5DN_cjs.sendOnWire({
163
+ const { response } = await chunkHM5A33QV_cjs.sendOnWire({
164
164
  url: request.url,
165
165
  method: request.method,
166
166
  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 chunkZOZOF5DN_cjs.WIRE_FETCH_OPTION_KEYS) {
213
+ for (const key of chunkHM5A33QV_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 chunkZOZOF5DN_cjs.sendOnWire({
217
+ const { response, controller } = await chunkHM5A33QV_cjs.sendOnWire({
218
218
  url,
219
219
  method: init.method ?? "GET",
220
220
  fetchOptions,
@@ -227,13 +227,17 @@ async function sendMatrxRequest(url, init = {}, options = {}) {
227
227
  totalTimeoutMs: null,
228
228
  ...options.onUploadProgress ? { onUploadProgress: options.onUploadProgress } : {}
229
229
  });
230
+ if (callerSignal) {
231
+ if (callerSignal.aborted) controller.abort(callerSignal.reason);
232
+ else callerSignal.addEventListener("abort", () => controller.abort(callerSignal.reason), { once: true });
233
+ }
230
234
  return response;
231
235
  } catch (error) {
232
236
  if (chunk2SXAAKGV_cjs.isNetError(error) && error.code === "aborted") {
233
237
  throw callerSignal?.reason instanceof Error ? callerSignal.reason : new DOMException("The request was cancelled.", "AbortError");
234
238
  }
235
239
  if (options.timeoutMs !== void 0 && chunk2SXAAKGV_cjs.isNetError(error) && (error.code === "connect-timeout" || error.code === "total-timeout")) {
236
- throw new chunkZOZOF5DN_cjs.BackendApiError({
240
+ throw new chunkHM5A33QV_cjs.BackendApiError({
237
241
  code: "request_timeout",
238
242
  detail: `${init.method ?? "GET"} ${url} exceeded ${options.timeoutMs}ms`,
239
243
  userMessage: "The request timed out \u2014 please retry.",
@@ -247,7 +251,7 @@ async function sendMatrxRequest(url, init = {}, options = {}) {
247
251
  }
248
252
  }
249
253
  async function readMatrxJsonResponse(response) {
250
- if (!response.ok) throw await chunkZOZOF5DN_cjs.parseHttpError(response);
254
+ if (!response.ok) throw await chunkHM5A33QV_cjs.parseHttpError(response);
251
255
  if (response.status === 204) return null;
252
256
  return await response.json();
253
257
  }
@@ -257,7 +261,7 @@ function classifyStatus(status) {
257
261
  return status >= 400 && status < 500 ? "validation_error" : "http_error";
258
262
  }
259
263
  function normalizeMatrxError(err) {
260
- if (err instanceof chunkZOZOF5DN_cjs.OrganizationContextError) {
264
+ if (err instanceof chunkHM5A33QV_cjs.OrganizationContextError) {
261
265
  return {
262
266
  type: "validation_error",
263
267
  message: err.message,
@@ -269,7 +273,7 @@ function normalizeMatrxError(err) {
269
273
  if (err instanceof DOMException && err.name === "AbortError") {
270
274
  return { type: "abort_error", message: "Request was cancelled." };
271
275
  }
272
- if (err instanceof chunkZOZOF5DN_cjs.MatrxApiError) {
276
+ if (err instanceof chunkHM5A33QV_cjs.MatrxApiError) {
273
277
  return {
274
278
  type: classifyStatus(err.status),
275
279
  message: honestTransportMessage(err.message, err.status),
@@ -279,7 +283,7 @@ function normalizeMatrxError(err) {
279
283
  name: err.name
280
284
  };
281
285
  }
282
- if (err instanceof chunkZOZOF5DN_cjs.BackendApiError) {
286
+ if (err instanceof chunkHM5A33QV_cjs.BackendApiError) {
283
287
  return {
284
288
  type: "network_error",
285
289
  message: honestTransportMessage(
@@ -375,9 +379,9 @@ function createMatrxTransport(options) {
375
379
  const resolve = resolveTarget ?? (() => ({ baseUrl }));
376
380
  const resolveOrganizationId = (callOrganizationId) => {
377
381
  if (organizationId === void 0) return null;
378
- if (callOrganizationId !== null) return chunkZOZOF5DN_cjs.requireOrganizationContext(callOrganizationId);
382
+ if (callOrganizationId !== null) return chunkHM5A33QV_cjs.requireOrganizationContext(callOrganizationId);
379
383
  const candidate = typeof organizationId === "function" ? organizationId() : organizationId;
380
- return chunkZOZOF5DN_cjs.requireOrganizationContext(candidate);
384
+ return chunkHM5A33QV_cjs.requireOrganizationContext(candidate);
381
385
  };
382
386
  return {
383
387
  async fetch(path, init) {
@@ -388,7 +392,7 @@ function createMatrxTransport(options) {
388
392
  let overHeaders = callOrganizationId === null ? policyHeaders : stripOrganizationHeader(policyHeaders);
389
393
  const orgId = resolveOrganizationId(callOrganizationId);
390
394
  if (orgId !== null) {
391
- overHeaders = chunkZOZOF5DN_cjs.applyOrganizationContextHeader(overHeaders, orgId);
395
+ overHeaders = chunkHM5A33QV_cjs.applyOrganizationContextHeader(overHeaders, orgId);
392
396
  }
393
397
  const wireHeaders = callOrganizationId === null ? { ...init.headers } : stripOrganizationHeader({ ...init.headers });
394
398
  const info = {
@@ -401,7 +405,7 @@ function createMatrxTransport(options) {
401
405
  diagnostics?.onRequest?.(info);
402
406
  let response;
403
407
  try {
404
- ({ response } = await chunkZOZOF5DN_cjs.sendOnWire(
408
+ ({ response } = await chunkHM5A33QV_cjs.sendOnWire(
405
409
  {
406
410
  url,
407
411
  method: init.method,
@@ -425,11 +429,11 @@ function createMatrxTransport(options) {
425
429
  }
426
430
  if (!response.ok && !expectedErrorStatuses?.includes(response.status)) {
427
431
  const serverDetail = await response.clone().json().catch(() => void 0);
428
- const code = chunkZOZOF5DN_cjs.extractMatrxErrorCode(serverDetail);
432
+ const code = chunkHM5A33QV_cjs.extractMatrxErrorCode(serverDetail);
429
433
  diagnostics?.onError?.(
430
434
  {
431
435
  type: classifyStatus(response.status),
432
- message: chunkZOZOF5DN_cjs.extractMatrxErrorMessage(serverDetail) ?? `HTTP ${response.status}`,
436
+ message: chunkHM5A33QV_cjs.extractMatrxErrorMessage(serverDetail) ?? `HTTP ${response.status}`,
433
437
  status: response.status,
434
438
  serverDetail,
435
439
  ...code ? { code } : {}
@@ -708,7 +712,7 @@ async function readServerDetail(response) {
708
712
  }
709
713
  }
710
714
  async function throwApiError(path, response) {
711
- throw new chunkZOZOF5DN_cjs.MatrxApiError({
715
+ throw new chunkHM5A33QV_cjs.MatrxApiError({
712
716
  status: response.status,
713
717
  path,
714
718
  serverDetail: await readServerDetail(response)
@@ -729,7 +733,7 @@ function toRunHandle(response, options) {
729
733
  return {
730
734
  requestId: response.headers.get("X-Request-ID"),
731
735
  conversationId: response.headers.get("X-Conversation-ID"),
732
- events: chunkZOZOF5DN_cjs.readMatrxNdjsonStream(response.body, {
736
+ events: chunkHM5A33QV_cjs.readMatrxNdjsonStream(response.body, {
733
737
  ...options.signal ? { signal: options.signal } : {},
734
738
  ...options.maxReadAhead !== void 0 ? { maxReadAhead: options.maxReadAhead } : {},
735
739
  ...options.onMalformedLine ? { onMalformedLine: options.onMalformedLine } : {},
@@ -752,7 +756,7 @@ async function requestStream(transport, path, options) {
752
756
  });
753
757
  if (!response.ok) return throwApiError(path, response);
754
758
  if (!response.body) {
755
- throw new chunkZOZOF5DN_cjs.MatrxApiError({
759
+ throw new chunkHM5A33QV_cjs.MatrxApiError({
756
760
  status: response.status,
757
761
  path,
758
762
  serverDetail: { code: "missing_response_body" },
@@ -812,7 +816,7 @@ async function getRuntimeOperationStatus(transport, requestId, options = {}) {
812
816
  { method: "GET", ...options.signal ? { signal: options.signal } : {} }
813
817
  );
814
818
  } catch (error) {
815
- if (error instanceof chunkZOZOF5DN_cjs.MatrxApiError && error.status === 404) return null;
819
+ if (error instanceof chunkHM5A33QV_cjs.MatrxApiError && error.status === 404) return null;
816
820
  throw error;
817
821
  }
818
822
  }
@@ -827,7 +831,7 @@ async function getRuntimeOperationsByLink(transport, linkKind, linkId, options =
827
831
  { method: "GET", ...options.signal ? { signal: options.signal } : {} }
828
832
  );
829
833
  } catch (error) {
830
- if (error instanceof chunkZOZOF5DN_cjs.MatrxApiError && error.status === 404) return null;
834
+ if (error instanceof chunkHM5A33QV_cjs.MatrxApiError && error.status === 404) return null;
831
835
  throw error;
832
836
  }
833
837
  }
@@ -868,7 +872,7 @@ async function* followRuntimeOperationEvents(transport, executionId, options = {
868
872
  ...options.signal ? { signal: options.signal } : {}
869
873
  }
870
874
  );
871
- const frames = chunkZOZOF5DN_cjs.readMatrxSseStream(
875
+ const frames = chunkHM5A33QV_cjs.readMatrxSseStream(
872
876
  response.body,
873
877
  options.onIncomplete ? { onIncomplete: options.onIncomplete } : {}
874
878
  );
@@ -1071,7 +1075,7 @@ async function openMatrxStream(transport, path, options = {}) {
1071
1075
  return toRunHandle(response, options);
1072
1076
  }
1073
1077
  function withRunOrganization(transport, organizationId) {
1074
- const orgId = chunkZOZOF5DN_cjs.requireOrganizationContext(organizationId);
1078
+ const orgId = chunkHM5A33QV_cjs.requireOrganizationContext(organizationId);
1075
1079
  return {
1076
1080
  fetch: (path, init) => transport.fetch(path, {
1077
1081
  ...init,
@@ -1098,7 +1102,7 @@ async function followWorkflowRunEvents(transport, runId, options) {
1098
1102
  throw error;
1099
1103
  }
1100
1104
  try {
1101
- for await (const frame of chunkZOZOF5DN_cjs.readMatrxSseStream(
1105
+ for await (const frame of chunkHM5A33QV_cjs.readMatrxSseStream(
1102
1106
  response.body
1103
1107
  )) {
1104
1108
  if (frame.event === "end") return { ended: true };
@@ -1144,7 +1148,7 @@ async function resumeOrRejoin(transport, resumeCall, options) {
1144
1148
  } catch (error) {
1145
1149
  const target = readLiveRunRejoin(error);
1146
1150
  if (!target) {
1147
- if (error instanceof chunkZOZOF5DN_cjs.MatrxApiError && isResumeConflict(error)) {
1151
+ if (error instanceof chunkHM5A33QV_cjs.MatrxApiError && isResumeConflict(error)) {
1148
1152
  return { kind: "resume_conflict", error };
1149
1153
  }
1150
1154
  throw error;
@@ -1560,7 +1564,7 @@ async function reportProviderSessionUsage(transport, usage, options = {}) {
1560
1564
  });
1561
1565
  return "ok";
1562
1566
  } catch (error) {
1563
- if (error instanceof chunkZOZOF5DN_cjs.MatrxApiError) {
1567
+ if (error instanceof chunkHM5A33QV_cjs.MatrxApiError) {
1564
1568
  const status = error.status;
1565
1569
  if (status >= 400 && status < 500 && status !== 401 && status !== 408 && status !== 425 && status !== 429) {
1566
1570
  console.warn(`[provider-usage] server refused ${usage.provider} usage ${usage.usage_id} (${status})`);
@@ -2256,115 +2260,115 @@ Object.defineProperty(exports, "toCredentialsPort", {
2256
2260
  });
2257
2261
  Object.defineProperty(exports, "BackendApiError", {
2258
2262
  enumerable: true,
2259
- get: function () { return chunkZOZOF5DN_cjs.BackendApiError; }
2263
+ get: function () { return chunkHM5A33QV_cjs.BackendApiError; }
2260
2264
  });
2261
2265
  Object.defineProperty(exports, "CONTRACT_SHA256", {
2262
2266
  enumerable: true,
2263
- get: function () { return chunkZOZOF5DN_cjs.CONTRACT_SHA256; }
2267
+ get: function () { return chunkHM5A33QV_cjs.CONTRACT_SHA256; }
2264
2268
  });
2265
2269
  Object.defineProperty(exports, "DEPLOYMENTS", {
2266
2270
  enumerable: true,
2267
- get: function () { return chunkZOZOF5DN_cjs.DEPLOYMENTS; }
2271
+ get: function () { return chunkHM5A33QV_cjs.DEPLOYMENTS; }
2268
2272
  });
2269
2273
  Object.defineProperty(exports, "DOMAINS", {
2270
2274
  enumerable: true,
2271
- get: function () { return chunkZOZOF5DN_cjs.DOMAINS; }
2275
+ get: function () { return chunkHM5A33QV_cjs.DOMAINS; }
2272
2276
  });
2273
2277
  Object.defineProperty(exports, "MatrxApiError", {
2274
2278
  enumerable: true,
2275
- get: function () { return chunkZOZOF5DN_cjs.MatrxApiError; }
2279
+ get: function () { return chunkHM5A33QV_cjs.MatrxApiError; }
2276
2280
  });
2277
2281
  Object.defineProperty(exports, "OrganizationContextError", {
2278
2282
  enumerable: true,
2279
- get: function () { return chunkZOZOF5DN_cjs.OrganizationContextError; }
2283
+ get: function () { return chunkHM5A33QV_cjs.OrganizationContextError; }
2280
2284
  });
2281
2285
  Object.defineProperty(exports, "StreamTransportError", {
2282
2286
  enumerable: true,
2283
- get: function () { return chunkZOZOF5DN_cjs.StreamTransportError; }
2287
+ get: function () { return chunkHM5A33QV_cjs.StreamTransportError; }
2284
2288
  });
2285
2289
  Object.defineProperty(exports, "applyOrganizationContextHeader", {
2286
2290
  enumerable: true,
2287
- get: function () { return chunkZOZOF5DN_cjs.applyOrganizationContextHeader; }
2291
+ get: function () { return chunkHM5A33QV_cjs.applyOrganizationContextHeader; }
2288
2292
  });
2289
2293
  Object.defineProperty(exports, "assertOrganizationMatchesOperation", {
2290
2294
  enumerable: true,
2291
- get: function () { return chunkZOZOF5DN_cjs.assertOrganizationMatchesOperation; }
2295
+ get: function () { return chunkHM5A33QV_cjs.assertOrganizationMatchesOperation; }
2292
2296
  });
2293
2297
  Object.defineProperty(exports, "assertQueryOrganizationMatchesContext", {
2294
2298
  enumerable: true,
2295
- get: function () { return chunkZOZOF5DN_cjs.assertQueryOrganizationMatchesContext; }
2299
+ get: function () { return chunkHM5A33QV_cjs.assertQueryOrganizationMatchesContext; }
2296
2300
  });
2297
2301
  Object.defineProperty(exports, "createApi", {
2298
2302
  enumerable: true,
2299
- get: function () { return chunkZOZOF5DN_cjs.createApi; }
2303
+ get: function () { return chunkHM5A33QV_cjs.createApi; }
2300
2304
  });
2301
2305
  Object.defineProperty(exports, "createOrganizationOperation", {
2302
2306
  enumerable: true,
2303
- get: function () { return chunkZOZOF5DN_cjs.createOrganizationOperation; }
2307
+ get: function () { return chunkHM5A33QV_cjs.createOrganizationOperation; }
2304
2308
  });
2305
2309
  Object.defineProperty(exports, "describeBackendFailure", {
2306
2310
  enumerable: true,
2307
- get: function () { return chunkZOZOF5DN_cjs.describeBackendFailure; }
2311
+ get: function () { return chunkHM5A33QV_cjs.describeBackendFailure; }
2308
2312
  });
2309
2313
  Object.defineProperty(exports, "extractMatrxErrorCode", {
2310
2314
  enumerable: true,
2311
- get: function () { return chunkZOZOF5DN_cjs.extractMatrxErrorCode; }
2315
+ get: function () { return chunkHM5A33QV_cjs.extractMatrxErrorCode; }
2312
2316
  });
2313
2317
  Object.defineProperty(exports, "extractMatrxErrorMessage", {
2314
2318
  enumerable: true,
2315
- get: function () { return chunkZOZOF5DN_cjs.extractMatrxErrorMessage; }
2319
+ get: function () { return chunkHM5A33QV_cjs.extractMatrxErrorMessage; }
2316
2320
  });
2317
2321
  Object.defineProperty(exports, "getUserMessage", {
2318
2322
  enumerable: true,
2319
- get: function () { return chunkZOZOF5DN_cjs.getUserMessage; }
2323
+ get: function () { return chunkHM5A33QV_cjs.getUserMessage; }
2320
2324
  });
2321
2325
  Object.defineProperty(exports, "isBinaryType", {
2322
2326
  enumerable: true,
2323
- get: function () { return chunkZOZOF5DN_cjs.isBinaryType; }
2327
+ get: function () { return chunkHM5A33QV_cjs.isBinaryType; }
2324
2328
  });
2325
2329
  Object.defineProperty(exports, "isGenericUserMessage", {
2326
2330
  enumerable: true,
2327
- get: function () { return chunkZOZOF5DN_cjs.isGenericUserMessage; }
2331
+ get: function () { return chunkHM5A33QV_cjs.isGenericUserMessage; }
2328
2332
  });
2329
2333
  Object.defineProperty(exports, "isStreamTransportLost", {
2330
2334
  enumerable: true,
2331
- get: function () { return chunkZOZOF5DN_cjs.isStreamTransportLost; }
2335
+ get: function () { return chunkHM5A33QV_cjs.isStreamTransportLost; }
2332
2336
  });
2333
2337
  Object.defineProperty(exports, "openJsonOrStream", {
2334
2338
  enumerable: true,
2335
- get: function () { return chunkZOZOF5DN_cjs.openJsonOrStream; }
2339
+ get: function () { return chunkHM5A33QV_cjs.openJsonOrStream; }
2336
2340
  });
2337
2341
  Object.defineProperty(exports, "openStream", {
2338
2342
  enumerable: true,
2339
- get: function () { return chunkZOZOF5DN_cjs.openStream; }
2343
+ get: function () { return chunkHM5A33QV_cjs.openStream; }
2340
2344
  });
2341
2345
  Object.defineProperty(exports, "parseCallApiError", {
2342
2346
  enumerable: true,
2343
- get: function () { return chunkZOZOF5DN_cjs.parseCallApiError; }
2347
+ get: function () { return chunkHM5A33QV_cjs.parseCallApiError; }
2344
2348
  });
2345
2349
  Object.defineProperty(exports, "parseHttpError", {
2346
2350
  enumerable: true,
2347
- get: function () { return chunkZOZOF5DN_cjs.parseHttpError; }
2351
+ get: function () { return chunkHM5A33QV_cjs.parseHttpError; }
2348
2352
  });
2349
2353
  Object.defineProperty(exports, "parseHttpErrorBody", {
2350
2354
  enumerable: true,
2351
- get: function () { return chunkZOZOF5DN_cjs.parseHttpErrorBody; }
2355
+ get: function () { return chunkHM5A33QV_cjs.parseHttpErrorBody; }
2352
2356
  });
2353
2357
  Object.defineProperty(exports, "parsePersistedBackendError", {
2354
2358
  enumerable: true,
2355
- get: function () { return chunkZOZOF5DN_cjs.parsePersistedBackendError; }
2359
+ get: function () { return chunkHM5A33QV_cjs.parsePersistedBackendError; }
2356
2360
  });
2357
2361
  Object.defineProperty(exports, "parseStreamError", {
2358
2362
  enumerable: true,
2359
- get: function () { return chunkZOZOF5DN_cjs.parseStreamError; }
2363
+ get: function () { return chunkHM5A33QV_cjs.parseStreamError; }
2360
2364
  });
2361
2365
  Object.defineProperty(exports, "requireOrganizationContext", {
2362
2366
  enumerable: true,
2363
- get: function () { return chunkZOZOF5DN_cjs.requireOrganizationContext; }
2367
+ get: function () { return chunkHM5A33QV_cjs.requireOrganizationContext; }
2364
2368
  });
2365
2369
  Object.defineProperty(exports, "unwrapUpstreamError", {
2366
2370
  enumerable: true,
2367
- get: function () { return chunkZOZOF5DN_cjs.unwrapUpstreamError; }
2371
+ get: function () { return chunkHM5A33QV_cjs.unwrapUpstreamError; }
2368
2372
  });
2369
2373
  Object.defineProperty(exports, "AbortedError", {
2370
2374
  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-BgjdVvrS.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-BgjdVvrS.cjs';
1
+ import { M as MatrxStreamEnvelope, b as MatrxNdjsonIssue, U as UploadProgress, c as MatrxStreamEnvelopeObservation, d as MatrxSseFrame } from './index-BluxzzHL.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-BluxzzHL.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
  export { AbortedError, ConnectTimeoutError, HeartbeatTimeoutError, HttpError, NetError, NetErrorCode, NetworkError, OfflineError, ResilientFetchOptions, ResilientFetchResult, RetryOptions, StreamMonitorOptions, TotalTimeoutError, extractErrorMessage, isNetError, isTransportFailure, monitorStream, resilientFetch, toNetError, withRetry } 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-BgjdVvrS.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-BgjdVvrS.js';
1
+ import { M as MatrxStreamEnvelope, b as MatrxNdjsonIssue, U as UploadProgress, c as MatrxStreamEnvelopeObservation, d as MatrxSseFrame } from './index-BluxzzHL.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-BluxzzHL.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
  export { AbortedError, ConnectTimeoutError, HeartbeatTimeoutError, HttpError, NetError, NetErrorCode, NetworkError, OfflineError, ResilientFetchOptions, ResilientFetchResult, RetryOptions, StreamMonitorOptions, TotalTimeoutError, extractErrorMessage, isNetError, isTransportFailure, monitorStream, resilientFetch, toNetError, withRetry } from './net.js';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { monitorStream } from './chunk-YTEOFGFC.js';
2
2
  export { API_KEY_PREFIX, MATRX_HEADERS, credentialToHeaders, toCredentialsPort } from './chunk-7MZPBCFV.js';
3
- import { OrganizationContextError, sendOnWire, WIRE_FETCH_OPTION_KEYS, BackendApiError, parseHttpError, MatrxApiError, applyOrganizationContextHeader, extractMatrxErrorCode, extractMatrxErrorMessage, readMatrxNdjsonStream, readMatrxSseStream, requireOrganizationContext, StreamTransportError } from './chunk-E3PGCGP7.js';
4
- export { BackendApiError, CONTRACT_SHA256, DEPLOYMENTS, DOMAINS, MatrxApiError, OrganizationContextError, StreamTransportError, applyOrganizationContextHeader, assertOrganizationMatchesOperation, assertQueryOrganizationMatchesContext, createApi, createOrganizationOperation, describeBackendFailure, extractMatrxErrorCode, extractMatrxErrorMessage, getUserMessage, isBinaryType, isGenericUserMessage, isStreamTransportLost, openJsonOrStream, openStream, parseCallApiError, parseHttpError, parseHttpErrorBody, parsePersistedBackendError, parseStreamError, requireOrganizationContext, unwrapUpstreamError } from './chunk-E3PGCGP7.js';
3
+ import { OrganizationContextError, sendOnWire, WIRE_FETCH_OPTION_KEYS, BackendApiError, parseHttpError, MatrxApiError, applyOrganizationContextHeader, extractMatrxErrorCode, extractMatrxErrorMessage, readMatrxNdjsonStream, readMatrxSseStream, requireOrganizationContext, StreamTransportError } from './chunk-OYD4PTWW.js';
4
+ export { BackendApiError, CONTRACT_SHA256, DEPLOYMENTS, DOMAINS, MatrxApiError, OrganizationContextError, StreamTransportError, applyOrganizationContextHeader, assertOrganizationMatchesOperation, assertQueryOrganizationMatchesContext, createApi, createOrganizationOperation, describeBackendFailure, extractMatrxErrorCode, extractMatrxErrorMessage, getUserMessage, isBinaryType, isGenericUserMessage, isStreamTransportLost, openJsonOrStream, openStream, parseCallApiError, parseHttpError, parseHttpErrorBody, parsePersistedBackendError, parseStreamError, requireOrganizationContext, unwrapUpstreamError } from './chunk-OYD4PTWW.js';
5
5
  import { isNetError, extractErrorMessage } from './chunk-KIEAFMKB.js';
6
6
  export { AbortedError, ConnectTimeoutError, HeartbeatTimeoutError, HttpError, NetError, NetworkError, OfflineError, TotalTimeoutError, extractErrorMessage, isNetError, isTransportFailure, resilientFetch, toNetError, withRetry } from './chunk-KIEAFMKB.js';
7
7
  import { formatDurationSeconds } from '@ai-matrx/kit/format';
@@ -214,7 +214,7 @@ async function sendMatrxRequest(url, init = {}, options = {}) {
214
214
  if (init[key] !== void 0) fetchOptions[key] = init[key];
215
215
  }
216
216
  try {
217
- const { response } = await sendOnWire({
217
+ const { response, controller } = await sendOnWire({
218
218
  url,
219
219
  method: init.method ?? "GET",
220
220
  fetchOptions,
@@ -227,6 +227,10 @@ async function sendMatrxRequest(url, init = {}, options = {}) {
227
227
  totalTimeoutMs: null,
228
228
  ...options.onUploadProgress ? { onUploadProgress: options.onUploadProgress } : {}
229
229
  });
230
+ if (callerSignal) {
231
+ if (callerSignal.aborted) controller.abort(callerSignal.reason);
232
+ else callerSignal.addEventListener("abort", () => controller.abort(callerSignal.reason), { once: true });
233
+ }
230
234
  return response;
231
235
  } catch (error) {
232
236
  if (isNetError(error) && error.code === "aborted") {