@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/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 chunk2ZHIYXHV_cjs = require('./chunk-2ZHIYXHV.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 chunk2ZHIYXHV_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 chunk2ZHIYXHV_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 chunk2ZHIYXHV_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 chunk2ZHIYXHV_cjs.BackendApiError ? error : new chunk2ZHIYXHV_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: chunk2ZHIYXHV_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 chunk2ZHIYXHV_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,59 @@ 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
|
|
302
|
-
|
|
303
|
-
if (
|
|
304
|
-
|
|
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
|
+
});
|
|
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
|
+
}
|
|
311
216
|
try {
|
|
312
|
-
|
|
217
|
+
const { response } = await chunk2ZHIYXHV_cjs.sendOnWire({
|
|
218
|
+
url,
|
|
219
|
+
method: init.method ?? "GET",
|
|
220
|
+
fetchOptions,
|
|
221
|
+
headers,
|
|
222
|
+
...init.body !== void 0 && init.body !== null ? { body: init.body } : {},
|
|
223
|
+
...callerSignal ? { signal: callerSignal } : {},
|
|
224
|
+
// No deadline unless the caller set one: the raw lane carries bytes
|
|
225
|
+
// and long reads whose length only the caller knows.
|
|
226
|
+
connectTimeoutMs: options.timeoutMs ?? 24 * 60 * 60 * 1e3,
|
|
227
|
+
totalTimeoutMs: null,
|
|
228
|
+
...options.onUploadProgress ? { onUploadProgress: options.onUploadProgress } : {}
|
|
229
|
+
});
|
|
230
|
+
return response;
|
|
313
231
|
} catch (error) {
|
|
314
|
-
if (
|
|
315
|
-
throw new
|
|
232
|
+
if (chunkPKYPPATQ_cjs.isNetError(error) && error.code === "aborted") {
|
|
233
|
+
throw callerSignal?.reason instanceof Error ? callerSignal.reason : new DOMException("The request was cancelled.", "AbortError");
|
|
234
|
+
}
|
|
235
|
+
if (options.timeoutMs !== void 0 && chunkPKYPPATQ_cjs.isNetError(error) && error.code === "connect-timeout") {
|
|
236
|
+
throw new chunk2ZHIYXHV_cjs.BackendApiError({
|
|
316
237
|
code: "request_timeout",
|
|
317
238
|
detail: `${init.method ?? "GET"} ${url} exceeded ${options.timeoutMs}ms`,
|
|
318
239
|
userMessage: "The request timed out \u2014 please retry.",
|
|
319
240
|
status: 504
|
|
320
241
|
});
|
|
321
242
|
}
|
|
243
|
+
if (chunkPKYPPATQ_cjs.isNetError(error) && (error.code === "network" || error.code === "offline")) {
|
|
244
|
+
throw error.cause instanceof Error ? error.cause : error;
|
|
245
|
+
}
|
|
322
246
|
throw error;
|
|
323
|
-
} finally {
|
|
324
|
-
clearTimeout(timer);
|
|
325
|
-
callerSignal?.removeEventListener("abort", onCallerAbort);
|
|
326
247
|
}
|
|
327
248
|
}
|
|
328
249
|
async function readMatrxJsonResponse(response) {
|
|
329
|
-
if (!response.ok) throw await
|
|
250
|
+
if (!response.ok) throw await chunk2ZHIYXHV_cjs.parseHttpError(response);
|
|
330
251
|
if (response.status === 204) return null;
|
|
331
252
|
return await response.json();
|
|
332
253
|
}
|
|
254
|
+
|
|
255
|
+
// src/core/client.ts
|
|
333
256
|
function classifyStatus(status) {
|
|
334
257
|
return status >= 400 && status < 500 ? "validation_error" : "http_error";
|
|
335
258
|
}
|
|
336
259
|
function normalizeMatrxError(err) {
|
|
337
|
-
if (err instanceof
|
|
260
|
+
if (err instanceof chunk2ZHIYXHV_cjs.OrganizationContextError) {
|
|
338
261
|
return {
|
|
339
262
|
type: "validation_error",
|
|
340
263
|
message: err.message,
|
|
@@ -346,7 +269,7 @@ function normalizeMatrxError(err) {
|
|
|
346
269
|
if (err instanceof DOMException && err.name === "AbortError") {
|
|
347
270
|
return { type: "abort_error", message: "Request was cancelled." };
|
|
348
271
|
}
|
|
349
|
-
if (err instanceof
|
|
272
|
+
if (err instanceof chunk2ZHIYXHV_cjs.MatrxApiError) {
|
|
350
273
|
return {
|
|
351
274
|
type: classifyStatus(err.status),
|
|
352
275
|
message: honestTransportMessage(err.message, err.status),
|
|
@@ -356,7 +279,7 @@ function normalizeMatrxError(err) {
|
|
|
356
279
|
name: err.name
|
|
357
280
|
};
|
|
358
281
|
}
|
|
359
|
-
if (err instanceof
|
|
282
|
+
if (err instanceof chunk2ZHIYXHV_cjs.BackendApiError) {
|
|
360
283
|
return {
|
|
361
284
|
type: "network_error",
|
|
362
285
|
message: honestTransportMessage(
|
|
@@ -369,7 +292,7 @@ function normalizeMatrxError(err) {
|
|
|
369
292
|
...err.details !== null ? { serverDetail: err.details } : {}
|
|
370
293
|
};
|
|
371
294
|
}
|
|
372
|
-
if (
|
|
295
|
+
if (chunkPKYPPATQ_cjs.isNetError(err)) {
|
|
373
296
|
if (err.code === "aborted") {
|
|
374
297
|
return { type: "abort_error", message: err.message };
|
|
375
298
|
}
|
|
@@ -403,7 +326,7 @@ function normalizeMatrxError(err) {
|
|
|
403
326
|
}
|
|
404
327
|
return { type: "network_error", message: err.message };
|
|
405
328
|
}
|
|
406
|
-
return { type: "unknown", message:
|
|
329
|
+
return { type: "unknown", message: chunkPKYPPATQ_cjs.extractErrorMessage(err) };
|
|
407
330
|
}
|
|
408
331
|
var PRODUCTION_CONNECT_TIMEOUT_MS = 15e3;
|
|
409
332
|
function stripContentType(headers) {
|
|
@@ -414,6 +337,7 @@ function stripContentType(headers) {
|
|
|
414
337
|
);
|
|
415
338
|
}
|
|
416
339
|
var ORGANIZATION_HEADER = "x-organization-id";
|
|
340
|
+
var ORGANIZATION_HEADER_CANONICAL = "X-Organization-Id";
|
|
417
341
|
function readOrganizationHeader(headers) {
|
|
418
342
|
for (const [name, value] of Object.entries(headers ?? {})) {
|
|
419
343
|
if (name.toLowerCase() === ORGANIZATION_HEADER && value.trim().length > 0) {
|
|
@@ -433,14 +357,16 @@ function createMatrxTransport(options) {
|
|
|
433
357
|
const {
|
|
434
358
|
baseUrl,
|
|
435
359
|
resolveTarget,
|
|
436
|
-
credentials
|
|
360
|
+
credentials,
|
|
437
361
|
organizationId,
|
|
438
362
|
aiApiVersion,
|
|
439
363
|
connectTimeoutMs = PRODUCTION_CONNECT_TIMEOUT_MS,
|
|
440
364
|
totalTimeoutMs = null,
|
|
441
365
|
expectedErrorStatuses,
|
|
442
366
|
diagnostics,
|
|
443
|
-
source = "matrxTransport"
|
|
367
|
+
source = "matrxTransport",
|
|
368
|
+
refreshCredentials,
|
|
369
|
+
readyTimeoutMs
|
|
444
370
|
} = options;
|
|
445
371
|
if (baseUrl === void 0 === (resolveTarget === void 0)) {
|
|
446
372
|
throw new Error(
|
|
@@ -449,32 +375,28 @@ function createMatrxTransport(options) {
|
|
|
449
375
|
}
|
|
450
376
|
const resolve = resolveTarget ?? (() => ({ baseUrl }));
|
|
451
377
|
const resolveVersion = () => {
|
|
452
|
-
if (aiApiVersion === void 0) return MATRX_AI_API_VERSION_DEFAULT;
|
|
378
|
+
if (aiApiVersion === void 0) return chunk2ZHIYXHV_cjs.MATRX_AI_API_VERSION_DEFAULT;
|
|
453
379
|
return typeof aiApiVersion === "function" ? aiApiVersion() : aiApiVersion;
|
|
454
380
|
};
|
|
455
381
|
const resolveOrganizationId = (callOrganizationId) => {
|
|
456
382
|
if (organizationId === void 0) return null;
|
|
457
|
-
if (callOrganizationId !== null) return
|
|
383
|
+
if (callOrganizationId !== null) return chunk2ZHIYXHV_cjs.requireOrganizationContext(callOrganizationId);
|
|
458
384
|
const candidate = typeof organizationId === "function" ? organizationId() : organizationId;
|
|
459
|
-
return
|
|
385
|
+
return chunk2ZHIYXHV_cjs.requireOrganizationContext(candidate);
|
|
460
386
|
};
|
|
461
387
|
return {
|
|
462
388
|
async fetch(path, init) {
|
|
463
389
|
const target = await resolve(init);
|
|
464
390
|
const callOrganizationId = readOrganizationHeader(init.headers);
|
|
465
|
-
const versionedPath = applyAiApiVersion(path, resolveVersion());
|
|
391
|
+
const versionedPath = chunk2ZHIYXHV_cjs.applyAiApiVersion(path, resolveVersion());
|
|
466
392
|
const url = `${target.baseUrl}${versionedPath}`;
|
|
467
|
-
const credentialHeaders = credentials$1 ? credentials.credentialToHeaders(await credentials$1.get()) : {};
|
|
468
393
|
const policyHeaders = stripContentType(target.policyHeaders ?? {});
|
|
469
|
-
let
|
|
470
|
-
...init.headers,
|
|
471
|
-
...stripContentType(credentialHeaders),
|
|
472
|
-
...callOrganizationId === null ? policyHeaders : stripOrganizationHeader(policyHeaders)
|
|
473
|
-
};
|
|
394
|
+
let overHeaders = callOrganizationId === null ? policyHeaders : stripOrganizationHeader(policyHeaders);
|
|
474
395
|
const orgId = resolveOrganizationId(callOrganizationId);
|
|
475
396
|
if (orgId !== null) {
|
|
476
|
-
|
|
397
|
+
overHeaders = chunk2ZHIYXHV_cjs.applyOrganizationContextHeader(overHeaders, orgId);
|
|
477
398
|
}
|
|
399
|
+
const wireHeaders = callOrganizationId === null ? { ...init.headers } : stripOrganizationHeader({ ...init.headers });
|
|
478
400
|
const info = {
|
|
479
401
|
url,
|
|
480
402
|
method: init.method,
|
|
@@ -485,19 +407,23 @@ function createMatrxTransport(options) {
|
|
|
485
407
|
diagnostics?.onRequest?.(info);
|
|
486
408
|
let response;
|
|
487
409
|
try {
|
|
488
|
-
({ response } = await
|
|
489
|
-
url,
|
|
410
|
+
({ response } = await chunk2ZHIYXHV_cjs.sendOnWire(
|
|
490
411
|
{
|
|
412
|
+
url,
|
|
491
413
|
method: init.method,
|
|
492
|
-
headers,
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
{
|
|
414
|
+
headers: wireHeaders,
|
|
415
|
+
overHeaders: orgId === null && callOrganizationId !== null ? { ...overHeaders, [ORGANIZATION_HEADER_CANONICAL]: callOrganizationId } : overHeaders,
|
|
416
|
+
...init.body !== void 0 ? { body: init.body } : {},
|
|
496
417
|
...init.signal ? { signal: init.signal } : {},
|
|
418
|
+
...init.onUploadProgress ? { onUploadProgress: init.onUploadProgress } : {},
|
|
497
419
|
connectTimeoutMs,
|
|
498
420
|
totalTimeoutMs,
|
|
499
|
-
|
|
500
|
-
|
|
421
|
+
...diagnostics?.onProtocolDowngrade ? { onProtocolDowngrade: diagnostics.onProtocolDowngrade } : {}
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
...credentials ? { credentials } : {},
|
|
425
|
+
...refreshCredentials ? { refreshCredentials } : {},
|
|
426
|
+
...readyTimeoutMs !== void 0 ? { readyTimeoutMs } : {}
|
|
501
427
|
}
|
|
502
428
|
));
|
|
503
429
|
} catch (err) {
|
|
@@ -506,11 +432,11 @@ function createMatrxTransport(options) {
|
|
|
506
432
|
}
|
|
507
433
|
if (!response.ok && !expectedErrorStatuses?.includes(response.status)) {
|
|
508
434
|
const serverDetail = await response.clone().json().catch(() => void 0);
|
|
509
|
-
const code =
|
|
435
|
+
const code = chunk2ZHIYXHV_cjs.extractMatrxErrorCode(serverDetail);
|
|
510
436
|
diagnostics?.onError?.(
|
|
511
437
|
{
|
|
512
438
|
type: classifyStatus(response.status),
|
|
513
|
-
message:
|
|
439
|
+
message: chunk2ZHIYXHV_cjs.extractMatrxErrorMessage(serverDetail) ?? `HTTP ${response.status}`,
|
|
514
440
|
status: response.status,
|
|
515
441
|
serverDetail,
|
|
516
442
|
...code ? { code } : {}
|
|
@@ -523,42 +449,6 @@ function createMatrxTransport(options) {
|
|
|
523
449
|
};
|
|
524
450
|
}
|
|
525
451
|
|
|
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
452
|
// src/core/endpoint-path.ts
|
|
563
453
|
function normalizeLeadingSlash(value) {
|
|
564
454
|
const trimmed = value.trim();
|
|
@@ -580,21 +470,6 @@ function resolveEndpointPath(canonicalPath, config) {
|
|
|
580
470
|
}
|
|
581
471
|
return canonicalPath;
|
|
582
472
|
}
|
|
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
473
|
var RUN_OUTPUT_KINDS = ["text", "image", "video", "audio"];
|
|
599
474
|
var RUN_WAIT_KNOB_FEATURE = "agents.run_wait";
|
|
600
475
|
var RUN_STREAM_LIFETIME_BACKSTOP_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -840,7 +715,7 @@ async function readServerDetail(response) {
|
|
|
840
715
|
}
|
|
841
716
|
}
|
|
842
717
|
async function throwApiError(path, response) {
|
|
843
|
-
throw new
|
|
718
|
+
throw new chunk2ZHIYXHV_cjs.MatrxApiError({
|
|
844
719
|
status: response.status,
|
|
845
720
|
path,
|
|
846
721
|
serverDetail: await readServerDetail(response)
|
|
@@ -861,7 +736,7 @@ function toRunHandle(response, options) {
|
|
|
861
736
|
return {
|
|
862
737
|
requestId: response.headers.get("X-Request-ID"),
|
|
863
738
|
conversationId: response.headers.get("X-Conversation-ID"),
|
|
864
|
-
events:
|
|
739
|
+
events: chunk2ZHIYXHV_cjs.readMatrxNdjsonStream(response.body, {
|
|
865
740
|
...options.signal ? { signal: options.signal } : {},
|
|
866
741
|
...options.maxReadAhead !== void 0 ? { maxReadAhead: options.maxReadAhead } : {},
|
|
867
742
|
...options.onMalformedLine ? { onMalformedLine: options.onMalformedLine } : {},
|
|
@@ -884,7 +759,7 @@ async function requestStream(transport, path, options) {
|
|
|
884
759
|
});
|
|
885
760
|
if (!response.ok) return throwApiError(path, response);
|
|
886
761
|
if (!response.body) {
|
|
887
|
-
throw new
|
|
762
|
+
throw new chunk2ZHIYXHV_cjs.MatrxApiError({
|
|
888
763
|
status: response.status,
|
|
889
764
|
path,
|
|
890
765
|
serverDetail: { code: "missing_response_body" },
|
|
@@ -944,7 +819,7 @@ async function getRuntimeOperationStatus(transport, requestId, options = {}) {
|
|
|
944
819
|
{ method: "GET", ...options.signal ? { signal: options.signal } : {} }
|
|
945
820
|
);
|
|
946
821
|
} catch (error) {
|
|
947
|
-
if (error instanceof
|
|
822
|
+
if (error instanceof chunk2ZHIYXHV_cjs.MatrxApiError && error.status === 404) return null;
|
|
948
823
|
throw error;
|
|
949
824
|
}
|
|
950
825
|
}
|
|
@@ -959,7 +834,7 @@ async function getRuntimeOperationsByLink(transport, linkKind, linkId, options =
|
|
|
959
834
|
{ method: "GET", ...options.signal ? { signal: options.signal } : {} }
|
|
960
835
|
);
|
|
961
836
|
} catch (error) {
|
|
962
|
-
if (error instanceof
|
|
837
|
+
if (error instanceof chunk2ZHIYXHV_cjs.MatrxApiError && error.status === 404) return null;
|
|
963
838
|
throw error;
|
|
964
839
|
}
|
|
965
840
|
}
|
|
@@ -1000,7 +875,7 @@ async function* followRuntimeOperationEvents(transport, executionId, options = {
|
|
|
1000
875
|
...options.signal ? { signal: options.signal } : {}
|
|
1001
876
|
}
|
|
1002
877
|
);
|
|
1003
|
-
const frames =
|
|
878
|
+
const frames = chunk2ZHIYXHV_cjs.readMatrxSseStream(
|
|
1004
879
|
response.body,
|
|
1005
880
|
options.onIncomplete ? { onIncomplete: options.onIncomplete } : {}
|
|
1006
881
|
);
|
|
@@ -1093,27 +968,27 @@ async function rejoinRuntimeOperation(transport, requestId, options = {}) {
|
|
|
1093
968
|
var MATRX_RUN_IN_PROGRESS = "run_in_progress";
|
|
1094
969
|
var MATRX_RESUME_CONFLICT = "resume_conflict";
|
|
1095
970
|
var MATRX_LIVE_STREAM_UNAVAILABLE = "live_stream_unavailable";
|
|
1096
|
-
function
|
|
971
|
+
function isRecord(value) {
|
|
1097
972
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1098
973
|
}
|
|
1099
974
|
function nonBlank(value) {
|
|
1100
975
|
return typeof value === "string" && value.trim() ? value : null;
|
|
1101
976
|
}
|
|
1102
977
|
function detailCandidates(body) {
|
|
1103
|
-
if (!
|
|
978
|
+
if (!isRecord(body)) return [];
|
|
1104
979
|
const out = [];
|
|
1105
|
-
if (
|
|
1106
|
-
if (
|
|
980
|
+
if (isRecord(body.detail)) out.push(body.detail);
|
|
981
|
+
if (isRecord(body.details)) out.push(body.details);
|
|
1107
982
|
out.push(body);
|
|
1108
983
|
return out;
|
|
1109
984
|
}
|
|
1110
985
|
function statusOf(error) {
|
|
1111
|
-
if (!
|
|
986
|
+
if (!isRecord(error) && !(error instanceof Error)) return null;
|
|
1112
987
|
const status = error.status;
|
|
1113
988
|
return typeof status === "number" ? status : null;
|
|
1114
989
|
}
|
|
1115
990
|
function bodyOf(error) {
|
|
1116
|
-
if (!
|
|
991
|
+
if (!isRecord(error) && !(error instanceof Error)) return void 0;
|
|
1117
992
|
return error.serverDetail;
|
|
1118
993
|
}
|
|
1119
994
|
function readMatrxErrorCode(error) {
|
|
@@ -1174,7 +1049,7 @@ function readLiveRunRejoin(error) {
|
|
|
1174
1049
|
rejoinPath,
|
|
1175
1050
|
runId: firstString(candidates, "run_id"),
|
|
1176
1051
|
code,
|
|
1177
|
-
body:
|
|
1052
|
+
body: isRecord(root) ? root : {}
|
|
1178
1053
|
};
|
|
1179
1054
|
}
|
|
1180
1055
|
function readLiveRunRequestId(error) {
|
|
@@ -1190,8 +1065,8 @@ function runtimeOperationRejoinPath(requestId) {
|
|
|
1190
1065
|
return `/runtime/operations/${encodePathSegment(requestId)}/rejoin`;
|
|
1191
1066
|
}
|
|
1192
1067
|
function streamErrorText(eventOrPayload) {
|
|
1193
|
-
if (!
|
|
1194
|
-
const payload = typeof eventOrPayload.event === "string" &&
|
|
1068
|
+
if (!isRecord(eventOrPayload)) return null;
|
|
1069
|
+
const payload = typeof eventOrPayload.event === "string" && isRecord(eventOrPayload.data) ? eventOrPayload.data : eventOrPayload;
|
|
1195
1070
|
return nonBlank(payload.user_message) ?? nonBlank(payload.message);
|
|
1196
1071
|
}
|
|
1197
1072
|
async function openMatrxStream(transport, path, options = {}) {
|
|
@@ -1203,7 +1078,7 @@ async function openMatrxStream(transport, path, options = {}) {
|
|
|
1203
1078
|
return toRunHandle(response, options);
|
|
1204
1079
|
}
|
|
1205
1080
|
function withRunOrganization(transport, organizationId) {
|
|
1206
|
-
const orgId =
|
|
1081
|
+
const orgId = chunk2ZHIYXHV_cjs.requireOrganizationContext(organizationId);
|
|
1207
1082
|
return {
|
|
1208
1083
|
fetch: (path, init) => transport.fetch(path, {
|
|
1209
1084
|
...init,
|
|
@@ -1230,7 +1105,7 @@ async function followWorkflowRunEvents(transport, runId, options) {
|
|
|
1230
1105
|
throw error;
|
|
1231
1106
|
}
|
|
1232
1107
|
try {
|
|
1233
|
-
for await (const frame of
|
|
1108
|
+
for await (const frame of chunk2ZHIYXHV_cjs.readMatrxSseStream(
|
|
1234
1109
|
response.body
|
|
1235
1110
|
)) {
|
|
1236
1111
|
if (frame.event === "end") return { ended: true };
|
|
@@ -1241,7 +1116,7 @@ async function followWorkflowRunEvents(transport, runId, options) {
|
|
|
1241
1116
|
} catch {
|
|
1242
1117
|
continue;
|
|
1243
1118
|
}
|
|
1244
|
-
if (!
|
|
1119
|
+
if (!isRecord(parsed)) continue;
|
|
1245
1120
|
options.onEvent(parsed, parsed.event === "node_stream" ? null : frame.seq);
|
|
1246
1121
|
}
|
|
1247
1122
|
} catch (error) {
|
|
@@ -1276,7 +1151,7 @@ async function resumeOrRejoin(transport, resumeCall, options) {
|
|
|
1276
1151
|
} catch (error) {
|
|
1277
1152
|
const target = readLiveRunRejoin(error);
|
|
1278
1153
|
if (!target) {
|
|
1279
|
-
if (error instanceof
|
|
1154
|
+
if (error instanceof chunk2ZHIYXHV_cjs.MatrxApiError && isResumeConflict(error)) {
|
|
1280
1155
|
return { kind: "resume_conflict", error };
|
|
1281
1156
|
}
|
|
1282
1157
|
throw error;
|
|
@@ -1692,7 +1567,7 @@ async function reportProviderSessionUsage(transport, usage, options = {}) {
|
|
|
1692
1567
|
});
|
|
1693
1568
|
return "ok";
|
|
1694
1569
|
} catch (error) {
|
|
1695
|
-
if (error instanceof
|
|
1570
|
+
if (error instanceof chunk2ZHIYXHV_cjs.MatrxApiError) {
|
|
1696
1571
|
const status = error.status;
|
|
1697
1572
|
if (status >= 400 && status < 500 && status !== 401 && status !== 408 && status !== 425 && status !== 429) {
|
|
1698
1573
|
console.warn(`[provider-usage] server refused ${usage.provider} usage ${usage.usage_id} (${status})`);
|
|
@@ -1812,11 +1687,11 @@ var MatrxRunError = class extends Error {
|
|
|
1812
1687
|
this.partialText = args.partialText ?? "";
|
|
1813
1688
|
}
|
|
1814
1689
|
};
|
|
1815
|
-
function
|
|
1690
|
+
function isRecord2(value) {
|
|
1816
1691
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1817
1692
|
}
|
|
1818
1693
|
function stringField(value, key) {
|
|
1819
|
-
if (!
|
|
1694
|
+
if (!isRecord2(value)) return null;
|
|
1820
1695
|
const field = value[key];
|
|
1821
1696
|
return typeof field === "string" && field ? field : null;
|
|
1822
1697
|
}
|
|
@@ -1836,7 +1711,7 @@ async function runAgentToCompletion(transport, agentId, request, options = {}) {
|
|
|
1836
1711
|
continue;
|
|
1837
1712
|
}
|
|
1838
1713
|
if (envelope.event === "error" && failure === null) {
|
|
1839
|
-
const payload =
|
|
1714
|
+
const payload = isRecord2(envelope.data) ? envelope.data : null;
|
|
1840
1715
|
failure = new MatrxRunError({
|
|
1841
1716
|
message: streamErrorText(payload) ?? "The agent run failed",
|
|
1842
1717
|
errorPayload: payload,
|
|
@@ -1844,12 +1719,12 @@ async function runAgentToCompletion(transport, agentId, request, options = {}) {
|
|
|
1844
1719
|
});
|
|
1845
1720
|
continue;
|
|
1846
1721
|
}
|
|
1847
|
-
if (envelope.event !== "completion" || !
|
|
1722
|
+
if (envelope.event !== "completion" || !isRecord2(envelope.data)) continue;
|
|
1848
1723
|
if (envelope.data.operation !== "user_request") continue;
|
|
1849
1724
|
completion = envelope.data;
|
|
1850
1725
|
const status = envelope.data.status;
|
|
1851
1726
|
if ((status === "failed" || status === "cancelled") && failure === null) {
|
|
1852
|
-
const result =
|
|
1727
|
+
const result = isRecord2(envelope.data.result) ? envelope.data.result : null;
|
|
1853
1728
|
failure = new MatrxRunError({
|
|
1854
1729
|
message: stringField(result, "error") ?? stringField(result, "user_message") ?? `The agent run ${status}`,
|
|
1855
1730
|
completionStatus: status,
|
|
@@ -2374,10 +2249,6 @@ var ENDPOINTS = {
|
|
|
2374
2249
|
}
|
|
2375
2250
|
};
|
|
2376
2251
|
|
|
2377
|
-
Object.defineProperty(exports, "monitorStream", {
|
|
2378
|
-
enumerable: true,
|
|
2379
|
-
get: function () { return chunkFNIYADWI_cjs.monitorStream; }
|
|
2380
|
-
});
|
|
2381
2252
|
Object.defineProperty(exports, "API_KEY_PREFIX", {
|
|
2382
2253
|
enumerable: true,
|
|
2383
2254
|
get: function () { return chunkMVXD6WI6_cjs.API_KEY_PREFIX; }
|
|
@@ -2396,170 +2267,209 @@ Object.defineProperty(exports, "toCredentialsPort", {
|
|
|
2396
2267
|
});
|
|
2397
2268
|
Object.defineProperty(exports, "BackendApiError", {
|
|
2398
2269
|
enumerable: true,
|
|
2399
|
-
get: function () { return
|
|
2270
|
+
get: function () { return chunk2ZHIYXHV_cjs.BackendApiError; }
|
|
2400
2271
|
});
|
|
2401
2272
|
Object.defineProperty(exports, "CONTRACT_SHA256", {
|
|
2402
2273
|
enumerable: true,
|
|
2403
|
-
get: function () { return
|
|
2274
|
+
get: function () { return chunk2ZHIYXHV_cjs.CONTRACT_SHA256; }
|
|
2404
2275
|
});
|
|
2405
2276
|
Object.defineProperty(exports, "DEPLOYMENTS", {
|
|
2406
2277
|
enumerable: true,
|
|
2407
|
-
get: function () { return
|
|
2278
|
+
get: function () { return chunk2ZHIYXHV_cjs.DEPLOYMENTS; }
|
|
2408
2279
|
});
|
|
2409
2280
|
Object.defineProperty(exports, "DOMAINS", {
|
|
2410
2281
|
enumerable: true,
|
|
2411
|
-
get: function () { return
|
|
2282
|
+
get: function () { return chunk2ZHIYXHV_cjs.DOMAINS; }
|
|
2283
|
+
});
|
|
2284
|
+
Object.defineProperty(exports, "MATRX_AI_API_VERSION_DEFAULT", {
|
|
2285
|
+
enumerable: true,
|
|
2286
|
+
get: function () { return chunk2ZHIYXHV_cjs.MATRX_AI_API_VERSION_DEFAULT; }
|
|
2412
2287
|
});
|
|
2413
2288
|
Object.defineProperty(exports, "MatrxApiError", {
|
|
2414
2289
|
enumerable: true,
|
|
2415
|
-
get: function () { return
|
|
2290
|
+
get: function () { return chunk2ZHIYXHV_cjs.MatrxApiError; }
|
|
2416
2291
|
});
|
|
2417
2292
|
Object.defineProperty(exports, "OrganizationContextError", {
|
|
2418
2293
|
enumerable: true,
|
|
2419
|
-
get: function () { return
|
|
2294
|
+
get: function () { return chunk2ZHIYXHV_cjs.OrganizationContextError; }
|
|
2420
2295
|
});
|
|
2421
2296
|
Object.defineProperty(exports, "StreamTransportError", {
|
|
2422
2297
|
enumerable: true,
|
|
2423
|
-
get: function () { return
|
|
2298
|
+
get: function () { return chunk2ZHIYXHV_cjs.StreamTransportError; }
|
|
2299
|
+
});
|
|
2300
|
+
Object.defineProperty(exports, "V2_COVERED_AI_PATH_TEMPLATES", {
|
|
2301
|
+
enumerable: true,
|
|
2302
|
+
get: function () { return chunk2ZHIYXHV_cjs.V2_COVERED_AI_PATH_TEMPLATES; }
|
|
2303
|
+
});
|
|
2304
|
+
Object.defineProperty(exports, "aiVersionPathOverrides", {
|
|
2305
|
+
enumerable: true,
|
|
2306
|
+
get: function () { return chunk2ZHIYXHV_cjs.aiVersionPathOverrides; }
|
|
2307
|
+
});
|
|
2308
|
+
Object.defineProperty(exports, "applyAiApiVersion", {
|
|
2309
|
+
enumerable: true,
|
|
2310
|
+
get: function () { return chunk2ZHIYXHV_cjs.applyAiApiVersion; }
|
|
2424
2311
|
});
|
|
2425
2312
|
Object.defineProperty(exports, "applyOrganizationContextHeader", {
|
|
2426
2313
|
enumerable: true,
|
|
2427
|
-
get: function () { return
|
|
2314
|
+
get: function () { return chunk2ZHIYXHV_cjs.applyOrganizationContextHeader; }
|
|
2428
2315
|
});
|
|
2429
2316
|
Object.defineProperty(exports, "assertOrganizationMatchesOperation", {
|
|
2430
2317
|
enumerable: true,
|
|
2431
|
-
get: function () { return
|
|
2318
|
+
get: function () { return chunk2ZHIYXHV_cjs.assertOrganizationMatchesOperation; }
|
|
2432
2319
|
});
|
|
2433
2320
|
Object.defineProperty(exports, "assertQueryOrganizationMatchesContext", {
|
|
2434
2321
|
enumerable: true,
|
|
2435
|
-
get: function () { return
|
|
2322
|
+
get: function () { return chunk2ZHIYXHV_cjs.assertQueryOrganizationMatchesContext; }
|
|
2436
2323
|
});
|
|
2437
2324
|
Object.defineProperty(exports, "createApi", {
|
|
2438
2325
|
enumerable: true,
|
|
2439
|
-
get: function () { return
|
|
2326
|
+
get: function () { return chunk2ZHIYXHV_cjs.createApi; }
|
|
2440
2327
|
});
|
|
2441
2328
|
Object.defineProperty(exports, "createOrganizationOperation", {
|
|
2442
2329
|
enumerable: true,
|
|
2443
|
-
get: function () { return
|
|
2330
|
+
get: function () { return chunk2ZHIYXHV_cjs.createOrganizationOperation; }
|
|
2444
2331
|
});
|
|
2445
2332
|
Object.defineProperty(exports, "describeBackendFailure", {
|
|
2446
2333
|
enumerable: true,
|
|
2447
|
-
get: function () { return
|
|
2334
|
+
get: function () { return chunk2ZHIYXHV_cjs.describeBackendFailure; }
|
|
2448
2335
|
});
|
|
2449
2336
|
Object.defineProperty(exports, "extractMatrxErrorCode", {
|
|
2450
2337
|
enumerable: true,
|
|
2451
|
-
get: function () { return
|
|
2338
|
+
get: function () { return chunk2ZHIYXHV_cjs.extractMatrxErrorCode; }
|
|
2452
2339
|
});
|
|
2453
2340
|
Object.defineProperty(exports, "extractMatrxErrorMessage", {
|
|
2454
2341
|
enumerable: true,
|
|
2455
|
-
get: function () { return
|
|
2342
|
+
get: function () { return chunk2ZHIYXHV_cjs.extractMatrxErrorMessage; }
|
|
2343
|
+
});
|
|
2344
|
+
Object.defineProperty(exports, "fetchWithMatrxProtocolFallback", {
|
|
2345
|
+
enumerable: true,
|
|
2346
|
+
get: function () { return chunk2ZHIYXHV_cjs.fetchWithMatrxProtocolFallback; }
|
|
2456
2347
|
});
|
|
2457
2348
|
Object.defineProperty(exports, "getUserMessage", {
|
|
2458
2349
|
enumerable: true,
|
|
2459
|
-
get: function () { return
|
|
2350
|
+
get: function () { return chunk2ZHIYXHV_cjs.getUserMessage; }
|
|
2351
|
+
});
|
|
2352
|
+
Object.defineProperty(exports, "isCoveredAiPath", {
|
|
2353
|
+
enumerable: true,
|
|
2354
|
+
get: function () { return chunk2ZHIYXHV_cjs.isCoveredAiPath; }
|
|
2460
2355
|
});
|
|
2461
2356
|
Object.defineProperty(exports, "isGenericUserMessage", {
|
|
2462
2357
|
enumerable: true,
|
|
2463
|
-
get: function () { return
|
|
2358
|
+
get: function () { return chunk2ZHIYXHV_cjs.isGenericUserMessage; }
|
|
2464
2359
|
});
|
|
2465
2360
|
Object.defineProperty(exports, "isStreamTransportLost", {
|
|
2466
2361
|
enumerable: true,
|
|
2467
|
-
get: function () { return
|
|
2362
|
+
get: function () { return chunk2ZHIYXHV_cjs.isStreamTransportLost; }
|
|
2363
|
+
});
|
|
2364
|
+
Object.defineProperty(exports, "isV2Path", {
|
|
2365
|
+
enumerable: true,
|
|
2366
|
+
get: function () { return chunk2ZHIYXHV_cjs.isV2Path; }
|
|
2468
2367
|
});
|
|
2469
2368
|
Object.defineProperty(exports, "openJsonOrStream", {
|
|
2470
2369
|
enumerable: true,
|
|
2471
|
-
get: function () { return
|
|
2370
|
+
get: function () { return chunk2ZHIYXHV_cjs.openJsonOrStream; }
|
|
2472
2371
|
});
|
|
2473
2372
|
Object.defineProperty(exports, "openStream", {
|
|
2474
2373
|
enumerable: true,
|
|
2475
|
-
get: function () { return
|
|
2374
|
+
get: function () { return chunk2ZHIYXHV_cjs.openStream; }
|
|
2476
2375
|
});
|
|
2477
2376
|
Object.defineProperty(exports, "parseCallApiError", {
|
|
2478
2377
|
enumerable: true,
|
|
2479
|
-
get: function () { return
|
|
2378
|
+
get: function () { return chunk2ZHIYXHV_cjs.parseCallApiError; }
|
|
2480
2379
|
});
|
|
2481
2380
|
Object.defineProperty(exports, "parseHttpError", {
|
|
2482
2381
|
enumerable: true,
|
|
2483
|
-
get: function () { return
|
|
2382
|
+
get: function () { return chunk2ZHIYXHV_cjs.parseHttpError; }
|
|
2484
2383
|
});
|
|
2485
2384
|
Object.defineProperty(exports, "parseHttpErrorBody", {
|
|
2486
2385
|
enumerable: true,
|
|
2487
|
-
get: function () { return
|
|
2386
|
+
get: function () { return chunk2ZHIYXHV_cjs.parseHttpErrorBody; }
|
|
2488
2387
|
});
|
|
2489
2388
|
Object.defineProperty(exports, "parsePersistedBackendError", {
|
|
2490
2389
|
enumerable: true,
|
|
2491
|
-
get: function () { return
|
|
2390
|
+
get: function () { return chunk2ZHIYXHV_cjs.parsePersistedBackendError; }
|
|
2492
2391
|
});
|
|
2493
2392
|
Object.defineProperty(exports, "parseStreamError", {
|
|
2494
2393
|
enumerable: true,
|
|
2495
|
-
get: function () { return
|
|
2394
|
+
get: function () { return chunk2ZHIYXHV_cjs.parseStreamError; }
|
|
2496
2395
|
});
|
|
2497
2396
|
Object.defineProperty(exports, "requireOrganizationContext", {
|
|
2498
2397
|
enumerable: true,
|
|
2499
|
-
get: function () { return
|
|
2398
|
+
get: function () { return chunk2ZHIYXHV_cjs.requireOrganizationContext; }
|
|
2399
|
+
});
|
|
2400
|
+
Object.defineProperty(exports, "toV1FallbackUrl", {
|
|
2401
|
+
enumerable: true,
|
|
2402
|
+
get: function () { return chunk2ZHIYXHV_cjs.toV1FallbackUrl; }
|
|
2403
|
+
});
|
|
2404
|
+
Object.defineProperty(exports, "toV2Path", {
|
|
2405
|
+
enumerable: true,
|
|
2406
|
+
get: function () { return chunk2ZHIYXHV_cjs.toV2Path; }
|
|
2500
2407
|
});
|
|
2501
2408
|
Object.defineProperty(exports, "unwrapUpstreamError", {
|
|
2502
2409
|
enumerable: true,
|
|
2503
|
-
get: function () { return
|
|
2410
|
+
get: function () { return chunk2ZHIYXHV_cjs.unwrapUpstreamError; }
|
|
2504
2411
|
});
|
|
2505
2412
|
Object.defineProperty(exports, "AbortedError", {
|
|
2506
2413
|
enumerable: true,
|
|
2507
|
-
get: function () { return
|
|
2414
|
+
get: function () { return chunkPKYPPATQ_cjs.AbortedError; }
|
|
2508
2415
|
});
|
|
2509
2416
|
Object.defineProperty(exports, "ConnectTimeoutError", {
|
|
2510
2417
|
enumerable: true,
|
|
2511
|
-
get: function () { return
|
|
2418
|
+
get: function () { return chunkPKYPPATQ_cjs.ConnectTimeoutError; }
|
|
2512
2419
|
});
|
|
2513
2420
|
Object.defineProperty(exports, "HeartbeatTimeoutError", {
|
|
2514
2421
|
enumerable: true,
|
|
2515
|
-
get: function () { return
|
|
2422
|
+
get: function () { return chunkPKYPPATQ_cjs.HeartbeatTimeoutError; }
|
|
2516
2423
|
});
|
|
2517
2424
|
Object.defineProperty(exports, "HttpError", {
|
|
2518
2425
|
enumerable: true,
|
|
2519
|
-
get: function () { return
|
|
2426
|
+
get: function () { return chunkPKYPPATQ_cjs.HttpError; }
|
|
2520
2427
|
});
|
|
2521
2428
|
Object.defineProperty(exports, "NetError", {
|
|
2522
2429
|
enumerable: true,
|
|
2523
|
-
get: function () { return
|
|
2430
|
+
get: function () { return chunkPKYPPATQ_cjs.NetError; }
|
|
2524
2431
|
});
|
|
2525
2432
|
Object.defineProperty(exports, "NetworkError", {
|
|
2526
2433
|
enumerable: true,
|
|
2527
|
-
get: function () { return
|
|
2434
|
+
get: function () { return chunkPKYPPATQ_cjs.NetworkError; }
|
|
2528
2435
|
});
|
|
2529
2436
|
Object.defineProperty(exports, "OfflineError", {
|
|
2530
2437
|
enumerable: true,
|
|
2531
|
-
get: function () { return
|
|
2438
|
+
get: function () { return chunkPKYPPATQ_cjs.OfflineError; }
|
|
2532
2439
|
});
|
|
2533
2440
|
Object.defineProperty(exports, "TotalTimeoutError", {
|
|
2534
2441
|
enumerable: true,
|
|
2535
|
-
get: function () { return
|
|
2442
|
+
get: function () { return chunkPKYPPATQ_cjs.TotalTimeoutError; }
|
|
2536
2443
|
});
|
|
2537
2444
|
Object.defineProperty(exports, "extractErrorMessage", {
|
|
2538
2445
|
enumerable: true,
|
|
2539
|
-
get: function () { return
|
|
2446
|
+
get: function () { return chunkPKYPPATQ_cjs.extractErrorMessage; }
|
|
2540
2447
|
});
|
|
2541
2448
|
Object.defineProperty(exports, "isNetError", {
|
|
2542
2449
|
enumerable: true,
|
|
2543
|
-
get: function () { return
|
|
2450
|
+
get: function () { return chunkPKYPPATQ_cjs.isNetError; }
|
|
2544
2451
|
});
|
|
2545
2452
|
Object.defineProperty(exports, "isTransportFailure", {
|
|
2546
2453
|
enumerable: true,
|
|
2547
|
-
get: function () { return
|
|
2454
|
+
get: function () { return chunkPKYPPATQ_cjs.isTransportFailure; }
|
|
2455
|
+
});
|
|
2456
|
+
Object.defineProperty(exports, "monitorStream", {
|
|
2457
|
+
enumerable: true,
|
|
2458
|
+
get: function () { return chunkPKYPPATQ_cjs.monitorStream; }
|
|
2548
2459
|
});
|
|
2549
2460
|
Object.defineProperty(exports, "resilientFetch", {
|
|
2550
2461
|
enumerable: true,
|
|
2551
|
-
get: function () { return
|
|
2462
|
+
get: function () { return chunkPKYPPATQ_cjs.resilientFetch; }
|
|
2552
2463
|
});
|
|
2553
2464
|
Object.defineProperty(exports, "toNetError", {
|
|
2554
2465
|
enumerable: true,
|
|
2555
|
-
get: function () { return
|
|
2466
|
+
get: function () { return chunkPKYPPATQ_cjs.toNetError; }
|
|
2556
2467
|
});
|
|
2557
2468
|
Object.defineProperty(exports, "withRetry", {
|
|
2558
2469
|
enumerable: true,
|
|
2559
|
-
get: function () { return
|
|
2470
|
+
get: function () { return chunkPKYPPATQ_cjs.withRetry; }
|
|
2560
2471
|
});
|
|
2561
2472
|
exports.ENDPOINTS = ENDPOINTS;
|
|
2562
|
-
exports.MATRX_AI_API_VERSION_DEFAULT = MATRX_AI_API_VERSION_DEFAULT;
|
|
2563
2473
|
exports.MATRX_LIVE_STREAM_UNAVAILABLE = MATRX_LIVE_STREAM_UNAVAILABLE;
|
|
2564
2474
|
exports.MATRX_RESUME_CONFLICT = MATRX_RESUME_CONFLICT;
|
|
2565
2475
|
exports.MATRX_RUN_IN_PROGRESS = MATRX_RUN_IN_PROGRESS;
|
|
@@ -2569,11 +2479,7 @@ exports.RUN_OUTPUT_KINDS = RUN_OUTPUT_KINDS;
|
|
|
2569
2479
|
exports.RUN_STREAM_LIFETIME_BACKSTOP_MS = RUN_STREAM_LIFETIME_BACKSTOP_MS;
|
|
2570
2480
|
exports.RUN_WAIT_KNOB_FEATURE = RUN_WAIT_KNOB_FEATURE;
|
|
2571
2481
|
exports.TERMINAL_MATRX_RUNTIME_STATUSES = TERMINAL_MATRX_RUNTIME_STATUSES;
|
|
2572
|
-
exports.V2_COVERED_AI_PATH_TEMPLATES = V2_COVERED_AI_PATH_TEMPLATES;
|
|
2573
2482
|
exports.WARM_PATH = WARM_PATH;
|
|
2574
|
-
exports.aiVersionPathOverrides = aiVersionPathOverrides;
|
|
2575
|
-
exports.applyAiApiVersion = applyAiApiVersion;
|
|
2576
|
-
exports.applyDesktopTargetToRequestBody = applyDesktopTargetToRequestBody;
|
|
2577
2483
|
exports.bareStatusSentence = bareStatusSentence;
|
|
2578
2484
|
exports.buildMatrxRequestBody = buildMatrxRequestBody;
|
|
2579
2485
|
exports.buildMatrxRequestUrl = buildMatrxRequestUrl;
|
|
@@ -2589,7 +2495,6 @@ exports.createStreamReplayCursor = createStreamReplayCursor;
|
|
|
2589
2495
|
exports.createWarmup = createWarmup;
|
|
2590
2496
|
exports.encodePathSegment = encodePathSegment;
|
|
2591
2497
|
exports.executeMatrxCall = executeMatrxCall;
|
|
2592
|
-
exports.fetchWithMatrxProtocolFallback = fetchWithMatrxProtocolFallback;
|
|
2593
2498
|
exports.followRuntimeOperationEvents = followRuntimeOperationEvents;
|
|
2594
2499
|
exports.followRuntimeOperationToEnd = followRuntimeOperationToEnd;
|
|
2595
2500
|
exports.followServerJob = followServerJob;
|
|
@@ -2599,17 +2504,14 @@ exports.getRuntimeOperationStatus = getRuntimeOperationStatus;
|
|
|
2599
2504
|
exports.getRuntimeOperationsByLink = getRuntimeOperationsByLink;
|
|
2600
2505
|
exports.honestTransportMessage = honestTransportMessage;
|
|
2601
2506
|
exports.isBareTransportCode = isBareTransportCode;
|
|
2602
|
-
exports.isCoveredAiPath = isCoveredAiPath;
|
|
2603
2507
|
exports.isEmptyProviderUsage = isEmptyProviderUsage;
|
|
2604
2508
|
exports.isJobOutputKind = isJobOutputKind;
|
|
2605
2509
|
exports.isLiveStreamUnavailable = isLiveStreamUnavailable;
|
|
2606
2510
|
exports.isResumeConflict = isResumeConflict;
|
|
2607
2511
|
exports.isServerJobSettled = isServerJobSettled;
|
|
2608
|
-
exports.isV2Path = isV2Path;
|
|
2609
2512
|
exports.listConversationPendingToolCalls = listConversationPendingToolCalls;
|
|
2610
2513
|
exports.listRuntimeOperationEvents = listRuntimeOperationEvents;
|
|
2611
2514
|
exports.listUserPendingToolCalls = listUserPendingToolCalls;
|
|
2612
|
-
exports.logApiTarget = logApiTarget;
|
|
2613
2515
|
exports.mintMatrxConversationId = mintMatrxConversationId;
|
|
2614
2516
|
exports.newEphemeralConversationStart = newEphemeralConversationStart;
|
|
2615
2517
|
exports.newStoredConversationStart = newStoredConversationStart;
|
|
@@ -2654,6 +2556,4 @@ exports.startMandateRun = startMandateRun;
|
|
|
2654
2556
|
exports.streamErrorText = streamErrorText;
|
|
2655
2557
|
exports.submitAgentToolResults = submitAgentToolResults;
|
|
2656
2558
|
exports.toRunHandle = toRunHandle;
|
|
2657
|
-
exports.toV1FallbackUrl = toV1FallbackUrl;
|
|
2658
|
-
exports.toV2Path = toV2Path;
|
|
2659
2559
|
exports.withRunOrganization = withRunOrganization;
|