@ai-matrx/api 0.1.20 → 0.1.22

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 (132) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/account.d.cts +2 -2
  3. package/dist/account.d.ts +2 -2
  4. package/dist/agents.cjs +12 -12
  5. package/dist/agents.d.cts +126 -4
  6. package/dist/agents.d.ts +126 -4
  7. package/dist/agents.js +2 -2
  8. package/dist/ai.cjs +3 -3
  9. package/dist/ai.d.cts +2 -2
  10. package/dist/ai.d.ts +2 -2
  11. package/dist/ai.js +2 -2
  12. package/dist/apps.cjs +6 -6
  13. package/dist/apps.d.cts +2 -2
  14. package/dist/apps.d.ts +2 -2
  15. package/dist/apps.js +2 -2
  16. package/dist/architecture.cjs +11 -11
  17. package/dist/architecture.d.cts +2 -2
  18. package/dist/architecture.d.ts +2 -2
  19. package/dist/architecture.js +2 -2
  20. package/dist/audio.cjs +5 -5
  21. package/dist/audio.d.cts +2 -2
  22. package/dist/audio.d.ts +2 -2
  23. package/dist/audio.js +2 -2
  24. package/dist/chat.cjs +12 -60
  25. package/dist/chat.d.cts +4 -116
  26. package/dist/chat.d.ts +4 -116
  27. package/dist/chat.js +3 -43
  28. package/dist/{chunk-PKYPPATQ.cjs → chunk-2SXAAKGV.cjs} +45 -100
  29. package/dist/{chunk-JRPLPAIX.js → chunk-3M4Y376I.js} +5 -89
  30. package/dist/chunk-FNIYADWI.cjs +59 -0
  31. package/dist/{chunk-EV7AXV2X.cjs → chunk-FSXBRXRX.cjs} +8 -101
  32. package/dist/{chunk-PIPE5OML.js → chunk-KIEAFMKB.js} +46 -100
  33. package/dist/chunk-YTEOFGFC.js +57 -0
  34. package/dist/code.cjs +7 -7
  35. package/dist/code.d.cts +2 -2
  36. package/dist/code.d.ts +2 -2
  37. package/dist/code.js +2 -2
  38. package/dist/commerce.d.cts +2 -2
  39. package/dist/commerce.d.ts +2 -2
  40. package/dist/communications.cjs +5 -5
  41. package/dist/communications.d.cts +2 -2
  42. package/dist/communications.d.ts +2 -2
  43. package/dist/communications.js +2 -2
  44. package/dist/computer.cjs +5 -5
  45. package/dist/computer.d.cts +2 -2
  46. package/dist/computer.d.ts +2 -2
  47. package/dist/computer.js +2 -2
  48. package/dist/content.cjs +5 -5
  49. package/dist/content.d.cts +2 -2
  50. package/dist/content.d.ts +2 -2
  51. package/dist/content.js +2 -2
  52. package/dist/crm.cjs +3 -3
  53. package/dist/crm.d.cts +2 -2
  54. package/dist/crm.d.ts +2 -2
  55. package/dist/crm.js +2 -2
  56. package/dist/data.cjs +4 -4
  57. package/dist/data.d.cts +2 -2
  58. package/dist/data.d.ts +2 -2
  59. package/dist/data.js +2 -2
  60. package/dist/education.cjs +5 -5
  61. package/dist/education.d.cts +2 -2
  62. package/dist/education.d.ts +2 -2
  63. package/dist/education.js +2 -2
  64. package/dist/files.cjs +21 -21
  65. package/dist/files.d.cts +2 -2
  66. package/dist/files.d.ts +2 -2
  67. package/dist/files.js +2 -2
  68. package/dist/human-resources.d.cts +2 -2
  69. package/dist/human-resources.d.ts +2 -2
  70. package/dist/{index-YFW4xNti.d.cts → index-oZNMwcTG.d.cts} +3 -3
  71. package/dist/{index-YFW4xNti.d.ts → index-oZNMwcTG.d.ts} +3 -3
  72. package/dist/index.cjs +86 -129
  73. package/dist/index.d.cts +7 -122
  74. package/dist/index.d.ts +7 -122
  75. package/dist/index.js +8 -15
  76. package/dist/integrations.cjs +4 -4
  77. package/dist/integrations.d.cts +2 -2
  78. package/dist/integrations.d.ts +2 -2
  79. package/dist/integrations.js +2 -2
  80. package/dist/intelligence.cjs +8 -8
  81. package/dist/intelligence.d.cts +3 -3
  82. package/dist/intelligence.d.ts +3 -3
  83. package/dist/intelligence.js +3 -3
  84. package/dist/{keys.generated-DPvmbTFD.d.cts → keys.generated-DE-t9kzx.d.cts} +2 -2
  85. package/dist/{keys.generated-DPvmbTFD.d.ts → keys.generated-DE-t9kzx.d.ts} +2 -2
  86. package/dist/knowledge.cjs +43 -43
  87. package/dist/knowledge.d.cts +2 -2
  88. package/dist/knowledge.d.ts +2 -2
  89. package/dist/knowledge.js +2 -2
  90. package/dist/legal.cjs +7 -7
  91. package/dist/legal.d.cts +2 -2
  92. package/dist/legal.d.ts +2 -2
  93. package/dist/legal.js +2 -2
  94. package/dist/marketing.cjs +77 -77
  95. package/dist/marketing.d.cts +2 -2
  96. package/dist/marketing.d.ts +2 -2
  97. package/dist/marketing.js +2 -2
  98. package/dist/masterwork.cjs +33 -33
  99. package/dist/masterwork.d.cts +2 -2
  100. package/dist/masterwork.d.ts +2 -2
  101. package/dist/masterwork.js +2 -2
  102. package/dist/media.cjs +12 -12
  103. package/dist/media.d.cts +2 -2
  104. package/dist/media.d.ts +2 -2
  105. package/dist/media.js +2 -2
  106. package/dist/net.cjs +20 -19
  107. package/dist/net.js +2 -1
  108. package/dist/platform.cjs +4 -4
  109. package/dist/platform.d.cts +2 -2
  110. package/dist/platform.d.ts +2 -2
  111. package/dist/platform.js +2 -2
  112. package/dist/publish.cjs +8 -8
  113. package/dist/publish.d.cts +2 -2
  114. package/dist/publish.d.ts +2 -2
  115. package/dist/publish.js +2 -2
  116. package/dist/schemas.d.cts +3 -125
  117. package/dist/schemas.d.ts +3 -125
  118. package/dist/stream.cjs +11 -11
  119. package/dist/stream.d.cts +1 -1
  120. package/dist/stream.d.ts +1 -1
  121. package/dist/stream.js +2 -2
  122. package/dist/types.d.cts +6 -210
  123. package/dist/types.d.ts +6 -210
  124. package/dist/web.cjs +27 -27
  125. package/dist/web.d.cts +2 -2
  126. package/dist/web.d.ts +2 -2
  127. package/dist/web.js +2 -2
  128. package/dist/workflows.cjs +14 -14
  129. package/dist/workflows.d.cts +2 -2
  130. package/dist/workflows.d.ts +2 -2
  131. package/dist/workflows.js +2 -2
  132. package/package.json +2 -2
