@ai-matrx/api 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/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-PKYPPATQ.cjs → chunk-2SXAAKGV.cjs} +45 -100
- package/dist/{chunk-JRPLPAIX.js → chunk-ER7WV43R.js} +4 -88
- package/dist/chunk-FNIYADWI.cjs +59 -0
- package/dist/{chunk-PIPE5OML.js → chunk-KIEAFMKB.js} +46 -100
- package/dist/{chunk-EV7AXV2X.cjs → chunk-SME66TWP.cjs} +7 -100
- package/dist/chunk-YTEOFGFC.js +57 -0
- 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 +5 -5
- 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.cjs +4 -4
- package/dist/data.d.cts +1 -1
- package/dist/data.d.ts +1 -1
- package/dist/data.js +2 -2
- 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-YFW4xNti.d.cts → index-BXLIDtlM.d.cts} +1 -1
- package/dist/{index-YFW4xNti.d.ts → index-BXLIDtlM.d.ts} +1 -1
- package/dist/index.cjs +86 -129
- package/dist/index.d.cts +7 -122
- package/dist/index.d.ts +7 -122
- package/dist/index.js +8 -15
- 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 +8 -8
- package/dist/intelligence.d.cts +2 -2
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +3 -3
- package/dist/{keys.generated-DPvmbTFD.d.cts → keys.generated-DE-t9kzx.d.cts} +2 -2
- package/dist/{keys.generated-DPvmbTFD.d.ts → keys.generated-DE-t9kzx.d.ts} +2 -2
- package/dist/knowledge.cjs +43 -43
- package/dist/knowledge.d.cts +1 -1
- package/dist/knowledge.d.ts +1 -1
- 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 +1 -1
- package/dist/marketing.d.ts +1 -1
- 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 +20 -19
- package/dist/net.js +2 -1
- 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/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.d.cts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/web.cjs +27 -27
- package/dist/web.d.cts +1 -1
- package/dist/web.d.ts +1 -1
- package/dist/web.js +2 -2
- package/dist/workflows.cjs +14 -14
- package/dist/workflows.d.cts +1 -1
- package/dist/workflows.d.ts +1 -1
- package/dist/workflows.js +2 -2
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,115 +1,9 @@
|
|
|
1
|
-
import { M as MatrxStreamEnvelope, b as MatrxNdjsonIssue, U as UploadProgress, c as MatrxStreamEnvelopeObservation, d as MatrxSseFrame } from './index-
|
|
2
|
-
export { A as Api, e as ApiRequestInfo, a as ApiStream, f as AuthTier, g as CONTRACT_SHA256, C as CallOptions, h as CreateApiOptions, D as DEPLOYMENTS, i as DOMAINS, j as DeploymentName, E as Environment, H as HttpMethod, J as JsonOrStream, N as NdjsonEvent, O as OperationArgs, k as OperationDescriptor, l as OrgRule, S as SseEvent, m as StreamKind, n as createApi, o as isBinaryType, p as openJsonOrStream, q as openStream } from './index-
|
|
1
|
+
import { M as MatrxStreamEnvelope, b as MatrxNdjsonIssue, U as UploadProgress, c as MatrxStreamEnvelopeObservation, d as MatrxSseFrame } from './index-BXLIDtlM.cjs';
|
|
2
|
+
export { A as Api, e as ApiRequestInfo, a as ApiStream, f as AuthTier, g as CONTRACT_SHA256, C as CallOptions, h as CreateApiOptions, D as DEPLOYMENTS, i as DOMAINS, j as DeploymentName, E as Environment, H as HttpMethod, J as JsonOrStream, N as NdjsonEvent, O as OperationArgs, k as OperationDescriptor, l as OrgRule, S as SseEvent, m as StreamKind, n as createApi, o as isBinaryType, p as openJsonOrStream, q as openStream } from './index-BXLIDtlM.cjs';
|
|
3
3
|
import { CredentialsPort } from '@ai-matrx/auth/credentials';
|
|
4
4
|
export { API_KEY_PREFIX, CredentialsPort, CredentialsSetting, MATRX_HEADERS, MatrxCredential, MatrxCredentialKind, credentialToHeaders, toCredentialsPort } from '@ai-matrx/auth/credentials';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { g as MandateKey, b as DynamicMandateKey } from './keys.generated-DPvmbTFD.cjs';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* The AI API protocol-version policy — which version of the AI runtime a
|
|
11
|
-
* Matrx client talks to, and the v2 → v1 transport fallback (moved in from
|
|
12
|
-
* matrx-frontend `lib/api/ai-api-version.ts` + `call-api.ts::
|
|
13
|
-
* fetchWithV2Fallback` under C22; server truth
|
|
14
|
-
* `aidream/docs/runtime/V2_FRONTEND_MIGRATION.md`).
|
|
15
|
-
*
|
|
16
|
-
* Background: the Python backend exposes a `/v2` runtime-spine namespace that
|
|
17
|
-
* wraps the core AI request surfaces in a request-tracking envelope. Body,
|
|
18
|
-
* headers, and streaming response are BYTE-IDENTICAL to v1 — only the URL
|
|
19
|
-
* differs.
|
|
20
|
-
*
|
|
21
|
-
* ─── The one rule that keeps burning us ─────────────────────────────────────
|
|
22
|
-
* `/v2` is inserted at the FRONT of the in-app path, right before `/ai`:
|
|
23
|
-
*
|
|
24
|
-
* /ai/agents/{id} → /v2/ai/agents/{id} ✅ correct
|
|
25
|
-
* /ai/v2/agents/… ❌ WRONG (nested) — 404s
|
|
26
|
-
*
|
|
27
|
-
* `toV2Path` below is the ONLY place this transform is spelled out.
|
|
28
|
-
*
|
|
29
|
-
* ─── Scope: ONLY the covered surfaces have a v2 form ────────────────────────
|
|
30
|
-
* chat, manual, agents/{id}, conversations/{id} (+ singular aliases),
|
|
31
|
-
* prompts/{id}, mandates/{key}. EVERYTHING ELSE — cancel, warm, resume,
|
|
32
|
-
* fork-and-run, runtime operations, files … — has NO v2 route, and the server
|
|
33
|
-
* does NOT auto-downgrade (a `/v2` request to an uncovered surface is a plain
|
|
34
|
-
* 404). So the transform is a scoped allowlist, never a blanket prefix.
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
type MatrxAiApiVersion = "v1" | "v2";
|
|
38
|
-
/**
|
|
39
|
-
* The package-wide default AI API version — the production value every Matrx
|
|
40
|
-
* client runs unless its host deliberately overrides
|
|
41
|
-
* (`createMatrxTransport({ aiApiVersion })`).
|
|
42
|
-
*/
|
|
43
|
-
declare const MATRX_AI_API_VERSION_DEFAULT: MatrxAiApiVersion;
|
|
44
|
-
/**
|
|
45
|
-
* The canonical v1 path TEMPLATES the v2 spine covers, `{param}` placeholders
|
|
46
|
-
* intact — for hosts that route through a template registry.
|
|
47
|
-
*/
|
|
48
|
-
declare const V2_COVERED_AI_PATH_TEMPLATES: readonly ["/ai/manual", "/ai/chat", "/ai/agents/{agent_id}", "/ai/agent/{agent_id}", "/ai/conversations/{conversation_id}", "/ai/conversation/{conversation_id}", "/ai/prompts/{prompt_id}", "/ai/mandates/{mandate_key}"];
|
|
49
|
-
/**
|
|
50
|
-
* Insert `/v2` at the front of an in-app path. Idempotent, and prefix-aware:
|
|
51
|
-
* a legacy `/api/` compatibility prefix (stripped server-side) is preserved so
|
|
52
|
-
* `/api/ai/chat` → `/api/v2/ai/chat`.
|
|
53
|
-
*/
|
|
54
|
-
declare function toV2Path(path: string): string;
|
|
55
|
-
/** Whether `path` (already interpolated) is one of the covered surfaces. */
|
|
56
|
-
declare function isCoveredAiPath(path: string): boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Whether an in-app path (or a full URL whose path was built by `toV2Path`)
|
|
59
|
-
* targets the v2 namespace — the guard the downgrade fallback keys off.
|
|
60
|
-
*/
|
|
61
|
-
declare function isV2Path(pathOrUrl: string): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* The inverse of `toV2Path` — strip the `/v2` version segment so a transport
|
|
64
|
-
* failure of the v2 endpoint (network error, 404/405, 5xx BEFORE any stream
|
|
65
|
-
* content) can retry the identical request on the v1 route. Works on a bare
|
|
66
|
-
* path, an `/api`-prefixed path, or a full URL (the `/v2/ai/` shape is unique
|
|
67
|
-
* to the version namespace). Idempotent on non-v2 input.
|
|
68
|
-
*/
|
|
69
|
-
declare function toV1FallbackUrl(url: string): string;
|
|
70
|
-
/**
|
|
71
|
-
* Apply the active AI API version to an ALREADY-INTERPOLATED in-app path.
|
|
72
|
-
*
|
|
73
|
-
* - Covered surface + v2 → `/v2` prefix inserted.
|
|
74
|
-
* - Anything else (or v1) → returned unchanged.
|
|
75
|
-
*
|
|
76
|
-
* Pass the in-app PATH only (no scheme/host); prepend the base URL afterward.
|
|
77
|
-
*/
|
|
78
|
-
declare function applyAiApiVersion(path: string, version: MatrxAiApiVersion): string;
|
|
79
|
-
/** One v2 → v1 downgrade, surfaced to the host's diagnostics sink. */
|
|
80
|
-
interface MatrxProtocolDowngrade {
|
|
81
|
-
/** The failed v2 URL. */
|
|
82
|
-
url: string;
|
|
83
|
-
/** Why the downgrade fired (thrown error text, or `HTTP <status>`). */
|
|
84
|
-
reason: string;
|
|
85
|
-
/** HTTP status when the trigger was a response (404/405/5xx). */
|
|
86
|
-
status?: number;
|
|
87
|
-
}
|
|
88
|
-
interface MatrxProtocolFallbackOptions extends ResilientFetchOptions {
|
|
89
|
-
/**
|
|
90
|
-
* Fired on every downgrade — a sustained stream of these means a v2 surface
|
|
91
|
-
* is unhealthy. The fallback also `console.warn`s unconditionally (parity
|
|
92
|
-
* with the original host pipeline) so the signal never disappears silently.
|
|
93
|
-
*/
|
|
94
|
-
onDowngrade?: (downgrade: MatrxProtocolDowngrade) => void;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* `resilientFetch` with the v2 → v1 transport fallback. Fires ONLY when a
|
|
98
|
-
* `/v2/ai/...` ENDPOINT itself fails — a network-layer throw (non-abort), a
|
|
99
|
-
* 404/405 (surface not on v2), or a 5xx — always BEFORE any stream content is
|
|
100
|
-
* consumed. Never on an application error (those fail identically on v1), and
|
|
101
|
-
* never on a caller abort (a user cancel must not be logged as a downgrade —
|
|
102
|
-
* that poisons the exact telemetry the rollout reads to judge v2 health).
|
|
103
|
-
*/
|
|
104
|
-
declare function fetchWithMatrxProtocolFallback(url: string, init: RequestInit, opts?: MatrxProtocolFallbackOptions): Promise<ResilientFetchResult>;
|
|
105
|
-
/**
|
|
106
|
-
* The exact-match `pathOverrides` map for `resolveEndpointPath` — keyed on the
|
|
107
|
-
* canonical templates, valued at their `/v2` siblings. Empty for v1. Every call
|
|
108
|
-
* that flows through the endpoint-override registry picks up v2 for the covered
|
|
109
|
-
* surfaces — and ONLY the covered surfaces. (Moved from matrx-frontend
|
|
110
|
-
* `lib/api/ai-api-version.ts`, chat-package independence P9.)
|
|
111
|
-
*/
|
|
112
|
-
declare function aiVersionPathOverrides(version: MatrxAiApiVersion): Record<string, string>;
|
|
5
|
+
export { AbortedError, ConnectTimeoutError, HeartbeatTimeoutError, HttpError, NetError, NetErrorCode, NetworkError, OfflineError, ResilientFetchOptions, ResilientFetchResult, RetryOptions, StreamMonitorOptions, TotalTimeoutError, extractErrorMessage, isNetError, isTransportFailure, monitorStream, resilientFetch, toNetError, withRetry } from './net.cjs';
|
|
6
|
+
import { g as MandateKey, b as DynamicMandateKey } from './keys.generated-DE-t9kzx.cjs';
|
|
113
7
|
|
|
114
8
|
/**
|
|
115
9
|
* `@ai-matrx/api` — the Matrx transport port.
|
|
@@ -433,8 +327,6 @@ declare function getUserMessage(error: unknown): string;
|
|
|
433
327
|
* effectively time-to-response), total UNCAPPED (the port cannot tell a JSON
|
|
434
328
|
* call from a long-lived NDJSON/SSE stream; the connect timeout is the JSON
|
|
435
329
|
* guard), via `@ai-matrx/api/net`'s `resilientFetch`;
|
|
436
|
-
* - **protocol** — the AI API version transform (`applyAiApiVersion`, default
|
|
437
|
-
* v2) + the loud v2 → v1 transport fallback (`./protocol`);
|
|
438
330
|
* - **credentials** — read fresh from the injected `CredentialsPort` on EVERY
|
|
439
331
|
* call, so a token refresh mid-run is picked up; mapped to headers by the
|
|
440
332
|
* ONE `credentialToHeaders`;
|
|
@@ -445,7 +337,7 @@ declare function getUserMessage(error: unknown): string;
|
|
|
445
337
|
* - **error classification** — every failure normalizes through
|
|
446
338
|
* `normalizeMatrxError` into the ONE `MatrxCallError` envelope;
|
|
447
339
|
* - **diagnostics** — a typed sink the host wires to its capture/telemetry
|
|
448
|
-
* (`onRequest`, `onError
|
|
340
|
+
* (`onRequest`, `onError`); wiring it is optional,
|
|
449
341
|
* the transport works silently without it.
|
|
450
342
|
*
|
|
451
343
|
* Header merge order is part of the port contract: wire headers first
|
|
@@ -530,8 +422,6 @@ interface MatrxTransportDiagnostics {
|
|
|
530
422
|
* listed in `expectedErrorStatuses`, with the classified envelope.
|
|
531
423
|
*/
|
|
532
424
|
onError?: (error: MatrxCallError, info: MatrxRequestInfo) => void;
|
|
533
|
-
/** Fired on every v2 → v1 protocol downgrade. */
|
|
534
|
-
onProtocolDowngrade?: (downgrade: MatrxProtocolDowngrade) => void;
|
|
535
425
|
}
|
|
536
426
|
interface CreateMatrxTransportOptions {
|
|
537
427
|
/** Fixed base URL, no trailing slash. Exactly one of `baseUrl` / `resolveTarget`. */
|
|
@@ -559,8 +449,6 @@ interface CreateMatrxTransportOptions {
|
|
|
559
449
|
* org in the body only.
|
|
560
450
|
*/
|
|
561
451
|
organizationId?: string | (() => string | null | undefined);
|
|
562
|
-
/** AI API protocol version (value or per-call getter). Default `"v2"`. */
|
|
563
|
-
aiApiVersion?: MatrxAiApiVersion | (() => MatrxAiApiVersion);
|
|
564
452
|
/** Max ms request start → response headers. Default 15_000. */
|
|
565
453
|
connectTimeoutMs?: number;
|
|
566
454
|
/**
|
|
@@ -741,14 +629,11 @@ interface ExecuteMatrxCallRequest<E = MatrxStreamEnvelope> {
|
|
|
741
629
|
onStreamError?: (error: MatrxCallError) => void;
|
|
742
630
|
}
|
|
743
631
|
interface ExecuteMatrxCallHooks<E = MatrxStreamEnvelope> {
|
|
744
|
-
/** Every v2 → v1 protocol downgrade. */
|
|
745
|
-
onProtocolDowngrade?: (downgrade: MatrxProtocolDowngrade) => void;
|
|
746
632
|
/** The host's stream parser (default `parseMatrxNdjsonResponse`). */
|
|
747
633
|
parseStream?: (response: Response, signal?: AbortSignal) => MatrxStreamParse<E>;
|
|
748
634
|
}
|
|
749
635
|
/**
|
|
750
|
-
* Execute one call
|
|
751
|
-
* response resolves as `{ error }`; a thrown failure (network, timeout,
|
|
636
|
+
* Execute one call. An HTTP error response resolves as `{ error }`; a thrown failure (network, timeout,
|
|
752
637
|
* abort, a broken stream) propagates — the caller normalizes it with
|
|
753
638
|
* `normalizeMatrxError` and decides what to capture.
|
|
754
639
|
*/
|
|
@@ -2795,4 +2680,4 @@ declare const ENDPOINTS: {
|
|
|
2795
2680
|
};
|
|
2796
2681
|
};
|
|
2797
2682
|
|
|
2798
|
-
export { BackendApiError, type BackendApiErrorData, type BackendErrorCode, type BackendFailureExplanation, type CreateMatrxTransportOptions, type CreateWarmupOptions, ENDPOINTS, type EndpointOverrideConfig, type ExecuteMatrxCallHooks, type ExecuteMatrxCallRequest, type FollowRuntimeOperationOptions, type FollowRuntimeOperationToEndOptions, type FollowRuntimeOperationToEndResult, type FollowServerJobOptions, type FollowUnavailableRejoinOptions, type JsonRequestOptions,
|
|
2683
|
+
export { BackendApiError, type BackendApiErrorData, type BackendErrorCode, type BackendFailureExplanation, type CreateMatrxTransportOptions, type CreateWarmupOptions, ENDPOINTS, type EndpointOverrideConfig, type ExecuteMatrxCallHooks, type ExecuteMatrxCallRequest, type FollowRuntimeOperationOptions, type FollowRuntimeOperationToEndOptions, type FollowRuntimeOperationToEndResult, type FollowServerJobOptions, type FollowUnavailableRejoinOptions, type JsonRequestOptions, MATRX_LIVE_STREAM_UNAVAILABLE, MATRX_RESUME_CONFLICT, MATRX_RUN_IN_PROGRESS, MATRX_UI_ONLY_BODY_FIELDS, type MatrxAgentStartRequest, MatrxApiError, type MatrxCallError, type MatrxCallResult, type MatrxCallScope, type MatrxCancelResponse, type MatrxChatMessage, type MatrxClientSessionProvider, type MatrxClientToolResult, type MatrxCompletedRun, type MatrxContextAnchor, type MatrxConversationContinueRequest, type MatrxConversationResumeRequest, type MatrxConversationStart, type MatrxEphemeralConversation, type MatrxFollowedOutcome, type MatrxHttpErrorLike, type MatrxHttpMethod, type MatrxJsonObject, type MatrxJsonValue, type MatrxLiveRunRejoin, type MatrxLiveStreamUnavailable, type MatrxMandateStartRequest, type MatrxOperationEventsPage, type MatrxOperationFollowEvent, type MatrxOperationStatusResponse, type MatrxOperationsByLinkResponse, type MatrxPendingCallSummary, type MatrxQueryParams, type MatrxRequestInfo, type MatrxRequestScope, MatrxRunError, type MatrxRunHandle, type MatrxRunPickup, type MatrxRunPickupSettlement, type MatrxRuntimeExecutionStatus, type MatrxRuntimeOperationEvent, type MatrxRuntimeOperationView, type MatrxStoredConversationContinue, type MatrxStoredConversationCreate, type MatrxStreamCallOptions, type MatrxStreamCursorStamp, type MatrxStreamIds, type MatrxStreamParse, type MatrxToolResultsResponse, type MatrxTransport, type MatrxTransportDiagnostics, type MatrxTransportRequest, type MatrxTransportTarget, type MatrxTurnFields, OrganizationContextError, type OrganizationContextErrorCode, type OrganizationOperation, type ParseMatrxNdjsonResponseHooks, type ProviderSessionFailure, type ProviderSessionFailureVerdict, type ProviderSessionUsage, type ProviderSessionUsageReceipt, type ProviderUsageReporter, type ProviderUsageReporterOptions, type ProviderUsageSendResult, type QueryValue, RUN_OUTPUT_KINDS, RUN_STREAM_LIFETIME_BACKSTOP_MS, RUN_WAIT_KNOB_FEATURE, type ResumeOrRejoinOptions, type ResumeOrRejoinOutcome, type RunAgentToCompletionOptions, type RunOutputKind, type RunWait, type RunWaitKnobReader, type SendMatrxRequestOptions, type ServerJobFinalStatus, type ServerJobOutcome, type ServerJobPath, type ServerJobStatus, type ServerJobTarget, type SettleRunPickupOptions, type StreamReplayCursor, type StreamReplayCursorOptions, type StreamRequestOptions, StreamTransportError, TERMINAL_MATRX_RUNTIME_STATUSES, type UpstreamErrorPayload, WARM_PATH, type WarmItem, type WarmReason, type Warmup, applyOrganizationContextHeader, assertOrganizationMatchesOperation, assertQueryOrganizationMatchesContext, bareStatusSentence, buildMatrxRequestBody, buildMatrxRequestUrl, buildQuery, buildSafeRequestLog, cancelAgentRun, continueAgentConversation, continueEphemeralConversationStart, continueStoredConversationStart, createMatrxTransport, createOrganizationOperation, createProviderUsageReporter, createStreamReplayCursor, createWarmup, describeBackendFailure, encodePathSegment, executeMatrxCall, extractMatrxErrorCode, extractMatrxErrorMessage, followRuntimeOperationEvents, followRuntimeOperationToEnd, followServerJob, followUnavailableRejoin, followWorkflowRunEvents, getRuntimeOperationStatus, getRuntimeOperationsByLink, getUserMessage, honestTransportMessage, isBareTransportCode, isEmptyProviderUsage, isGenericUserMessage, isJobOutputKind, isLiveStreamUnavailable, isResumeConflict, isServerJobSettled, isStreamTransportLost, listConversationPendingToolCalls, listRuntimeOperationEvents, listUserPendingToolCalls, mintMatrxConversationId, newEphemeralConversationStart, newStoredConversationStart, normalizeMatrxError, openMatrxStream, parseCallApiError, parseHttpError, parseHttpErrorBody, parseMatrxNdjsonResponse, parsePersistedBackendError, parseStreamError, pickServerJobOperation, preconnectServer, providerSessionFailureBody, providerSessionUsageBody, readConversationOrganizationId, readLiveRunRejoin, readLiveRunRequestId, readLiveStreamUnavailable, readMatrxErrorCode, readMatrxErrorCodeFromMessage, readMatrxJsonResponse, readStreamCursor, redactUrlForRequestLog, rejoinRuntimeOperation, reportProviderSessionFailure, reportProviderSessionUsage, requestJson, requestStream, requireOrganizationContext, resetPreconnectedForTests, resolveEndpointPath, resolveRunWaitWith, resumeAgentConversation, resumeOrRejoin, runAgentToCompletion, runJobLabel, runOutputKindFromModalities, runWaitKnobKey, runWaitTimeoutMessage, runtimeOperationRejoinPath, sendMatrxRequest, serverJobRejoinHandle, settleRunPickup, shouldReportMatrxCallError, startAgentRun, startMandateRun, streamErrorText, submitAgentToolResults, toRunHandle, unwrapUpstreamError, withRunOrganization };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,115 +1,9 @@
|
|
|
1
|
-
import { M as MatrxStreamEnvelope, b as MatrxNdjsonIssue, U as UploadProgress, c as MatrxStreamEnvelopeObservation, d as MatrxSseFrame } from './index-
|
|
2
|
-
export { A as Api, e as ApiRequestInfo, a as ApiStream, f as AuthTier, g as CONTRACT_SHA256, C as CallOptions, h as CreateApiOptions, D as DEPLOYMENTS, i as DOMAINS, j as DeploymentName, E as Environment, H as HttpMethod, J as JsonOrStream, N as NdjsonEvent, O as OperationArgs, k as OperationDescriptor, l as OrgRule, S as SseEvent, m as StreamKind, n as createApi, o as isBinaryType, p as openJsonOrStream, q as openStream } from './index-
|
|
1
|
+
import { M as MatrxStreamEnvelope, b as MatrxNdjsonIssue, U as UploadProgress, c as MatrxStreamEnvelopeObservation, d as MatrxSseFrame } from './index-BXLIDtlM.js';
|
|
2
|
+
export { A as Api, e as ApiRequestInfo, a as ApiStream, f as AuthTier, g as CONTRACT_SHA256, C as CallOptions, h as CreateApiOptions, D as DEPLOYMENTS, i as DOMAINS, j as DeploymentName, E as Environment, H as HttpMethod, J as JsonOrStream, N as NdjsonEvent, O as OperationArgs, k as OperationDescriptor, l as OrgRule, S as SseEvent, m as StreamKind, n as createApi, o as isBinaryType, p as openJsonOrStream, q as openStream } from './index-BXLIDtlM.js';
|
|
3
3
|
import { CredentialsPort } from '@ai-matrx/auth/credentials';
|
|
4
4
|
export { API_KEY_PREFIX, CredentialsPort, CredentialsSetting, MATRX_HEADERS, MatrxCredential, MatrxCredentialKind, credentialToHeaders, toCredentialsPort } from '@ai-matrx/auth/credentials';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { g as MandateKey, b as DynamicMandateKey } from './keys.generated-DPvmbTFD.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* The AI API protocol-version policy — which version of the AI runtime a
|
|
11
|
-
* Matrx client talks to, and the v2 → v1 transport fallback (moved in from
|
|
12
|
-
* matrx-frontend `lib/api/ai-api-version.ts` + `call-api.ts::
|
|
13
|
-
* fetchWithV2Fallback` under C22; server truth
|
|
14
|
-
* `aidream/docs/runtime/V2_FRONTEND_MIGRATION.md`).
|
|
15
|
-
*
|
|
16
|
-
* Background: the Python backend exposes a `/v2` runtime-spine namespace that
|
|
17
|
-
* wraps the core AI request surfaces in a request-tracking envelope. Body,
|
|
18
|
-
* headers, and streaming response are BYTE-IDENTICAL to v1 — only the URL
|
|
19
|
-
* differs.
|
|
20
|
-
*
|
|
21
|
-
* ─── The one rule that keeps burning us ─────────────────────────────────────
|
|
22
|
-
* `/v2` is inserted at the FRONT of the in-app path, right before `/ai`:
|
|
23
|
-
*
|
|
24
|
-
* /ai/agents/{id} → /v2/ai/agents/{id} ✅ correct
|
|
25
|
-
* /ai/v2/agents/… ❌ WRONG (nested) — 404s
|
|
26
|
-
*
|
|
27
|
-
* `toV2Path` below is the ONLY place this transform is spelled out.
|
|
28
|
-
*
|
|
29
|
-
* ─── Scope: ONLY the covered surfaces have a v2 form ────────────────────────
|
|
30
|
-
* chat, manual, agents/{id}, conversations/{id} (+ singular aliases),
|
|
31
|
-
* prompts/{id}, mandates/{key}. EVERYTHING ELSE — cancel, warm, resume,
|
|
32
|
-
* fork-and-run, runtime operations, files … — has NO v2 route, and the server
|
|
33
|
-
* does NOT auto-downgrade (a `/v2` request to an uncovered surface is a plain
|
|
34
|
-
* 404). So the transform is a scoped allowlist, never a blanket prefix.
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
type MatrxAiApiVersion = "v1" | "v2";
|
|
38
|
-
/**
|
|
39
|
-
* The package-wide default AI API version — the production value every Matrx
|
|
40
|
-
* client runs unless its host deliberately overrides
|
|
41
|
-
* (`createMatrxTransport({ aiApiVersion })`).
|
|
42
|
-
*/
|
|
43
|
-
declare const MATRX_AI_API_VERSION_DEFAULT: MatrxAiApiVersion;
|
|
44
|
-
/**
|
|
45
|
-
* The canonical v1 path TEMPLATES the v2 spine covers, `{param}` placeholders
|
|
46
|
-
* intact — for hosts that route through a template registry.
|
|
47
|
-
*/
|
|
48
|
-
declare const V2_COVERED_AI_PATH_TEMPLATES: readonly ["/ai/manual", "/ai/chat", "/ai/agents/{agent_id}", "/ai/agent/{agent_id}", "/ai/conversations/{conversation_id}", "/ai/conversation/{conversation_id}", "/ai/prompts/{prompt_id}", "/ai/mandates/{mandate_key}"];
|
|
49
|
-
/**
|
|
50
|
-
* Insert `/v2` at the front of an in-app path. Idempotent, and prefix-aware:
|
|
51
|
-
* a legacy `/api/` compatibility prefix (stripped server-side) is preserved so
|
|
52
|
-
* `/api/ai/chat` → `/api/v2/ai/chat`.
|
|
53
|
-
*/
|
|
54
|
-
declare function toV2Path(path: string): string;
|
|
55
|
-
/** Whether `path` (already interpolated) is one of the covered surfaces. */
|
|
56
|
-
declare function isCoveredAiPath(path: string): boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Whether an in-app path (or a full URL whose path was built by `toV2Path`)
|
|
59
|
-
* targets the v2 namespace — the guard the downgrade fallback keys off.
|
|
60
|
-
*/
|
|
61
|
-
declare function isV2Path(pathOrUrl: string): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* The inverse of `toV2Path` — strip the `/v2` version segment so a transport
|
|
64
|
-
* failure of the v2 endpoint (network error, 404/405, 5xx BEFORE any stream
|
|
65
|
-
* content) can retry the identical request on the v1 route. Works on a bare
|
|
66
|
-
* path, an `/api`-prefixed path, or a full URL (the `/v2/ai/` shape is unique
|
|
67
|
-
* to the version namespace). Idempotent on non-v2 input.
|
|
68
|
-
*/
|
|
69
|
-
declare function toV1FallbackUrl(url: string): string;
|
|
70
|
-
/**
|
|
71
|
-
* Apply the active AI API version to an ALREADY-INTERPOLATED in-app path.
|
|
72
|
-
*
|
|
73
|
-
* - Covered surface + v2 → `/v2` prefix inserted.
|
|
74
|
-
* - Anything else (or v1) → returned unchanged.
|
|
75
|
-
*
|
|
76
|
-
* Pass the in-app PATH only (no scheme/host); prepend the base URL afterward.
|
|
77
|
-
*/
|
|
78
|
-
declare function applyAiApiVersion(path: string, version: MatrxAiApiVersion): string;
|
|
79
|
-
/** One v2 → v1 downgrade, surfaced to the host's diagnostics sink. */
|
|
80
|
-
interface MatrxProtocolDowngrade {
|
|
81
|
-
/** The failed v2 URL. */
|
|
82
|
-
url: string;
|
|
83
|
-
/** Why the downgrade fired (thrown error text, or `HTTP <status>`). */
|
|
84
|
-
reason: string;
|
|
85
|
-
/** HTTP status when the trigger was a response (404/405/5xx). */
|
|
86
|
-
status?: number;
|
|
87
|
-
}
|
|
88
|
-
interface MatrxProtocolFallbackOptions extends ResilientFetchOptions {
|
|
89
|
-
/**
|
|
90
|
-
* Fired on every downgrade — a sustained stream of these means a v2 surface
|
|
91
|
-
* is unhealthy. The fallback also `console.warn`s unconditionally (parity
|
|
92
|
-
* with the original host pipeline) so the signal never disappears silently.
|
|
93
|
-
*/
|
|
94
|
-
onDowngrade?: (downgrade: MatrxProtocolDowngrade) => void;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* `resilientFetch` with the v2 → v1 transport fallback. Fires ONLY when a
|
|
98
|
-
* `/v2/ai/...` ENDPOINT itself fails — a network-layer throw (non-abort), a
|
|
99
|
-
* 404/405 (surface not on v2), or a 5xx — always BEFORE any stream content is
|
|
100
|
-
* consumed. Never on an application error (those fail identically on v1), and
|
|
101
|
-
* never on a caller abort (a user cancel must not be logged as a downgrade —
|
|
102
|
-
* that poisons the exact telemetry the rollout reads to judge v2 health).
|
|
103
|
-
*/
|
|
104
|
-
declare function fetchWithMatrxProtocolFallback(url: string, init: RequestInit, opts?: MatrxProtocolFallbackOptions): Promise<ResilientFetchResult>;
|
|
105
|
-
/**
|
|
106
|
-
* The exact-match `pathOverrides` map for `resolveEndpointPath` — keyed on the
|
|
107
|
-
* canonical templates, valued at their `/v2` siblings. Empty for v1. Every call
|
|
108
|
-
* that flows through the endpoint-override registry picks up v2 for the covered
|
|
109
|
-
* surfaces — and ONLY the covered surfaces. (Moved from matrx-frontend
|
|
110
|
-
* `lib/api/ai-api-version.ts`, chat-package independence P9.)
|
|
111
|
-
*/
|
|
112
|
-
declare function aiVersionPathOverrides(version: MatrxAiApiVersion): Record<string, string>;
|
|
5
|
+
export { AbortedError, ConnectTimeoutError, HeartbeatTimeoutError, HttpError, NetError, NetErrorCode, NetworkError, OfflineError, ResilientFetchOptions, ResilientFetchResult, RetryOptions, StreamMonitorOptions, TotalTimeoutError, extractErrorMessage, isNetError, isTransportFailure, monitorStream, resilientFetch, toNetError, withRetry } from './net.js';
|
|
6
|
+
import { g as MandateKey, b as DynamicMandateKey } from './keys.generated-DE-t9kzx.js';
|
|
113
7
|
|
|
114
8
|
/**
|
|
115
9
|
* `@ai-matrx/api` — the Matrx transport port.
|
|
@@ -433,8 +327,6 @@ declare function getUserMessage(error: unknown): string;
|
|
|
433
327
|
* effectively time-to-response), total UNCAPPED (the port cannot tell a JSON
|
|
434
328
|
* call from a long-lived NDJSON/SSE stream; the connect timeout is the JSON
|
|
435
329
|
* guard), via `@ai-matrx/api/net`'s `resilientFetch`;
|
|
436
|
-
* - **protocol** — the AI API version transform (`applyAiApiVersion`, default
|
|
437
|
-
* v2) + the loud v2 → v1 transport fallback (`./protocol`);
|
|
438
330
|
* - **credentials** — read fresh from the injected `CredentialsPort` on EVERY
|
|
439
331
|
* call, so a token refresh mid-run is picked up; mapped to headers by the
|
|
440
332
|
* ONE `credentialToHeaders`;
|
|
@@ -445,7 +337,7 @@ declare function getUserMessage(error: unknown): string;
|
|
|
445
337
|
* - **error classification** — every failure normalizes through
|
|
446
338
|
* `normalizeMatrxError` into the ONE `MatrxCallError` envelope;
|
|
447
339
|
* - **diagnostics** — a typed sink the host wires to its capture/telemetry
|
|
448
|
-
* (`onRequest`, `onError
|
|
340
|
+
* (`onRequest`, `onError`); wiring it is optional,
|
|
449
341
|
* the transport works silently without it.
|
|
450
342
|
*
|
|
451
343
|
* Header merge order is part of the port contract: wire headers first
|
|
@@ -530,8 +422,6 @@ interface MatrxTransportDiagnostics {
|
|
|
530
422
|
* listed in `expectedErrorStatuses`, with the classified envelope.
|
|
531
423
|
*/
|
|
532
424
|
onError?: (error: MatrxCallError, info: MatrxRequestInfo) => void;
|
|
533
|
-
/** Fired on every v2 → v1 protocol downgrade. */
|
|
534
|
-
onProtocolDowngrade?: (downgrade: MatrxProtocolDowngrade) => void;
|
|
535
425
|
}
|
|
536
426
|
interface CreateMatrxTransportOptions {
|
|
537
427
|
/** Fixed base URL, no trailing slash. Exactly one of `baseUrl` / `resolveTarget`. */
|
|
@@ -559,8 +449,6 @@ interface CreateMatrxTransportOptions {
|
|
|
559
449
|
* org in the body only.
|
|
560
450
|
*/
|
|
561
451
|
organizationId?: string | (() => string | null | undefined);
|
|
562
|
-
/** AI API protocol version (value or per-call getter). Default `"v2"`. */
|
|
563
|
-
aiApiVersion?: MatrxAiApiVersion | (() => MatrxAiApiVersion);
|
|
564
452
|
/** Max ms request start → response headers. Default 15_000. */
|
|
565
453
|
connectTimeoutMs?: number;
|
|
566
454
|
/**
|
|
@@ -741,14 +629,11 @@ interface ExecuteMatrxCallRequest<E = MatrxStreamEnvelope> {
|
|
|
741
629
|
onStreamError?: (error: MatrxCallError) => void;
|
|
742
630
|
}
|
|
743
631
|
interface ExecuteMatrxCallHooks<E = MatrxStreamEnvelope> {
|
|
744
|
-
/** Every v2 → v1 protocol downgrade. */
|
|
745
|
-
onProtocolDowngrade?: (downgrade: MatrxProtocolDowngrade) => void;
|
|
746
632
|
/** The host's stream parser (default `parseMatrxNdjsonResponse`). */
|
|
747
633
|
parseStream?: (response: Response, signal?: AbortSignal) => MatrxStreamParse<E>;
|
|
748
634
|
}
|
|
749
635
|
/**
|
|
750
|
-
* Execute one call
|
|
751
|
-
* response resolves as `{ error }`; a thrown failure (network, timeout,
|
|
636
|
+
* Execute one call. An HTTP error response resolves as `{ error }`; a thrown failure (network, timeout,
|
|
752
637
|
* abort, a broken stream) propagates — the caller normalizes it with
|
|
753
638
|
* `normalizeMatrxError` and decides what to capture.
|
|
754
639
|
*/
|
|
@@ -2795,4 +2680,4 @@ declare const ENDPOINTS: {
|
|
|
2795
2680
|
};
|
|
2796
2681
|
};
|
|
2797
2682
|
|
|
2798
|
-
export { BackendApiError, type BackendApiErrorData, type BackendErrorCode, type BackendFailureExplanation, type CreateMatrxTransportOptions, type CreateWarmupOptions, ENDPOINTS, type EndpointOverrideConfig, type ExecuteMatrxCallHooks, type ExecuteMatrxCallRequest, type FollowRuntimeOperationOptions, type FollowRuntimeOperationToEndOptions, type FollowRuntimeOperationToEndResult, type FollowServerJobOptions, type FollowUnavailableRejoinOptions, type JsonRequestOptions,
|
|
2683
|
+
export { BackendApiError, type BackendApiErrorData, type BackendErrorCode, type BackendFailureExplanation, type CreateMatrxTransportOptions, type CreateWarmupOptions, ENDPOINTS, type EndpointOverrideConfig, type ExecuteMatrxCallHooks, type ExecuteMatrxCallRequest, type FollowRuntimeOperationOptions, type FollowRuntimeOperationToEndOptions, type FollowRuntimeOperationToEndResult, type FollowServerJobOptions, type FollowUnavailableRejoinOptions, type JsonRequestOptions, MATRX_LIVE_STREAM_UNAVAILABLE, MATRX_RESUME_CONFLICT, MATRX_RUN_IN_PROGRESS, MATRX_UI_ONLY_BODY_FIELDS, type MatrxAgentStartRequest, MatrxApiError, type MatrxCallError, type MatrxCallResult, type MatrxCallScope, type MatrxCancelResponse, type MatrxChatMessage, type MatrxClientSessionProvider, type MatrxClientToolResult, type MatrxCompletedRun, type MatrxContextAnchor, type MatrxConversationContinueRequest, type MatrxConversationResumeRequest, type MatrxConversationStart, type MatrxEphemeralConversation, type MatrxFollowedOutcome, type MatrxHttpErrorLike, type MatrxHttpMethod, type MatrxJsonObject, type MatrxJsonValue, type MatrxLiveRunRejoin, type MatrxLiveStreamUnavailable, type MatrxMandateStartRequest, type MatrxOperationEventsPage, type MatrxOperationFollowEvent, type MatrxOperationStatusResponse, type MatrxOperationsByLinkResponse, type MatrxPendingCallSummary, type MatrxQueryParams, type MatrxRequestInfo, type MatrxRequestScope, MatrxRunError, type MatrxRunHandle, type MatrxRunPickup, type MatrxRunPickupSettlement, type MatrxRuntimeExecutionStatus, type MatrxRuntimeOperationEvent, type MatrxRuntimeOperationView, type MatrxStoredConversationContinue, type MatrxStoredConversationCreate, type MatrxStreamCallOptions, type MatrxStreamCursorStamp, type MatrxStreamIds, type MatrxStreamParse, type MatrxToolResultsResponse, type MatrxTransport, type MatrxTransportDiagnostics, type MatrxTransportRequest, type MatrxTransportTarget, type MatrxTurnFields, OrganizationContextError, type OrganizationContextErrorCode, type OrganizationOperation, type ParseMatrxNdjsonResponseHooks, type ProviderSessionFailure, type ProviderSessionFailureVerdict, type ProviderSessionUsage, type ProviderSessionUsageReceipt, type ProviderUsageReporter, type ProviderUsageReporterOptions, type ProviderUsageSendResult, type QueryValue, RUN_OUTPUT_KINDS, RUN_STREAM_LIFETIME_BACKSTOP_MS, RUN_WAIT_KNOB_FEATURE, type ResumeOrRejoinOptions, type ResumeOrRejoinOutcome, type RunAgentToCompletionOptions, type RunOutputKind, type RunWait, type RunWaitKnobReader, type SendMatrxRequestOptions, type ServerJobFinalStatus, type ServerJobOutcome, type ServerJobPath, type ServerJobStatus, type ServerJobTarget, type SettleRunPickupOptions, type StreamReplayCursor, type StreamReplayCursorOptions, type StreamRequestOptions, StreamTransportError, TERMINAL_MATRX_RUNTIME_STATUSES, type UpstreamErrorPayload, WARM_PATH, type WarmItem, type WarmReason, type Warmup, applyOrganizationContextHeader, assertOrganizationMatchesOperation, assertQueryOrganizationMatchesContext, bareStatusSentence, buildMatrxRequestBody, buildMatrxRequestUrl, buildQuery, buildSafeRequestLog, cancelAgentRun, continueAgentConversation, continueEphemeralConversationStart, continueStoredConversationStart, createMatrxTransport, createOrganizationOperation, createProviderUsageReporter, createStreamReplayCursor, createWarmup, describeBackendFailure, encodePathSegment, executeMatrxCall, extractMatrxErrorCode, extractMatrxErrorMessage, followRuntimeOperationEvents, followRuntimeOperationToEnd, followServerJob, followUnavailableRejoin, followWorkflowRunEvents, getRuntimeOperationStatus, getRuntimeOperationsByLink, getUserMessage, honestTransportMessage, isBareTransportCode, isEmptyProviderUsage, isGenericUserMessage, isJobOutputKind, isLiveStreamUnavailable, isResumeConflict, isServerJobSettled, isStreamTransportLost, listConversationPendingToolCalls, listRuntimeOperationEvents, listUserPendingToolCalls, mintMatrxConversationId, newEphemeralConversationStart, newStoredConversationStart, normalizeMatrxError, openMatrxStream, parseCallApiError, parseHttpError, parseHttpErrorBody, parseMatrxNdjsonResponse, parsePersistedBackendError, parseStreamError, pickServerJobOperation, preconnectServer, providerSessionFailureBody, providerSessionUsageBody, readConversationOrganizationId, readLiveRunRejoin, readLiveRunRequestId, readLiveStreamUnavailable, readMatrxErrorCode, readMatrxErrorCodeFromMessage, readMatrxJsonResponse, readStreamCursor, redactUrlForRequestLog, rejoinRuntimeOperation, reportProviderSessionFailure, reportProviderSessionUsage, requestJson, requestStream, requireOrganizationContext, resetPreconnectedForTests, resolveEndpointPath, resolveRunWaitWith, resumeAgentConversation, resumeOrRejoin, runAgentToCompletion, runJobLabel, runOutputKindFromModalities, runWaitKnobKey, runWaitTimeoutMessage, runtimeOperationRejoinPath, sendMatrxRequest, serverJobRejoinHandle, settleRunPickup, shouldReportMatrxCallError, startAgentRun, startMandateRun, streamErrorText, submitAgentToolResults, toRunHandle, unwrapUpstreamError, withRunOrganization };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
export { monitorStream } from './chunk-YTEOFGFC.js';
|
|
1
2
|
export { API_KEY_PREFIX, MATRX_HEADERS, credentialToHeaders, toCredentialsPort } from './chunk-7MZPBCFV.js';
|
|
2
|
-
import { OrganizationContextError, sendOnWire, WIRE_FETCH_OPTION_KEYS, BackendApiError, parseHttpError, MatrxApiError,
|
|
3
|
-
export { BackendApiError, CONTRACT_SHA256, DEPLOYMENTS, DOMAINS,
|
|
4
|
-
import { isNetError, extractErrorMessage } from './chunk-
|
|
5
|
-
export { AbortedError, ConnectTimeoutError, HeartbeatTimeoutError, HttpError, NetError, NetworkError, OfflineError, TotalTimeoutError, extractErrorMessage, isNetError, isTransportFailure,
|
|
3
|
+
import { OrganizationContextError, sendOnWire, WIRE_FETCH_OPTION_KEYS, BackendApiError, parseHttpError, MatrxApiError, applyOrganizationContextHeader, extractMatrxErrorCode, extractMatrxErrorMessage, readMatrxNdjsonStream, readMatrxSseStream, requireOrganizationContext, StreamTransportError } from './chunk-ER7WV43R.js';
|
|
4
|
+
export { BackendApiError, CONTRACT_SHA256, DEPLOYMENTS, DOMAINS, MatrxApiError, OrganizationContextError, StreamTransportError, applyOrganizationContextHeader, assertOrganizationMatchesOperation, assertQueryOrganizationMatchesContext, createApi, createOrganizationOperation, describeBackendFailure, extractMatrxErrorCode, extractMatrxErrorMessage, getUserMessage, isBinaryType, isGenericUserMessage, isStreamTransportLost, openJsonOrStream, openStream, parseCallApiError, parseHttpError, parseHttpErrorBody, parsePersistedBackendError, parseStreamError, requireOrganizationContext, unwrapUpstreamError } from './chunk-ER7WV43R.js';
|
|
5
|
+
import { isNetError, extractErrorMessage } from './chunk-KIEAFMKB.js';
|
|
6
|
+
export { AbortedError, ConnectTimeoutError, HeartbeatTimeoutError, HttpError, NetError, NetworkError, OfflineError, TotalTimeoutError, extractErrorMessage, isNetError, isTransportFailure, resilientFetch, toNetError, withRetry } from './chunk-KIEAFMKB.js';
|
|
6
7
|
import { formatDurationSeconds } from '@ai-matrx/kit/format';
|
|
7
8
|
|
|
8
9
|
// src/core/call.ts
|
|
@@ -167,8 +168,7 @@ async function executeMatrxCall(request, hooks = {}) {
|
|
|
167
168
|
...request.signal ? { signal: request.signal } : {},
|
|
168
169
|
connectTimeoutMs: request.connectTimeoutMs ?? DEFAULT_CONNECT_TIMEOUT_MS,
|
|
169
170
|
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 } : {}
|
|
171
|
+
...request.stream ? { stream: true } : {}
|
|
172
172
|
});
|
|
173
173
|
const requestId = response.headers.get("X-Request-ID");
|
|
174
174
|
const conversationId = response.headers.get("X-Conversation-ID");
|
|
@@ -359,7 +359,6 @@ function createMatrxTransport(options) {
|
|
|
359
359
|
resolveTarget,
|
|
360
360
|
credentials,
|
|
361
361
|
organizationId,
|
|
362
|
-
aiApiVersion,
|
|
363
362
|
connectTimeoutMs = PRODUCTION_CONNECT_TIMEOUT_MS,
|
|
364
363
|
totalTimeoutMs = null,
|
|
365
364
|
expectedErrorStatuses,
|
|
@@ -374,10 +373,6 @@ function createMatrxTransport(options) {
|
|
|
374
373
|
);
|
|
375
374
|
}
|
|
376
375
|
const resolve = resolveTarget ?? (() => ({ baseUrl }));
|
|
377
|
-
const resolveVersion = () => {
|
|
378
|
-
if (aiApiVersion === void 0) return MATRX_AI_API_VERSION_DEFAULT;
|
|
379
|
-
return typeof aiApiVersion === "function" ? aiApiVersion() : aiApiVersion;
|
|
380
|
-
};
|
|
381
376
|
const resolveOrganizationId = (callOrganizationId) => {
|
|
382
377
|
if (organizationId === void 0) return null;
|
|
383
378
|
if (callOrganizationId !== null) return requireOrganizationContext(callOrganizationId);
|
|
@@ -388,8 +383,7 @@ function createMatrxTransport(options) {
|
|
|
388
383
|
async fetch(path, init) {
|
|
389
384
|
const target = await resolve(init);
|
|
390
385
|
const callOrganizationId = readOrganizationHeader(init.headers);
|
|
391
|
-
const
|
|
392
|
-
const url = `${target.baseUrl}${versionedPath}`;
|
|
386
|
+
const url = `${target.baseUrl}${path}`;
|
|
393
387
|
const policyHeaders = stripContentType(target.policyHeaders ?? {});
|
|
394
388
|
let overHeaders = callOrganizationId === null ? policyHeaders : stripOrganizationHeader(policyHeaders);
|
|
395
389
|
const orgId = resolveOrganizationId(callOrganizationId);
|
|
@@ -417,8 +411,7 @@ function createMatrxTransport(options) {
|
|
|
417
411
|
...init.signal ? { signal: init.signal } : {},
|
|
418
412
|
...init.onUploadProgress ? { onUploadProgress: init.onUploadProgress } : {},
|
|
419
413
|
connectTimeoutMs,
|
|
420
|
-
totalTimeoutMs
|
|
421
|
-
...diagnostics?.onProtocolDowngrade ? { onProtocolDowngrade: diagnostics.onProtocolDowngrade } : {}
|
|
414
|
+
totalTimeoutMs
|
|
422
415
|
},
|
|
423
416
|
{
|
|
424
417
|
...credentials ? { credentials } : {},
|
package/dist/integrations.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkSME66TWP_cjs = require('./chunk-SME66TWP.cjs');
|
|
4
|
+
require('./chunk-2SXAAKGV.cjs');
|
|
5
5
|
|
|
6
6
|
// src/generated/integrations.ts
|
|
7
7
|
var $ebayAccountDeletionChallenge = { m: "GET", p: "/ebay/account-deletion", d: "aidream", a: "guest", o: "optional", n: "integrations.ebay_account_deletion_challenge" };
|
|
@@ -3634,11 +3634,11 @@ function bingIntegrationsDisconnect(api, args, options) {
|
|
|
3634
3634
|
}
|
|
3635
3635
|
var $importNotionZip = { m: "POST", p: "/notion-import/zip", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "integrations.import_notion_zip" };
|
|
3636
3636
|
function importNotionZip(api, args, options) {
|
|
3637
|
-
return
|
|
3637
|
+
return chunkSME66TWP_cjs.openStream(api, $importNotionZip, args, options);
|
|
3638
3638
|
}
|
|
3639
3639
|
var $importNotionConnected = { m: "POST", p: "/notion-import/connected", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "integrations.import_notion_connected" };
|
|
3640
3640
|
function importNotionConnected(api, args, options) {
|
|
3641
|
-
return
|
|
3641
|
+
return chunkSME66TWP_cjs.openStream(api, $importNotionConnected, args, options);
|
|
3642
3642
|
}
|
|
3643
3643
|
var TABLE = {
|
|
3644
3644
|
"GET /ebay/account-deletion": $ebayAccountDeletionChallenge,
|
package/dist/integrations.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Api, C as CallOptions, a as ApiStream, N as NdjsonEvent } from './index-
|
|
1
|
+
import { A as Api, C as CallOptions, a as ApiStream, N as NdjsonEvent } from './index-BXLIDtlM.cjs';
|
|
2
2
|
import { JsonValue, CalendarLocalRefreshResult, CalendarCreateResult, CalendarEventAttendee, StorageImportResult } from './schemas.cjs';
|
|
3
3
|
import '@ai-matrx/auth/credentials';
|
|
4
4
|
|
package/dist/integrations.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Api, C as CallOptions, a as ApiStream, N as NdjsonEvent } from './index-
|
|
1
|
+
import { A as Api, C as CallOptions, a as ApiStream, N as NdjsonEvent } from './index-BXLIDtlM.js';
|
|
2
2
|
import { JsonValue, CalendarLocalRefreshResult, CalendarCreateResult, CalendarEventAttendee, StorageImportResult } from './schemas.js';
|
|
3
3
|
import '@ai-matrx/auth/credentials';
|
|
4
4
|
|
package/dist/integrations.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { openStream } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { openStream } from './chunk-ER7WV43R.js';
|
|
2
|
+
import './chunk-KIEAFMKB.js';
|
|
3
3
|
|
|
4
4
|
// src/generated/integrations.ts
|
|
5
5
|
var $ebayAccountDeletionChallenge = { m: "GET", p: "/ebay/account-deletion", d: "aidream", a: "guest", o: "optional", n: "integrations.ebay_account_deletion_challenge" };
|
package/dist/intelligence.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkSME66TWP_cjs = require('./chunk-SME66TWP.cjs');
|
|
4
|
+
require('./chunk-2SXAAKGV.cjs');
|
|
5
5
|
|
|
6
6
|
// src/intelligence/keys.generated.ts
|
|
7
7
|
var MANDATE_KEYS_META = {
|
|
8
|
-
aidreamRevision: "
|
|
8
|
+
aidreamRevision: "bdb99c5fe277dae3e3ab171f84c452a32cabf5c6",
|
|
9
9
|
generatorVersion: "1.0.0",
|
|
10
10
|
packageVersion: "0.59.0",
|
|
11
11
|
retireWindow: 3
|
|
@@ -729,7 +729,7 @@ function getAgentCalibration(api, args, options) {
|
|
|
729
729
|
}
|
|
730
730
|
var $createDecision = { m: "POST", p: "/ai/decisions", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "intelligence.create_decision" };
|
|
731
731
|
function createDecision(api, args, options) {
|
|
732
|
-
return
|
|
732
|
+
return chunkSME66TWP_cjs.openStream(api, $createDecision, args, options);
|
|
733
733
|
}
|
|
734
734
|
var $readDecision = { m: "GET", p: "/ai/decisions/{execution_id}", d: "aidream", a: "guest", o: "required", n: "intelligence.read_decision" };
|
|
735
735
|
function readDecision(api, args, options) {
|
|
@@ -877,11 +877,11 @@ function captureProvisionDoor(api, args, options) {
|
|
|
877
877
|
}
|
|
878
878
|
var $runInitial = { m: "POST", p: "/agent-iteration/run-initial", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "intelligence.run_initial" };
|
|
879
879
|
function runInitial(api, args, options) {
|
|
880
|
-
return
|
|
880
|
+
return chunkSME66TWP_cjs.openStream(api, $runInitial, args, options);
|
|
881
881
|
}
|
|
882
882
|
var $runFeedback = { m: "POST", p: "/agent-iteration/feedback", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "intelligence.run_feedback" };
|
|
883
883
|
function runFeedback(api, args, options) {
|
|
884
|
-
return
|
|
884
|
+
return chunkSME66TWP_cjs.openStream(api, $runFeedback, args, options);
|
|
885
885
|
}
|
|
886
886
|
var $commitChoice = { m: "POST", p: "/agent-iteration/commit-choice", d: "aidream", a: "guest", o: "required", n: "intelligence.commit_choice" };
|
|
887
887
|
function commitChoice(api, args, options) {
|
|
@@ -1037,7 +1037,7 @@ function getMandateRun(api, args, options) {
|
|
|
1037
1037
|
}
|
|
1038
1038
|
var $replayMandateRun = { m: "POST", p: "/mandates/runs/{conversation_id}/replay", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "intelligence.replay_mandate_run" };
|
|
1039
1039
|
function replayMandateRun(api, args, options) {
|
|
1040
|
-
return
|
|
1040
|
+
return chunkSME66TWP_cjs.openStream(api, $replayMandateRun, args, options);
|
|
1041
1041
|
}
|
|
1042
1042
|
var $getMandateRunResult = { m: "GET", p: "/mandates/runs/{request_id}/result", d: "aidream", a: "guest", o: "optional", n: "intelligence.get_mandate_run_result" };
|
|
1043
1043
|
function getMandateRunResult(api, args, options) {
|
|
@@ -1045,7 +1045,7 @@ function getMandateRunResult(api, args, options) {
|
|
|
1045
1045
|
}
|
|
1046
1046
|
var $answerMandateRun = { m: "POST", p: "/mandates/runs/{request_id}/answer", d: "aidream", a: "guest", o: "required", s: "ndjson", n: "intelligence.answer_mandate_run" };
|
|
1047
1047
|
function answerMandateRun(api, args, options) {
|
|
1048
|
-
return
|
|
1048
|
+
return chunkSME66TWP_cjs.openStream(api, $answerMandateRun, args, options);
|
|
1049
1049
|
}
|
|
1050
1050
|
var $getMandateRuns = { m: "GET", p: "/mandates/{mandate_key}/runs", d: "aidream", a: "guest", o: "optional", n: "intelligence.get_mandate_runs" };
|
|
1051
1051
|
function getMandateRuns(api, args, options) {
|
package/dist/intelligence.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as Api, C as CallOptions, a as ApiStream, N as NdjsonEvent } from './index-
|
|
1
|
+
import { A as Api, C as CallOptions, a as ApiStream, N as NdjsonEvent } from './index-BXLIDtlM.cjs';
|
|
2
2
|
import { JsonValue, MandateTestHolder } from './schemas.cjs';
|
|
3
|
-
export { A as ALL_MANDATE_KEYS, D as DYNAMIC_MANDATE_FAMILIES, a as DynamicMandateFamilyPrefix, b as DynamicMandateKey, M as MANDATE_FAMILIES, c as MANDATE_KEYS, d as MANDATE_KEYS_META, e as MandateFamilyMember, f as MandateFamilyPrefix, g as MandateKey, R as RETIRING_MANDATE_KEYS, m as mandateKeyOfApp, h as mandateKeyOfShortcut } from './keys.generated-
|
|
3
|
+
export { A as ALL_MANDATE_KEYS, D as DYNAMIC_MANDATE_FAMILIES, a as DynamicMandateFamilyPrefix, b as DynamicMandateKey, M as MANDATE_FAMILIES, c as MANDATE_KEYS, d as MANDATE_KEYS_META, e as MandateFamilyMember, f as MandateFamilyPrefix, g as MandateKey, R as RETIRING_MANDATE_KEYS, m as mandateKeyOfApp, h as mandateKeyOfShortcut } from './keys.generated-DE-t9kzx.cjs';
|
|
4
4
|
import '@ai-matrx/auth/credentials';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/intelligence.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as Api, C as CallOptions, a as ApiStream, N as NdjsonEvent } from './index-
|
|
1
|
+
import { A as Api, C as CallOptions, a as ApiStream, N as NdjsonEvent } from './index-BXLIDtlM.js';
|
|
2
2
|
import { JsonValue, MandateTestHolder } from './schemas.js';
|
|
3
|
-
export { A as ALL_MANDATE_KEYS, D as DYNAMIC_MANDATE_FAMILIES, a as DynamicMandateFamilyPrefix, b as DynamicMandateKey, M as MANDATE_FAMILIES, c as MANDATE_KEYS, d as MANDATE_KEYS_META, e as MandateFamilyMember, f as MandateFamilyPrefix, g as MandateKey, R as RETIRING_MANDATE_KEYS, m as mandateKeyOfApp, h as mandateKeyOfShortcut } from './keys.generated-
|
|
3
|
+
export { A as ALL_MANDATE_KEYS, D as DYNAMIC_MANDATE_FAMILIES, a as DynamicMandateFamilyPrefix, b as DynamicMandateKey, M as MANDATE_FAMILIES, c as MANDATE_KEYS, d as MANDATE_KEYS_META, e as MandateFamilyMember, f as MandateFamilyPrefix, g as MandateKey, R as RETIRING_MANDATE_KEYS, m as mandateKeyOfApp, h as mandateKeyOfShortcut } from './keys.generated-DE-t9kzx.js';
|
|
4
4
|
import '@ai-matrx/auth/credentials';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/intelligence.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { openStream } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { openStream } from './chunk-ER7WV43R.js';
|
|
2
|
+
import './chunk-KIEAFMKB.js';
|
|
3
3
|
|
|
4
4
|
// src/intelligence/keys.generated.ts
|
|
5
5
|
var MANDATE_KEYS_META = {
|
|
6
|
-
aidreamRevision: "
|
|
6
|
+
aidreamRevision: "bdb99c5fe277dae3e3ab171f84c452a32cabf5c6",
|
|
7
7
|
generatorVersion: "1.0.0",
|
|
8
8
|
packageVersion: "0.59.0",
|
|
9
9
|
retireWindow: 3
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* from the IN-PROCESS mandate declarations — the same `declared_mandates()` the
|
|
7
7
|
* boot sync writes to the database from. There is no hand list anywhere.
|
|
8
8
|
*
|
|
9
|
-
* aidream revision:
|
|
9
|
+
* aidream revision: bdb99c5fe277dae3e3ab171f84c452a32cabf5c6
|
|
10
10
|
* generator version: 1.0.0
|
|
11
11
|
* package version: 0.59.0
|
|
12
12
|
* active keys: 584
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
/** Where this module came from — surfaced so a report can name the exact build. */
|
|
21
21
|
declare const MANDATE_KEYS_META: {
|
|
22
|
-
readonly aidreamRevision: "
|
|
22
|
+
readonly aidreamRevision: "bdb99c5fe277dae3e3ab171f84c452a32cabf5c6";
|
|
23
23
|
readonly generatorVersion: "1.0.0";
|
|
24
24
|
readonly packageVersion: "0.59.0";
|
|
25
25
|
readonly retireWindow: 3;
|