@ai-matrx/api 0.1.9 → 0.1.10
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 +5 -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-PIVTHTVR.js → chunk-FLANGLCG.js} +260 -36
- package/dist/{chunk-KIEAFMKB.js → chunk-PIPE5OML.js} +100 -46
- package/dist/{chunk-2SXAAKGV.cjs → chunk-PKYPPATQ.cjs} +100 -45
- package/dist/{chunk-PMGKZ4FT.cjs → chunk-SPASYIUH.cjs} +268 -34
- 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 +183 -288
- package/dist/index.d.cts +129 -180
- package/dist/index.d.ts +129 -180
- package/dist/index.js +76 -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 +49823 -0
- package/dist/types.d.ts +49823 -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/index.cjs
CHANGED
|
@@ -1,95 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunkFNIYADWI_cjs = require('./chunk-FNIYADWI.cjs');
|
|
4
3
|
var chunkMVXD6WI6_cjs = require('./chunk-MVXD6WI6.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var credentials = require('@ai-matrx/auth/credentials');
|
|
4
|
+
var chunkSPASYIUH_cjs = require('./chunk-SPASYIUH.cjs');
|
|
5
|
+
var chunkPKYPPATQ_cjs = require('./chunk-PKYPPATQ.cjs');
|
|
8
6
|
var format = require('@ai-matrx/kit/format');
|
|
9
7
|
|
|
10
|
-
// src/core/protocol.ts
|
|
11
|
-
var MATRX_AI_API_VERSION_DEFAULT = "v2";
|
|
12
|
-
var V2_COVERED_AI_PATH_TEMPLATES = [
|
|
13
|
-
"/ai/manual",
|
|
14
|
-
"/ai/chat",
|
|
15
|
-
"/ai/agents/{agent_id}",
|
|
16
|
-
"/ai/agent/{agent_id}",
|
|
17
|
-
// singular alias — behaves identically
|
|
18
|
-
"/ai/conversations/{conversation_id}",
|
|
19
|
-
"/ai/conversation/{conversation_id}",
|
|
20
|
-
// singular alias
|
|
21
|
-
"/ai/prompts/{prompt_id}",
|
|
22
|
-
// saved-prompt execution
|
|
23
|
-
"/ai/mandates/{mandate_key}"
|
|
24
|
-
// THE MANDATE DOOR — `/v2` sibling exists (routers/v2.py)
|
|
25
|
-
];
|
|
26
|
-
function toV2Path(path) {
|
|
27
|
-
const withLead = path.startsWith("/") ? path : `/${path}`;
|
|
28
|
-
if (withLead.startsWith("/api/")) {
|
|
29
|
-
const rest = withLead.slice("/api".length);
|
|
30
|
-
return rest.startsWith("/v2/") ? withLead : `/api/v2${rest}`;
|
|
31
|
-
}
|
|
32
|
-
return withLead.startsWith("/v2/") ? withLead : `/v2${withLead}`;
|
|
33
|
-
}
|
|
34
|
-
var COVERED_INTERPOLATED_PATH = [
|
|
35
|
-
/^(?:\/api)?\/ai\/manual$/,
|
|
36
|
-
/^(?:\/api)?\/ai\/chat$/,
|
|
37
|
-
/^(?:\/api)?\/ai\/agents\/[^/]+$/,
|
|
38
|
-
/^(?:\/api)?\/ai\/agent\/[^/]+$/,
|
|
39
|
-
/^(?:\/api)?\/ai\/conversations\/[^/]+$/,
|
|
40
|
-
/^(?:\/api)?\/ai\/conversation\/[^/]+$/,
|
|
41
|
-
/^(?:\/api)?\/ai\/prompts\/[^/]+$/,
|
|
42
|
-
// `/warm` etc. deliberately don't match
|
|
43
|
-
/^(?:\/api)?\/ai\/mandates\/[^/]+$/
|
|
44
|
-
// the mandate door
|
|
45
|
-
];
|
|
46
|
-
function isCoveredAiPath(path) {
|
|
47
|
-
return COVERED_INTERPOLATED_PATH.some((re) => re.test(path));
|
|
48
|
-
}
|
|
49
|
-
function isV2Path(pathOrUrl) {
|
|
50
|
-
return /\/v2\/ai\//.test(pathOrUrl);
|
|
51
|
-
}
|
|
52
|
-
function toV1FallbackUrl(url) {
|
|
53
|
-
return url.replace(/\/v2\/ai\//, "/ai/");
|
|
54
|
-
}
|
|
55
|
-
function applyAiApiVersion(path, version) {
|
|
56
|
-
if (version !== "v2") return path;
|
|
57
|
-
return isCoveredAiPath(path) ? toV2Path(path) : path;
|
|
58
|
-
}
|
|
59
|
-
async function fetchWithMatrxProtocolFallback(url, init, opts = {}) {
|
|
60
|
-
const { onDowngrade, ...fetchOpts } = opts;
|
|
61
|
-
const logDowngrade = (reason, status2) => {
|
|
62
|
-
console.warn(
|
|
63
|
-
`[matrx] ai_v2_downgrade \u2192 retrying on v1. v2=${url} reason=${reason}`
|
|
64
|
-
);
|
|
65
|
-
onDowngrade?.({ url, reason, ...status2 !== void 0 ? { status: status2 } : {} });
|
|
66
|
-
};
|
|
67
|
-
if (!isV2Path(url)) return chunk2SXAAKGV_cjs.resilientFetch(url, init, fetchOpts);
|
|
68
|
-
let result;
|
|
69
|
-
try {
|
|
70
|
-
result = await chunk2SXAAKGV_cjs.resilientFetch(url, init, fetchOpts);
|
|
71
|
-
} catch (err) {
|
|
72
|
-
const isAbort2 = chunk2SXAAKGV_cjs.isNetError(err) && err.code === "aborted" || err instanceof Error && err.name === "AbortError";
|
|
73
|
-
if (isAbort2) throw err;
|
|
74
|
-
logDowngrade(String(err));
|
|
75
|
-
return chunk2SXAAKGV_cjs.resilientFetch(toV1FallbackUrl(url), init, fetchOpts);
|
|
76
|
-
}
|
|
77
|
-
const status = result.response.status;
|
|
78
|
-
if (status === 404 || status === 405 || status >= 500) {
|
|
79
|
-
logDowngrade(`HTTP ${status}`, status);
|
|
80
|
-
return chunk2SXAAKGV_cjs.resilientFetch(toV1FallbackUrl(url), init, fetchOpts);
|
|
81
|
-
}
|
|
82
|
-
return result;
|
|
83
|
-
}
|
|
84
|
-
function aiVersionPathOverrides(version) {
|
|
85
|
-
if (version !== "v2") return {};
|
|
86
|
-
const map = {};
|
|
87
|
-
for (const template of V2_COVERED_AI_PATH_TEMPLATES) {
|
|
88
|
-
map[template] = toV2Path(template);
|
|
89
|
-
}
|
|
90
|
-
return map;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
8
|
// src/core/call.ts
|
|
94
9
|
function buildMatrxRequestUrl(baseUrl, pathTemplate, pathParams, queryParams) {
|
|
95
10
|
let resolvedPath = pathTemplate;
|
|
@@ -128,7 +43,7 @@ function buildMatrxRequestBody(body, scope) {
|
|
|
128
43
|
}
|
|
129
44
|
const bodyOrganizationId = base.organization_id;
|
|
130
45
|
if (scope.organization_id !== void 0 && bodyOrganizationId !== void 0 && (typeof bodyOrganizationId !== "string" || bodyOrganizationId.trim() !== scope.organization_id)) {
|
|
131
|
-
throw new
|
|
46
|
+
throw new chunkSPASYIUH_cjs.OrganizationContextError(
|
|
132
47
|
"organization_context_mismatch",
|
|
133
48
|
"Request body organization_id must match the request context organization."
|
|
134
49
|
);
|
|
@@ -200,14 +115,14 @@ function parseMatrxNdjsonResponse(response, signal, hooks = {}) {
|
|
|
200
115
|
};
|
|
201
116
|
async function* events() {
|
|
202
117
|
if (!response.body) {
|
|
203
|
-
throw new
|
|
118
|
+
throw new chunkSPASYIUH_cjs.BackendApiError({
|
|
204
119
|
code: "internal_error",
|
|
205
120
|
detail: "Response has no body",
|
|
206
121
|
userMessage: "No response received from server"
|
|
207
122
|
});
|
|
208
123
|
}
|
|
209
124
|
try {
|
|
210
|
-
for await (const envelope of
|
|
125
|
+
for await (const envelope of chunkSPASYIUH_cjs.readMatrxNdjsonStream(response.body, {
|
|
211
126
|
...signal ? { signal } : {},
|
|
212
127
|
...hooks.onMalformedLine ? { onMalformedLine: hooks.onMalformedLine } : {},
|
|
213
128
|
...hooks.onUnknownEnvelope ? { onUnknownEnvelope: hooks.onUnknownEnvelope } : {}
|
|
@@ -219,7 +134,7 @@ function parseMatrxNdjsonResponse(response, signal, hooks = {}) {
|
|
|
219
134
|
if (signal?.aborted || error instanceof Error && error.name === "AbortError") {
|
|
220
135
|
return;
|
|
221
136
|
}
|
|
222
|
-
const transportError = error instanceof
|
|
137
|
+
const transportError = error instanceof chunkSPASYIUH_cjs.BackendApiError ? error : new chunkSPASYIUH_cjs.StreamTransportError({
|
|
223
138
|
detail: error instanceof Error ? error.message : "The response stream ended unexpectedly.",
|
|
224
139
|
details: error,
|
|
225
140
|
...ids.requestId ? { requestId: ids.requestId } : {}
|
|
@@ -236,7 +151,7 @@ async function httpErrorFrom(response) {
|
|
|
236
151
|
const serverDetail = await response.json().catch(() => void 0);
|
|
237
152
|
return {
|
|
238
153
|
type: response.status >= 400 && response.status < 500 ? "validation_error" : "http_error",
|
|
239
|
-
message:
|
|
154
|
+
message: chunkSPASYIUH_cjs.extractMatrxErrorMessage(serverDetail) ?? bareStatusSentence(response.status),
|
|
240
155
|
status: response.status,
|
|
241
156
|
serverDetail
|
|
242
157
|
};
|
|
@@ -244,21 +159,17 @@ async function httpErrorFrom(response) {
|
|
|
244
159
|
async function executeMatrxCall(request, hooks = {}) {
|
|
245
160
|
const upper = request.method.toUpperCase();
|
|
246
161
|
const sendsBody = request.stream || upper !== "GET" && upper !== "HEAD";
|
|
247
|
-
const { response } = await
|
|
248
|
-
request.url,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
throwOnHttpError: false,
|
|
259
|
-
...hooks.onProtocolDowngrade ? { onDowngrade: hooks.onProtocolDowngrade } : {}
|
|
260
|
-
}
|
|
261
|
-
);
|
|
162
|
+
const { response } = await chunkSPASYIUH_cjs.sendOnWire({
|
|
163
|
+
url: request.url,
|
|
164
|
+
method: request.method,
|
|
165
|
+
headers: request.headers,
|
|
166
|
+
...sendsBody ? { body: JSON.stringify(request.body) } : {},
|
|
167
|
+
...request.signal ? { signal: request.signal } : {},
|
|
168
|
+
connectTimeoutMs: request.connectTimeoutMs ?? DEFAULT_CONNECT_TIMEOUT_MS,
|
|
169
|
+
totalTimeoutMs: request.stream ? null : request.totalTimeoutMs === void 0 ? DEFAULT_JSON_TOTAL_TIMEOUT_MS : request.totalTimeoutMs,
|
|
170
|
+
...request.stream ? { stream: true } : {},
|
|
171
|
+
...hooks.onProtocolDowngrade ? { onProtocolDowngrade: hooks.onProtocolDowngrade } : {}
|
|
172
|
+
});
|
|
262
173
|
const requestId = response.headers.get("X-Request-ID");
|
|
263
174
|
const conversationId = response.headers.get("X-Conversation-ID");
|
|
264
175
|
const idFields = {
|
|
@@ -294,47 +205,54 @@ async function executeMatrxCall(request, hooks = {}) {
|
|
|
294
205
|
}
|
|
295
206
|
async function sendMatrxRequest(url, init = {}, options = {}) {
|
|
296
207
|
const callerSignal = options.signal ?? init.signal ?? void 0;
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
const onCallerAbort = () => controller.abort(callerSignal?.reason);
|
|
302
|
-
if (callerSignal) {
|
|
303
|
-
if (callerSignal.aborted) controller.abort(callerSignal.reason);
|
|
304
|
-
else callerSignal.addEventListener("abort", onCallerAbort, { once: true });
|
|
305
|
-
}
|
|
306
|
-
let timedOut = false;
|
|
307
|
-
const timer = setTimeout(() => {
|
|
308
|
-
timedOut = true;
|
|
309
|
-
controller.abort();
|
|
310
|
-
}, options.timeoutMs);
|
|
208
|
+
const headers = {};
|
|
209
|
+
new Headers(init.headers ?? {}).forEach((value, name) => {
|
|
210
|
+
headers[name] = value;
|
|
211
|
+
});
|
|
311
212
|
try {
|
|
312
|
-
|
|
213
|
+
const { response } = await chunkSPASYIUH_cjs.sendOnWire({
|
|
214
|
+
url,
|
|
215
|
+
method: init.method ?? "GET",
|
|
216
|
+
headers,
|
|
217
|
+
...init.body !== void 0 && init.body !== null ? { body: init.body } : {},
|
|
218
|
+
...callerSignal ? { signal: callerSignal } : {},
|
|
219
|
+
// No deadline unless the caller set one: the raw lane carries bytes
|
|
220
|
+
// and long reads whose length only the caller knows.
|
|
221
|
+
connectTimeoutMs: options.timeoutMs ?? 24 * 60 * 60 * 1e3,
|
|
222
|
+
totalTimeoutMs: null,
|
|
223
|
+
...options.onUploadProgress ? { onUploadProgress: options.onUploadProgress } : {}
|
|
224
|
+
});
|
|
225
|
+
return response;
|
|
313
226
|
} catch (error) {
|
|
314
|
-
if (
|
|
315
|
-
throw new
|
|
227
|
+
if (chunkPKYPPATQ_cjs.isNetError(error) && error.code === "aborted") {
|
|
228
|
+
throw callerSignal?.reason instanceof Error ? callerSignal.reason : new DOMException("The request was cancelled.", "AbortError");
|
|
229
|
+
}
|
|
230
|
+
if (options.timeoutMs !== void 0 && chunkPKYPPATQ_cjs.isNetError(error) && error.code === "connect-timeout") {
|
|
231
|
+
throw new chunkSPASYIUH_cjs.BackendApiError({
|
|
316
232
|
code: "request_timeout",
|
|
317
233
|
detail: `${init.method ?? "GET"} ${url} exceeded ${options.timeoutMs}ms`,
|
|
318
234
|
userMessage: "The request timed out \u2014 please retry.",
|
|
319
235
|
status: 504
|
|
320
236
|
});
|
|
321
237
|
}
|
|
238
|
+
if (chunkPKYPPATQ_cjs.isNetError(error) && (error.code === "network" || error.code === "offline")) {
|
|
239
|
+
throw error.cause instanceof Error ? error.cause : error;
|
|
240
|
+
}
|
|
322
241
|
throw error;
|
|
323
|
-
} finally {
|
|
324
|
-
clearTimeout(timer);
|
|
325
|
-
callerSignal?.removeEventListener("abort", onCallerAbort);
|
|
326
242
|
}
|
|
327
243
|
}
|
|
328
244
|
async function readMatrxJsonResponse(response) {
|
|
329
|
-
if (!response.ok) throw await
|
|
245
|
+
if (!response.ok) throw await chunkSPASYIUH_cjs.parseHttpError(response);
|
|
330
246
|
if (response.status === 204) return null;
|
|
331
247
|
return await response.json();
|
|
332
248
|
}
|
|
249
|
+
|
|
250
|
+
// src/core/client.ts
|
|
333
251
|
function classifyStatus(status) {
|
|
334
252
|
return status >= 400 && status < 500 ? "validation_error" : "http_error";
|
|
335
253
|
}
|
|
336
254
|
function normalizeMatrxError(err) {
|
|
337
|
-
if (err instanceof
|
|
255
|
+
if (err instanceof chunkSPASYIUH_cjs.OrganizationContextError) {
|
|
338
256
|
return {
|
|
339
257
|
type: "validation_error",
|
|
340
258
|
message: err.message,
|
|
@@ -346,7 +264,7 @@ function normalizeMatrxError(err) {
|
|
|
346
264
|
if (err instanceof DOMException && err.name === "AbortError") {
|
|
347
265
|
return { type: "abort_error", message: "Request was cancelled." };
|
|
348
266
|
}
|
|
349
|
-
if (err instanceof
|
|
267
|
+
if (err instanceof chunkSPASYIUH_cjs.MatrxApiError) {
|
|
350
268
|
return {
|
|
351
269
|
type: classifyStatus(err.status),
|
|
352
270
|
message: honestTransportMessage(err.message, err.status),
|
|
@@ -356,7 +274,7 @@ function normalizeMatrxError(err) {
|
|
|
356
274
|
name: err.name
|
|
357
275
|
};
|
|
358
276
|
}
|
|
359
|
-
if (err instanceof
|
|
277
|
+
if (err instanceof chunkSPASYIUH_cjs.BackendApiError) {
|
|
360
278
|
return {
|
|
361
279
|
type: "network_error",
|
|
362
280
|
message: honestTransportMessage(
|
|
@@ -369,7 +287,7 @@ function normalizeMatrxError(err) {
|
|
|
369
287
|
...err.details !== null ? { serverDetail: err.details } : {}
|
|
370
288
|
};
|
|
371
289
|
}
|
|
372
|
-
if (
|
|
290
|
+
if (chunkPKYPPATQ_cjs.isNetError(err)) {
|
|
373
291
|
if (err.code === "aborted") {
|
|
374
292
|
return { type: "abort_error", message: err.message };
|
|
375
293
|
}
|
|
@@ -403,7 +321,7 @@ function normalizeMatrxError(err) {
|
|
|
403
321
|
}
|
|
404
322
|
return { type: "network_error", message: err.message };
|
|
405
323
|
}
|
|
406
|
-
return { type: "unknown", message:
|
|
324
|
+
return { type: "unknown", message: chunkPKYPPATQ_cjs.extractErrorMessage(err) };
|
|
407
325
|
}
|
|
408
326
|
var PRODUCTION_CONNECT_TIMEOUT_MS = 15e3;
|
|
409
327
|
function stripContentType(headers) {
|
|
@@ -414,6 +332,7 @@ function stripContentType(headers) {
|
|
|
414
332
|
);
|
|
415
333
|
}
|
|
416
334
|
var ORGANIZATION_HEADER = "x-organization-id";
|
|
335
|
+
var ORGANIZATION_HEADER_CANONICAL = "X-Organization-Id";
|
|
417
336
|
function readOrganizationHeader(headers) {
|
|
418
337
|
for (const [name, value] of Object.entries(headers ?? {})) {
|
|
419
338
|
if (name.toLowerCase() === ORGANIZATION_HEADER && value.trim().length > 0) {
|
|
@@ -433,14 +352,16 @@ function createMatrxTransport(options) {
|
|
|
433
352
|
const {
|
|
434
353
|
baseUrl,
|
|
435
354
|
resolveTarget,
|
|
436
|
-
credentials
|
|
355
|
+
credentials,
|
|
437
356
|
organizationId,
|
|
438
357
|
aiApiVersion,
|
|
439
358
|
connectTimeoutMs = PRODUCTION_CONNECT_TIMEOUT_MS,
|
|
440
359
|
totalTimeoutMs = null,
|
|
441
360
|
expectedErrorStatuses,
|
|
442
361
|
diagnostics,
|
|
443
|
-
source = "matrxTransport"
|
|
362
|
+
source = "matrxTransport",
|
|
363
|
+
refreshCredentials,
|
|
364
|
+
readyTimeoutMs
|
|
444
365
|
} = options;
|
|
445
366
|
if (baseUrl === void 0 === (resolveTarget === void 0)) {
|
|
446
367
|
throw new Error(
|
|
@@ -449,32 +370,28 @@ function createMatrxTransport(options) {
|
|
|
449
370
|
}
|
|
450
371
|
const resolve = resolveTarget ?? (() => ({ baseUrl }));
|
|
451
372
|
const resolveVersion = () => {
|
|
452
|
-
if (aiApiVersion === void 0) return MATRX_AI_API_VERSION_DEFAULT;
|
|
373
|
+
if (aiApiVersion === void 0) return chunkSPASYIUH_cjs.MATRX_AI_API_VERSION_DEFAULT;
|
|
453
374
|
return typeof aiApiVersion === "function" ? aiApiVersion() : aiApiVersion;
|
|
454
375
|
};
|
|
455
376
|
const resolveOrganizationId = (callOrganizationId) => {
|
|
456
377
|
if (organizationId === void 0) return null;
|
|
457
|
-
if (callOrganizationId !== null) return
|
|
378
|
+
if (callOrganizationId !== null) return chunkSPASYIUH_cjs.requireOrganizationContext(callOrganizationId);
|
|
458
379
|
const candidate = typeof organizationId === "function" ? organizationId() : organizationId;
|
|
459
|
-
return
|
|
380
|
+
return chunkSPASYIUH_cjs.requireOrganizationContext(candidate);
|
|
460
381
|
};
|
|
461
382
|
return {
|
|
462
383
|
async fetch(path, init) {
|
|
463
384
|
const target = await resolve(init);
|
|
464
385
|
const callOrganizationId = readOrganizationHeader(init.headers);
|
|
465
|
-
const versionedPath = applyAiApiVersion(path, resolveVersion());
|
|
386
|
+
const versionedPath = chunkSPASYIUH_cjs.applyAiApiVersion(path, resolveVersion());
|
|
466
387
|
const url = `${target.baseUrl}${versionedPath}`;
|
|
467
|
-
const credentialHeaders = credentials$1 ? credentials.credentialToHeaders(await credentials$1.get()) : {};
|
|
468
388
|
const policyHeaders = stripContentType(target.policyHeaders ?? {});
|
|
469
|
-
let
|
|
470
|
-
...init.headers,
|
|
471
|
-
...stripContentType(credentialHeaders),
|
|
472
|
-
...callOrganizationId === null ? policyHeaders : stripOrganizationHeader(policyHeaders)
|
|
473
|
-
};
|
|
389
|
+
let overHeaders = callOrganizationId === null ? policyHeaders : stripOrganizationHeader(policyHeaders);
|
|
474
390
|
const orgId = resolveOrganizationId(callOrganizationId);
|
|
475
391
|
if (orgId !== null) {
|
|
476
|
-
|
|
392
|
+
overHeaders = chunkSPASYIUH_cjs.applyOrganizationContextHeader(overHeaders, orgId);
|
|
477
393
|
}
|
|
394
|
+
const wireHeaders = callOrganizationId === null ? { ...init.headers } : stripOrganizationHeader({ ...init.headers });
|
|
478
395
|
const info = {
|
|
479
396
|
url,
|
|
480
397
|
method: init.method,
|
|
@@ -485,19 +402,23 @@ function createMatrxTransport(options) {
|
|
|
485
402
|
diagnostics?.onRequest?.(info);
|
|
486
403
|
let response;
|
|
487
404
|
try {
|
|
488
|
-
({ response } = await
|
|
489
|
-
url,
|
|
405
|
+
({ response } = await chunkSPASYIUH_cjs.sendOnWire(
|
|
490
406
|
{
|
|
407
|
+
url,
|
|
491
408
|
method: init.method,
|
|
492
|
-
headers,
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
{
|
|
409
|
+
headers: wireHeaders,
|
|
410
|
+
overHeaders: orgId === null && callOrganizationId !== null ? { ...overHeaders, [ORGANIZATION_HEADER_CANONICAL]: callOrganizationId } : overHeaders,
|
|
411
|
+
...init.body !== void 0 ? { body: init.body } : {},
|
|
496
412
|
...init.signal ? { signal: init.signal } : {},
|
|
413
|
+
...init.onUploadProgress ? { onUploadProgress: init.onUploadProgress } : {},
|
|
497
414
|
connectTimeoutMs,
|
|
498
415
|
totalTimeoutMs,
|
|
499
|
-
|
|
500
|
-
|
|
416
|
+
...diagnostics?.onProtocolDowngrade ? { onProtocolDowngrade: diagnostics.onProtocolDowngrade } : {}
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
...credentials ? { credentials } : {},
|
|
420
|
+
...refreshCredentials ? { refreshCredentials } : {},
|
|
421
|
+
...readyTimeoutMs !== void 0 ? { readyTimeoutMs } : {}
|
|
501
422
|
}
|
|
502
423
|
));
|
|
503
424
|
} catch (err) {
|
|
@@ -506,11 +427,11 @@ function createMatrxTransport(options) {
|
|
|
506
427
|
}
|
|
507
428
|
if (!response.ok && !expectedErrorStatuses?.includes(response.status)) {
|
|
508
429
|
const serverDetail = await response.clone().json().catch(() => void 0);
|
|
509
|
-
const code =
|
|
430
|
+
const code = chunkSPASYIUH_cjs.extractMatrxErrorCode(serverDetail);
|
|
510
431
|
diagnostics?.onError?.(
|
|
511
432
|
{
|
|
512
433
|
type: classifyStatus(response.status),
|
|
513
|
-
message:
|
|
434
|
+
message: chunkSPASYIUH_cjs.extractMatrxErrorMessage(serverDetail) ?? `HTTP ${response.status}`,
|
|
514
435
|
status: response.status,
|
|
515
436
|
serverDetail,
|
|
516
437
|
...code ? { code } : {}
|
|
@@ -523,42 +444,6 @@ function createMatrxTransport(options) {
|
|
|
523
444
|
};
|
|
524
445
|
}
|
|
525
446
|
|
|
526
|
-
// src/core/api-target-log.ts
|
|
527
|
-
var SUSPECT_HOST_FRAGMENTS = ["sandbox"];
|
|
528
|
-
function looksSuspect(url) {
|
|
529
|
-
const lower = url.toLowerCase();
|
|
530
|
-
return SUSPECT_HOST_FRAGMENTS.some((frag) => lower.includes(frag));
|
|
531
|
-
}
|
|
532
|
-
function logApiTarget(url, context) {
|
|
533
|
-
const { source, method, channel, activeServer, ...extra } = context;
|
|
534
|
-
let origin = url;
|
|
535
|
-
try {
|
|
536
|
-
origin = new URL(url).origin;
|
|
537
|
-
} catch {
|
|
538
|
-
}
|
|
539
|
-
const suspect = looksSuspect(url);
|
|
540
|
-
const tag = suspect ? "\u{1F6A8} API TARGET (SANDBOX?)" : "\u{1F4E1} API TARGET";
|
|
541
|
-
const style = suspect ? "font-weight:bold;color:#fff;background:#c0392b;padding:1px 4px;border-radius:3px;" : "font-weight:bold;color:#fff;background:#16a085;padding:1px 4px;border-radius:3px;";
|
|
542
|
-
const meta = {
|
|
543
|
-
origin,
|
|
544
|
-
fullUrl: url,
|
|
545
|
-
source
|
|
546
|
-
};
|
|
547
|
-
if (method) meta.method = method;
|
|
548
|
-
if (channel) meta.channel = channel;
|
|
549
|
-
if (activeServer) meta.activeServer = activeServer;
|
|
550
|
-
for (const [k, v] of Object.entries(extra)) {
|
|
551
|
-
if (v !== void 0) meta[k] = v;
|
|
552
|
-
}
|
|
553
|
-
const log = suspect ? console.error : console.info;
|
|
554
|
-
log(
|
|
555
|
-
`%c${tag}%c ${method ? method + " " : ""}${url}`,
|
|
556
|
-
style,
|
|
557
|
-
"color:inherit;",
|
|
558
|
-
meta
|
|
559
|
-
);
|
|
560
|
-
}
|
|
561
|
-
|
|
562
447
|
// src/core/endpoint-path.ts
|
|
563
448
|
function normalizeLeadingSlash(value) {
|
|
564
449
|
const trimmed = value.trim();
|
|
@@ -580,21 +465,6 @@ function resolveEndpointPath(canonicalPath, config) {
|
|
|
580
465
|
}
|
|
581
466
|
return canonicalPath;
|
|
582
467
|
}
|
|
583
|
-
|
|
584
|
-
// src/core/desktop-target.ts
|
|
585
|
-
var DESKTOP_NATIVE_CAPABILITY = "desktop-native";
|
|
586
|
-
function applyDesktopTargetToRequestBody(body, targetInstanceId) {
|
|
587
|
-
if (!targetInstanceId || !isRecord(body)) return;
|
|
588
|
-
const existingClient = isRecord(body.client) ? body.client : null;
|
|
589
|
-
const existingState = existingClient && isRecord(existingClient.state) ? existingClient.state : null;
|
|
590
|
-
const existingDesktopState = existingState && isRecord(existingState[DESKTOP_NATIVE_CAPABILITY]) ? existingState[DESKTOP_NATIVE_CAPABILITY] : null;
|
|
591
|
-
if (!existingClient || !existingState || !existingDesktopState) return;
|
|
592
|
-
body.target_instance_id ??= targetInstanceId;
|
|
593
|
-
existingDesktopState.target_instance_id ??= targetInstanceId;
|
|
594
|
-
}
|
|
595
|
-
function isRecord(value) {
|
|
596
|
-
return value != null && typeof value === "object" && !Array.isArray(value);
|
|
597
|
-
}
|
|
598
468
|
var RUN_OUTPUT_KINDS = ["text", "image", "video", "audio"];
|
|
599
469
|
var RUN_WAIT_KNOB_FEATURE = "agents.run_wait";
|
|
600
470
|
var RUN_STREAM_LIFETIME_BACKSTOP_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -840,7 +710,7 @@ async function readServerDetail(response) {
|
|
|
840
710
|
}
|
|
841
711
|
}
|
|
842
712
|
async function throwApiError(path, response) {
|
|
843
|
-
throw new
|
|
713
|
+
throw new chunkSPASYIUH_cjs.MatrxApiError({
|
|
844
714
|
status: response.status,
|
|
845
715
|
path,
|
|
846
716
|
serverDetail: await readServerDetail(response)
|
|
@@ -861,7 +731,7 @@ function toRunHandle(response, options) {
|
|
|
861
731
|
return {
|
|
862
732
|
requestId: response.headers.get("X-Request-ID"),
|
|
863
733
|
conversationId: response.headers.get("X-Conversation-ID"),
|
|
864
|
-
events:
|
|
734
|
+
events: chunkSPASYIUH_cjs.readMatrxNdjsonStream(response.body, {
|
|
865
735
|
...options.signal ? { signal: options.signal } : {},
|
|
866
736
|
...options.maxReadAhead !== void 0 ? { maxReadAhead: options.maxReadAhead } : {},
|
|
867
737
|
...options.onMalformedLine ? { onMalformedLine: options.onMalformedLine } : {},
|
|
@@ -884,7 +754,7 @@ async function requestStream(transport, path, options) {
|
|
|
884
754
|
});
|
|
885
755
|
if (!response.ok) return throwApiError(path, response);
|
|
886
756
|
if (!response.body) {
|
|
887
|
-
throw new
|
|
757
|
+
throw new chunkSPASYIUH_cjs.MatrxApiError({
|
|
888
758
|
status: response.status,
|
|
889
759
|
path,
|
|
890
760
|
serverDetail: { code: "missing_response_body" },
|
|
@@ -944,7 +814,7 @@ async function getRuntimeOperationStatus(transport, requestId, options = {}) {
|
|
|
944
814
|
{ method: "GET", ...options.signal ? { signal: options.signal } : {} }
|
|
945
815
|
);
|
|
946
816
|
} catch (error) {
|
|
947
|
-
if (error instanceof
|
|
817
|
+
if (error instanceof chunkSPASYIUH_cjs.MatrxApiError && error.status === 404) return null;
|
|
948
818
|
throw error;
|
|
949
819
|
}
|
|
950
820
|
}
|
|
@@ -959,7 +829,7 @@ async function getRuntimeOperationsByLink(transport, linkKind, linkId, options =
|
|
|
959
829
|
{ method: "GET", ...options.signal ? { signal: options.signal } : {} }
|
|
960
830
|
);
|
|
961
831
|
} catch (error) {
|
|
962
|
-
if (error instanceof
|
|
832
|
+
if (error instanceof chunkSPASYIUH_cjs.MatrxApiError && error.status === 404) return null;
|
|
963
833
|
throw error;
|
|
964
834
|
}
|
|
965
835
|
}
|
|
@@ -1000,7 +870,7 @@ async function* followRuntimeOperationEvents(transport, executionId, options = {
|
|
|
1000
870
|
...options.signal ? { signal: options.signal } : {}
|
|
1001
871
|
}
|
|
1002
872
|
);
|
|
1003
|
-
const frames =
|
|
873
|
+
const frames = chunkSPASYIUH_cjs.readMatrxSseStream(
|
|
1004
874
|
response.body,
|
|
1005
875
|
options.onIncomplete ? { onIncomplete: options.onIncomplete } : {}
|
|
1006
876
|
);
|
|
@@ -1093,27 +963,27 @@ async function rejoinRuntimeOperation(transport, requestId, options = {}) {
|
|
|
1093
963
|
var MATRX_RUN_IN_PROGRESS = "run_in_progress";
|
|
1094
964
|
var MATRX_RESUME_CONFLICT = "resume_conflict";
|
|
1095
965
|
var MATRX_LIVE_STREAM_UNAVAILABLE = "live_stream_unavailable";
|
|
1096
|
-
function
|
|
966
|
+
function isRecord(value) {
|
|
1097
967
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1098
968
|
}
|
|
1099
969
|
function nonBlank(value) {
|
|
1100
970
|
return typeof value === "string" && value.trim() ? value : null;
|
|
1101
971
|
}
|
|
1102
972
|
function detailCandidates(body) {
|
|
1103
|
-
if (!
|
|
973
|
+
if (!isRecord(body)) return [];
|
|
1104
974
|
const out = [];
|
|
1105
|
-
if (
|
|
1106
|
-
if (
|
|
975
|
+
if (isRecord(body.detail)) out.push(body.detail);
|
|
976
|
+
if (isRecord(body.details)) out.push(body.details);
|
|
1107
977
|
out.push(body);
|
|
1108
978
|
return out;
|
|
1109
979
|
}
|
|
1110
980
|
function statusOf(error) {
|
|
1111
|
-
if (!
|
|
981
|
+
if (!isRecord(error) && !(error instanceof Error)) return null;
|
|
1112
982
|
const status = error.status;
|
|
1113
983
|
return typeof status === "number" ? status : null;
|
|
1114
984
|
}
|
|
1115
985
|
function bodyOf(error) {
|
|
1116
|
-
if (!
|
|
986
|
+
if (!isRecord(error) && !(error instanceof Error)) return void 0;
|
|
1117
987
|
return error.serverDetail;
|
|
1118
988
|
}
|
|
1119
989
|
function readMatrxErrorCode(error) {
|
|
@@ -1174,7 +1044,7 @@ function readLiveRunRejoin(error) {
|
|
|
1174
1044
|
rejoinPath,
|
|
1175
1045
|
runId: firstString(candidates, "run_id"),
|
|
1176
1046
|
code,
|
|
1177
|
-
body:
|
|
1047
|
+
body: isRecord(root) ? root : {}
|
|
1178
1048
|
};
|
|
1179
1049
|
}
|
|
1180
1050
|
function readLiveRunRequestId(error) {
|
|
@@ -1190,8 +1060,8 @@ function runtimeOperationRejoinPath(requestId) {
|
|
|
1190
1060
|
return `/runtime/operations/${encodePathSegment(requestId)}/rejoin`;
|
|
1191
1061
|
}
|
|
1192
1062
|
function streamErrorText(eventOrPayload) {
|
|
1193
|
-
if (!
|
|
1194
|
-
const payload = typeof eventOrPayload.event === "string" &&
|
|
1063
|
+
if (!isRecord(eventOrPayload)) return null;
|
|
1064
|
+
const payload = typeof eventOrPayload.event === "string" && isRecord(eventOrPayload.data) ? eventOrPayload.data : eventOrPayload;
|
|
1195
1065
|
return nonBlank(payload.user_message) ?? nonBlank(payload.message);
|
|
1196
1066
|
}
|
|
1197
1067
|
async function openMatrxStream(transport, path, options = {}) {
|
|
@@ -1203,7 +1073,7 @@ async function openMatrxStream(transport, path, options = {}) {
|
|
|
1203
1073
|
return toRunHandle(response, options);
|
|
1204
1074
|
}
|
|
1205
1075
|
function withRunOrganization(transport, organizationId) {
|
|
1206
|
-
const orgId =
|
|
1076
|
+
const orgId = chunkSPASYIUH_cjs.requireOrganizationContext(organizationId);
|
|
1207
1077
|
return {
|
|
1208
1078
|
fetch: (path, init) => transport.fetch(path, {
|
|
1209
1079
|
...init,
|
|
@@ -1230,7 +1100,7 @@ async function followWorkflowRunEvents(transport, runId, options) {
|
|
|
1230
1100
|
throw error;
|
|
1231
1101
|
}
|
|
1232
1102
|
try {
|
|
1233
|
-
for await (const frame of
|
|
1103
|
+
for await (const frame of chunkSPASYIUH_cjs.readMatrxSseStream(
|
|
1234
1104
|
response.body
|
|
1235
1105
|
)) {
|
|
1236
1106
|
if (frame.event === "end") return { ended: true };
|
|
@@ -1241,7 +1111,7 @@ async function followWorkflowRunEvents(transport, runId, options) {
|
|
|
1241
1111
|
} catch {
|
|
1242
1112
|
continue;
|
|
1243
1113
|
}
|
|
1244
|
-
if (!
|
|
1114
|
+
if (!isRecord(parsed)) continue;
|
|
1245
1115
|
options.onEvent(parsed, parsed.event === "node_stream" ? null : frame.seq);
|
|
1246
1116
|
}
|
|
1247
1117
|
} catch (error) {
|
|
@@ -1276,7 +1146,7 @@ async function resumeOrRejoin(transport, resumeCall, options) {
|
|
|
1276
1146
|
} catch (error) {
|
|
1277
1147
|
const target = readLiveRunRejoin(error);
|
|
1278
1148
|
if (!target) {
|
|
1279
|
-
if (error instanceof
|
|
1149
|
+
if (error instanceof chunkSPASYIUH_cjs.MatrxApiError && isResumeConflict(error)) {
|
|
1280
1150
|
return { kind: "resume_conflict", error };
|
|
1281
1151
|
}
|
|
1282
1152
|
throw error;
|
|
@@ -1692,7 +1562,7 @@ async function reportProviderSessionUsage(transport, usage, options = {}) {
|
|
|
1692
1562
|
});
|
|
1693
1563
|
return "ok";
|
|
1694
1564
|
} catch (error) {
|
|
1695
|
-
if (error instanceof
|
|
1565
|
+
if (error instanceof chunkSPASYIUH_cjs.MatrxApiError) {
|
|
1696
1566
|
const status = error.status;
|
|
1697
1567
|
if (status >= 400 && status < 500 && status !== 401 && status !== 408 && status !== 425 && status !== 429) {
|
|
1698
1568
|
console.warn(`[provider-usage] server refused ${usage.provider} usage ${usage.usage_id} (${status})`);
|
|
@@ -1812,11 +1682,11 @@ var MatrxRunError = class extends Error {
|
|
|
1812
1682
|
this.partialText = args.partialText ?? "";
|
|
1813
1683
|
}
|
|
1814
1684
|
};
|
|
1815
|
-
function
|
|
1685
|
+
function isRecord2(value) {
|
|
1816
1686
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1817
1687
|
}
|
|
1818
1688
|
function stringField(value, key) {
|
|
1819
|
-
if (!
|
|
1689
|
+
if (!isRecord2(value)) return null;
|
|
1820
1690
|
const field = value[key];
|
|
1821
1691
|
return typeof field === "string" && field ? field : null;
|
|
1822
1692
|
}
|
|
@@ -1836,7 +1706,7 @@ async function runAgentToCompletion(transport, agentId, request, options = {}) {
|
|
|
1836
1706
|
continue;
|
|
1837
1707
|
}
|
|
1838
1708
|
if (envelope.event === "error" && failure === null) {
|
|
1839
|
-
const payload =
|
|
1709
|
+
const payload = isRecord2(envelope.data) ? envelope.data : null;
|
|
1840
1710
|
failure = new MatrxRunError({
|
|
1841
1711
|
message: streamErrorText(payload) ?? "The agent run failed",
|
|
1842
1712
|
errorPayload: payload,
|
|
@@ -1844,12 +1714,12 @@ async function runAgentToCompletion(transport, agentId, request, options = {}) {
|
|
|
1844
1714
|
});
|
|
1845
1715
|
continue;
|
|
1846
1716
|
}
|
|
1847
|
-
if (envelope.event !== "completion" || !
|
|
1717
|
+
if (envelope.event !== "completion" || !isRecord2(envelope.data)) continue;
|
|
1848
1718
|
if (envelope.data.operation !== "user_request") continue;
|
|
1849
1719
|
completion = envelope.data;
|
|
1850
1720
|
const status = envelope.data.status;
|
|
1851
1721
|
if ((status === "failed" || status === "cancelled") && failure === null) {
|
|
1852
|
-
const result =
|
|
1722
|
+
const result = isRecord2(envelope.data.result) ? envelope.data.result : null;
|
|
1853
1723
|
failure = new MatrxRunError({
|
|
1854
1724
|
message: stringField(result, "error") ?? stringField(result, "user_message") ?? `The agent run ${status}`,
|
|
1855
1725
|
completionStatus: status,
|
|
@@ -2374,10 +2244,6 @@ var ENDPOINTS = {
|
|
|
2374
2244
|
}
|
|
2375
2245
|
};
|
|
2376
2246
|
|
|
2377
|
-
Object.defineProperty(exports, "monitorStream", {
|
|
2378
|
-
enumerable: true,
|
|
2379
|
-
get: function () { return chunkFNIYADWI_cjs.monitorStream; }
|
|
2380
|
-
});
|
|
2381
2247
|
Object.defineProperty(exports, "API_KEY_PREFIX", {
|
|
2382
2248
|
enumerable: true,
|
|
2383
2249
|
get: function () { return chunkMVXD6WI6_cjs.API_KEY_PREFIX; }
|
|
@@ -2396,170 +2262,209 @@ Object.defineProperty(exports, "toCredentialsPort", {
|
|
|
2396
2262
|
});
|
|
2397
2263
|
Object.defineProperty(exports, "BackendApiError", {
|
|
2398
2264
|
enumerable: true,
|
|
2399
|
-
get: function () { return
|
|
2265
|
+
get: function () { return chunkSPASYIUH_cjs.BackendApiError; }
|
|
2400
2266
|
});
|
|
2401
2267
|
Object.defineProperty(exports, "CONTRACT_SHA256", {
|
|
2402
2268
|
enumerable: true,
|
|
2403
|
-
get: function () { return
|
|
2269
|
+
get: function () { return chunkSPASYIUH_cjs.CONTRACT_SHA256; }
|
|
2404
2270
|
});
|
|
2405
2271
|
Object.defineProperty(exports, "DEPLOYMENTS", {
|
|
2406
2272
|
enumerable: true,
|
|
2407
|
-
get: function () { return
|
|
2273
|
+
get: function () { return chunkSPASYIUH_cjs.DEPLOYMENTS; }
|
|
2408
2274
|
});
|
|
2409
2275
|
Object.defineProperty(exports, "DOMAINS", {
|
|
2410
2276
|
enumerable: true,
|
|
2411
|
-
get: function () { return
|
|
2277
|
+
get: function () { return chunkSPASYIUH_cjs.DOMAINS; }
|
|
2278
|
+
});
|
|
2279
|
+
Object.defineProperty(exports, "MATRX_AI_API_VERSION_DEFAULT", {
|
|
2280
|
+
enumerable: true,
|
|
2281
|
+
get: function () { return chunkSPASYIUH_cjs.MATRX_AI_API_VERSION_DEFAULT; }
|
|
2412
2282
|
});
|
|
2413
2283
|
Object.defineProperty(exports, "MatrxApiError", {
|
|
2414
2284
|
enumerable: true,
|
|
2415
|
-
get: function () { return
|
|
2285
|
+
get: function () { return chunkSPASYIUH_cjs.MatrxApiError; }
|
|
2416
2286
|
});
|
|
2417
2287
|
Object.defineProperty(exports, "OrganizationContextError", {
|
|
2418
2288
|
enumerable: true,
|
|
2419
|
-
get: function () { return
|
|
2289
|
+
get: function () { return chunkSPASYIUH_cjs.OrganizationContextError; }
|
|
2420
2290
|
});
|
|
2421
2291
|
Object.defineProperty(exports, "StreamTransportError", {
|
|
2422
2292
|
enumerable: true,
|
|
2423
|
-
get: function () { return
|
|
2293
|
+
get: function () { return chunkSPASYIUH_cjs.StreamTransportError; }
|
|
2294
|
+
});
|
|
2295
|
+
Object.defineProperty(exports, "V2_COVERED_AI_PATH_TEMPLATES", {
|
|
2296
|
+
enumerable: true,
|
|
2297
|
+
get: function () { return chunkSPASYIUH_cjs.V2_COVERED_AI_PATH_TEMPLATES; }
|
|
2298
|
+
});
|
|
2299
|
+
Object.defineProperty(exports, "aiVersionPathOverrides", {
|
|
2300
|
+
enumerable: true,
|
|
2301
|
+
get: function () { return chunkSPASYIUH_cjs.aiVersionPathOverrides; }
|
|
2302
|
+
});
|
|
2303
|
+
Object.defineProperty(exports, "applyAiApiVersion", {
|
|
2304
|
+
enumerable: true,
|
|
2305
|
+
get: function () { return chunkSPASYIUH_cjs.applyAiApiVersion; }
|
|
2424
2306
|
});
|
|
2425
2307
|
Object.defineProperty(exports, "applyOrganizationContextHeader", {
|
|
2426
2308
|
enumerable: true,
|
|
2427
|
-
get: function () { return
|
|
2309
|
+
get: function () { return chunkSPASYIUH_cjs.applyOrganizationContextHeader; }
|
|
2428
2310
|
});
|
|
2429
2311
|
Object.defineProperty(exports, "assertOrganizationMatchesOperation", {
|
|
2430
2312
|
enumerable: true,
|
|
2431
|
-
get: function () { return
|
|
2313
|
+
get: function () { return chunkSPASYIUH_cjs.assertOrganizationMatchesOperation; }
|
|
2432
2314
|
});
|
|
2433
2315
|
Object.defineProperty(exports, "assertQueryOrganizationMatchesContext", {
|
|
2434
2316
|
enumerable: true,
|
|
2435
|
-
get: function () { return
|
|
2317
|
+
get: function () { return chunkSPASYIUH_cjs.assertQueryOrganizationMatchesContext; }
|
|
2436
2318
|
});
|
|
2437
2319
|
Object.defineProperty(exports, "createApi", {
|
|
2438
2320
|
enumerable: true,
|
|
2439
|
-
get: function () { return
|
|
2321
|
+
get: function () { return chunkSPASYIUH_cjs.createApi; }
|
|
2440
2322
|
});
|
|
2441
2323
|
Object.defineProperty(exports, "createOrganizationOperation", {
|
|
2442
2324
|
enumerable: true,
|
|
2443
|
-
get: function () { return
|
|
2325
|
+
get: function () { return chunkSPASYIUH_cjs.createOrganizationOperation; }
|
|
2444
2326
|
});
|
|
2445
2327
|
Object.defineProperty(exports, "describeBackendFailure", {
|
|
2446
2328
|
enumerable: true,
|
|
2447
|
-
get: function () { return
|
|
2329
|
+
get: function () { return chunkSPASYIUH_cjs.describeBackendFailure; }
|
|
2448
2330
|
});
|
|
2449
2331
|
Object.defineProperty(exports, "extractMatrxErrorCode", {
|
|
2450
2332
|
enumerable: true,
|
|
2451
|
-
get: function () { return
|
|
2333
|
+
get: function () { return chunkSPASYIUH_cjs.extractMatrxErrorCode; }
|
|
2452
2334
|
});
|
|
2453
2335
|
Object.defineProperty(exports, "extractMatrxErrorMessage", {
|
|
2454
2336
|
enumerable: true,
|
|
2455
|
-
get: function () { return
|
|
2337
|
+
get: function () { return chunkSPASYIUH_cjs.extractMatrxErrorMessage; }
|
|
2338
|
+
});
|
|
2339
|
+
Object.defineProperty(exports, "fetchWithMatrxProtocolFallback", {
|
|
2340
|
+
enumerable: true,
|
|
2341
|
+
get: function () { return chunkSPASYIUH_cjs.fetchWithMatrxProtocolFallback; }
|
|
2456
2342
|
});
|
|
2457
2343
|
Object.defineProperty(exports, "getUserMessage", {
|
|
2458
2344
|
enumerable: true,
|
|
2459
|
-
get: function () { return
|
|
2345
|
+
get: function () { return chunkSPASYIUH_cjs.getUserMessage; }
|
|
2346
|
+
});
|
|
2347
|
+
Object.defineProperty(exports, "isCoveredAiPath", {
|
|
2348
|
+
enumerable: true,
|
|
2349
|
+
get: function () { return chunkSPASYIUH_cjs.isCoveredAiPath; }
|
|
2460
2350
|
});
|
|
2461
2351
|
Object.defineProperty(exports, "isGenericUserMessage", {
|
|
2462
2352
|
enumerable: true,
|
|
2463
|
-
get: function () { return
|
|
2353
|
+
get: function () { return chunkSPASYIUH_cjs.isGenericUserMessage; }
|
|
2464
2354
|
});
|
|
2465
2355
|
Object.defineProperty(exports, "isStreamTransportLost", {
|
|
2466
2356
|
enumerable: true,
|
|
2467
|
-
get: function () { return
|
|
2357
|
+
get: function () { return chunkSPASYIUH_cjs.isStreamTransportLost; }
|
|
2358
|
+
});
|
|
2359
|
+
Object.defineProperty(exports, "isV2Path", {
|
|
2360
|
+
enumerable: true,
|
|
2361
|
+
get: function () { return chunkSPASYIUH_cjs.isV2Path; }
|
|
2468
2362
|
});
|
|
2469
2363
|
Object.defineProperty(exports, "openJsonOrStream", {
|
|
2470
2364
|
enumerable: true,
|
|
2471
|
-
get: function () { return
|
|
2365
|
+
get: function () { return chunkSPASYIUH_cjs.openJsonOrStream; }
|
|
2472
2366
|
});
|
|
2473
2367
|
Object.defineProperty(exports, "openStream", {
|
|
2474
2368
|
enumerable: true,
|
|
2475
|
-
get: function () { return
|
|
2369
|
+
get: function () { return chunkSPASYIUH_cjs.openStream; }
|
|
2476
2370
|
});
|
|
2477
2371
|
Object.defineProperty(exports, "parseCallApiError", {
|
|
2478
2372
|
enumerable: true,
|
|
2479
|
-
get: function () { return
|
|
2373
|
+
get: function () { return chunkSPASYIUH_cjs.parseCallApiError; }
|
|
2480
2374
|
});
|
|
2481
2375
|
Object.defineProperty(exports, "parseHttpError", {
|
|
2482
2376
|
enumerable: true,
|
|
2483
|
-
get: function () { return
|
|
2377
|
+
get: function () { return chunkSPASYIUH_cjs.parseHttpError; }
|
|
2484
2378
|
});
|
|
2485
2379
|
Object.defineProperty(exports, "parseHttpErrorBody", {
|
|
2486
2380
|
enumerable: true,
|
|
2487
|
-
get: function () { return
|
|
2381
|
+
get: function () { return chunkSPASYIUH_cjs.parseHttpErrorBody; }
|
|
2488
2382
|
});
|
|
2489
2383
|
Object.defineProperty(exports, "parsePersistedBackendError", {
|
|
2490
2384
|
enumerable: true,
|
|
2491
|
-
get: function () { return
|
|
2385
|
+
get: function () { return chunkSPASYIUH_cjs.parsePersistedBackendError; }
|
|
2492
2386
|
});
|
|
2493
2387
|
Object.defineProperty(exports, "parseStreamError", {
|
|
2494
2388
|
enumerable: true,
|
|
2495
|
-
get: function () { return
|
|
2389
|
+
get: function () { return chunkSPASYIUH_cjs.parseStreamError; }
|
|
2496
2390
|
});
|
|
2497
2391
|
Object.defineProperty(exports, "requireOrganizationContext", {
|
|
2498
2392
|
enumerable: true,
|
|
2499
|
-
get: function () { return
|
|
2393
|
+
get: function () { return chunkSPASYIUH_cjs.requireOrganizationContext; }
|
|
2394
|
+
});
|
|
2395
|
+
Object.defineProperty(exports, "toV1FallbackUrl", {
|
|
2396
|
+
enumerable: true,
|
|
2397
|
+
get: function () { return chunkSPASYIUH_cjs.toV1FallbackUrl; }
|
|
2398
|
+
});
|
|
2399
|
+
Object.defineProperty(exports, "toV2Path", {
|
|
2400
|
+
enumerable: true,
|
|
2401
|
+
get: function () { return chunkSPASYIUH_cjs.toV2Path; }
|
|
2500
2402
|
});
|
|
2501
2403
|
Object.defineProperty(exports, "unwrapUpstreamError", {
|
|
2502
2404
|
enumerable: true,
|
|
2503
|
-
get: function () { return
|
|
2405
|
+
get: function () { return chunkSPASYIUH_cjs.unwrapUpstreamError; }
|
|
2504
2406
|
});
|
|
2505
2407
|
Object.defineProperty(exports, "AbortedError", {
|
|
2506
2408
|
enumerable: true,
|
|
2507
|
-
get: function () { return
|
|
2409
|
+
get: function () { return chunkPKYPPATQ_cjs.AbortedError; }
|
|
2508
2410
|
});
|
|
2509
2411
|
Object.defineProperty(exports, "ConnectTimeoutError", {
|
|
2510
2412
|
enumerable: true,
|
|
2511
|
-
get: function () { return
|
|
2413
|
+
get: function () { return chunkPKYPPATQ_cjs.ConnectTimeoutError; }
|
|
2512
2414
|
});
|
|
2513
2415
|
Object.defineProperty(exports, "HeartbeatTimeoutError", {
|
|
2514
2416
|
enumerable: true,
|
|
2515
|
-
get: function () { return
|
|
2417
|
+
get: function () { return chunkPKYPPATQ_cjs.HeartbeatTimeoutError; }
|
|
2516
2418
|
});
|
|
2517
2419
|
Object.defineProperty(exports, "HttpError", {
|
|
2518
2420
|
enumerable: true,
|
|
2519
|
-
get: function () { return
|
|
2421
|
+
get: function () { return chunkPKYPPATQ_cjs.HttpError; }
|
|
2520
2422
|
});
|
|
2521
2423
|
Object.defineProperty(exports, "NetError", {
|
|
2522
2424
|
enumerable: true,
|
|
2523
|
-
get: function () { return
|
|
2425
|
+
get: function () { return chunkPKYPPATQ_cjs.NetError; }
|
|
2524
2426
|
});
|
|
2525
2427
|
Object.defineProperty(exports, "NetworkError", {
|
|
2526
2428
|
enumerable: true,
|
|
2527
|
-
get: function () { return
|
|
2429
|
+
get: function () { return chunkPKYPPATQ_cjs.NetworkError; }
|
|
2528
2430
|
});
|
|
2529
2431
|
Object.defineProperty(exports, "OfflineError", {
|
|
2530
2432
|
enumerable: true,
|
|
2531
|
-
get: function () { return
|
|
2433
|
+
get: function () { return chunkPKYPPATQ_cjs.OfflineError; }
|
|
2532
2434
|
});
|
|
2533
2435
|
Object.defineProperty(exports, "TotalTimeoutError", {
|
|
2534
2436
|
enumerable: true,
|
|
2535
|
-
get: function () { return
|
|
2437
|
+
get: function () { return chunkPKYPPATQ_cjs.TotalTimeoutError; }
|
|
2536
2438
|
});
|
|
2537
2439
|
Object.defineProperty(exports, "extractErrorMessage", {
|
|
2538
2440
|
enumerable: true,
|
|
2539
|
-
get: function () { return
|
|
2441
|
+
get: function () { return chunkPKYPPATQ_cjs.extractErrorMessage; }
|
|
2540
2442
|
});
|
|
2541
2443
|
Object.defineProperty(exports, "isNetError", {
|
|
2542
2444
|
enumerable: true,
|
|
2543
|
-
get: function () { return
|
|
2445
|
+
get: function () { return chunkPKYPPATQ_cjs.isNetError; }
|
|
2544
2446
|
});
|
|
2545
2447
|
Object.defineProperty(exports, "isTransportFailure", {
|
|
2546
2448
|
enumerable: true,
|
|
2547
|
-
get: function () { return
|
|
2449
|
+
get: function () { return chunkPKYPPATQ_cjs.isTransportFailure; }
|
|
2450
|
+
});
|
|
2451
|
+
Object.defineProperty(exports, "monitorStream", {
|
|
2452
|
+
enumerable: true,
|
|
2453
|
+
get: function () { return chunkPKYPPATQ_cjs.monitorStream; }
|
|
2548
2454
|
});
|
|
2549
2455
|
Object.defineProperty(exports, "resilientFetch", {
|
|
2550
2456
|
enumerable: true,
|
|
2551
|
-
get: function () { return
|
|
2457
|
+
get: function () { return chunkPKYPPATQ_cjs.resilientFetch; }
|
|
2552
2458
|
});
|
|
2553
2459
|
Object.defineProperty(exports, "toNetError", {
|
|
2554
2460
|
enumerable: true,
|
|
2555
|
-
get: function () { return
|
|
2461
|
+
get: function () { return chunkPKYPPATQ_cjs.toNetError; }
|
|
2556
2462
|
});
|
|
2557
2463
|
Object.defineProperty(exports, "withRetry", {
|
|
2558
2464
|
enumerable: true,
|
|
2559
|
-
get: function () { return
|
|
2465
|
+
get: function () { return chunkPKYPPATQ_cjs.withRetry; }
|
|
2560
2466
|
});
|
|
2561
2467
|
exports.ENDPOINTS = ENDPOINTS;
|
|
2562
|
-
exports.MATRX_AI_API_VERSION_DEFAULT = MATRX_AI_API_VERSION_DEFAULT;
|
|
2563
2468
|
exports.MATRX_LIVE_STREAM_UNAVAILABLE = MATRX_LIVE_STREAM_UNAVAILABLE;
|
|
2564
2469
|
exports.MATRX_RESUME_CONFLICT = MATRX_RESUME_CONFLICT;
|
|
2565
2470
|
exports.MATRX_RUN_IN_PROGRESS = MATRX_RUN_IN_PROGRESS;
|
|
@@ -2569,11 +2474,7 @@ exports.RUN_OUTPUT_KINDS = RUN_OUTPUT_KINDS;
|
|
|
2569
2474
|
exports.RUN_STREAM_LIFETIME_BACKSTOP_MS = RUN_STREAM_LIFETIME_BACKSTOP_MS;
|
|
2570
2475
|
exports.RUN_WAIT_KNOB_FEATURE = RUN_WAIT_KNOB_FEATURE;
|
|
2571
2476
|
exports.TERMINAL_MATRX_RUNTIME_STATUSES = TERMINAL_MATRX_RUNTIME_STATUSES;
|
|
2572
|
-
exports.V2_COVERED_AI_PATH_TEMPLATES = V2_COVERED_AI_PATH_TEMPLATES;
|
|
2573
2477
|
exports.WARM_PATH = WARM_PATH;
|
|
2574
|
-
exports.aiVersionPathOverrides = aiVersionPathOverrides;
|
|
2575
|
-
exports.applyAiApiVersion = applyAiApiVersion;
|
|
2576
|
-
exports.applyDesktopTargetToRequestBody = applyDesktopTargetToRequestBody;
|
|
2577
2478
|
exports.bareStatusSentence = bareStatusSentence;
|
|
2578
2479
|
exports.buildMatrxRequestBody = buildMatrxRequestBody;
|
|
2579
2480
|
exports.buildMatrxRequestUrl = buildMatrxRequestUrl;
|
|
@@ -2589,7 +2490,6 @@ exports.createStreamReplayCursor = createStreamReplayCursor;
|
|
|
2589
2490
|
exports.createWarmup = createWarmup;
|
|
2590
2491
|
exports.encodePathSegment = encodePathSegment;
|
|
2591
2492
|
exports.executeMatrxCall = executeMatrxCall;
|
|
2592
|
-
exports.fetchWithMatrxProtocolFallback = fetchWithMatrxProtocolFallback;
|
|
2593
2493
|
exports.followRuntimeOperationEvents = followRuntimeOperationEvents;
|
|
2594
2494
|
exports.followRuntimeOperationToEnd = followRuntimeOperationToEnd;
|
|
2595
2495
|
exports.followServerJob = followServerJob;
|
|
@@ -2599,17 +2499,14 @@ exports.getRuntimeOperationStatus = getRuntimeOperationStatus;
|
|
|
2599
2499
|
exports.getRuntimeOperationsByLink = getRuntimeOperationsByLink;
|
|
2600
2500
|
exports.honestTransportMessage = honestTransportMessage;
|
|
2601
2501
|
exports.isBareTransportCode = isBareTransportCode;
|
|
2602
|
-
exports.isCoveredAiPath = isCoveredAiPath;
|
|
2603
2502
|
exports.isEmptyProviderUsage = isEmptyProviderUsage;
|
|
2604
2503
|
exports.isJobOutputKind = isJobOutputKind;
|
|
2605
2504
|
exports.isLiveStreamUnavailable = isLiveStreamUnavailable;
|
|
2606
2505
|
exports.isResumeConflict = isResumeConflict;
|
|
2607
2506
|
exports.isServerJobSettled = isServerJobSettled;
|
|
2608
|
-
exports.isV2Path = isV2Path;
|
|
2609
2507
|
exports.listConversationPendingToolCalls = listConversationPendingToolCalls;
|
|
2610
2508
|
exports.listRuntimeOperationEvents = listRuntimeOperationEvents;
|
|
2611
2509
|
exports.listUserPendingToolCalls = listUserPendingToolCalls;
|
|
2612
|
-
exports.logApiTarget = logApiTarget;
|
|
2613
2510
|
exports.mintMatrxConversationId = mintMatrxConversationId;
|
|
2614
2511
|
exports.newEphemeralConversationStart = newEphemeralConversationStart;
|
|
2615
2512
|
exports.newStoredConversationStart = newStoredConversationStart;
|
|
@@ -2654,6 +2551,4 @@ exports.startMandateRun = startMandateRun;
|
|
|
2654
2551
|
exports.streamErrorText = streamErrorText;
|
|
2655
2552
|
exports.submitAgentToolResults = submitAgentToolResults;
|
|
2656
2553
|
exports.toRunHandle = toRunHandle;
|
|
2657
|
-
exports.toV1FallbackUrl = toV1FallbackUrl;
|
|
2658
|
-
exports.toV2Path = toV2Path;
|
|
2659
2554
|
exports.withRunOrganization = withRunOrganization;
|