package/dist/chat.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { A as Api, C as CallOptions, J as JsonOrStream, N as NdjsonEvent, a as ApiStream } from './index-YFW4xNti.js';
2
- import { JsonValue, ResponseFormatText, ResponseFormatJsonObject, ResponseFormatJsonSchema, TtsVoiceSpeaker, TtsDialogueTurn, MediaRef, ImageLora, CustomTool, CompactionSettings, DictionaryConfig, ContextAnchor, ChatMessageInput, RegisteredToolSpec, InlineToolSpec, AgentToolSpec, ClientContext, UserOverrides, LLMParams, ResourceContextPolicy, IdeState, SandboxBindingRequest, PageContext, CacheBypass, TextPart, ThinkingPart, ToolCallPart, ToolResultPart, UserImageMediaPart, UserAudioMediaPart, UserVideoMediaPart, UserDocumentMediaPart, UserYouTubeMediaPart, CodeExecPart, CodeResultPart, WebSearchPart, WebpageInputPart, NotesInputPart, TaskInputPart, AgentInputPart, ProjectInputPart, AgentAppInputPart, TranscriptInputPart, TranscriptSessionInputPart, WorkbookInputPart, DocumentInputPart, TableInputPart, ListInputPart, DataInputPart, ContextInputPart, RemarksInputPart, DecisionQuestionsPart, DecisionAnswersPart, SpeechScriptPart, HostTurn, AgentStartRequest, PromptStartRequest, ActionNeeded } from './schemas.js';
1
+ import { A as Api, C as CallOptions, J as JsonOrStream, N as NdjsonEvent, a as ApiStream } from './index-oZNMwcTG.js';
2
+ import { JsonValue, ResponseFormatText, ResponseFormatJsonObject, ResponseFormatJsonSchema, TtsVoiceSpeaker, TtsDialogueTurn, MediaRef, ImageLora, CustomTool, CompactionSettings, DictionaryConfig, ContextAnchor, ChatMessageInput, RegisteredToolSpec, InlineToolSpec, AgentToolSpec, ClientContext, UserOverrides, LLMParams, ResourceContextPolicy, IdeState, SandboxBindingRequest, PageContext, CacheBypass, TextPart, ThinkingPart, ToolCallPart, ToolResultPart, UserImageMediaPart, UserAudioMediaPart, UserVideoMediaPart, UserDocumentMediaPart, UserYouTubeMediaPart, CodeExecPart, CodeResultPart, WebSearchPart, WebpageInputPart, NotesInputPart, TaskInputPart, AgentInputPart, ProjectInputPart, AgentAppInputPart, TranscriptInputPart, TranscriptSessionInputPart, WorkbookInputPart, DocumentInputPart, TableInputPart, ListInputPart, DataInputPart, ContextInputPart, RemarksInputPart, DecisionQuestionsPart, DecisionAnswersPart, SpeechScriptPart, HostTurn, ActionNeeded } from './schemas.js';
3
3
  import '@ai-matrx/auth/credentials';
4
4
 
5
5
  /**
6
6
  * GENERATED by @ai-matrx/api scripts/generate.mjs from aidream/api-contract — never edit by hand.
7
- * CONTRACT_SHA256 d1dd65662e3a41431aaf8b122d973c58c27ce4310caeb89ba3abd72b229a7383
7
+ * CONTRACT_SHA256 605c060bacf38697b876c603bf0260b9b2941fe22b1da1722810724c3d0c39be
8
8
  */
9
9
 
10
10
  /** What the chooser sends. Only `provider` plus one of `resource_ref` / */
@@ -1418,86 +1418,6 @@ type PromptExecutionResult = unknown;
1418
1418
  /** Prompt Execution */
1419
1419
  /** `POST /ai/chat/prompt-execution` · aidream · auth guest · org required · ndjson */
