@ai-matrx/agents 0.37.0 → 0.38.1

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +23 -4
  2. package/dist/content-transfer/index.cjs.map +1 -1
  3. package/dist/content-transfer/index.js.map +1 -1
  4. package/dist/content-transfer/react/index.cjs.map +1 -1
  5. package/dist/content-transfer/react/index.js.map +1 -1
  6. package/dist/generated/api-types.cjs.map +1 -1
  7. package/dist/generated/api-types.d.cts +5 -0
  8. package/dist/generated/api-types.d.ts +5 -0
  9. package/dist/index.cjs +49 -7
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +2 -2
  12. package/dist/index.d.ts +2 -2
  13. package/dist/index.js +49 -7
  14. package/dist/index.js.map +1 -1
  15. package/dist/{keys.generated-klzs6I1T.d.cts → keys.generated-DNRbtHNx.d.cts} +4 -4
  16. package/dist/{keys.generated-klzs6I1T.d.ts → keys.generated-DNRbtHNx.d.ts} +4 -4
  17. package/dist/mandates/index.cjs +2 -2
  18. package/dist/mandates/index.cjs.map +1 -1
  19. package/dist/mandates/index.d.cts +2 -2
  20. package/dist/mandates/index.d.ts +2 -2
  21. package/dist/mandates/index.js +2 -2
  22. package/dist/mandates/index.js.map +1 -1
  23. package/dist/matrx/index.cjs +49 -7
  24. package/dist/matrx/index.cjs.map +1 -1
  25. package/dist/matrx/index.d.cts +35 -3
  26. package/dist/matrx/index.d.ts +35 -3
  27. package/dist/matrx/index.js +49 -7
  28. package/dist/matrx/index.js.map +1 -1
  29. package/dist/portable/mcp.cjs.map +1 -1
  30. package/dist/portable/mcp.js.map +1 -1
  31. package/dist/react/index.cjs.map +1 -1
  32. package/dist/react/index.js.map +1 -1
  33. package/generated/api-types.ts +5 -0
  34. package/mandates/snapshots/keys.0.37.1.json +653 -0
  35. package/mandates/snapshots/keys.0.37.2.json +653 -0
  36. package/mandates/snapshots/keys.0.38.0.json +653 -0
  37. package/mandates/snapshots/keys.0.38.1.json +653 -0
  38. package/package.json +2 -2
@@ -5,7 +5,7 @@ import { ResilientFetchOptions } from '@ai-matrx/data/net';
5
5
  import { MatrxStreamEnvelope, MatrxNdjsonIssue } from '../stream/ndjson.cjs';
6
6
  import { v as MatrxRuntimeOperationEvent, a as FollowRuntimeOperationToEndOptions, u as MatrxRuntimeExecutionStatus, z as MatrxStreamCallOptions, t as MatrxRunHandle, l as MatrxJsonValue, k as MatrxJsonObject } from '../operations-C9QvBH_2.cjs';
7
7
  export { F as FollowRuntimeOperationOptions, b as FollowRuntimeOperationToEndResult, M as MatrxAgentStartRequest, c as MatrxCancelResponse, d as MatrxChatMessage, e as MatrxCompletedRun, f as MatrxContextAnchor, g as MatrxConversationContinueRequest, h as MatrxConversationResumeRequest, i as MatrxConversationStart, j as MatrxEphemeralConversation, m as MatrxMandateStartRequest, n as MatrxOperationEventsPage, o as MatrxOperationFollowEvent, p as MatrxOperationStatusResponse, q as MatrxOperationsByLinkResponse, r as MatrxRequestScope, s as MatrxRunError, w as MatrxRuntimeOperationView, x as MatrxStoredConversationContinue, y as MatrxStoredConversationCreate, A as MatrxTurnFields, R as RunAgentToCompletionOptions, T as TERMINAL_MATRX_RUNTIME_STATUSES, B as cancelAgentRun, C as continueAgentConversation, D as continueEphemeralConversationStart, E as continueStoredConversationStart, G as followRuntimeOperationEvents, H as followRuntimeOperationToEnd, I as getRuntimeOperationStatus, J as getRuntimeOperationsByLink, K as listRuntimeOperationEvents, L as mintMatrxConversationId, N as newEphemeralConversationStart, O as newStoredConversationStart, P as rejoinRuntimeOperation, Q as resumeAgentConversation, S as runAgentToCompletion, U as startAgentRun, V as startMandateRun } from '../operations-C9QvBH_2.cjs';
