@ai-matrx/api 0.1.10 → 0.1.11
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.
- package/CHANGELOG.md +6 -0
- package/dist/agents.cjs +11 -11
- package/dist/agents.js +1 -1
- package/dist/ai.cjs +2 -2
- package/dist/ai.js +1 -1
- package/dist/apps.cjs +5 -5
- package/dist/apps.js +1 -1
- package/dist/architecture.cjs +10 -10
- package/dist/architecture.js +1 -1
- package/dist/audio.cjs +4 -4
- package/dist/audio.js +1 -1
- package/dist/chat.cjs +11 -11
- package/dist/chat.js +1 -1
- package/dist/{chunk-SPASYIUH.cjs → chunk-2ZHIYXHV.cjs} +12 -1
- package/dist/{chunk-FLANGLCG.js → chunk-6KHHHBG5.js} +12 -2
- package/dist/code.cjs +6 -6
- package/dist/code.js +1 -1
- package/dist/communications.cjs +4 -4
- package/dist/communications.js +1 -1
- package/dist/computer.cjs +3 -3
- package/dist/computer.js +1 -1
- package/dist/content.cjs +4 -4
- package/dist/content.js +1 -1
- package/dist/crm.cjs +2 -2
- package/dist/crm.js +1 -1
- package/dist/education.cjs +4 -4
- package/dist/education.js +1 -1
- package/dist/files.cjs +20 -20
- package/dist/files.js +1 -1
- package/dist/index.cjs +72 -67
- package/dist/index.js +7 -2
- package/dist/integrations.cjs +3 -3
- package/dist/integrations.js +1 -1
- package/dist/intelligence.cjs +6 -6
- package/dist/intelligence.js +1 -1
- package/dist/knowledge.cjs +42 -42
- package/dist/knowledge.js +1 -1
- package/dist/legal.cjs +6 -6
- package/dist/legal.js +1 -1
- package/dist/marketing.cjs +76 -76
- package/dist/marketing.js +1 -1
- package/dist/masterwork.cjs +32 -32
- package/dist/masterwork.js +1 -1
- package/dist/media.cjs +11 -11
- package/dist/media.js +1 -1
- package/dist/platform.cjs +3 -3
- package/dist/platform.js +1 -1
- package/dist/publish.cjs +7 -7
- package/dist/publish.js +1 -1
- package/dist/stream.cjs +10 -10
- package/dist/stream.js +1 -1
- package/dist/types.d.cts +22845 -423
- package/dist/types.d.ts +22845 -423
- package/dist/web.cjs +26 -26
- package/dist/web.js +1 -1
- package/dist/workflows.cjs +13 -13
- package/dist/workflows.js +1 -1
- package/package.json +2 -2
package/dist/crm.js
CHANGED
package/dist/education.cjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2ZHIYXHV_cjs = require('./chunk-2ZHIYXHV.cjs');
|
|
4
4
|
require('./chunk-PKYPPATQ.cjs');
|
|
5
5
|
|
|
6
6
|
// src/generated/education.ts
|
|
7
7
|
var $sourceCard = { m: "POST", p: "/education/images/source-card", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "education.source_card" };
|
|
8
8
|
function sourceCard(api, args, options) {
|
|
9
|
-
return
|
|
9
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $sourceCard, args, options);
|
|
10
10
|
}
|
|
11
11
|
var $generateCard = { m: "POST", p: "/education/images/generate-card", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "education.generate_card" };
|
|
12
12
|
function generateCard(api, args, options) {
|
|
13
|
-
return
|
|
13
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $generateCard, args, options);
|
|
14
14
|
}
|
|
15
15
|
var $sourceSet = { m: "POST", p: "/education/images/source-set", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "education.source_set" };
|
|
16
16
|
function sourceSet(api, args, options) {
|
|
17
|
-
return
|
|
17
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $sourceSet, args, options);
|
|
18
18
|
}
|
|
19
19
|
var TABLE = {};
|
|
20
20
|
function call(api, key, args, options) {
|
package/dist/education.js
CHANGED
package/dist/files.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2ZHIYXHV_cjs = require('./chunk-2ZHIYXHV.cjs');
|
|
4
4
|
require('./chunk-PKYPPATQ.cjs');
|
|
5
5
|
|
|
6
6
|
// src/generated/files.ts
|
|
@@ -10,7 +10,7 @@ function compressPdf(api, args, options) {
|
|
|
10
10
|
}
|
|
11
11
|
var $extractTextFromPdf = { m: "POST", p: "/utilities/pdf/extract-text", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.extract_text_from_pdf" };
|
|
12
12
|
function extractTextFromPdf(api, args, options) {
|
|
13
|
-
return
|
|
13
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $extractTextFromPdf, args, options);
|
|
14
14
|
}
|
|
15
15
|
var $extractPages = { m: "POST", p: "/utilities/pdf/extract-pages", d: "aidream", a: "guest", o: "required", n: "files.extract_pages" };
|
|
16
16
|
function extractPages(api, args, options) {
|
|
@@ -34,7 +34,7 @@ function mergePdfs(api, args, options) {
|
|
|
34
34
|
}
|
|
35
35
|
var $splitPdf = { m: "POST", p: "/utilities/pdf/split", d: "aidream", a: "guest", o: "required", s: "bytes_or_json", n: "files.split_pdf" };
|
|
36
36
|
function splitPdf(api, args, options) {
|
|
37
|
-
return
|
|
37
|
+
return chunk2ZHIYXHV_cjs.openJsonOrStream(api, $splitPdf, args, options);
|
|
38
38
|
}
|
|
39
39
|
var $reorderPages = { m: "POST", p: "/utilities/pdf/reorder-pages", d: "aidream", a: "guest", o: "required", n: "files.reorder_pages" };
|
|
40
40
|
function reorderPages(api, args, options) {
|
|
@@ -70,19 +70,19 @@ function studioRender(api, args, options) {
|
|
|
70
70
|
}
|
|
71
71
|
var $detectRepeatedRegionsEndpoint = { m: "POST", p: "/utilities/pdf/detect-repeated-regions", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.detect_repeated_regions_endpoint" };
|
|
72
72
|
function detectRepeatedRegionsEndpoint(api, args, options) {
|
|
73
|
-
return
|
|
73
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $detectRepeatedRegionsEndpoint, args, options);
|
|
74
74
|
}
|
|
75
75
|
var $stripRepeatedRegionsEndpoint = { m: "POST", p: "/utilities/pdf/strip-repeated-regions", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.strip_repeated_regions_endpoint" };
|
|
76
76
|
function stripRepeatedRegionsEndpoint(api, args, options) {
|
|
77
|
-
return
|
|
77
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $stripRepeatedRegionsEndpoint, args, options);
|
|
78
78
|
}
|
|
79
79
|
var $classifyPagesEndpoint = { m: "POST", p: "/utilities/pdf/classify-pages", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.classify_pages_endpoint" };
|
|
80
80
|
function classifyPagesEndpoint(api, args, options) {
|
|
81
|
-
return
|
|
81
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $classifyPagesEndpoint, args, options);
|
|
82
82
|
}
|
|
83
83
|
var $extractReadingOrderEndpoint = { m: "POST", p: "/utilities/pdf/extract-reading-order", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.extract_reading_order_endpoint" };
|
|
84
84
|
function extractReadingOrderEndpoint(api, args, options) {
|
|
85
|
-
return
|
|
85
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $extractReadingOrderEndpoint, args, options);
|
|
86
86
|
}
|
|
87
87
|
var $redactPatternsCatalog = { m: "GET", p: "/utilities/pdf/redact/patterns", d: "aidream", a: "guest", o: "optional", n: "files.redact_patterns_catalog" };
|
|
88
88
|
function redactPatternsCatalog(api, args, options) {
|
|
@@ -114,31 +114,31 @@ function flattenAnnotationsEndpoint(api, args, options) {
|
|
|
114
114
|
}
|
|
115
115
|
var $extractTextRemote = { m: "POST", p: "/utilities/pdf/extract-text-remote", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.extract_text_remote" };
|
|
116
116
|
function extractTextRemote(api, args, options) {
|
|
117
|
-
return
|
|
117
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $extractTextRemote, args, options);
|
|
118
118
|
}
|
|
119
119
|
var $extractTables = { m: "POST", p: "/utilities/pdf/extract-tables", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.extract_tables" };
|
|
120
120
|
function extractTables(api, args, options) {
|
|
121
|
-
return
|
|
121
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $extractTables, args, options);
|
|
122
122
|
}
|
|
123
123
|
var $processWithAi = { m: "POST", p: "/utilities/pdf/process-with-ai", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.process_with_ai" };
|
|
124
124
|
function processWithAi(api, args, options) {
|
|
125
|
-
return
|
|
125
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $processWithAi, args, options);
|
|
126
126
|
}
|
|
127
127
|
var $fullPipeline = { m: "POST", p: "/utilities/pdf/full-pipeline", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.full_pipeline" };
|
|
128
128
|
function fullPipeline(api, args, options) {
|
|
129
|
-
return
|
|
129
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $fullPipeline, args, options);
|
|
130
130
|
}
|
|
131
131
|
var $batchExtract = { m: "POST", p: "/utilities/pdf/batch-extract", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.batch_extract" };
|
|
132
132
|
function batchExtract(api, args, options) {
|
|
133
|
-
return
|
|
133
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $batchExtract, args, options);
|
|
134
134
|
}
|
|
135
135
|
var $pdfFromImages = { m: "POST", p: "/utilities/pdf/from-images", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.pdf_from_images" };
|
|
136
136
|
function pdfFromImages(api, args, options) {
|
|
137
|
-
return
|
|
137
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $pdfFromImages, args, options);
|
|
138
138
|
}
|
|
139
139
|
var $cleanDocumentContent = { m: "POST", p: "/utilities/pdf/clean-content/{doc_id}", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.clean_document_content" };
|
|
140
140
|
function cleanDocumentContent(api, args, options) {
|
|
141
|
-
return
|
|
141
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $cleanDocumentContent, args, options);
|
|
142
142
|
}
|
|
143
143
|
var $listDocuments = { m: "GET", p: "/utilities/pdf/documents", d: "aidream", a: "guest", o: "optional", n: "files.list_documents" };
|
|
144
144
|
function listDocuments(api, args, options) {
|
|
@@ -406,15 +406,15 @@ function getFileLineageSummary(api, args, options) {
|
|
|
406
406
|
}
|
|
407
407
|
var $ingestFileForRag = { m: "POST", p: "/files/{file_id}/ingest", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.ingest_file_for_rag" };
|
|
408
408
|
function ingestFileForRag(api, args, options) {
|
|
409
|
-
return
|
|
409
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $ingestFileForRag, args, options);
|
|
410
410
|
}
|
|
411
411
|
var $ingestFileForRagStream = { m: "POST", p: "/files/{file_id}/ingest/stream", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.ingest_file_for_rag_stream" };
|
|
412
412
|
function ingestFileForRagStream(api, args, options) {
|
|
413
|
-
return
|
|
413
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $ingestFileForRagStream, args, options);
|
|
414
414
|
}
|
|
415
415
|
var $refreshFileRag = { m: "POST", p: "/files/{file_id}/refresh", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.refresh_file_rag" };
|
|
416
416
|
function refreshFileRag(api, args, options) {
|
|
417
|
-
return
|
|
417
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $refreshFileRag, args, options);
|
|
418
418
|
}
|
|
419
419
|
var $versionsListVersions = { m: "GET", p: "/files/{file_id}/versions", d: "aidream", a: "guest", o: "required", n: "files.versions_list_versions" };
|
|
420
420
|
function versionsListVersions(api, args, options) {
|
|
@@ -546,7 +546,7 @@ function fetchAnalysis(api, args, options) {
|
|
|
546
546
|
}
|
|
547
547
|
var $refreshAnalysis = { m: "POST", p: "/files/{file_id}/analysis/refresh", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.refresh_analysis" };
|
|
548
548
|
function refreshAnalysis(api, args, options) {
|
|
549
|
-
return
|
|
549
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $refreshAnalysis, args, options);
|
|
550
550
|
}
|
|
551
551
|
var $redactMask = { m: "POST", p: "/files/{file_id}/redact/mask", d: "aidream", a: "guest", o: "required", n: "files.redact_mask" };
|
|
552
552
|
function redactMask(api, args, options) {
|
|
@@ -654,7 +654,7 @@ function listOverridesEndpoint(api, args, options) {
|
|
|
654
654
|
}
|
|
655
655
|
var $searchEndpoint = { m: "POST", p: "/files/{file_id}/search", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "files.search_endpoint" };
|
|
656
656
|
function searchEndpoint(api, args, options) {
|
|
657
|
-
return
|
|
657
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $searchEndpoint, args, options);
|
|
658
658
|
}
|
|
659
659
|
var $extractRegionEndpoint = { m: "POST", p: "/files/{file_id}/regions/extract", d: "aidream", a: "guest", o: "required", n: "files.extract_region_endpoint" };
|
|
660
660
|
function extractRegionEndpoint(api, args, options) {
|
|
@@ -882,7 +882,7 @@ function searchSemantic(api, args, options) {
|
|
|
882
882
|
}
|
|
883
883
|
var $downloadStream = { m: "GET", p: "/downloads/stream", d: "matrx-local", a: "loopback_token", o: "exempt", s: "sse", n: "files.download_stream" };
|
|
884
884
|
function downloadStream(api, args, options) {
|
|
885
|
-
return
|
|
885
|
+
return chunk2ZHIYXHV_cjs.openStream(api, $downloadStream, args, options);
|
|
886
886
|
}
|
|
887
887
|
var $listDownloads = { m: "GET", p: "/downloads", d: "matrx-local", a: "loopback_token", o: "exempt", n: "files.list_downloads" };
|
|
888
888
|
function listDownloads(api, args, options) {
|
package/dist/files.js
CHANGED
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
|
|
4
|
+
var chunk2ZHIYXHV_cjs = require('./chunk-2ZHIYXHV.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
|
|
46
|
+
throw new chunk2ZHIYXHV_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
|
|
118
|
+
throw new chunk2ZHIYXHV_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
|
|
125
|
+
for await (const envelope of chunk2ZHIYXHV_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
|
|
137
|
+
const transportError = error instanceof chunk2ZHIYXHV_cjs.BackendApiError ? error : new chunk2ZHIYXHV_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:
|
|
154
|
+
message: chunk2ZHIYXHV_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
|
|
162
|
+
const { response } = await chunk2ZHIYXHV_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 chunk2ZHIYXHV_cjs.WIRE_FETCH_OPTION_KEYS) {
|
|
214
|
+
if (init[key] !== void 0) fetchOptions[key] = init[key];
|
|
215
|
+
}
|
|
212
216
|
try {
|
|
213
|
-
const { response } = await
|
|
217
|
+
const { response } = await chunk2ZHIYXHV_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 } : {},
|
|
@@ -228,7 +233,7 @@ async function sendMatrxRequest(url, init = {}, options = {}) {
|
|
|
228
233
|
throw callerSignal?.reason instanceof Error ? callerSignal.reason : new DOMException("The request was cancelled.", "AbortError");
|
|
229
234
|
}
|
|
230
235
|
if (options.timeoutMs !== void 0 && chunkPKYPPATQ_cjs.isNetError(error) && error.code === "connect-timeout") {
|
|
231
|
-
throw new
|
|
236
|
+
throw new chunk2ZHIYXHV_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
|
|
250
|
+
if (!response.ok) throw await chunk2ZHIYXHV_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
|
|
260
|
+
if (err instanceof chunk2ZHIYXHV_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
|
|
272
|
+
if (err instanceof chunk2ZHIYXHV_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
|
|
282
|
+
if (err instanceof chunk2ZHIYXHV_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
|
|
378
|
+
if (aiApiVersion === void 0) return chunk2ZHIYXHV_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
|
|
383
|
+
if (callOrganizationId !== null) return chunk2ZHIYXHV_cjs.requireOrganizationContext(callOrganizationId);
|
|
379
384
|
const candidate = typeof organizationId === "function" ? organizationId() : organizationId;
|
|
380
|
-
return
|
|
385
|
+
return chunk2ZHIYXHV_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 =
|
|
391
|
+
const versionedPath = chunk2ZHIYXHV_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 =
|
|
397
|
+
overHeaders = chunk2ZHIYXHV_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
|
|
410
|
+
({ response } = await chunk2ZHIYXHV_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 =
|
|
435
|
+
const code = chunk2ZHIYXHV_cjs.extractMatrxErrorCode(serverDetail);
|
|
431
436
|
diagnostics?.onError?.(
|
|
432
437
|
{
|
|
433
438
|
type: classifyStatus(response.status),
|
|
434
|
-
message:
|
|
439
|
+
message: chunk2ZHIYXHV_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
|
|
718
|
+
throw new chunk2ZHIYXHV_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:
|
|
739
|
+
events: chunk2ZHIYXHV_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
|
|
762
|
+
throw new chunk2ZHIYXHV_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
|
|
822
|
+
if (error instanceof chunk2ZHIYXHV_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
|
|
837
|
+
if (error instanceof chunk2ZHIYXHV_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 =
|
|
878
|
+
const frames = chunk2ZHIYXHV_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 =
|
|
1081
|
+
const orgId = chunk2ZHIYXHV_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
|
|
1108
|
+
for await (const frame of chunk2ZHIYXHV_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
|
|
1154
|
+
if (error instanceof chunk2ZHIYXHV_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
|
|
1570
|
+
if (error instanceof chunk2ZHIYXHV_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,147 @@ Object.defineProperty(exports, "toCredentialsPort", {
|
|
|
2262
2267
|
});
|
|
2263
2268
|
Object.defineProperty(exports, "BackendApiError", {
|
|
2264
2269
|
enumerable: true,
|
|
2265
|
-
get: function () { return
|
|
2270
|
+
get: function () { return chunk2ZHIYXHV_cjs.BackendApiError; }
|
|
2266
2271
|
});
|
|
2267
2272
|
Object.defineProperty(exports, "CONTRACT_SHA256", {
|
|
2268
2273
|
enumerable: true,
|
|
2269
|
-
get: function () { return
|
|
2274
|
+
get: function () { return chunk2ZHIYXHV_cjs.CONTRACT_SHA256; }
|
|
2270
2275
|
});
|
|
2271
2276
|
Object.defineProperty(exports, "DEPLOYMENTS", {
|
|
2272
2277
|
enumerable: true,
|
|
2273
|
-
get: function () { return
|
|
2278
|
+
get: function () { return chunk2ZHIYXHV_cjs.DEPLOYMENTS; }
|
|
2274
2279
|
});
|
|
2275
2280
|
Object.defineProperty(exports, "DOMAINS", {
|
|
2276
2281
|
enumerable: true,
|
|
2277
|
-
get: function () { return
|
|
2282
|
+
get: function () { return chunk2ZHIYXHV_cjs.DOMAINS; }
|
|
2278
2283
|
});
|
|
2279
2284
|
Object.defineProperty(exports, "MATRX_AI_API_VERSION_DEFAULT", {
|
|
2280
2285
|
enumerable: true,
|
|
2281
|
-
get: function () { return
|
|
2286
|
+
get: function () { return chunk2ZHIYXHV_cjs.MATRX_AI_API_VERSION_DEFAULT; }
|
|
2282
2287
|
});
|
|
2283
2288
|
Object.defineProperty(exports, "MatrxApiError", {
|
|
2284
2289
|
enumerable: true,
|
|
2285
|
-
get: function () { return
|
|
2290
|
+
get: function () { return chunk2ZHIYXHV_cjs.MatrxApiError; }
|
|
2286
2291
|
});
|
|
2287
2292
|
Object.defineProperty(exports, "OrganizationContextError", {
|
|
2288
2293
|
enumerable: true,
|
|
2289
|
-
get: function () { return
|
|
2294
|
+
get: function () { return chunk2ZHIYXHV_cjs.OrganizationContextError; }
|
|
2290
2295
|
});
|
|
2291
2296
|
Object.defineProperty(exports, "StreamTransportError", {
|
|
2292
2297
|
enumerable: true,
|
|
2293
|
-
get: function () { return
|
|
2298
|
+
get: function () { return chunk2ZHIYXHV_cjs.StreamTransportError; }
|
|
2294
2299
|
});
|
|
2295
2300
|
Object.defineProperty(exports, "V2_COVERED_AI_PATH_TEMPLATES", {
|
|
2296
2301
|
enumerable: true,
|
|
2297
|
-
get: function () { return
|
|
2302
|
+
get: function () { return chunk2ZHIYXHV_cjs.V2_COVERED_AI_PATH_TEMPLATES; }
|
|
2298
2303
|
});
|
|
2299
2304
|
Object.defineProperty(exports, "aiVersionPathOverrides", {
|
|
2300
2305
|
enumerable: true,
|
|
2301
|
-
get: function () { return
|
|
2306
|
+
get: function () { return chunk2ZHIYXHV_cjs.aiVersionPathOverrides; }
|
|
2302
2307
|
});
|
|
2303
2308
|
Object.defineProperty(exports, "applyAiApiVersion", {
|
|
2304
2309
|
enumerable: true,
|
|
2305
|
-
get: function () { return
|
|
2310
|
+
get: function () { return chunk2ZHIYXHV_cjs.applyAiApiVersion; }
|
|
2306
2311
|
});
|
|
2307
2312
|
Object.defineProperty(exports, "applyOrganizationContextHeader", {
|
|
2308
2313
|
enumerable: true,
|
|
2309
|
-
get: function () { return
|
|
2314
|
+
get: function () { return chunk2ZHIYXHV_cjs.applyOrganizationContextHeader; }
|
|
2310
2315
|
});
|
|
2311
2316
|
Object.defineProperty(exports, "assertOrganizationMatchesOperation", {
|
|
2312
2317
|
enumerable: true,
|
|
2313
|
-
get: function () { return
|
|
2318
|
+
get: function () { return chunk2ZHIYXHV_cjs.assertOrganizationMatchesOperation; }
|
|
2314
2319
|
});
|
|
2315
2320
|
Object.defineProperty(exports, "assertQueryOrganizationMatchesContext", {
|
|
2316
2321
|
enumerable: true,
|
|
2317
|
-
get: function () { return
|
|
2322
|
+
get: function () { return chunk2ZHIYXHV_cjs.assertQueryOrganizationMatchesContext; }
|
|
2318
2323
|
});
|
|
2319
2324
|
Object.defineProperty(exports, "createApi", {
|
|
2320
2325
|
enumerable: true,
|
|
2321
|
-
get: function () { return
|
|
2326
|
+
get: function () { return chunk2ZHIYXHV_cjs.createApi; }
|
|
2322
2327
|
});
|
|
2323
2328
|
Object.defineProperty(exports, "createOrganizationOperation", {
|
|
2324
2329
|
enumerable: true,
|
|
2325
|
-
get: function () { return
|
|
2330
|
+
get: function () { return chunk2ZHIYXHV_cjs.createOrganizationOperation; }
|
|
2326
2331
|
});
|
|
2327
2332
|
Object.defineProperty(exports, "describeBackendFailure", {
|
|
2328
2333
|
enumerable: true,
|
|
2329
|
-
get: function () { return
|
|
2334
|
+
get: function () { return chunk2ZHIYXHV_cjs.describeBackendFailure; }
|
|
2330
2335
|
});
|
|
2331
2336
|
Object.defineProperty(exports, "extractMatrxErrorCode", {
|
|
2332
2337
|
enumerable: true,
|
|
2333
|
-
get: function () { return
|
|
2338
|
+
get: function () { return chunk2ZHIYXHV_cjs.extractMatrxErrorCode; }
|
|
2334
2339
|
});
|
|
2335
2340
|
Object.defineProperty(exports, "extractMatrxErrorMessage", {
|
|
2336
2341
|
enumerable: true,
|
|
2337
|
-
get: function () { return
|
|
2342
|
+
get: function () { return chunk2ZHIYXHV_cjs.extractMatrxErrorMessage; }
|
|
2338
2343
|
});
|
|
2339
2344
|
Object.defineProperty(exports, "fetchWithMatrxProtocolFallback", {
|
|
2340
2345
|
enumerable: true,
|
|
2341
|
-
get: function () { return
|
|
2346
|
+
get: function () { return chunk2ZHIYXHV_cjs.fetchWithMatrxProtocolFallback; }
|
|
2342
2347
|
});
|
|
2343
2348
|
Object.defineProperty(exports, "getUserMessage", {
|
|
2344
2349
|
enumerable: true,
|
|
2345
|
-
get: function () { return
|
|
2350
|
+
get: function () { return chunk2ZHIYXHV_cjs.getUserMessage; }
|
|
2346
2351
|
});
|
|
2347
2352
|
Object.defineProperty(exports, "isCoveredAiPath", {
|
|
2348
2353
|
enumerable: true,
|
|
2349
|
-
get: function () { return
|
|
2354
|
+
get: function () { return chunk2ZHIYXHV_cjs.isCoveredAiPath; }
|
|
2350
2355
|
});
|
|
2351
2356
|
Object.defineProperty(exports, "isGenericUserMessage", {
|
|
2352
2357
|
enumerable: true,
|
|
2353
|
-
get: function () { return
|
|
2358
|
+
get: function () { return chunk2ZHIYXHV_cjs.isGenericUserMessage; }
|
|
2354
2359
|
});
|
|
2355
2360
|
Object.defineProperty(exports, "isStreamTransportLost", {
|
|
2356
2361
|
enumerable: true,
|
|
2357
|
-
get: function () { return
|
|
2362
|
+
get: function () { return chunk2ZHIYXHV_cjs.isStreamTransportLost; }
|
|
2358
2363
|
});
|
|
2359
2364
|
Object.defineProperty(exports, "isV2Path", {
|
|
2360
2365
|
enumerable: true,
|
|
2361
|
-
get: function () { return
|
|
2366
|
+
get: function () { return chunk2ZHIYXHV_cjs.isV2Path; }
|
|
2362
2367
|
});
|
|
2363
2368
|
Object.defineProperty(exports, "openJsonOrStream", {
|
|
2364
2369
|
enumerable: true,
|
|
2365
|
-
get: function () { return
|
|
2370
|
+
get: function () { return chunk2ZHIYXHV_cjs.openJsonOrStream; }
|
|
2366
2371
|
});
|
|
2367
2372
|
Object.defineProperty(exports, "openStream", {
|
|
2368
2373
|
enumerable: true,
|
|
2369
|
-
get: function () { return
|
|
2374
|
+
get: function () { return chunk2ZHIYXHV_cjs.openStream; }
|
|
2370
2375
|
});
|
|
2371
2376
|
Object.defineProperty(exports, "parseCallApiError", {
|
|
2372
2377
|
enumerable: true,
|
|
2373
|
-
get: function () { return
|
|
2378
|
+
get: function () { return chunk2ZHIYXHV_cjs.parseCallApiError; }
|
|
2374
2379
|
});
|
|
2375
2380
|
Object.defineProperty(exports, "parseHttpError", {
|
|
2376
2381
|
enumerable: true,
|
|
2377
|
-
get: function () { return
|
|
2382
|
+
get: function () { return chunk2ZHIYXHV_cjs.parseHttpError; }
|
|
2378
2383
|
});
|
|
2379
2384
|
Object.defineProperty(exports, "parseHttpErrorBody", {
|
|
2380
2385
|
enumerable: true,
|
|
2381
|
-
get: function () { return
|
|
2386
|
+
get: function () { return chunk2ZHIYXHV_cjs.parseHttpErrorBody; }
|
|
2382
2387
|
});
|
|
2383
2388
|
Object.defineProperty(exports, "parsePersistedBackendError", {
|
|
2384
2389
|
enumerable: true,
|
|
2385
|
-
get: function () { return
|
|
2390
|
+
get: function () { return chunk2ZHIYXHV_cjs.parsePersistedBackendError; }
|
|
2386
2391
|
});
|
|
2387
2392
|
Object.defineProperty(exports, "parseStreamError", {
|
|
2388
2393
|
enumerable: true,
|
|
2389
|
-
get: function () { return
|
|
2394
|
+
get: function () { return chunk2ZHIYXHV_cjs.parseStreamError; }
|
|
2390
2395
|
});
|
|
2391
2396
|
Object.defineProperty(exports, "requireOrganizationContext", {
|
|
2392
2397
|
enumerable: true,
|
|
2393
|
-
get: function () { return
|
|
2398
|
+
get: function () { return chunk2ZHIYXHV_cjs.requireOrganizationContext; }
|
|
2394
2399
|
});
|
|
2395
2400
|
Object.defineProperty(exports, "toV1FallbackUrl", {
|
|
2396
2401
|
enumerable: true,
|
|
2397
|
-
get: function () { return
|
|
2402
|
+
get: function () { return chunk2ZHIYXHV_cjs.toV1FallbackUrl; }
|
|
2398
2403
|
});
|
|
2399
2404
|
Object.defineProperty(exports, "toV2Path", {
|
|
2400
2405
|
enumerable: true,
|
|
2401
|
-
get: function () { return
|
|
2406
|
+
get: function () { return chunk2ZHIYXHV_cjs.toV2Path; }
|
|
2402
2407
|
});
|
|
2403
2408
|
Object.defineProperty(exports, "unwrapUpstreamError", {
|
|
2404
2409
|
enumerable: true,
|
|
2405
|
-
get: function () { return
|
|
2410
|
+
get: function () { return chunk2ZHIYXHV_cjs.unwrapUpstreamError; }
|
|
2406
2411
|
});
|
|
2407
2412
|
Object.defineProperty(exports, "AbortedError", {
|
|
2408
2413
|
enumerable: true,
|