1420
1420
  declare function promptExecution(api: Api, args: PromptExecutionArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1421
- type V2ChatV2Args = {
1422
- body: ChatRequest;
1423
- };
1424
- type V2ChatV2Result = unknown;
1425
- /** Chat V2 */
1426
- /** `POST /v2/ai/manual` · aidream · auth guest · org required */
1427
- declare function v2ChatV2(api: Api, args: V2ChatV2Args, options?: CallOptions): Promise<V2ChatV2Result>;
1428
- type V2ChatV2PostArgs = {
1429
- body: ChatRequest;
1430
- };
1431
- type V2ChatV2PostResult = unknown;
1432
- /** Chat V2 */
1433
- /** `POST /v2/ai/chat` · aidream · auth guest · org required */
1434
- declare function v2ChatV2Post(api: Api, args: V2ChatV2PostArgs, options?: CallOptions): Promise<V2ChatV2PostResult>;
1435
- type V2StartAgentV2Args = {
1436
- path: {
1437
- agent_id: string;
1438
- };
1439
- query?: {
1440
- is_version?: boolean;
1441
- };
1442
- body: AgentStartRequest;
1443
- };
1444
- type V2StartAgentV2Result = unknown;
1445
- /** Start Agent V2 */
1446
- /** `POST /v2/ai/agent/{agent_id}` · aidream · auth guest · org required */
1447
- declare function v2StartAgentV2(api: Api, args: V2StartAgentV2Args, options?: CallOptions): Promise<V2StartAgentV2Result>;
1448
- type V2StartAgentV2PostArgs = {
1449
- path: {
1450
- agent_id: string;
1451
- };
1452
- query?: {
1453
- is_version?: boolean;
1454
- };
1455
- body: AgentStartRequest;
1456
- };
1457
- type V2StartAgentV2PostResult = unknown;
1458
- /** Start Agent V2 */
1459
- /** `POST /v2/ai/agents/{agent_id}` · aidream · auth guest · org required */
1460
- declare function v2StartAgentV2Post(api: Api, args: V2StartAgentV2PostArgs, options?: CallOptions): Promise<V2StartAgentV2PostResult>;
1461
- type StartMandatedAgentV2Args = {
1462
- path: {
1463
- mandate_key: string;
1464
- };
1465
- body: AgentStartRequest;
1466
- };
1467
- type StartMandatedAgentV2Result = unknown;
1468
- /** Start Mandated Agent V2 */
1469
- /** `POST /v2/ai/mandates/{mandate_key}` · aidream · auth guest · org required */
1470
- declare function startMandatedAgentV2(api: Api, args: StartMandatedAgentV2Args, options?: CallOptions): Promise<StartMandatedAgentV2Result>;
1471
- type V2ContinueConversationV2Args = {
1472
- path: {
1473
- conversation_id: string;
1474
- };
1475
- body: ConversationContinueRequest;
1476
- };
1477
- type V2ContinueConversationV2Result = unknown;
1478
- /** Continue Conversation V2 */
1479
- /** `POST /v2/ai/conversation/{conversation_id}` · aidream · auth guest · org required */
1480
- declare function v2ContinueConversationV2(api: Api, args: V2ContinueConversationV2Args, options?: CallOptions): Promise<V2ContinueConversationV2Result>;
1481
- type V2ContinueConversationV2PostArgs = {
1482
- path: {
1483
- conversation_id: string;
1484
- };
1485
- body: ConversationContinueRequest;
1486
- };
1487
- type V2ContinueConversationV2PostResult = unknown;
1488
- /** Continue Conversation V2 */
1489
- /** `POST /v2/ai/conversations/{conversation_id}` · aidream · auth guest · org required */
1490
- declare function v2ContinueConversationV2Post(api: Api, args: V2ContinueConversationV2PostArgs, options?: CallOptions): Promise<V2ContinueConversationV2PostResult>;
1491
- type StartPromptV2Args = {
1492
- path: {
1493
- prompt_id: string;
1494
- };
1495
- body: PromptStartRequest;
1496
- };
1497
- type StartPromptV2Result = unknown;
1498
- /** Start Prompt V2 */
1499
- /** `POST /v2/ai/prompts/{prompt_id}` · aidream · auth guest · org required */
1500
- declare function startPromptV2(api: Api, args: StartPromptV2Args, options?: CallOptions): Promise<StartPromptV2Result>;
1501
1421
  type GetConversationAttachmentsArgs = {
1502
1422
  path: {
1503
1423
  conversation_id: string;
@@ -2028,38 +1948,6 @@ interface Operations {
2028
1948
  args: WarmHealthRouteArgs;
2029
1949
  result: WarmHealthRouteResult;
2030
1950
  };
2031
- "POST /v2/ai/manual": {
2032
- args: V2ChatV2Args;
2033
- result: V2ChatV2Result;
2034
- };
2035
- "POST /v2/ai/chat": {
2036
- args: V2ChatV2PostArgs;
2037
- result: V2ChatV2PostResult;
2038
- };
2039
- "POST /v2/ai/agent/{agent_id}": {
2040
- args: V2StartAgentV2Args;
2041
- result: V2StartAgentV2Result;
2042
- };
2043
- "POST /v2/ai/agents/{agent_id}": {
2044
- args: V2StartAgentV2PostArgs;
2045
- result: V2StartAgentV2PostResult;
2046
- };
2047
- "POST /v2/ai/mandates/{mandate_key}": {
2048
- args: StartMandatedAgentV2Args;
2049
- result: StartMandatedAgentV2Result;
2050
- };
2051
- "POST /v2/ai/conversation/{conversation_id}": {
2052
- args: V2ContinueConversationV2Args;
2053
- result: V2ContinueConversationV2Result;
2054
- };
2055
- "POST /v2/ai/conversations/{conversation_id}": {
2056
- args: V2ContinueConversationV2PostArgs;
2057
- result: V2ContinueConversationV2PostResult;
2058
- };
2059
- "POST /v2/ai/prompts/{prompt_id}": {
2060
- args: StartPromptV2Args;
2061
- result: StartPromptV2Result;
2062
- };
2063
1951
  "GET /conversations/{conversation_id}/attachments": {
2064
1952
  args: GetConversationAttachmentsArgs;
2065
1953
  result: GetConversationAttachmentsResult;
@@ -2240,4 +2128,4 @@ interface Operations {
2240
2128
  /** Path-keyed call, scoped to this domain only (never a global path map). */
2241
2129
  declare function call<K extends keyof Operations>(api: Api, key: K, args?: Operations[K]["args"], options?: CallOptions): Promise<Operations[K]["result"]>;
2242
2130
 
2243
- export { type AiProviderStatusArgs, type AiProviderStatusResult, type AttachConversationResourceArgs, type AttachConversationResourceResult, type AttachResourceRequest, type BatchDeleteMessagesArgs, type BatchDeleteMessagesResult, type BatchDeleteRequest, type BatchDeleteResponse, type CacheL2State, type CadenceEveryRounds, type CancelRequestArgs, type CancelRequestResult, type CancelResponse, type ChatArgs, type ChatMirrorStatusArgs, type ChatMirrorStatusResult, type ChatPostArgs, type ChatPostResult, type ChatRequest, type ChatResult, type ChatSyncStatusArgs, type ChatSyncStatusResult, type ClientToolResult, type CompactTurnsArgs, type CompactTurnsRequest, type CompactTurnsResponse, type CompactTurnsResult, type ContextStateResponse, type ConversationAttachmentPayload, type ConversationContinueRequest, type ConversationDeleteResponse, type ConversationRecord, type ConversationSettingsResponse, type ConversationSettingsUpdate, type ConversationWarmResponse, type ConversationsBindConversationSandboxArgs, type ConversationsBindConversationSandboxPutArgs, type ConversationsBindConversationSandboxPutResult, type ConversationsBindConversationSandboxResult, type ConversationsCancelInboxItemArgs, type ConversationsCancelInboxItemDeleteArgs, type ConversationsCancelInboxItemDeleteResult, type ConversationsCancelInboxItemResult, type ConversationsContinueConversationArgs, type ConversationsContinueConversationPostArgs, type ConversationsContinueConversationPostResult, type ConversationsContinueConversationResult, type ConversationsEditInboxItemArgs, type ConversationsEditInboxItemPatchArgs, type ConversationsEditInboxItemPatchResult, type ConversationsEditInboxItemResult, type ConversationsEnqueueInboxItemArgs, type ConversationsEnqueueInboxItemPostArgs, type ConversationsEnqueueInboxItemPostResult, type ConversationsEnqueueInboxItemResult, type ConversationsForkAndRunArgs, type ConversationsForkAndRunPostArgs, type ConversationsForkAndRunPostResult, type ConversationsForkAndRunResult, type ConversationsGetConversationMemoryCostArgs, type ConversationsGetConversationMemoryCostGetArgs, type ConversationsGetConversationMemoryCostGetResult, type ConversationsGetConversationMemoryCostResult, type ConversationsGetConversationSandboxArgs, type ConversationsGetConversationSandboxGetArgs, type ConversationsGetConversationSandboxGetResult, type ConversationsGetConversationSandboxResult, type ConversationsListConversationPendingCallsArgs, type ConversationsListConversationPendingCallsGetArgs, type ConversationsListConversationPendingCallsGetResult, type ConversationsListConversationPendingCallsResult, type ConversationsListInboxItemsArgs, type ConversationsListInboxItemsGetArgs, type ConversationsListInboxItemsGetResult, type ConversationsListInboxItemsResult, type ConversationsResumeConversationArgs, type ConversationsResumeConversationPostArgs, type ConversationsResumeConversationPostResult, type ConversationsResumeConversationResult, type ConversationsSubmitToolResultsArgs, type ConversationsSubmitToolResultsPostArgs, type ConversationsSubmitToolResultsPostResult, type ConversationsSubmitToolResultsResult, type ConversationsUnbindConversationSandboxArgs, type ConversationsUnbindConversationSandboxDeleteArgs, type ConversationsUnbindConversationSandboxDeleteResult, type ConversationsUnbindConversationSandboxResult, type ConversationsWarmConversationArgs, type ConversationsWarmConversationPostArgs, type ConversationsWarmConversationPostResult, type ConversationsWarmConversationResult, type CxAttributionRegistry, type CxExplorerFacetEntry, type CxExplorerFacets, type CxExplorerTotals, type DelegationConversationStateArgs, type DelegationConversationStateResult, type DelegationPendingReviewsArgs, type DelegationPendingReviewsResult, type DelegationReviewDecisionArgs, type DelegationReviewDecisionResult, type DelegationStatusArgs, type DelegationStatusResult, type DelegationUiClaimArgs, type DelegationUiClaimResult, type DelegationUiReleaseArgs, type DelegationUiReleaseResult, type DeleteAllMessagesArgs, type DeleteAllMessagesResponse, type DeleteAllMessagesResult, type DeleteConversationDoorArgs, type DeleteConversationDoorResult, type DeleteMessageArgs, type DeleteMessageResponse, type DeleteMessageResult, type DetachConversationResourceArgs, type DetachConversationResourceResult, type DirectChatArgs, type DirectChatRequest, type DirectChatResult, type ForkAndRunRequest, type ForkConversationArgs, type ForkConversationResponse, type ForkConversationResult, type ForkRequest, type GetAttributionRegistryArgs, type GetAttributionRegistryResult, type GetContextStateArgs, type GetContextStateResult, type GetConversationAttachmentsArgs, type GetConversationAttachmentsResult, type GetConversationRequestsArgs, type GetConversationRequestsResult, type GetConversationResponse, type GetConversationWithAllRelatedArgs, type GetConversationWithAllRelatedResult, type GetFacetsArgs, type GetFacetsResult, type GetGroupChatArgs, type GetGroupChatResult, type GetUserConversationsArgs, type GetUserConversationsResult, type GroupChatOut, type HideMessagesFromModelArgs, type HideMessagesFromModelResult, type HideRequest, type HideResponse, type InboxEditRequest, type InboxEnqueueRequest, type InboxEnqueueResponse, type InboxItem, type InboxMutationResponse, type InvalidateCacheResponse, type InvalidateConversationCacheArgs, type InvalidateConversationCacheResult, type ListAnthropicToolSchemasArgs, type ListAnthropicToolSchemasResult, type ListConversationsResponse, type ListLocalToolsArgs, type ListLocalToolsResult, type ListModelsArgs, type ListModelsResult, type ListRequestsResponse, type ListToolSchemasArgs, type ListToolSchemasByCategoryArgs, type ListToolSchemasByCategoryResult, type ListToolSchemasResult, type ListUserPendingCallsArgs, type ListUserPendingCallsResult, type LocalLlmConnectArgs, type LocalLlmConnectRequest, type LocalLlmConnectResult, type LocalLlmDisconnectArgs, type LocalLlmDisconnectResult, type LocalLlmStatusArgs, type LocalLlmStatusResult, type MemoryCostByEventType, type MemoryCostSummary, type MessageSelector, type MessageUpdate, type Operations, type Participant, type ParticipantOut, type PendingCallSummary, type PolicyUpdate, type PromptExecutionArgs, type PromptExecutionResult, type ProviderReadiness, type ProviderReadinessArgs, type ProviderReadinessResult, type PutParticipantPolicyArgs, type PutParticipantPolicyResult, type ReplaceMessagesArgs, type ReplaceMessagesResult, type ReplaceRequest, type ReplaceResponse, type RequestRecord, type RestoreCompactionArgs, type RestoreCompactionResult, type RestoreRequest, type RetryNowRequestArgs, type RetryNowRequestResult, type RetryNowResponse, type RevealAfterRound, type RevealEveryRounds, type ReviewDecisionRequest, type SandboxBindRequest, type SandboxBindingState, type SeesExcept, type SeesOnly, type SetLocalToolExposureArgs, type SetLocalToolExposureResult, type StartMandatedAgentV2Args, type StartMandatedAgentV2Result, type StartPromptV2Args, type StartPromptV2Result, type SystemInstructionInput, type ToolExposureRequest, type ToolResultsRequest, type ToolResultsResponse, type TriggerChatMirrorSyncArgs, type TriggerChatMirrorSyncResult, type TriggerChatSyncArgs, type TriggerChatSyncResult, type TurnRange, type UiClaimRequest, type UpdateConversationSettingsDoorArgs, type UpdateConversationSettingsDoorResult, type UpdateMessageArgs, type UpdateMessageResponse, type UpdateMessageResult, type V2ChatV2Args, type V2ChatV2PostArgs, type V2ChatV2PostResult, type V2ChatV2Result, type V2ContinueConversationV2Args, type V2ContinueConversationV2PostArgs, type V2ContinueConversationV2PostResult, type V2ContinueConversationV2Result, type V2StartAgentV2Args, type V2StartAgentV2PostArgs, type V2StartAgentV2PostResult, type V2StartAgentV2Result, type ViewPolicy, type WarmArgs, type WarmHealthOut, type WarmHealthRouteArgs, type WarmHealthRouteResult, type WarmIn, type WarmItemIn, type WarmItemOut, type WarmOut, type WarmResult, aiProviderStatus, type aidream__services__conversation_context__compaction__RestoreResponse, type aidream__services__conversation_context__continue_conversation__ResumeRequest, attachConversationResource, batchDeleteMessages, call, cancelRequest, chat, chatMirrorStatus, chatPost, chatSyncStatus, compactTurns, conversationsBindConversationSandbox, conversationsBindConversationSandboxPut, conversationsCancelInboxItem, conversationsCancelInboxItemDelete, conversationsContinueConversation, conversationsContinueConversationPost, conversationsEditInboxItem, conversationsEditInboxItemPatch, conversationsEnqueueInboxItem, conversationsEnqueueInboxItemPost, conversationsForkAndRun, conversationsForkAndRunPost, conversationsGetConversationMemoryCost, conversationsGetConversationMemoryCostGet, conversationsGetConversationSandbox, conversationsGetConversationSandboxGet, conversationsListConversationPendingCalls, conversationsListConversationPendingCallsGet, conversationsListInboxItems, conversationsListInboxItemsGet, conversationsResumeConversation, conversationsResumeConversationPost, conversationsSubmitToolResults, conversationsSubmitToolResultsPost, conversationsUnbindConversationSandbox, conversationsUnbindConversationSandboxDelete, conversationsWarmConversation, conversationsWarmConversationPost, delegationConversationState, delegationPendingReviews, delegationReviewDecision, delegationStatus, delegationUiClaim, delegationUiRelease, deleteAllMessages, deleteConversationDoor, deleteMessage, detachConversationResource, directChat, forkConversation, getAttributionRegistry, getContextState, getConversationAttachments, getConversationRequests, getConversationWithAllRelated, getFacets, getGroupChat, getUserConversations, hideMessagesFromModel, invalidateConversationCache, listAnthropicToolSchemas, listLocalTools, listModels, listToolSchemas, listToolSchemasByCategory, listUserPendingCalls, localLlmConnect, localLlmDisconnect, localLlmStatus, promptExecution, providerReadiness, putParticipantPolicy, replaceMessages, restoreCompaction, retryNowRequest, setLocalToolExposure, startMandatedAgentV2, startPromptV2, triggerChatMirrorSync, triggerChatSync, updateConversationSettingsDoor, updateMessage, v2ChatV2, v2ChatV2Post, v2ContinueConversationV2, v2ContinueConversationV2Post, v2StartAgentV2, v2StartAgentV2Post, warm, warmHealthRoute };
2131
+ export { type AiProviderStatusArgs, type AiProviderStatusResult, type AttachConversationResourceArgs, type AttachConversationResourceResult, type AttachResourceRequest, type BatchDeleteMessagesArgs, type BatchDeleteMessagesResult, type BatchDeleteRequest, type BatchDeleteResponse, type CacheL2State, type CadenceEveryRounds, type CancelRequestArgs, type CancelRequestResult, type CancelResponse, type ChatArgs, type ChatMirrorStatusArgs, type ChatMirrorStatusResult, type ChatPostArgs, type ChatPostResult, type ChatRequest, type ChatResult, type ChatSyncStatusArgs, type ChatSyncStatusResult, type ClientToolResult, type CompactTurnsArgs, type CompactTurnsRequest, type CompactTurnsResponse, type CompactTurnsResult, type ContextStateResponse, type ConversationAttachmentPayload, type ConversationContinueRequest, type ConversationDeleteResponse, type ConversationRecord, type ConversationSettingsResponse, type ConversationSettingsUpdate, type ConversationWarmResponse, type ConversationsBindConversationSandboxArgs, type ConversationsBindConversationSandboxPutArgs, type ConversationsBindConversationSandboxPutResult, type ConversationsBindConversationSandboxResult, type ConversationsCancelInboxItemArgs, type ConversationsCancelInboxItemDeleteArgs, type ConversationsCancelInboxItemDeleteResult, type ConversationsCancelInboxItemResult, type ConversationsContinueConversationArgs, type ConversationsContinueConversationPostArgs, type ConversationsContinueConversationPostResult, type ConversationsContinueConversationResult, type ConversationsEditInboxItemArgs, type ConversationsEditInboxItemPatchArgs, type ConversationsEditInboxItemPatchResult, type ConversationsEditInboxItemResult, type ConversationsEnqueueInboxItemArgs, type ConversationsEnqueueInboxItemPostArgs, type ConversationsEnqueueInboxItemPostResult, type ConversationsEnqueueInboxItemResult, type ConversationsForkAndRunArgs, type ConversationsForkAndRunPostArgs, type ConversationsForkAndRunPostResult, type ConversationsForkAndRunResult, type ConversationsGetConversationMemoryCostArgs, type ConversationsGetConversationMemoryCostGetArgs, type ConversationsGetConversationMemoryCostGetResult, type ConversationsGetConversationMemoryCostResult, type ConversationsGetConversationSandboxArgs, type ConversationsGetConversationSandboxGetArgs, type ConversationsGetConversationSandboxGetResult, type ConversationsGetConversationSandboxResult, type ConversationsListConversationPendingCallsArgs, type ConversationsListConversationPendingCallsGetArgs, type ConversationsListConversationPendingCallsGetResult, type ConversationsListConversationPendingCallsResult, type ConversationsListInboxItemsArgs, type ConversationsListInboxItemsGetArgs, type ConversationsListInboxItemsGetResult, type ConversationsListInboxItemsResult, type ConversationsResumeConversationArgs, type ConversationsResumeConversationPostArgs, type ConversationsResumeConversationPostResult, type ConversationsResumeConversationResult, type ConversationsSubmitToolResultsArgs, type ConversationsSubmitToolResultsPostArgs, type ConversationsSubmitToolResultsPostResult, type ConversationsSubmitToolResultsResult, type ConversationsUnbindConversationSandboxArgs, type ConversationsUnbindConversationSandboxDeleteArgs, type ConversationsUnbindConversationSandboxDeleteResult, type ConversationsUnbindConversationSandboxResult, type ConversationsWarmConversationArgs, type ConversationsWarmConversationPostArgs, type ConversationsWarmConversationPostResult, type ConversationsWarmConversationResult, type CxAttributionRegistry, type CxExplorerFacetEntry, type CxExplorerFacets, type CxExplorerTotals, type DelegationConversationStateArgs, type DelegationConversationStateResult, type DelegationPendingReviewsArgs, type DelegationPendingReviewsResult, type DelegationReviewDecisionArgs, type DelegationReviewDecisionResult, type DelegationStatusArgs, type DelegationStatusResult, type DelegationUiClaimArgs, type DelegationUiClaimResult, type DelegationUiReleaseArgs, type DelegationUiReleaseResult, type DeleteAllMessagesArgs, type DeleteAllMessagesResponse, type DeleteAllMessagesResult, type DeleteConversationDoorArgs, type DeleteConversationDoorResult, type DeleteMessageArgs, type DeleteMessageResponse, type DeleteMessageResult, type DetachConversationResourceArgs, type DetachConversationResourceResult, type DirectChatArgs, type DirectChatRequest, type DirectChatResult, type ForkAndRunRequest, type ForkConversationArgs, type ForkConversationResponse, type ForkConversationResult, type ForkRequest, type GetAttributionRegistryArgs, type GetAttributionRegistryResult, type GetContextStateArgs, type GetContextStateResult, type GetConversationAttachmentsArgs, type GetConversationAttachmentsResult, type GetConversationRequestsArgs, type GetConversationRequestsResult, type GetConversationResponse, type GetConversationWithAllRelatedArgs, type GetConversationWithAllRelatedResult, type GetFacetsArgs, type GetFacetsResult, type GetGroupChatArgs, type GetGroupChatResult, type GetUserConversationsArgs, type GetUserConversationsResult, type GroupChatOut, type HideMessagesFromModelArgs, type HideMessagesFromModelResult, type HideRequest, type HideResponse, type InboxEditRequest, type InboxEnqueueRequest, type InboxEnqueueResponse, type InboxItem, type InboxMutationResponse, type InvalidateCacheResponse, type InvalidateConversationCacheArgs, type InvalidateConversationCacheResult, type ListAnthropicToolSchemasArgs, type ListAnthropicToolSchemasResult, type ListConversationsResponse, type ListLocalToolsArgs, type ListLocalToolsResult, type ListModelsArgs, type ListModelsResult, type ListRequestsResponse, type ListToolSchemasArgs, type ListToolSchemasByCategoryArgs, type ListToolSchemasByCategoryResult, type ListToolSchemasResult, type ListUserPendingCallsArgs, type ListUserPendingCallsResult, type LocalLlmConnectArgs, type LocalLlmConnectRequest, type LocalLlmConnectResult, type LocalLlmDisconnectArgs, type LocalLlmDisconnectResult, type LocalLlmStatusArgs, type LocalLlmStatusResult, type MemoryCostByEventType, type MemoryCostSummary, type MessageSelector, type MessageUpdate, type Operations, type Participant, type ParticipantOut, type PendingCallSummary, type PolicyUpdate, type PromptExecutionArgs, type PromptExecutionResult, type ProviderReadiness, type ProviderReadinessArgs, type ProviderReadinessResult, type PutParticipantPolicyArgs, type PutParticipantPolicyResult, type ReplaceMessagesArgs, type ReplaceMessagesResult, type ReplaceRequest, type ReplaceResponse, type RequestRecord, type RestoreCompactionArgs, type RestoreCompactionResult, type RestoreRequest, type RetryNowRequestArgs, type RetryNowRequestResult, type RetryNowResponse, type RevealAfterRound, type RevealEveryRounds, type ReviewDecisionRequest, type SandboxBindRequest, type SandboxBindingState, type SeesExcept, type SeesOnly, type SetLocalToolExposureArgs, type SetLocalToolExposureResult, type SystemInstructionInput, type ToolExposureRequest, type ToolResultsRequest, type ToolResultsResponse, type TriggerChatMirrorSyncArgs, type TriggerChatMirrorSyncResult, type TriggerChatSyncArgs, type TriggerChatSyncResult, type TurnRange, type UiClaimRequest, type UpdateConversationSettingsDoorArgs, type UpdateConversationSettingsDoorResult, type UpdateMessageArgs, type UpdateMessageResponse, type UpdateMessageResult, type ViewPolicy, type WarmArgs, type WarmHealthOut, type WarmHealthRouteArgs, type WarmHealthRouteResult, type WarmIn, type WarmItemIn, type WarmItemOut, type WarmOut, type WarmResult, aiProviderStatus, type aidream__services__conversation_context__compaction__RestoreResponse, type aidream__services__conversation_context__continue_conversation__ResumeRequest, attachConversationResource, batchDeleteMessages, call, cancelRequest, chat, chatMirrorStatus, chatPost, chatSyncStatus, compactTurns, conversationsBindConversationSandbox, conversationsBindConversationSandboxPut, conversationsCancelInboxItem, conversationsCancelInboxItemDelete, conversationsContinueConversation, conversationsContinueConversationPost, conversationsEditInboxItem, conversationsEditInboxItemPatch, conversationsEnqueueInboxItem, conversationsEnqueueInboxItemPost, conversationsForkAndRun, conversationsForkAndRunPost, conversationsGetConversationMemoryCost, conversationsGetConversationMemoryCostGet, conversationsGetConversationSandbox, conversationsGetConversationSandboxGet, conversationsListConversationPendingCalls, conversationsListConversationPendingCallsGet, conversationsListInboxItems, conversationsListInboxItemsGet, conversationsResumeConversation, conversationsResumeConversationPost, conversationsSubmitToolResults, conversationsSubmitToolResultsPost, conversationsUnbindConversationSandbox, conversationsUnbindConversationSandboxDelete, conversationsWarmConversation, conversationsWarmConversationPost, delegationConversationState, delegationPendingReviews, delegationReviewDecision, delegationStatus, delegationUiClaim, delegationUiRelease, deleteAllMessages, deleteConversationDoor, deleteMessage, detachConversationResource, directChat, forkConversation, getAttributionRegistry, getContextState, getConversationAttachments, getConversationRequests, getConversationWithAllRelated, getFacets, getGroupChat, getUserConversations, hideMessagesFromModel, invalidateConversationCache, listAnthropicToolSchemas, listLocalTools, listModels, listToolSchemas, listToolSchemasByCategory, listUserPendingCalls, localLlmConnect, localLlmDisconnect, localLlmStatus, promptExecution, providerReadiness, putParticipantPolicy, replaceMessages, restoreCompaction, retryNowRequest, setLocalToolExposure, triggerChatMirrorSync, triggerChatSync, updateConversationSettingsDoor, updateMessage, warm, warmHealthRoute };
package/dist/chat.js CHANGED
@@ -1,5 +1,5 @@
1
- import { openJsonOrStream, openStream } from './chunk-JRPLPAIX.js';
2
- import './chunk-PIPE5OML.js';
1
+ import { openJsonOrStream, openStream } from './chunk-3M4Y376I.js';
2
+ import './chunk-KIEAFMKB.js';
3
3
 
4
4
  // src/generated/chat.ts
5
5
  var $conversationsWarmConversation = { m: "POST", p: "/ai/conversation/{conversation_id}/warm", d: "aidream", a: "user", o: "required", n: "chat.conversations_warm_conversation" };
@@ -150,38 +150,6 @@ var $promptExecution = { m: "POST", p: "/ai/chat/prompt-execution", d: "aidream"
150
150
  function promptExecution(api, args, options) {
151
151
  return openStream(api, $promptExecution, args, options);
152
152
  }
153
- var $v2ChatV2 = { m: "POST", p: "/v2/ai/manual", d: "aidream", a: "guest", o: "required", n: "chat.v2_chat_v2" };
154
- function v2ChatV2(api, args, options) {
155
- return api.call($v2ChatV2, args, options);
156
- }
157
- var $v2ChatV2Post = { m: "POST", p: "/v2/ai/chat", d: "aidream", a: "guest", o: "required", n: "chat.v2_chat_v2_post" };
158
- function v2ChatV2Post(api, args, options) {
159
- return api.call($v2ChatV2Post, args, options);
160
- }
161
- var $v2StartAgentV2 = { m: "POST", p: "/v2/ai/agent/{agent_id}", d: "aidream", a: "guest", o: "required", n: "chat.v2_start_agent_v2" };
162
- function v2StartAgentV2(api, args, options) {
163
- return api.call($v2StartAgentV2, args, options);
164
- }
165
- var $v2StartAgentV2Post = { m: "POST", p: "/v2/ai/agents/{agent_id}", d: "aidream", a: "guest", o: "required", n: "chat.v2_start_agent_v2_post" };
166
- function v2StartAgentV2Post(api, args, options) {
167
- return api.call($v2StartAgentV2Post, args, options);
168
- }
169
- var $startMandatedAgentV2 = { m: "POST", p: "/v2/ai/mandates/{mandate_key}", d: "aidream", a: "guest", o: "required", n: "chat.start_mandated_agent_v2" };
170
- function startMandatedAgentV2(api, args, options) {
171
- return api.call($startMandatedAgentV2, args, options);
172
- }
173
- var $v2ContinueConversationV2 = { m: "POST", p: "/v2/ai/conversation/{conversation_id}", d: "aidream", a: "guest", o: "required", n: "chat.v2_continue_conversation_v2" };
174
- function v2ContinueConversationV2(api, args, options) {
175
- return api.call($v2ContinueConversationV2, args, options);
176
- }
177
- var $v2ContinueConversationV2Post = { m: "POST", p: "/v2/ai/conversations/{conversation_id}", d: "aidream", a: "guest", o: "required", n: "chat.v2_continue_conversation_v2_post" };
178
- function v2ContinueConversationV2Post(api, args, options) {
179
- return api.call($v2ContinueConversationV2Post, args, options);
180
- }
181
- var $startPromptV2 = { m: "POST", p: "/v2/ai/prompts/{prompt_id}", d: "aidream", a: "guest", o: "required", n: "chat.start_prompt_v2" };
182
- function startPromptV2(api, args, options) {
183
- return api.call($startPromptV2, args, options);
184
- }
185
153
  var $getConversationAttachments = { m: "GET", p: "/conversations/{conversation_id}/attachments", d: "aidream", a: "guest", o: "optional", n: "chat.get_conversation_attachments" };
186
154
  function getConversationAttachments(api, args, options) {
187
155
  return api.call($getConversationAttachments, args, options);
@@ -386,14 +354,6 @@ var TABLE = {
386
354
  "POST /ai/retry-now/{request_id}": $retryNowRequest,
387
355
  "POST /ai/warm": $warm,
388
356
  "GET /ai/warm/health": $warmHealthRoute,
389
- "POST /v2/ai/manual": $v2ChatV2,
390
- "POST /v2/ai/chat": $v2ChatV2Post,
391
- "POST /v2/ai/agent/{agent_id}": $v2StartAgentV2,
392
- "POST /v2/ai/agents/{agent_id}": $v2StartAgentV2Post,
393
- "POST /v2/ai/mandates/{mandate_key}": $startMandatedAgentV2,
394
- "POST /v2/ai/conversation/{conversation_id}": $v2ContinueConversationV2,
395
- "POST /v2/ai/conversations/{conversation_id}": $v2ContinueConversationV2Post,
396
- "POST /v2/ai/prompts/{prompt_id}": $startPromptV2,
397
357
  "GET /conversations/{conversation_id}/attachments": $getConversationAttachments,
398
358
  "POST /conversations/{conversation_id}/attachments": $attachConversationResource,
399
359
  "DELETE /conversations/{conversation_id}/attachments/{association_id}": $detachConversationResource,
@@ -443,4 +403,4 @@ function call(api, key, args, options) {
443
403
  return api.call(TABLE[key], args, options);
444
404
  }
445
405
 
446
- export { aiProviderStatus, attachConversationResource, batchDeleteMessages, call, cancelRequest, chat, chatMirrorStatus, chatPost, chatSyncStatus, compactTurns, conversationsBindConversationSandbox, conversationsBindConversationSandboxPut, conversationsCancelInboxItem, conversationsCancelInboxItemDelete, conversationsContinueConversation, conversationsContinueConversationPost, conversationsEditInboxItem, conversationsEditInboxItemPatch, conversationsEnqueueInboxItem, conversationsEnqueueInboxItemPost, conversationsForkAndRun, conversationsForkAndRunPost, conversationsGetConversationMemoryCost, conversationsGetConversationMemoryCostGet, conversationsGetConversationSandbox, conversationsGetConversationSandboxGet, conversationsListConversationPendingCalls, conversationsListConversationPendingCallsGet, conversationsListInboxItems, conversationsListInboxItemsGet, conversationsResumeConversation, conversationsResumeConversationPost, conversationsSubmitToolResults, conversationsSubmitToolResultsPost, conversationsUnbindConversationSandbox, conversationsUnbindConversationSandboxDelete, conversationsWarmConversation, conversationsWarmConversationPost, delegationConversationState, delegationPendingReviews, delegationReviewDecision, delegationStatus, delegationUiClaim, delegationUiRelease, deleteAllMessages, deleteConversationDoor, deleteMessage, detachConversationResource, directChat, forkConversation, getAttributionRegistry, getContextState, getConversationAttachments, getConversationRequests, getConversationWithAllRelated, getFacets, getGroupChat, getUserConversations, hideMessagesFromModel, invalidateConversationCache, listAnthropicToolSchemas, listLocalTools, listModels, listToolSchemas, listToolSchemasByCategory, listUserPendingCalls, localLlmConnect, localLlmDisconnect, localLlmStatus, promptExecution, providerReadiness, putParticipantPolicy, replaceMessages, restoreCompaction, retryNowRequest, setLocalToolExposure, startMandatedAgentV2, startPromptV2, triggerChatMirrorSync, triggerChatSync, updateConversationSettingsDoor, updateMessage, v2ChatV2, v2ChatV2Post, v2ContinueConversationV2, v2ContinueConversationV2Post, v2StartAgentV2, v2StartAgentV2Post, warm, warmHealthRoute };
406
+ export { aiProviderStatus, attachConversationResource, batchDeleteMessages, call, cancelRequest, chat, chatMirrorStatus, chatPost, chatSyncStatus, compactTurns, conversationsBindConversationSandbox, conversationsBindConversationSandboxPut, conversationsCancelInboxItem, conversationsCancelInboxItemDelete, conversationsContinueConversation, conversationsContinueConversationPost, conversationsEditInboxItem, conversationsEditInboxItemPatch, conversationsEnqueueInboxItem, conversationsEnqueueInboxItemPost, conversationsForkAndRun, conversationsForkAndRunPost, conversationsGetConversationMemoryCost, conversationsGetConversationMemoryCostGet, conversationsGetConversationSandbox, conversationsGetConversationSandboxGet, conversationsListConversationPendingCalls, conversationsListConversationPendingCallsGet, conversationsListInboxItems, conversationsListInboxItemsGet, conversationsResumeConversation, conversationsResumeConversationPost, conversationsSubmitToolResults, conversationsSubmitToolResultsPost, conversationsUnbindConversationSandbox, conversationsUnbindConversationSandboxDelete, conversationsWarmConversation, conversationsWarmConversationPost, delegationConversationState, delegationPendingReviews, delegationReviewDecision, delegationStatus, delegationUiClaim, delegationUiRelease, deleteAllMessages, deleteConversationDoor, deleteMessage, detachConversationResource, directChat, forkConversation, getAttributionRegistry, getContextState, getConversationAttachments, getConversationRequests, getConversationWithAllRelated, getFacets, getGroupChat, getUserConversations, hideMessagesFromModel, invalidateConversationCache, listAnthropicToolSchemas, listLocalTools, listModels, listToolSchemas, listToolSchemasByCategory, listUserPendingCalls, localLlmConnect, localLlmDisconnect, localLlmStatus, promptExecution, providerReadiness, putParticipantPolicy, replaceMessages, restoreCompaction, retryNowRequest, setLocalToolExposure, triggerChatMirrorSync, triggerChatSync, updateConversationSettingsDoor, updateMessage, warm, warmHealthRoute };
@@ -143,58 +143,6 @@ function toNetError(err) {
143
143
  );
144
144
  }
145
145
 
146
- // src/net/retry.ts
147
- function defaultRetryOn(err) {
148
- return isNetError(err) && err.retryable;
149
- }
150
- function sleep(ms, signal) {
151
- return new Promise((resolve, reject) => {
152
- const timer = setTimeout(() => {
153
- resolve();
154
- if (signal) signal.removeEventListener("abort", onAbort);
155
- }, ms);
156
- const onAbort = () => {
157
- clearTimeout(timer);
158
- reject(signal?.reason ?? new Error("Aborted"));
159
- };
160
- if (signal) {
161
- if (signal.aborted) {
162
- clearTimeout(timer);
163
- reject(signal.reason);
164
- } else {
165
- signal.addEventListener("abort", onAbort, { once: true });
166
- }
167
- }
168
- });
169
- }
170
- async function withRetry(fn, opts = {}) {
171
- const attempts = Math.max(1, opts.attempts ?? 3);
172
- const initialDelayMs = opts.initialDelayMs ?? 250;
173
- const maxDelayMs = opts.maxDelayMs ?? 4e3;
174
- const factor = opts.backoffFactor ?? 2;
175
- const jitter = Math.max(0, Math.min(1, opts.jitter ?? 0.25));
176
- const retryOn = opts.retryOn ?? defaultRetryOn;
177
- let lastErr;
178
- for (let attempt = 1; attempt <= attempts; attempt++) {
179
- if (opts.signal?.aborted) throw opts.signal.reason;
180
- try {
181
- return await fn(attempt);
182
- } catch (err) {
183
- lastErr = err;
184
- if (attempt === attempts || !retryOn(err)) throw err;
185
- const base = Math.min(
186
- maxDelayMs,
187
- initialDelayMs * Math.pow(factor, attempt - 1)
188
- );
189
- const jitterAmount = base * jitter * (Math.random() * 2 - 1);
190
- const delayMs = Math.max(0, Math.round(base + jitterAmount));
191
- opts.onRetry?.(attempt, err, delayMs);
192
- await sleep(delayMs, opts.signal);
193
- }
194
- }
195
- throw lastErr;
196
- }
197
-
198
146
  // src/net/resilient-fetch.ts
199
147
  var DEFAULTS = {
200
148
  connectTimeoutMs: 15e3,
@@ -263,58 +211,56 @@ async function resilientFetch(url, init = {}, opts = {}) {
263
211
  }
264
212
  }
265
213
 
266
- // src/net/stream-monitor.ts
267
- var DEFAULTS2 = {
268
- heartbeatTimeoutMs: 3e4,
269
- maxLifetimeMs: 6e5
270
- };
271
- async function* monitorStream(source, opts = {}) {
272
- const heartbeatTimeoutMs = opts.heartbeatTimeoutMs ?? DEFAULTS2.heartbeatTimeoutMs;
273
- const maxLifetimeMs = opts.maxLifetimeMs ?? DEFAULTS2.maxLifetimeMs;
274
- const abort = opts.abortController;
275
- const startedAt = Date.now();
276
- const iter = source[Symbol.asyncIterator]();
277
- while (true) {
278
- const elapsed = Date.now() - startedAt;
279
- const remainingLifetime = maxLifetimeMs - elapsed;
280
- if (remainingLifetime <= 0) {
281
- abort?.abort("total-timeout");
282
- throw new TotalTimeoutError(maxLifetimeMs);
214
+ // src/net/retry.ts
215
+ function defaultRetryOn(err) {
216
+ return isNetError(err) && err.retryable;
217
+ }
218
+ function sleep(ms, signal) {
219
+ return new Promise((resolve, reject) => {
220
+ const timer = setTimeout(() => {
221
+ resolve();
222
+ if (signal) signal.removeEventListener("abort", onAbort);
223
+ }, ms);
224
+ const onAbort = () => {
225
+ clearTimeout(timer);
226
+ reject(signal?.reason ?? new Error("Aborted"));
227
+ };
228
+ if (signal) {
229
+ if (signal.aborted) {
230
+ clearTimeout(timer);
231
+ reject(signal.reason);
232
+ } else {
233
+ signal.addEventListener("abort", onAbort, { once: true });
234
+ }
283
235
  }
284
- const deadline = Math.min(heartbeatTimeoutMs, remainingLifetime);
285
- let timer = null;
286
- let timedOutKind = null;
287
- const timeoutPromise = new Promise((_, reject) => {
288
- timer = setTimeout(() => {
289
- timedOutKind = deadline === remainingLifetime ? "total" : "heartbeat";
290
- abort?.abort(
291
- timedOutKind === "total" ? "total-timeout" : "heartbeat-timeout"
292
- );
293
- reject(
294
- timedOutKind === "total" ? new TotalTimeoutError(maxLifetimeMs) : new HeartbeatTimeoutError(heartbeatTimeoutMs)
295
- );
296
- }, deadline);
297
- });
298
- let result;
236
+ });
237
+ }
238
+ async function withRetry(fn, opts = {}) {
239
+ const attempts = Math.max(1, opts.attempts ?? 3);
240
+ const initialDelayMs = opts.initialDelayMs ?? 250;
241
+ const maxDelayMs = opts.maxDelayMs ?? 4e3;
242
+ const factor = opts.backoffFactor ?? 2;
243
+ const jitter = Math.max(0, Math.min(1, opts.jitter ?? 0.25));
244
+ const retryOn = opts.retryOn ?? defaultRetryOn;
245
+ let lastErr;
246
+ for (let attempt = 1; attempt <= attempts; attempt++) {
247
+ if (opts.signal?.aborted) throw opts.signal.reason;
299
248
  try {
300
- result = await Promise.race([iter.next(), timeoutPromise]);
249
+ return await fn(attempt);
301
250
  } catch (err) {
302
- if (timer !== null) clearTimeout(timer);
303
- try {
304
- const cleanup = iter.return?.(void 0);
305
- if (cleanup) {
306
- void Promise.resolve(cleanup).catch(() => {
307
- });
308
- }
309
- } catch {
310
- }
311
- throw err;
251
+ lastErr = err;
252
+ if (attempt === attempts || !retryOn(err)) throw err;
253
+ const base = Math.min(
254
+ maxDelayMs,
255
+ initialDelayMs * Math.pow(factor, attempt - 1)
256
+ );
257
+ const jitterAmount = base * jitter * (Math.random() * 2 - 1);
258
+ const delayMs = Math.max(0, Math.round(base + jitterAmount));
259
+ opts.onRetry?.(attempt, err, delayMs);
260
+ await sleep(delayMs, opts.signal);
312
261
  }
313
- if (timer !== null) clearTimeout(timer);
314
- if (result.done) return;
315
- opts.onHeartbeat?.(Date.now());
316
- yield result.value;
317
262
  }
263
+ throw lastErr;
318
264
  }
319
265
 
320
266
  exports.AbortedError = AbortedError;
@@ -328,7 +274,6 @@ exports.TotalTimeoutError = TotalTimeoutError;
328
274
  exports.extractErrorMessage = extractErrorMessage;
329
275
  exports.isNetError = isNetError;
330
276
  exports.isTransportFailure = isTransportFailure;
331
- exports.monitorStream = monitorStream;
332
277
  exports.resilientFetch = resilientFetch;
333
278
  exports.toNetError = toNetError;
334
279
  exports.withRetry = withRetry;
@@ -1,90 +1,7 @@
1
- import { resilientFetch, isNetError, withRetry, isTransportFailure, AbortedError, TotalTimeoutError } from './chunk-PIPE5OML.js';
1
+ import { withRetry, isTransportFailure, AbortedError, resilientFetch, TotalTimeoutError } from './chunk-KIEAFMKB.js';
2
2
  import { isUuidShape } from '@ai-matrx/kit/uuid';
3
3
  import { credentialToHeaders, toCredentialsPort, MATRX_HEADERS } from '@ai-matrx/auth/credentials';
4
4
 
5
- // src/core/protocol.ts
6
- var MATRX_AI_API_VERSION_DEFAULT = "v2";
7
- var V2_COVERED_AI_PATH_TEMPLATES = [
8
- "/ai/manual",
9
- "/ai/chat",
10
- "/ai/agents/{agent_id}",
11
- "/ai/agent/{agent_id}",
12
- // singular alias — behaves identically
13
- "/ai/conversations/{conversation_id}",
14
- "/ai/conversation/{conversation_id}",
15
- // singular alias
16
- "/ai/prompts/{prompt_id}",
17
- // saved-prompt execution
18
- "/ai/mandates/{mandate_key}"
19
- // THE MANDATE DOOR — `/v2` sibling exists (routers/v2.py)
20
- ];
21
- function toV2Path(path) {
22
- const withLead = path.startsWith("/") ? path : `/${path}`;
23
- if (withLead.startsWith("/api/")) {
24
- const rest = withLead.slice("/api".length);
25
- return rest.startsWith("/v2/") ? withLead : `/api/v2${rest}`;
26
- }
27
- return withLead.startsWith("/v2/") ? withLead : `/v2${withLead}`;
28
- }
29
- var COVERED_INTERPOLATED_PATH = [
30
- /^(?:\/api)?\/ai\/manual$/,
31
- /^(?:\/api)?\/ai\/chat$/,
32
- /^(?:\/api)?\/ai\/agents\/[^/]+$/,
33
- /^(?:\/api)?\/ai\/agent\/[^/]+$/,
34
- /^(?:\/api)?\/ai\/conversations\/[^/]+$/,
35
- /^(?:\/api)?\/ai\/conversation\/[^/]+$/,
36
- /^(?:\/api)?\/ai\/prompts\/[^/]+$/,
37
- // `/warm` etc. deliberately don't match
38
- /^(?:\/api)?\/ai\/mandates\/[^/]+$/
39
- // the mandate door
40
- ];
41
- function isCoveredAiPath(path) {
42
- return COVERED_INTERPOLATED_PATH.some((re) => re.test(path));
43
- }
44
- function isV2Path(pathOrUrl) {
45
- return /\/v2\/ai\//.test(pathOrUrl);
46
- }
47
- function toV1FallbackUrl(url) {
48
- return url.replace(/\/v2\/ai\//, "/ai/");
49
- }
50
- function applyAiApiVersion(path, version) {
51
- if (version !== "v2") return path;
52
- return isCoveredAiPath(path) ? toV2Path(path) : path;
53
- }
54
- async function fetchWithMatrxProtocolFallback(url, init, opts = {}) {
55
- const { onDowngrade, ...fetchOpts } = opts;
56
- const logDowngrade = (reason, status2) => {
57
- console.warn(
58
- `[matrx] ai_v2_downgrade \u2192 retrying on v1. v2=${url} reason=${reason}`
59
- );
60
- onDowngrade?.({ url, reason, ...status2 !== void 0 ? { status: status2 } : {} });
61
- };
62
- if (!isV2Path(url)) return resilientFetch(url, init, fetchOpts);
63
- let result;
64
- try {
65
- result = await resilientFetch(url, init, fetchOpts);
66
- } catch (err) {
67
- const isAbort = isNetError(err) && err.code === "aborted" || err instanceof Error && err.name === "AbortError";
68
- if (isAbort) throw err;
69
- logDowngrade(String(err));
70
- return resilientFetch(toV1FallbackUrl(url), init, fetchOpts);
71
- }
72
- const status = result.response.status;
73
- if (status === 404 || status === 405 || status >= 500) {
74
- logDowngrade(`HTTP ${status}`, status);
75
- return resilientFetch(toV1FallbackUrl(url), init, fetchOpts);
76
- }
77
- return result;
78
- }
79
- function aiVersionPathOverrides(version) {
80
- if (version !== "v2") return {};
81
- const map = {};
82
- for (const template of V2_COVERED_AI_PATH_TEMPLATES) {
83
- map[template] = toV2Path(template);
84
- }
85
- return map;
86
- }
87
-
88
5
  // src/core/backend-errors.ts
89
6
  var BackendApiError = class extends Error {
90
7
  /** Machine-readable error code */
@@ -818,7 +735,7 @@ async function* readMatrxSseStream(stream, options = {}) {
818
735
  }
819
736
 
820
737
  // src/deployments.generated.ts
821
- var CONTRACT_SHA256 = "d1dd65662e3a41431aaf8b122d973c58c27ce4310caeb89ba3abd72b229a7383";
738
+ var CONTRACT_SHA256 = "605c060bacf38697b876c603bf0260b9b2941fe22b1da1722810724c3d0c39be";
822
739
  var DEPLOYMENTS = {
823
740
  "files": {
824
741
  "app": "files-standalone",
@@ -1049,15 +966,14 @@ async function sendOnWire(request, auth = {}) {
1049
966
  );
1050
967
  }
1051
968
  }
1052
- return fetchWithMatrxProtocolFallback(
969
+ return resilientFetch(
1053
970
  request.url,
1054
971
  { ...request.fetchOptions, method, headers: merged, ...body !== void 0 ? { body } : {} },
1055
972
  {
1056
973
  ...request.signal ? { signal: request.signal } : {},
1057
974
  connectTimeoutMs: request.connectTimeoutMs ?? DEFAULT_CONNECT_TIMEOUT_MS,
1058
975
  totalTimeoutMs: request.totalTimeoutMs !== void 0 ? request.totalTimeoutMs : null,
1059
- throwOnHttpError: false,
1060
- ...request.onProtocolDowngrade ? { onDowngrade: request.onProtocolDowngrade } : {}
976
+ throwOnHttpError: false
1061
977
  }
1062
978
  ).then((result) => {
1063
979
  if (request.onUploadProgress && body !== void 0) {
@@ -1278,4 +1194,4 @@ async function openJsonOrStream(api, op, args, options) {
1278
1194
  return { kind: "stream", stream: toStream(op, response, requestId, controller) };
1279
1195
  }
1280
1196
 
1281
- export { BackendApiError, CONTRACT_SHA256, DEFAULT_MATRX_NDJSON_READ_AHEAD, DEPLOYMENTS, DOMAINS, MATRX_AI_API_VERSION_DEFAULT, MatrxApiError, OrganizationContextError, StreamTransportError, V2_COVERED_AI_PATH_TEMPLATES, WIRE_FETCH_OPTION_KEYS, aiVersionPathOverrides, applyAiApiVersion, applyOrganizationContextHeader, assertOrganizationMatchesOperation, assertQueryOrganizationMatchesContext, createApi, createMatrxNdjsonFramer, createMatrxSseFramer, createOrganizationOperation, describeBackendFailure, extractMatrxErrorCode, extractMatrxErrorMessage, fetchWithMatrxProtocolFallback, getUserMessage, isBinaryType, isCoveredAiPath, isGenericUserMessage, isStreamTransportLost, isV2Path, normalizeMatrxStreamEnvelope, openJsonOrStream, openStream, parseCallApiError, parseHttpError, parseHttpErrorBody, parseMatrxSseFrame, parsePersistedBackendError, parseStreamError, readMatrxNdjsonStream, readMatrxSseStream, requireOrganizationContext, sendOnWire, toV1FallbackUrl, toV2Path, unwrapUpstreamError };
1197
+ export { BackendApiError, CONTRACT_SHA256, DEFAULT_MATRX_NDJSON_READ_AHEAD, DEPLOYMENTS, DOMAINS, MatrxApiError, OrganizationContextError, StreamTransportError, WIRE_FETCH_OPTION_KEYS, applyOrganizationContextHeader, assertOrganizationMatchesOperation, assertQueryOrganizationMatchesContext, createApi, createMatrxNdjsonFramer, createMatrxSseFramer, createOrganizationOperation, describeBackendFailure, extractMatrxErrorCode, extractMatrxErrorMessage, getUserMessage, isBinaryType, isGenericUserMessage, isStreamTransportLost, normalizeMatrxStreamEnvelope, openJsonOrStream, openStream, parseCallApiError, parseHttpError, parseHttpErrorBody, parseMatrxSseFrame, parsePersistedBackendError, parseStreamError, readMatrxNdjsonStream, readMatrxSseStream, requireOrganizationContext, sendOnWire, unwrapUpstreamError };
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ var chunk2SXAAKGV_cjs = require('./chunk-2SXAAKGV.cjs');
4
+
5
+ // src/net/stream-monitor.ts
6
+ var DEFAULTS = {
7
+ heartbeatTimeoutMs: 3e4,
8
+ maxLifetimeMs: 6e5
9
+ };
10
+ async function* monitorStream(source, opts = {}) {
11
+ const heartbeatTimeoutMs = opts.heartbeatTimeoutMs ?? DEFAULTS.heartbeatTimeoutMs;
12
+ const maxLifetimeMs = opts.maxLifetimeMs ?? DEFAULTS.maxLifetimeMs;
13
+ const abort = opts.abortController;
14
+ const startedAt = Date.now();
15
+ const iter = source[Symbol.asyncIterator]();
16
+ while (true) {
17
+ const elapsed = Date.now() - startedAt;
18
+ const remainingLifetime = maxLifetimeMs - elapsed;
19
+ if (remainingLifetime <= 0) {
20
+ abort?.abort("total-timeout");
21
+ throw new chunk2SXAAKGV_cjs.TotalTimeoutError(maxLifetimeMs);
22
+ }
23
+ const deadline = Math.min(heartbeatTimeoutMs, remainingLifetime);
24
+ let timer = null;
25
+ let timedOutKind = null;
26
+ const timeoutPromise = new Promise((_, reject) => {
27
+ timer = setTimeout(() => {
28
+ timedOutKind = deadline === remainingLifetime ? "total" : "heartbeat";
29
+ abort?.abort(
30
+ timedOutKind === "total" ? "total-timeout" : "heartbeat-timeout"
31
+ );
32
+ reject(
33
+ timedOutKind === "total" ? new chunk2SXAAKGV_cjs.TotalTimeoutError(maxLifetimeMs) : new chunk2SXAAKGV_cjs.HeartbeatTimeoutError(heartbeatTimeoutMs)
34
+ );
35
+ }, deadline);
36
+ });
37
+ let result;
38
+ try {
39
+ result = await Promise.race([iter.next(), timeoutPromise]);
40
+ } catch (err) {
41
+ if (timer !== null) clearTimeout(timer);
42
+ try {
43
+ const cleanup = iter.return?.(void 0);
44
+ if (cleanup) {
45
+ void Promise.resolve(cleanup).catch(() => {
46
+ });
47
+ }
48
+ } catch {
49
+ }
50
+ throw err;
51
+ }
52
+ if (timer !== null) clearTimeout(timer);
53
+ if (result.done) return;
54
+ opts.onHeartbeat?.(Date.now());
55
+ yield result.value;
56
+ }
57
+ }
58
+
59
+ exports.monitorStream = monitorStream;