8
- import { M as MandateKey, D as DynamicMandateKey } from '../keys.generated-klzs6I1T.cjs';
8
+ import { M as MandateKey, D as DynamicMandateKey } from '../keys.generated-DNRbtHNx.cjs';
9
9
  import '../stream/sse.cjs';
10
10
 
11
11
  /**
@@ -507,6 +507,10 @@ declare function getUserMessage(error: unknown): string;
507
507
  * body reader classified as a resumable `StreamTransportError`;
508
508
  * - `executeMatrxCall` — the JSON or NDJSON execution over the v2 → v1
509
509
  * protocol fallback, with the stream callbacks and `consumeStream`;
510
+ * - `sendMatrxRequest` / `readMatrxJsonResponse` — the raw-`Response` lane
511
+ * for a host's imperative client (multipart bodies, byte downloads,
512
+ * response-aware callers): one deadline, a caller abort kept as itself, and
513
+ * the ONE HTTP error parser;
510
514
  * - `buildSafeRequestLog` / `redactUrlForRequestLog` /
511
515
  * `shouldReportMatrxCallError` — the log and capture policy.
512
516
  *
@@ -537,7 +541,12 @@ interface MatrxCallResult<T = unknown> {
537
541
  /** Set when the call failed with an HTTP error response. */
538
542
  error?: MatrxCallError;
539
543
  }
540
- type MatrxQueryParams = Record<string, string | number | boolean>;
544
+ type MatrxQueryScalar = string | number | boolean;
545
+ /**
546
+ * Query values: a scalar is sent as itself, an array repeats the key (the
547
+ * FastAPI repeatable-parameter convention), `null` / `undefined` are omitted.
548
+ */
549
+ type MatrxQueryParams = Record<string, MatrxQueryScalar | readonly MatrxQueryScalar[] | null | undefined>;
541
550
  /**
542
551
  * The full URL for one call: `{param}` segments substituted (encoded), the
543
552
  * legacy `/api` prefix stripped (server routes no longer live under it), and
@@ -642,6 +651,29 @@ interface ExecuteMatrxCallHooks<E = MatrxStreamEnvelope> {
642
651
  * `normalizeMatrxError` and decides what to capture.
643
652
  */
644
653
  declare function executeMatrxCall<T = unknown, E = MatrxStreamEnvelope>(request: ExecuteMatrxCallRequest<E>, hooks?: ExecuteMatrxCallHooks<E>): Promise<MatrxCallResult<T>>;
654
+ interface SendMatrxRequestOptions {
655
+ /** Caller cancellation; an abort propagates as the caller's own AbortError. */
656
+ signal?: AbortSignal;
657
+ /**
658
+ * Deadline (ms) from send to response headers. On expiry the call rejects
659
+ * with a `BackendApiError` coded `request_timeout` (status 504) — never a
660
+ * fake caller cancellation. Omit for no deadline.
661
+ */
662
+ timeoutMs?: number;
663
+ }
664
+ /**
665
+ * Send one request and resolve with the raw `Response`, whatever its status.
666
+ * The lane for an imperative host client whose bodies are not JSON (a
667
+ * `FormData` upload), whose answers are bytes, or which reads the response
668
+ * itself. A caller abort and a network failure propagate unchanged; only this
669
+ * call's own deadline is classified (`request_timeout`).
670
+ */
671
+ declare function sendMatrxRequest(url: string, init?: RequestInit, options?: SendMatrxRequestOptions): Promise<Response>;
672
+ /**
673
+ * A response's JSON body, or the ONE classified `BackendApiError`
674
+ * (`parseHttpError`) for a non-2xx answer. A 204 resolves `null`.
675
+ */
676
+ declare function readMatrxJsonResponse<T>(response: Response): Promise<T>;
645
677
 
646
678
  /**
647
679
  * The fail-closed organization-context kernel — ONE implementation for every
@@ -1829,4 +1861,4 @@ interface WarmAgentOptions extends WarmOptions {
1829
1861
  */
1830
1862
  declare function warmAgent(agentId: string, { baseUrl, isVersion, onError }: WarmAgentOptions): void;
1831
1863
 
