@ai-matrx/api 0.1.9 → 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 +11 -0
- package/README.md +1 -1
- package/dist/account.d.cts +1 -1
- package/dist/account.d.ts +1 -1
- package/dist/agents.cjs +12 -12
- package/dist/agents.d.cts +1 -1
- package/dist/agents.d.ts +1 -1
- package/dist/agents.js +2 -2
- package/dist/ai.cjs +3 -3
- package/dist/ai.d.cts +1 -1
- package/dist/ai.d.ts +1 -1
- package/dist/ai.js +2 -2
- package/dist/apps.cjs +6 -6
- package/dist/apps.d.cts +1 -1
- package/dist/apps.d.ts +1 -1
- package/dist/apps.js +2 -2
- package/dist/architecture.cjs +11 -11
- package/dist/architecture.d.cts +1 -1
- package/dist/architecture.d.ts +1 -1
- package/dist/architecture.js +2 -2
- package/dist/audio.cjs +5 -5
- package/dist/audio.d.cts +1 -1
- package/dist/audio.d.ts +1 -1
- package/dist/audio.js +2 -2
- package/dist/chat.cjs +12 -12
- package/dist/chat.d.cts +1 -1
- package/dist/chat.d.ts +1 -1
- package/dist/chat.js +2 -2
- package/dist/{chunk-PMGKZ4FT.cjs → chunk-2ZHIYXHV.cjs} +279 -34
- package/dist/{chunk-PIVTHTVR.js → chunk-6KHHHBG5.js} +270 -36
- package/dist/{chunk-KIEAFMKB.js → chunk-PIPE5OML.js} +100 -46
- package/dist/{chunk-2SXAAKGV.cjs → chunk-PKYPPATQ.cjs} +100 -45
- package/dist/code.cjs +7 -7
- package/dist/code.d.cts +1 -1
- package/dist/code.d.ts +1 -1
- package/dist/code.js +2 -2
- package/dist/commerce.d.cts +1 -1
- package/dist/commerce.d.ts +1 -1
- package/dist/communications.cjs +5 -5
- package/dist/communications.d.cts +1 -1
- package/dist/communications.d.ts +1 -1
- package/dist/communications.js +2 -2
- package/dist/computer.cjs +4 -4
- package/dist/computer.d.cts +1 -1
- package/dist/computer.d.ts +1 -1
- package/dist/computer.js +2 -2
- package/dist/content.cjs +5 -5
- package/dist/content.d.cts +1 -1
- package/dist/content.d.ts +1 -1
- package/dist/content.js +2 -2
- package/dist/crm.cjs +3 -3
- package/dist/crm.d.cts +1 -1
- package/dist/crm.d.ts +1 -1
- package/dist/crm.js +2 -2
- package/dist/data.d.cts +1 -1
- package/dist/data.d.ts +1 -1
- package/dist/education.cjs +5 -5
- package/dist/education.d.cts +1 -1
- package/dist/education.d.ts +1 -1
- package/dist/education.js +2 -2
- package/dist/files.cjs +21 -21
- package/dist/files.d.cts +1 -1
- package/dist/files.d.ts +1 -1
- package/dist/files.js +2 -2
- package/dist/human-resources.d.cts +1 -1
- package/dist/human-resources.d.ts +1 -1
- package/dist/{index-C3ZlP3BI.d.cts → index-Gj30ybjE.d.cts} +42 -3
- package/dist/{index-C3ZlP3BI.d.ts → index-Gj30ybjE.d.ts} +42 -3
- package/dist/index.cjs +188 -288
- package/dist/index.d.cts +129 -180
- package/dist/index.d.ts +129 -180
- package/dist/index.js +81 -206
- package/dist/integrations.cjs +4 -4
- package/dist/integrations.d.cts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.js +2 -2
- package/dist/intelligence.cjs +10 -8
- package/dist/intelligence.d.cts +13 -13
- package/dist/intelligence.d.ts +13 -13
- package/dist/intelligence.js +5 -3
- package/dist/{keys.generated-CK_C5UXG.d.cts → keys.generated-DZUiM-uA.d.cts} +5 -3
- package/dist/{keys.generated-CK_C5UXG.d.ts → keys.generated-DZUiM-uA.d.ts} +5 -3
- package/dist/knowledge.cjs +43 -43
- package/dist/knowledge.d.cts +13 -13
- package/dist/knowledge.d.ts +13 -13
- package/dist/knowledge.js +2 -2
- package/dist/legal.cjs +7 -7
- package/dist/legal.d.cts +1 -1
- package/dist/legal.d.ts +1 -1
- package/dist/legal.js +2 -2
- package/dist/marketing.cjs +77 -77
- package/dist/marketing.d.cts +27 -27
- package/dist/marketing.d.ts +27 -27
- package/dist/marketing.js +2 -2
- package/dist/masterwork.cjs +33 -33
- package/dist/masterwork.d.cts +1 -1
- package/dist/masterwork.d.ts +1 -1
- package/dist/masterwork.js +2 -2
- package/dist/media.cjs +12 -12
- package/dist/media.d.cts +1 -1
- package/dist/media.d.ts +1 -1
- package/dist/media.js +2 -2
- package/dist/net.cjs +19 -20
- package/dist/net.d.cts +41 -41
- package/dist/net.d.ts +41 -41
- package/dist/net.js +1 -2
- package/dist/platform.cjs +4 -4
- package/dist/platform.d.cts +1 -1
- package/dist/platform.d.ts +1 -1
- package/dist/platform.js +2 -2
- package/dist/publish.cjs +8 -8
- package/dist/publish.d.cts +1 -1
- package/dist/publish.d.ts +1 -1
- package/dist/publish.js +2 -2
- package/dist/schemas.d.cts +78 -15
- package/dist/schemas.d.ts +78 -15
- package/dist/stream.cjs +11 -11
- package/dist/stream.d.cts +1 -1
- package/dist/stream.d.ts +1 -1
- package/dist/stream.js +2 -2
- package/dist/types.cjs +2 -0
- package/dist/types.d.cts +72245 -0
- package/dist/types.d.ts +72245 -0
- package/dist/types.js +1 -0
- package/dist/web.cjs +27 -27
- package/dist/web.d.cts +17 -17
- package/dist/web.d.ts +17 -17
- package/dist/web.js +2 -2
- package/dist/workflows.cjs +14 -14
- package/dist/workflows.d.cts +23 -26
- package/dist/workflows.d.ts +23 -26
- package/dist/workflows.js +2 -2
- package/package.json +14 -4
- package/dist/chunk-FNIYADWI.cjs +0 -59
- package/dist/chunk-YTEOFGFC.js +0 -57
package/dist/files.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunk2ZHIYXHV_cjs = require('./chunk-2ZHIYXHV.cjs');
|
|
4
|
+
require('./chunk-PKYPPATQ.cjs');
|
|
5
5
|
|
|
6
6
|
// src/generated/files.ts
|
|
7
7
|
var $compressPdf = { m: "POST", p: "/utilities/pdf/compress", d: "aidream", a: "guest", o: "required", n: "files.compress_pdf" };
|
|
@@ -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.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Api, C as CallOptions, a as ApiStream, N as NdjsonEvent, S as SseEvent, J as JsonOrStream } from './index-
|
|
1
|
+
import { A as Api, C as CallOptions, a as ApiStream, N as NdjsonEvent, S as SseEvent, J as JsonOrStream } from './index-Gj30ybjE.cjs';
|
|
2
2
|
import { JsonValue, Asset, MediaRef, UserAnalysisPreferencesResponse, StorageImportResult } from './schemas.cjs';
|
|
3
3
|
import '@ai-matrx/auth/credentials';
|
|
4
4
|
|
package/dist/files.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Api, C as CallOptions, a as ApiStream, N as NdjsonEvent, S as SseEvent, J as JsonOrStream } from './index-
|
|
1
|
+
import { A as Api, C as CallOptions, a as ApiStream, N as NdjsonEvent, S as SseEvent, J as JsonOrStream } from './index-Gj30ybjE.js';
|
|
2
2
|
import { JsonValue, Asset, MediaRef, UserAnalysisPreferencesResponse, StorageImportResult } from './schemas.js';
|
|
3
3
|
import '@ai-matrx/auth/credentials';
|
|
4
4
|
|
package/dist/files.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { openStream, openJsonOrStream } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { openStream, openJsonOrStream } from './chunk-6KHHHBG5.js';
|
|
2
|
+
import './chunk-PIPE5OML.js';
|
|
3
3
|
|
|
4
4
|
// src/generated/files.ts
|
|
5
5
|
var $compressPdf = { m: "POST", p: "/utilities/pdf/compress", d: "aidream", a: "guest", o: "required", n: "files.compress_pdf" };
|
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
import { CredentialsSetting } from '@ai-matrx/auth/credentials';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* THE ONE WIRE — every request `@ai-matrx/api` sends leaves through
|
|
5
|
+
* {@link sendOnWire}. `createApi` (generated operations), `createMatrxTransport`
|
|
6
|
+
* (the run/stream port), `executeMatrxCall` and `sendMatrxRequest` are thin
|
|
7
|
+
* shapes over it; none of them call `fetch` on their own.
|
|
8
|
+
*
|
|
9
|
+
* What the wire owns, once:
|
|
10
|
+
*
|
|
11
|
+
* - every HTTP method and every body (`BodyInit` as-is, anything else JSON);
|
|
12
|
+
* - the session-ready wait: a credentials port that exposes `ready()` is
|
|
13
|
+
* awaited (bounded by `readyTimeoutMs`) before the credential is read, so a
|
|
14
|
+
* call issued while sign-in is still settling never leaves anonymously;
|
|
15
|
+
* - credentials read fresh per call and mapped by the ONE `credentialToHeaders`;
|
|
16
|
+
* - connect/total timeouts, the v2 → v1 protocol fallback, retry of
|
|
17
|
+
* idempotent non-stream reads on transport failures;
|
|
18
|
+
* - 401 → `refreshCredentials()` → exactly one retry with the fresh credential
|
|
19
|
+
* (the refused body is cancelled first; a second 401 is surfaced);
|
|
20
|
+
* - upload progress: `onUploadProgress` sends through `XMLHttpRequest` where
|
|
21
|
+
* it exists (browsers) and reports monotonic `loaded/total`; elsewhere the
|
|
22
|
+
* request goes through `fetch` and reports one final 100%.
|
|
23
|
+
*
|
|
24
|
+
* The wire never throws on an HTTP status — callers decide what a non-2xx
|
|
25
|
+
* means (typed error, expected domain outcome, stream error callback).
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/** Bytes sent so far on an upload. `total` is 0 when the size is unknown. */
|
|
29
|
+
interface UploadProgress {
|
|
30
|
+
loaded: number;
|
|
31
|
+
total: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
3
34
|
/**
|
|
4
35
|
* Canonical AI Matrx NDJSON wire kernel.
|
|
5
36
|
*
|
|
@@ -269,8 +300,8 @@ declare const DOMAINS: readonly ["account", "agents", "ai", "apps", "architectur
|
|
|
269
300
|
* `required` fails closed before the wire, `optional` sends one when bound,
|
|
270
301
|
* `exempt` never sends one;
|
|
271
302
|
* - `X-Request-Id` on every call;
|
|
272
|
-
* -
|
|
273
|
-
* reads
|
|
303
|
+
* - the ONE wire (`core/wire.ts`): session-ready wait, timeouts, retry of
|
|
304
|
+
* idempotent reads, 401 refresh-and-retry once, upload progress;
|
|
274
305
|
* - one error model (`MatrxApiError`, `NetError`, `OrganizationContextError`);
|
|
275
306
|
* - stream parsing (NDJSON, SSE, bytes, and the conditional `*_or_json`).
|
|
276
307
|
*
|
|
@@ -338,6 +369,12 @@ interface CreateApiOptions {
|
|
|
338
369
|
* retried. Omit to surface every 401 as-is.
|
|
339
370
|
*/
|
|
340
371
|
refreshCredentials?: () => Promise<boolean>;
|
|
372
|
+
/**
|
|
373
|
+
* Upper bound (ms) on the session-ready wait: when the credentials port
|
|
374
|
+
* exposes `ready()`, every call waits for it first so nothing leaves
|
|
375
|
+
* before sign-in settles. Default 3 000; then the call goes anyway.
|
|
376
|
+
*/
|
|
377
|
+
readyTimeoutMs?: number;
|
|
341
378
|
/** Extra headers on every call (never overrides credentials or org). */
|
|
342
379
|
headers?: Record<string, string>;
|
|
343
380
|
/** Observability sink; the client works fully without it. */
|
|
@@ -351,6 +388,8 @@ interface CallOptions {
|
|
|
351
388
|
headers?: Record<string, string>;
|
|
352
389
|
connectTimeoutMs?: number;
|
|
353
390
|
totalTimeoutMs?: number | null;
|
|
391
|
+
/** Upload progress (bytes sent). Browsers report as the body streams out; elsewhere one final 100%. */
|
|
392
|
+
onUploadProgress?: (progress: UploadProgress) => void;
|
|
354
393
|
}
|
|
355
394
|
/** The arguments a generated operation accepts (each operation narrows them). */
|
|
356
395
|
interface OperationArgs {
|
|
@@ -394,4 +433,4 @@ declare function openStream<E>(api: Api, op: OperationDescriptor, args?: Operati
|
|
|
394
433
|
/** Send a conditional (`*_or_json`) operation: JSON when the server answered JSON, else the stream. */
|
|
395
434
|
declare function openJsonOrStream<J, E>(api: Api, op: OperationDescriptor, args?: OperationArgs, options?: CallOptions): Promise<JsonOrStream<J, E>>;
|
|
396
435
|
|
|
397
|
-
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 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 };
|
|
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 };
|
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
import { CredentialsSetting } from '@ai-matrx/auth/credentials';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* THE ONE WIRE — every request `@ai-matrx/api` sends leaves through
|
|
5
|
+
* {@link sendOnWire}. `createApi` (generated operations), `createMatrxTransport`
|
|
6
|
+
* (the run/stream port), `executeMatrxCall` and `sendMatrxRequest` are thin
|
|
7
|
+
* shapes over it; none of them call `fetch` on their own.
|
|
8
|
+
*
|
|
9
|
+
* What the wire owns, once:
|
|
10
|
+
*
|
|
11
|
+
* - every HTTP method and every body (`BodyInit` as-is, anything else JSON);
|
|
12
|
+
* - the session-ready wait: a credentials port that exposes `ready()` is
|
|
13
|
+
* awaited (bounded by `readyTimeoutMs`) before the credential is read, so a
|
|
14
|
+
* call issued while sign-in is still settling never leaves anonymously;
|
|
15
|
+
* - credentials read fresh per call and mapped by the ONE `credentialToHeaders`;
|
|
16
|
+
* - connect/total timeouts, the v2 → v1 protocol fallback, retry of
|
|
17
|
+
* idempotent non-stream reads on transport failures;
|
|
18
|
+
* - 401 → `refreshCredentials()` → exactly one retry with the fresh credential
|
|
19
|
+
* (the refused body is cancelled first; a second 401 is surfaced);
|
|
20
|
+
* - upload progress: `onUploadProgress` sends through `XMLHttpRequest` where
|
|
21
|
+
* it exists (browsers) and reports monotonic `loaded/total`; elsewhere the
|
|
22
|
+
* request goes through `fetch` and reports one final 100%.
|
|
23
|
+
*
|
|
24
|
+
* The wire never throws on an HTTP status — callers decide what a non-2xx
|
|
25
|
+
* means (typed error, expected domain outcome, stream error callback).
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/** Bytes sent so far on an upload. `total` is 0 when the size is unknown. */
|
|
29
|
+
interface UploadProgress {
|
|
30
|
+
loaded: number;
|
|
31
|
+
total: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
3
34
|
/**
|
|
4
35
|
* Canonical AI Matrx NDJSON wire kernel.
|
|
5
36
|
*
|
|
@@ -269,8 +300,8 @@ declare const DOMAINS: readonly ["account", "agents", "ai", "apps", "architectur
|
|
|
269
300
|
* `required` fails closed before the wire, `optional` sends one when bound,
|
|
270
301
|
* `exempt` never sends one;
|
|
271
302
|
* - `X-Request-Id` on every call;
|
|
272
|
-
* -
|
|
273
|
-
* reads
|
|
303
|
+
* - the ONE wire (`core/wire.ts`): session-ready wait, timeouts, retry of
|
|
304
|
+
* idempotent reads, 401 refresh-and-retry once, upload progress;
|
|
274
305
|
* - one error model (`MatrxApiError`, `NetError`, `OrganizationContextError`);
|
|
275
306
|
* - stream parsing (NDJSON, SSE, bytes, and the conditional `*_or_json`).
|
|
276
307
|
*
|
|
@@ -338,6 +369,12 @@ interface CreateApiOptions {
|
|
|
338
369
|
* retried. Omit to surface every 401 as-is.
|
|
339
370
|
*/
|
|
340
371
|
refreshCredentials?: () => Promise<boolean>;
|
|
372
|
+
/**
|
|
373
|
+
* Upper bound (ms) on the session-ready wait: when the credentials port
|
|
374
|
+
* exposes `ready()`, every call waits for it first so nothing leaves
|
|
375
|
+
* before sign-in settles. Default 3 000; then the call goes anyway.
|
|
376
|
+
*/
|
|
377
|
+
readyTimeoutMs?: number;
|
|
341
378
|
/** Extra headers on every call (never overrides credentials or org). */
|
|
342
379
|
headers?: Record<string, string>;
|
|
343
380
|
/** Observability sink; the client works fully without it. */
|
|
@@ -351,6 +388,8 @@ interface CallOptions {
|
|
|
351
388
|
headers?: Record<string, string>;
|
|
352
389
|
connectTimeoutMs?: number;
|
|
353
390
|
totalTimeoutMs?: number | null;
|
|
391
|
+
/** Upload progress (bytes sent). Browsers report as the body streams out; elsewhere one final 100%. */
|
|
392
|
+
onUploadProgress?: (progress: UploadProgress) => void;
|
|
354
393
|
}
|
|
355
394
|
/** The arguments a generated operation accepts (each operation narrows them). */
|
|
356
395
|
interface OperationArgs {
|
|
@@ -394,4 +433,4 @@ declare function openStream<E>(api: Api, op: OperationDescriptor, args?: Operati
|
|
|
394
433
|
/** Send a conditional (`*_or_json`) operation: JSON when the server answered JSON, else the stream. */
|
|
395
434
|
declare function openJsonOrStream<J, E>(api: Api, op: OperationDescriptor, args?: OperationArgs, options?: CallOptions): Promise<JsonOrStream<J, E>>;
|
|
396
435
|
|
|
397
|
-
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 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 };
|
|
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 };
|