1832
- export { type ApiTargetLogContext, BackendApiError, type BackendApiErrorData, type BackendErrorCode, type BackendFailureExplanation, type CreateMatrxTransportOptions, ENDPOINTS, type EndpointOverrideConfig, type ExecuteMatrxCallHooks, type ExecuteMatrxCallRequest, FollowRuntimeOperationToEndOptions, type FollowUnavailableRejoinOptions, MATRX_AI_API_VERSION_DEFAULT, MATRX_LIVE_STREAM_UNAVAILABLE, MATRX_RESUME_CONFLICT, MATRX_RUN_IN_PROGRESS, MATRX_UI_ONLY_BODY_FIELDS, type MatrxAiApiVersion, MatrxApiError, type MatrxCallError, type MatrxCallResult, type MatrxCallScope, type MatrxClientSessionProvider, type MatrxClientToolResult, type MatrxFollowedOutcome, type MatrxHttpErrorLike, type MatrxHttpMethod, MatrxJsonObject, MatrxJsonValue, type MatrxLiveRunRejoin, type MatrxLiveStreamUnavailable, type MatrxPendingCallSummary, type MatrxProtocolDowngrade, type MatrxProtocolFallbackOptions, type MatrxQueryParams, type MatrxRequestInfo, MatrxRunHandle, type MatrxRunPickup, type MatrxRunPickupSettlement, MatrxRuntimeExecutionStatus, MatrxRuntimeOperationEvent, MatrxStreamCallOptions, type MatrxStreamIds, type MatrxStreamParse, type MatrxToolResultsResponse, MatrxTransport, type MatrxTransportDiagnostics, type MatrxTransportTarget, OrganizationContextError, type OrganizationContextErrorCode, type OrganizationOperation, type ParseMatrxNdjsonResponseHooks, type ProviderSessionFailure, type ProviderSessionFailureVerdict, RUN_OUTPUT_KINDS, RUN_STREAM_LIFETIME_BACKSTOP_MS, RUN_WAIT_KNOB_FEATURE, type ResumeOrRejoinOptions, type ResumeOrRejoinOutcome, type RunOutputKind, type RunWait, type RunWaitKnobReader, type SettleRunPickupOptions, StreamTransportError, type UpstreamErrorPayload, V2_COVERED_AI_PATH_TEMPLATES, aiVersionPathOverrides, applyAiApiVersion, applyDesktopTargetToRequestBody, applyOrganizationContextHeader, assertOrganizationMatchesOperation, assertQueryOrganizationMatchesContext, bareStatusSentence, buildMatrxRequestBody, buildMatrxRequestUrl, buildSafeRequestLog, createMatrxTransport, createOrganizationOperation, describeBackendFailure, executeMatrxCall, fetchWithMatrxProtocolFallback, followUnavailableRejoin, followWorkflowRunEvents, getUserMessage, honestTransportMessage, isBareTransportCode, isCoveredAiPath, isGenericUserMessage, isJobOutputKind, isLiveStreamUnavailable, isResumeConflict, isStreamTransportLost, isV2Path, listConversationPendingToolCalls, listUserPendingToolCalls, logApiTarget, normalizeMatrxError, openMatrxStream, parseCallApiError, parseHttpError, parseHttpErrorBody, parseMatrxNdjsonResponse, parsePersistedBackendError, parseStreamError, providerSessionFailureBody, readConversationOrganizationId, readLiveRunRejoin, readLiveRunRequestId, readLiveStreamUnavailable, readMatrxErrorCode, readMatrxErrorCodeFromMessage, redactUrlForRequestLog, reportProviderSessionFailure, requireOrganizationContext, resolveEndpointPath, resolveRunWaitWith, resumeOrRejoin, runJobLabel, runOutputKindFromModalities, runWaitKnobKey, runWaitTimeoutMessage, runtimeOperationRejoinPath, settleRunPickup, shouldReportMatrxCallError, streamErrorText, submitAgentToolResults, toV1FallbackUrl, toV2Path, unwrapUpstreamError, warmAgent, withRunOrganization };
1864
+ export { type ApiTargetLogContext, BackendApiError, type BackendApiErrorData, type BackendErrorCode, type BackendFailureExplanation, type CreateMatrxTransportOptions, ENDPOINTS, type EndpointOverrideConfig, type ExecuteMatrxCallHooks, type ExecuteMatrxCallRequest, FollowRuntimeOperationToEndOptions, type FollowUnavailableRejoinOptions, MATRX_AI_API_VERSION_DEFAULT, MATRX_LIVE_STREAM_UNAVAILABLE, MATRX_RESUME_CONFLICT, MATRX_RUN_IN_PROGRESS, MATRX_UI_ONLY_BODY_FIELDS, type MatrxAiApiVersion, MatrxApiError, type MatrxCallError, type MatrxCallResult, type MatrxCallScope, type MatrxClientSessionProvider, type MatrxClientToolResult, type MatrxFollowedOutcome, type MatrxHttpErrorLike, type MatrxHttpMethod, MatrxJsonObject, MatrxJsonValue, type MatrxLiveRunRejoin, type MatrxLiveStreamUnavailable, type MatrxPendingCallSummary, type MatrxProtocolDowngrade, type MatrxProtocolFallbackOptions, type MatrxQueryParams, type MatrxRequestInfo, MatrxRunHandle, type MatrxRunPickup, type MatrxRunPickupSettlement, MatrxRuntimeExecutionStatus, MatrxRuntimeOperationEvent, MatrxStreamCallOptions, type MatrxStreamIds, type MatrxStreamParse, type MatrxToolResultsResponse, MatrxTransport, type MatrxTransportDiagnostics, type MatrxTransportTarget, OrganizationContextError, type OrganizationContextErrorCode, type OrganizationOperation, type ParseMatrxNdjsonResponseHooks, type ProviderSessionFailure, type ProviderSessionFailureVerdict, RUN_OUTPUT_KINDS, RUN_STREAM_LIFETIME_BACKSTOP_MS, RUN_WAIT_KNOB_FEATURE, type ResumeOrRejoinOptions, type ResumeOrRejoinOutcome, type RunOutputKind, type RunWait, type RunWaitKnobReader, type SendMatrxRequestOptions, type SettleRunPickupOptions, StreamTransportError, type UpstreamErrorPayload, V2_COVERED_AI_PATH_TEMPLATES, aiVersionPathOverrides, applyAiApiVersion, applyDesktopTargetToRequestBody, applyOrganizationContextHeader, assertOrganizationMatchesOperation, assertQueryOrganizationMatchesContext, bareStatusSentence, buildMatrxRequestBody, buildMatrxRequestUrl, buildSafeRequestLog, createMatrxTransport, createOrganizationOperation, describeBackendFailure, executeMatrxCall, fetchWithMatrxProtocolFallback, followUnavailableRejoin, followWorkflowRunEvents, getUserMessage, honestTransportMessage, isBareTransportCode, isCoveredAiPath, isGenericUserMessage, isJobOutputKind, isLiveStreamUnavailable, isResumeConflict, isStreamTransportLost, isV2Path, listConversationPendingToolCalls, listUserPendingToolCalls, logApiTarget, normalizeMatrxError, openMatrxStream, parseCallApiError, parseHttpError, parseHttpErrorBody, parseMatrxNdjsonResponse, parsePersistedBackendError, parseStreamError, providerSessionFailureBody, readConversationOrganizationId, readLiveRunRejoin, readLiveRunRequestId, readLiveStreamUnavailable, readMatrxErrorCode, readMatrxErrorCodeFromMessage, readMatrxJsonResponse, redactUrlForRequestLog, reportProviderSessionFailure, requireOrganizationContext, resolveEndpointPath, resolveRunWaitWith, resumeOrRejoin, runJobLabel, runOutputKindFromModalities, runWaitKnobKey, runWaitTimeoutMessage, runtimeOperationRejoinPath, sendMatrxRequest, settleRunPickup, shouldReportMatrxCallError, streamErrorText, submitAgentToolResults, toV1FallbackUrl, toV2Path, unwrapUpstreamError, warmAgent, withRunOrganization };
@@ -5,7 +5,7 @@ import { ResilientFetchOptions } from '@ai-matrx/data/net';
5
5
  import { MatrxStreamEnvelope, MatrxNdjsonIssue } from '../stream/ndjson.js';
6
6
  import { v as MatrxRuntimeOperationEvent, a as FollowRuntimeOperationToEndOptions, u as MatrxRuntimeExecutionStatus, z as MatrxStreamCallOptions, t as MatrxRunHandle, l as MatrxJsonValue, k as MatrxJsonObject } from '../operations-C3iHFcnt.js';
7
7
  export { F as FollowRuntimeOperationOptions, b as FollowRuntimeOperationToEndResult, M as MatrxAgentStartRequest, c as MatrxCancelResponse, d as MatrxChatMessage, e as MatrxCompletedRun, f as MatrxContextAnchor, g as MatrxConversationContinueRequest, h as MatrxConversationResumeRequest, i as MatrxConversationStart, j as MatrxEphemeralConversation, m as MatrxMandateStartRequest, n as MatrxOperationEventsPage, o as MatrxOperationFollowEvent, p as MatrxOperationStatusResponse, q as MatrxOperationsByLinkResponse, r as MatrxRequestScope, s as MatrxRunError, w as MatrxRuntimeOperationView, x as MatrxStoredConversationContinue, y as MatrxStoredConversationCreate, A as MatrxTurnFields, R as RunAgentToCompletionOptions, T as TERMINAL_MATRX_RUNTIME_STATUSES, B as cancelAgentRun, C as continueAgentConversation, D as continueEphemeralConversationStart, E as continueStoredConversationStart, G as followRuntimeOperationEvents, H as followRuntimeOperationToEnd, I as getRuntimeOperationStatus, J as getRuntimeOperationsByLink, K as listRuntimeOperationEvents, L as mintMatrxConversationId, N as newEphemeralConversationStart, O as newStoredConversationStart, P as rejoinRuntimeOperation, Q as resumeAgentConversation, S as runAgentToCompletion, U as startAgentRun, V as startMandateRun } from '../operations-C3iHFcnt.js';
8
- import { M as MandateKey, D as DynamicMandateKey } from '../keys.generated-klzs6I1T.js';
8
+ import { M as MandateKey, D as DynamicMandateKey } from '../keys.generated-DNRbtHNx.js';
9
9
  import '../stream/sse.js';
10
10
 
11
11
  /**
@@ -507,6 +507,10 @@ declare function getUserMessage(error: unknown): string;
507
507
  * body reader classified as a resumable `StreamTransportError`;
508
508
  * - `executeMatrxCall` — the JSON or NDJSON execution over the v2 → v1
509
509
  * protocol fallback, with the stream callbacks and `consumeStream`;
510
+ * - `sendMatrxRequest` / `readMatrxJsonResponse` — the raw-`Response` lane
511
+ * for a host's imperative client (multipart bodies, byte downloads,
512
+ * response-aware callers): one deadline, a caller abort kept as itself, and
513
+ * the ONE HTTP error parser;
510
514
  * - `buildSafeRequestLog` / `redactUrlForRequestLog` /
511
515
  * `shouldReportMatrxCallError` — the log and capture policy.
512
516
  *
@@ -537,7 +541,12 @@ interface MatrxCallResult<T = unknown> {
537
541
  /** Set when the call failed with an HTTP error response. */
538
542
  error?: MatrxCallError;
539
543
  }
540
- type MatrxQueryParams = Record<string, string | number | boolean>;
544
+ type MatrxQueryScalar = string | number | boolean;
545
+ /**
546
+ * Query values: a scalar is sent as itself, an array repeats the key (the
547
+ * FastAPI repeatable-parameter convention), `null` / `undefined` are omitted.
548
+ */
549
+ type MatrxQueryParams = Record<string, MatrxQueryScalar | readonly MatrxQueryScalar[] | null | undefined>;
541
550
  /**
542
551
  * The full URL for one call: `{param}` segments substituted (encoded), the
543
552
  * legacy `/api` prefix stripped (server routes no longer live under it), and
@@ -642,6 +651,29 @@ interface ExecuteMatrxCallHooks<E = MatrxStreamEnvelope> {
642
651
  * `normalizeMatrxError` and decides what to capture.
643
652
  */
644
653
  declare function executeMatrxCall<T = unknown, E = MatrxStreamEnvelope>(request: ExecuteMatrxCallRequest<E>, hooks?: ExecuteMatrxCallHooks<E>): Promise<MatrxCallResult<T>>;
654
+ interface SendMatrxRequestOptions {
655
+ /** Caller cancellation; an abort propagates as the caller's own AbortError. */
656
+ signal?: AbortSignal;
657
+ /**
658
+ * Deadline (ms) from send to response headers. On expiry the call rejects
659
+ * with a `BackendApiError` coded `request_timeout` (status 504) — never a
660
+ * fake caller cancellation. Omit for no deadline.
661
+ */
662
+ timeoutMs?: number;
663
+ }
664
+ /**
665
+ * Send one request and resolve with the raw `Response`, whatever its status.
666
+ * The lane for an imperative host client whose bodies are not JSON (a
667
+ * `FormData` upload), whose answers are bytes, or which reads the response
668
+ * itself. A caller abort and a network failure propagate unchanged; only this
669
+ * call's own deadline is classified (`request_timeout`).
670
+ */
671
+ declare function sendMatrxRequest(url: string, init?: RequestInit, options?: SendMatrxRequestOptions): Promise<Response>;
672
+ /**
673
+ * A response's JSON body, or the ONE classified `BackendApiError`
674
+ * (`parseHttpError`) for a non-2xx answer. A 204 resolves `null`.
675
+ */
676
+ declare function readMatrxJsonResponse<T>(response: Response): Promise<T>;
645
677
 
646
678
  /**
647
679
  * The fail-closed organization-context kernel — ONE implementation for every
@@ -1829,4 +1861,4 @@ interface WarmAgentOptions extends WarmOptions {
1829
1861
  */
1830
1862
  declare function warmAgent(agentId: string, { baseUrl, isVersion, onError }: WarmAgentOptions): void;
1831
1863
 
1832
- export { type ApiTargetLogContext, BackendApiError, type BackendApiErrorData, type BackendErrorCode, type BackendFailureExplanation, type CreateMatrxTransportOptions, ENDPOINTS, type EndpointOverrideConfig, type ExecuteMatrxCallHooks, type ExecuteMatrxCallRequest, FollowRuntimeOperationToEndOptions, type FollowUnavailableRejoinOptions, MATRX_AI_API_VERSION_DEFAULT, MATRX_LIVE_STREAM_UNAVAILABLE, MATRX_RESUME_CONFLICT, MATRX_RUN_IN_PROGRESS, MATRX_UI_ONLY_BODY_FIELDS, type MatrxAiApiVersion, MatrxApiError, type MatrxCallError, type MatrxCallResult, type MatrxCallScope, type MatrxClientSessionProvider, type MatrxClientToolResult, type MatrxFollowedOutcome, type MatrxHttpErrorLike, type MatrxHttpMethod, MatrxJsonObject, MatrxJsonValue, type MatrxLiveRunRejoin, type MatrxLiveStreamUnavailable, type MatrxPendingCallSummary, type MatrxProtocolDowngrade, type MatrxProtocolFallbackOptions, type MatrxQueryParams, type MatrxRequestInfo, MatrxRunHandle, type MatrxRunPickup, type MatrxRunPickupSettlement, MatrxRuntimeExecutionStatus, MatrxRuntimeOperationEvent, MatrxStreamCallOptions, type MatrxStreamIds, type MatrxStreamParse, type MatrxToolResultsResponse, MatrxTransport, type MatrxTransportDiagnostics, type MatrxTransportTarget, OrganizationContextError, type OrganizationContextErrorCode, type OrganizationOperation, type ParseMatrxNdjsonResponseHooks, type ProviderSessionFailure, type ProviderSessionFailureVerdict, RUN_OUTPUT_KINDS, RUN_STREAM_LIFETIME_BACKSTOP_MS, RUN_WAIT_KNOB_FEATURE, type ResumeOrRejoinOptions, type ResumeOrRejoinOutcome, type RunOutputKind, type RunWait, type RunWaitKnobReader, type SettleRunPickupOptions, StreamTransportError, type UpstreamErrorPayload, V2_COVERED_AI_PATH_TEMPLATES, aiVersionPathOverrides, applyAiApiVersion, applyDesktopTargetToRequestBody, applyOrganizationContextHeader, assertOrganizationMatchesOperation, assertQueryOrganizationMatchesContext, bareStatusSentence, buildMatrxRequestBody, buildMatrxRequestUrl, buildSafeRequestLog, createMatrxTransport, createOrganizationOperation, describeBackendFailure, executeMatrxCall, fetchWithMatrxProtocolFallback, followUnavailableRejoin, followWorkflowRunEvents, getUserMessage, honestTransportMessage, isBareTransportCode, isCoveredAiPath, isGenericUserMessage, isJobOutputKind, isLiveStreamUnavailable, isResumeConflict, isStreamTransportLost, isV2Path, listConversationPendingToolCalls, listUserPendingToolCalls, logApiTarget, normalizeMatrxError, openMatrxStream, parseCallApiError, parseHttpError, parseHttpErrorBody, parseMatrxNdjsonResponse, parsePersistedBackendError, parseStreamError, providerSessionFailureBody, readConversationOrganizationId, readLiveRunRejoin, readLiveRunRequestId, readLiveStreamUnavailable, readMatrxErrorCode, readMatrxErrorCodeFromMessage, redactUrlForRequestLog, reportProviderSessionFailure, requireOrganizationContext, resolveEndpointPath, resolveRunWaitWith, resumeOrRejoin, runJobLabel, runOutputKindFromModalities, runWaitKnobKey, runWaitTimeoutMessage, runtimeOperationRejoinPath, settleRunPickup, shouldReportMatrxCallError, streamErrorText, submitAgentToolResults, toV1FallbackUrl, toV2Path, unwrapUpstreamError, warmAgent, withRunOrganization };
1864
+ export { type ApiTargetLogContext, BackendApiError, type BackendApiErrorData, type BackendErrorCode, type BackendFailureExplanation, type CreateMatrxTransportOptions, ENDPOINTS, type EndpointOverrideConfig, type ExecuteMatrxCallHooks, type ExecuteMatrxCallRequest, FollowRuntimeOperationToEndOptions, type FollowUnavailableRejoinOptions, MATRX_AI_API_VERSION_DEFAULT, MATRX_LIVE_STREAM_UNAVAILABLE, MATRX_RESUME_CONFLICT, MATRX_RUN_IN_PROGRESS, MATRX_UI_ONLY_BODY_FIELDS, type MatrxAiApiVersion, MatrxApiError, type MatrxCallError, type MatrxCallResult, type MatrxCallScope, type MatrxClientSessionProvider, type MatrxClientToolResult, type MatrxFollowedOutcome, type MatrxHttpErrorLike, type MatrxHttpMethod, MatrxJsonObject, MatrxJsonValue, type MatrxLiveRunRejoin, type MatrxLiveStreamUnavailable, type MatrxPendingCallSummary, type MatrxProtocolDowngrade, type MatrxProtocolFallbackOptions, type MatrxQueryParams, type MatrxRequestInfo, MatrxRunHandle, type MatrxRunPickup, type MatrxRunPickupSettlement, MatrxRuntimeExecutionStatus, MatrxRuntimeOperationEvent, MatrxStreamCallOptions, type MatrxStreamIds, type MatrxStreamParse, type MatrxToolResultsResponse, MatrxTransport, type MatrxTransportDiagnostics, type MatrxTransportTarget, OrganizationContextError, type OrganizationContextErrorCode, type OrganizationOperation, type ParseMatrxNdjsonResponseHooks, type ProviderSessionFailure, type ProviderSessionFailureVerdict, RUN_OUTPUT_KINDS, RUN_STREAM_LIFETIME_BACKSTOP_MS, RUN_WAIT_KNOB_FEATURE, type ResumeOrRejoinOptions, type ResumeOrRejoinOutcome, type RunOutputKind, type RunWait, type RunWaitKnobReader, type SendMatrxRequestOptions, type SettleRunPickupOptions, StreamTransportError, type UpstreamErrorPayload, V2_COVERED_AI_PATH_TEMPLATES, aiVersionPathOverrides, applyAiApiVersion, applyDesktopTargetToRequestBody, applyOrganizationContextHeader, assertOrganizationMatchesOperation, assertQueryOrganizationMatchesContext, bareStatusSentence, buildMatrxRequestBody, buildMatrxRequestUrl, buildSafeRequestLog, createMatrxTransport, createOrganizationOperation, describeBackendFailure, executeMatrxCall, fetchWithMatrxProtocolFallback, followUnavailableRejoin, followWorkflowRunEvents, getUserMessage, honestTransportMessage, isBareTransportCode, isCoveredAiPath, isGenericUserMessage, isJobOutputKind, isLiveStreamUnavailable, isResumeConflict, isStreamTransportLost, isV2Path, listConversationPendingToolCalls, listUserPendingToolCalls, logApiTarget, normalizeMatrxError, openMatrxStream, parseCallApiError, parseHttpError, parseHttpErrorBody, parseMatrxNdjsonResponse, parsePersistedBackendError, parseStreamError, providerSessionFailureBody, readConversationOrganizationId, readLiveRunRejoin, readLiveRunRequestId, readLiveStreamUnavailable, readMatrxErrorCode, readMatrxErrorCodeFromMessage, readMatrxJsonResponse, redactUrlForRequestLog, reportProviderSessionFailure, requireOrganizationContext, resolveEndpointPath, resolveRunWaitWith, resumeOrRejoin, runJobLabel, runOutputKindFromModalities, runWaitKnobKey, runWaitTimeoutMessage, runtimeOperationRejoinPath, sendMatrxRequest, settleRunPickup, shouldReportMatrxCallError, streamErrorText, submitAgentToolResults, toV1FallbackUrl, toV2Path, unwrapUpstreamError, warmAgent, withRunOrganization };
@@ -765,13 +765,15 @@ function buildMatrxRequestUrl(baseUrl, pathTemplate, pathParams, queryParams) {
765
765
  }
766
766
  const fullPath = resolvedPath.startsWith("/api/") ? resolvedPath.slice(4) : resolvedPath;
767
767
  const url = `${baseUrl}${fullPath}`;
768
- if (queryParams && Object.keys(queryParams).length > 0) {
769
- const qs = new URLSearchParams(
770
- Object.fromEntries(
771
- Object.entries(queryParams).map(([k, v]) => [k, String(v)])
772
- )
773
- ).toString();
774
- return `${url}?${qs}`;
768
+ if (queryParams) {
769
+ const search = new URLSearchParams();
770
+ for (const [key, value] of Object.entries(queryParams)) {
771
+ if (value === null || value === void 0) continue;
772
+ const values = Array.isArray(value) ? value : [value];
773
+ for (const entry of values) search.append(key, String(entry));
774
+ }
775
+ const qs = search.toString();
776
+ if (qs) return `${url}${url.includes("?") ? "&" : "?"}${qs}`;
775
777
  }
776
778
  return url;
777
779
  }
@@ -955,6 +957,44 @@ async function executeMatrxCall(request, hooks = {}) {
955
957
  ...parsed.conversationId !== null ? { conversationId: parsed.conversationId } : {}
956
958
  };
957
959
  }
960
+ async function sendMatrxRequest(url, init = {}, options = {}) {
961
+ const callerSignal = options.signal ?? init.signal ?? void 0;
962
+ if (options.timeoutMs === void 0) {
963
+ return fetch(url, { ...init, ...callerSignal ? { signal: callerSignal } : {} });
964
+ }
965
+ const controller = new AbortController();
966
+ const onCallerAbort = () => controller.abort(callerSignal?.reason);
967
+ if (callerSignal) {
968
+ if (callerSignal.aborted) controller.abort(callerSignal.reason);
969
+ else callerSignal.addEventListener("abort", onCallerAbort, { once: true });
970
+ }
971
+ let timedOut = false;
972
+ const timer = setTimeout(() => {
973
+ timedOut = true;
974
+ controller.abort();
975
+ }, options.timeoutMs);
976
+ try {
977
+ return await fetch(url, { ...init, signal: controller.signal });
978
+ } catch (error) {
979
+ if (timedOut) {
980
+ throw new BackendApiError({
981
+ code: "request_timeout",
982
+ detail: `${init.method ?? "GET"} ${url} exceeded ${options.timeoutMs}ms`,
983
+ userMessage: "The request timed out \u2014 please retry.",
984
+ status: 504
985
+ });
986
+ }
987
+ throw error;
988
+ } finally {
989
+ clearTimeout(timer);
990
+ callerSignal?.removeEventListener("abort", onCallerAbort);
991
+ }
992
+ }
993
+ async function readMatrxJsonResponse(response) {
994
+ if (!response.ok) throw await parseHttpError(response);
995
+ if (response.status === 204) return null;
996
+ return await response.json();
997
+ }
958
998
 
959
999
  // matrx/client.ts
960
1000
  function classifyStatus(status) {
@@ -2659,6 +2699,7 @@ export {
2659
2699
  readLiveStreamUnavailable,
2660
2700
  readMatrxErrorCode,
2661
2701
  readMatrxErrorCodeFromMessage,
2702
+ readMatrxJsonResponse,
2662
2703
  redactUrlForRequestLog,
2663
2704
  rejoinRuntimeOperation,
2664
2705
  reportProviderSessionFailure,
@@ -2673,6 +2714,7 @@ export {
2673
2714
  runWaitKnobKey,
2674
2715
  runWaitTimeoutMessage,
2675
2716
  runtimeOperationRejoinPath,
2717
+ sendMatrxRequest,
2676
2718
  settleRunPickup,
2677
2719
  shouldReportMatrxCallError,
2678
2720
  startAgentRun,