@leaflow/sdk 0.0.0-dev.358.gbb34078 → 0.0.0-dev.361.gefdc428
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/dist/assistant/v1/generated/functions.d.ts +1280 -560
- package/dist/assistant/v1/generated/functions.js +1288 -447
- package/dist/assistant/v1/generated/models.d.ts +1777 -979
- package/dist/assistant/v1/generated/models.js +196 -83
- package/dist/assistant/v1/generated/schemas.zod.d.ts +728 -313
- package/dist/assistant/v1/generated/schemas.zod.js +635 -274
- package/dist/assistant/v1/generated/validators/answerQuestionRequestBody.zod.d.ts +30 -0
- package/dist/assistant/v1/generated/validators/answerQuestionRequestBody.zod.js +28 -0
- package/dist/assistant/v1/generated/validators/approvalMode.zod.d.ts +32 -0
- package/dist/assistant/v1/generated/validators/approvalMode.zod.js +28 -0
- package/dist/assistant/v1/generated/validators/attachmentResource.zod.d.ts +19 -43
- package/dist/assistant/v1/generated/validators/attachmentResource.zod.js +23 -47
- package/dist/assistant/v1/generated/validators/bindingCodeResponseBody.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/bindingCodeResponseBody.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/bindingResource.zod.d.ts +16 -40
- package/dist/assistant/v1/generated/validators/bindingResource.zod.js +16 -40
- package/dist/assistant/v1/generated/validators/channelResource.zod.d.ts +18 -42
- package/dist/assistant/v1/generated/validators/channelResource.zod.js +17 -41
- package/dist/assistant/v1/generated/validators/channelWithSecretResponseBody.zod.d.ts +18 -42
- package/dist/assistant/v1/generated/validators/channelWithSecretResponseBody.zod.js +17 -41
- package/dist/assistant/v1/generated/validators/checkSenderParams.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/checkSenderParams.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/choiceResource.zod.d.ts +31 -0
- package/dist/assistant/v1/generated/validators/choiceResource.zod.js +29 -0
- package/dist/assistant/v1/generated/validators/clientActionRequest.zod.d.ts +21 -45
- package/dist/assistant/v1/generated/validators/clientActionRequest.zod.js +20 -47
- package/dist/assistant/v1/generated/validators/clientContextPart.zod.d.ts +16 -40
- package/dist/assistant/v1/generated/validators/clientContextPart.zod.js +17 -41
- package/dist/assistant/v1/generated/validators/clientContextRequest.zod.d.ts +23 -47
- package/dist/assistant/v1/generated/validators/clientContextRequest.zod.js +24 -48
- package/dist/assistant/v1/generated/validators/clientFunctionRequest.zod.d.ts +18 -42
- package/dist/assistant/v1/generated/validators/clientFunctionRequest.zod.js +24 -50
- package/dist/assistant/v1/generated/validators/commandListResponseBody.zod.d.ts +35 -0
- package/dist/assistant/v1/generated/validators/commandListResponseBody.zod.js +29 -0
- package/dist/assistant/v1/generated/validators/commandResource.zod.d.ts +33 -0
- package/dist/assistant/v1/generated/validators/commandResource.zod.js +33 -0
- package/dist/assistant/v1/generated/validators/commandResultResource.zod.d.ts +201 -0
- package/dist/assistant/v1/generated/validators/commandResultResource.zod.js +37 -0
- package/dist/assistant/v1/generated/validators/completeUploadRequestBody.zod.d.ts +30 -0
- package/dist/assistant/v1/generated/validators/completeUploadRequestBody.zod.js +28 -0
- package/dist/assistant/v1/generated/validators/contextUsageResource.zod.d.ts +31 -0
- package/dist/assistant/v1/generated/validators/contextUsageResource.zod.js +37 -0
- package/dist/assistant/v1/generated/validators/createChannelRequestBody.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/createChannelRequestBody.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/createFolderRequestBody.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/createFolderRequestBody.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/createTaskRequestBody.zod.d.ts +61 -0
- package/dist/assistant/v1/generated/validators/createTaskRequestBody.zod.js +35 -0
- package/dist/assistant/v1/generated/validators/createThreadRequestBody.zod.d.ts +51 -41
- package/dist/assistant/v1/generated/validators/createThreadRequestBody.zod.js +33 -47
- package/dist/assistant/v1/generated/validators/createThreadResponseBody.zod.d.ts +118 -0
- package/dist/assistant/v1/generated/validators/createThreadResponseBody.zod.js +33 -0
- package/dist/assistant/v1/generated/validators/createUploadRequestBody.zod.d.ts +37 -0
- package/dist/assistant/v1/generated/validators/createUploadRequestBody.zod.js +35 -0
- package/dist/assistant/v1/generated/validators/credentialFieldResource.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/credentialFieldResource.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/cursorPagination.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/cursorPagination.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/decideToolCallsRequestBody.zod.d.ts +33 -0
- package/dist/assistant/v1/generated/validators/decideToolCallsRequestBody.zod.js +38 -0
- package/dist/assistant/v1/generated/validators/defaultModelResource.zod.d.ts +39 -0
- package/dist/assistant/v1/generated/validators/defaultModelResource.zod.js +38 -0
- package/dist/assistant/v1/generated/validators/error.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/error.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/fileDiffResource.zod.d.ts +18 -42
- package/dist/assistant/v1/generated/validators/fileDiffResource.zod.js +22 -46
- package/dist/assistant/v1/generated/validators/folderCountsResource.zod.d.ts +35 -0
- package/dist/assistant/v1/generated/validators/folderCountsResource.zod.js +35 -0
- package/dist/assistant/v1/generated/validators/folderListResponseBody.zod.d.ts +28 -43
- package/dist/assistant/v1/generated/validators/folderListResponseBody.zod.js +16 -40
- package/dist/assistant/v1/generated/validators/folderResource.zod.d.ts +27 -41
- package/dist/assistant/v1/generated/validators/folderResource.zod.js +23 -43
- package/dist/assistant/v1/generated/validators/itemFrame.zod.d.ts +36 -0
- package/dist/assistant/v1/generated/validators/itemFrame.zod.js +32 -0
- package/dist/assistant/v1/generated/validators/itemSourceResource.zod.d.ts +36 -0
- package/dist/assistant/v1/generated/validators/itemSourceResource.zod.js +31 -0
- package/dist/assistant/v1/generated/validators/lastTurnResource.zod.d.ts +43 -0
- package/dist/assistant/v1/generated/validators/lastTurnResource.zod.js +37 -0
- package/dist/assistant/v1/generated/validators/lengthAwarePageBindingResource.zod.d.ts +16 -40
- package/dist/assistant/v1/generated/validators/lengthAwarePageBindingResource.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/lengthAwarePageChannelResource.zod.d.ts +18 -42
- package/dist/assistant/v1/generated/validators/lengthAwarePageChannelResource.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/listBindingsParams.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/listBindingsParams.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/listChannelRejectionsParams.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/listChannelRejectionsParams.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/listChannelsParams.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/listChannelsParams.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/listTaskRunsParams.zod.d.ts +34 -0
- package/dist/assistant/v1/generated/validators/listTaskRunsParams.zod.js +32 -0
- package/dist/assistant/v1/generated/validators/listThreadItemsParams.zod.d.ts +38 -0
- package/dist/assistant/v1/generated/validators/listThreadItemsParams.zod.js +40 -0
- package/dist/assistant/v1/generated/validators/listThreadTurnsParams.zod.d.ts +36 -0
- package/dist/assistant/v1/generated/validators/listThreadTurnsParams.zod.js +38 -0
- package/dist/assistant/v1/generated/validators/loginResource.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/loginResource.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/memoryListResponseBody.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/memoryListResponseBody.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/memoryResource.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/memoryResource.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/messagePart.zod.d.ts +17 -41
- package/dist/assistant/v1/generated/validators/messagePart.zod.js +20 -47
- package/dist/assistant/v1/generated/validators/moveFolderRequestBody.zod.d.ts +32 -0
- package/dist/assistant/v1/generated/validators/moveFolderRequestBody.zod.js +30 -0
- package/dist/assistant/v1/generated/validators/offsetPagination.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/offsetPagination.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/openRealtimeParams.zod.d.ts +31 -0
- package/dist/assistant/v1/generated/validators/openRealtimeParams.zod.js +29 -0
- package/dist/assistant/v1/generated/validators/partResource.zod.d.ts +17 -41
- package/dist/assistant/v1/generated/validators/partResource.zod.js +21 -45
- package/dist/assistant/v1/generated/validators/pendingActionResource.zod.d.ts +35 -0
- package/dist/assistant/v1/generated/validators/pendingActionResource.zod.js +37 -0
- package/dist/assistant/v1/generated/validators/placeThreadRequestBody.zod.d.ts +33 -0
- package/dist/assistant/v1/generated/validators/placeThreadRequestBody.zod.js +34 -0
- package/dist/assistant/v1/generated/validators/platformListResponseBody.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/platformListResponseBody.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/platformResource.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/platformResource.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/presentationResource.zod.d.ts +23 -47
- package/dist/assistant/v1/generated/validators/presentationResource.zod.js +20 -42
- package/dist/assistant/v1/generated/validators/putUploadPartHeaders.zod.d.ts +30 -0
- package/dist/assistant/v1/generated/validators/putUploadPartHeaders.zod.js +28 -0
- package/dist/assistant/v1/generated/validators/putUploadPartParams.zod.d.ts +30 -0
- package/dist/assistant/v1/generated/validators/putUploadPartParams.zod.js +28 -0
- package/dist/assistant/v1/generated/validators/questionResource.zod.d.ts +36 -0
- package/dist/assistant/v1/generated/validators/questionResource.zod.js +34 -0
- package/dist/assistant/v1/generated/validators/realtimeClientMessage.zod.d.ts +38 -0
- package/dist/assistant/v1/generated/validators/realtimeClientMessage.zod.js +42 -0
- package/dist/assistant/v1/generated/validators/realtimeExchange.zod.d.ts +278 -0
- package/dist/assistant/v1/generated/validators/realtimeExchange.zod.js +33 -0
- package/dist/assistant/v1/generated/validators/realtimeServerMessage.zod.d.ts +267 -0
- package/dist/assistant/v1/generated/validators/realtimeServerMessage.zod.js +64 -0
- package/dist/assistant/v1/generated/validators/realtimeTicketResource.zod.d.ts +32 -0
- package/dist/assistant/v1/generated/validators/realtimeTicketResource.zod.js +30 -0
- package/dist/assistant/v1/generated/validators/reasoningEffort.zod.d.ts +32 -0
- package/dist/assistant/v1/generated/validators/reasoningEffort.zod.js +28 -0
- package/dist/assistant/v1/generated/validators/rejectionListResponseBody.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/rejectionListResponseBody.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/rejectionResource.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/rejectionResource.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/resumeThreadRequestBody.zod.d.ts +31 -0
- package/dist/assistant/v1/generated/validators/resumeThreadRequestBody.zod.js +33 -0
- package/dist/assistant/v1/generated/validators/revertRequestBody.zod.d.ts +16 -39
- package/dist/assistant/v1/generated/validators/revertRequestBody.zod.js +18 -40
- package/dist/assistant/v1/generated/validators/revertedCountResponseBody.zod.d.ts +16 -39
- package/dist/assistant/v1/generated/validators/revertedCountResponseBody.zod.js +17 -40
- package/dist/assistant/v1/generated/validators/rotateSecretRequestBody.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/rotateSecretRequestBody.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/runCommandRequestBody.zod.d.ts +33 -0
- package/dist/assistant/v1/generated/validators/runCommandRequestBody.zod.js +39 -0
- package/dist/assistant/v1/generated/validators/searchTasksRequestBody.zod.d.ts +52 -0
- package/dist/assistant/v1/generated/validators/searchTasksRequestBody.zod.js +45 -0
- package/dist/assistant/v1/generated/validators/searchThreadsRequestBody.zod.d.ts +62 -0
- package/dist/assistant/v1/generated/validators/searchThreadsRequestBody.zod.js +83 -0
- package/dist/assistant/v1/generated/validators/sendMessageRequestBody.zod.d.ts +28 -52
- package/dist/assistant/v1/generated/validators/sendMessageRequestBody.zod.js +17 -41
- package/dist/assistant/v1/generated/validators/sendMessageResponseBody.zod.d.ts +33 -0
- package/dist/assistant/v1/generated/validators/sendMessageResponseBody.zod.js +37 -0
- package/dist/assistant/v1/generated/validators/senderCheckResource.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/senderCheckResource.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/settingsResource.zod.d.ts +47 -0
- package/dist/assistant/v1/generated/validators/settingsResource.zod.js +34 -0
- package/dist/assistant/v1/generated/validators/skillEnabledRequestBody.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/skillEnabledRequestBody.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/skillListResponseBody.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/skillListResponseBody.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/skillRequestBody.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/skillRequestBody.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/skillResource.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/skillResource.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/statusReportResource.zod.d.ts +108 -0
- package/dist/assistant/v1/generated/validators/statusReportResource.zod.js +48 -0
- package/dist/assistant/v1/generated/validators/subagentCountResource.zod.d.ts +33 -0
- package/dist/assistant/v1/generated/validators/subagentCountResource.zod.js +31 -0
- package/dist/assistant/v1/generated/validators/taskAction.zod.d.ts +41 -0
- package/dist/assistant/v1/generated/validators/taskAction.zod.js +51 -0
- package/dist/assistant/v1/generated/validators/taskListResponseBody.zod.d.ts +89 -0
- package/dist/assistant/v1/generated/validators/taskListResponseBody.zod.js +30 -0
- package/dist/assistant/v1/generated/validators/taskResource.zod.d.ts +86 -0
- package/dist/assistant/v1/generated/validators/taskResource.zod.js +45 -0
- package/dist/assistant/v1/generated/validators/taskRunListResponseBody.zod.d.ts +47 -0
- package/dist/assistant/v1/generated/validators/taskRunListResponseBody.zod.js +30 -0
- package/dist/assistant/v1/generated/validators/taskRunResource.zod.d.ts +44 -0
- package/dist/assistant/v1/generated/validators/taskRunResource.zod.js +38 -0
- package/dist/assistant/v1/generated/validators/taskTrigger.zod.d.ts +51 -0
- package/dist/assistant/v1/generated/validators/taskTrigger.zod.js +64 -0
- package/dist/assistant/v1/generated/validators/threadCountsResource.zod.d.ts +37 -0
- package/dist/assistant/v1/generated/validators/threadCountsResource.zod.js +37 -0
- package/dist/assistant/v1/generated/validators/threadItemListResponseBody.zod.d.ts +234 -0
- package/dist/assistant/v1/generated/validators/threadItemListResponseBody.zod.js +46 -0
- package/dist/assistant/v1/generated/validators/threadItemResource.zod.d.ts +127 -0
- package/dist/assistant/v1/generated/validators/threadItemResource.zod.js +84 -0
- package/dist/assistant/v1/generated/validators/threadListResponseBody.zod.d.ts +102 -48
- package/dist/assistant/v1/generated/validators/threadListResponseBody.zod.js +22 -45
- package/dist/assistant/v1/generated/validators/threadResource.zod.d.ts +116 -0
- package/dist/assistant/v1/generated/validators/threadResource.zod.js +94 -0
- package/dist/assistant/v1/generated/validators/threadStatus.zod.d.ts +35 -0
- package/dist/assistant/v1/generated/validators/threadStatus.zod.js +28 -0
- package/dist/assistant/v1/generated/validators/threadTurnListResponseBody.zod.d.ts +74 -0
- package/dist/assistant/v1/generated/validators/threadTurnListResponseBody.zod.js +30 -0
- package/dist/assistant/v1/generated/validators/threadTurnResource.zod.d.ts +72 -0
- package/dist/assistant/v1/generated/validators/threadTurnResource.zod.js +69 -0
- package/dist/assistant/v1/generated/validators/todoResource.zod.d.ts +17 -41
- package/dist/assistant/v1/generated/validators/todoResource.zod.js +18 -42
- package/dist/assistant/v1/generated/validators/toolCallResource.zod.d.ts +64 -0
- package/dist/assistant/v1/generated/validators/toolCallResource.zod.js +71 -0
- package/dist/assistant/v1/generated/validators/toolResultRequestBody.zod.d.ts +36 -0
- package/dist/assistant/v1/generated/validators/toolResultRequestBody.zod.js +48 -0
- package/dist/assistant/v1/generated/validators/turnStartedResponseBody.zod.d.ts +30 -0
- package/dist/assistant/v1/generated/validators/turnStartedResponseBody.zod.js +28 -0
- package/dist/assistant/v1/generated/validators/turnStatus.zod.d.ts +34 -0
- package/dist/assistant/v1/generated/validators/turnStatus.zod.js +28 -0
- package/dist/assistant/v1/generated/validators/turnType.zod.d.ts +31 -0
- package/dist/assistant/v1/generated/validators/turnType.zod.js +28 -0
- package/dist/assistant/v1/generated/validators/updateChannelRequestBody.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/updateChannelRequestBody.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/updateFolderRequestBody.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/updateFolderRequestBody.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/updateSettingsRequestBody.zod.d.ts +36 -0
- package/dist/assistant/v1/generated/validators/updateSettingsRequestBody.zod.js +31 -0
- package/dist/assistant/v1/generated/validators/updateTaskRequestBody.zod.d.ts +59 -0
- package/dist/assistant/v1/generated/validators/updateTaskRequestBody.zod.js +33 -0
- package/dist/assistant/v1/generated/validators/updateThreadRequestBody.zod.d.ts +23 -44
- package/dist/assistant/v1/generated/validators/updateThreadRequestBody.zod.js +22 -59
- package/dist/assistant/v1/generated/validators/updateUploadRequestBody.zod.d.ts +31 -0
- package/dist/assistant/v1/generated/validators/updateUploadRequestBody.zod.js +29 -0
- package/dist/assistant/v1/generated/validators/uploadAttachmentParams.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/uploadAttachmentParams.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/uploadConfigurationResource.zod.d.ts +35 -0
- package/dist/assistant/v1/generated/validators/uploadConfigurationResource.zod.js +33 -0
- package/dist/assistant/v1/generated/validators/uploadListResponseBody.zod.d.ts +44 -0
- package/dist/assistant/v1/generated/validators/uploadListResponseBody.zod.js +29 -0
- package/dist/assistant/v1/generated/validators/uploadPartResource.zod.d.ts +32 -0
- package/dist/assistant/v1/generated/validators/uploadPartResource.zod.js +30 -0
- package/dist/assistant/v1/generated/validators/uploadResource.zod.d.ts +42 -0
- package/dist/assistant/v1/generated/validators/uploadResource.zod.js +37 -0
- package/dist/assistant/v1/generated/validators/uploadedResource.zod.d.ts +16 -40
- package/dist/assistant/v1/generated/validators/uploadedResource.zod.js +18 -42
- package/dist/assistant/v1/generated/validators/usage.zod.d.ts +44 -0
- package/dist/assistant/v1/generated/validators/usage.zod.js +61 -0
- package/dist/assistant/v1/generated/validators/verifyCodeRequestBody.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/verifyCodeRequestBody.zod.js +15 -39
- package/dist/assistant/v1/generated/validators/webhookSecretResponseBody.zod.d.ts +15 -39
- package/dist/assistant/v1/generated/validators/webhookSecretResponseBody.zod.js +15 -39
- package/dist/billing/type/order/v1/generated/models.d.ts +71 -33
- package/dist/billing/type/order/v1/generated/models.js +2 -1
- package/dist/billing/type/order/v1/generated/validators/allowance.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/allowanceList.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/cancelSubscriptionRequest.zod.js +2 -2
- package/dist/billing/type/order/v1/generated/validators/cancellation.zod.js +2 -2
- package/dist/billing/type/order/v1/generated/validators/cancellationCreate.zod.js +2 -2
- package/dist/billing/type/order/v1/generated/validators/{terminationPolicy.zod.d.ts → cancellationPolicy.zod.d.ts} +3 -3
- package/dist/billing/type/order/v1/generated/validators/{terminationPolicy.zod.js → cancellationPolicy.zod.js} +2 -2
- package/dist/billing/type/order/v1/generated/validators/cancellationRefundPreview.zod.d.ts +2 -0
- package/dist/billing/type/order/v1/generated/validators/cancellationRefundPreview.zod.js +4 -3
- package/dist/billing/type/order/v1/generated/validators/cancellationRefundPreviewItem.zod.d.ts +1 -0
- package/dist/billing/type/order/v1/generated/validators/cancellationRefundPreviewItem.zod.js +1 -0
- package/dist/billing/type/order/v1/generated/validators/creditGrant.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/creditGrantList.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/discount.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/discountList.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/featureGrant.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/featureGrantList.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/featureGrantStatus.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/order.zod.d.ts +7 -5
- package/dist/billing/type/order/v1/generated/validators/orderItem.zod.d.ts +6 -4
- package/dist/billing/type/order/v1/generated/validators/orderItem.zod.js +10 -6
- package/dist/billing/type/order/v1/generated/validators/orderItemList.zod.d.ts +6 -4
- package/dist/billing/type/order/v1/generated/validators/orderItemStatus.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/orderList.zod.d.ts +7 -5
- package/dist/billing/type/order/v1/generated/validators/orderRefundQuote.zod.js +1 -1
- package/dist/billing/type/order/v1/generated/validators/orderStatus.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/paymentMethod.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/paymentMethodList.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/paymentResult.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/price.zod.d.ts +4 -1
- package/dist/billing/type/order/v1/generated/validators/price.zod.js +10 -2
- package/dist/billing/type/order/v1/generated/validators/priceList.zod.d.ts +4 -1
- package/dist/billing/type/order/v1/generated/validators/quote.zod.d.ts +2 -0
- package/dist/billing/type/order/v1/generated/validators/quoteCancellation.zod.js +2 -2
- package/dist/billing/type/order/v1/generated/validators/quoteItemInput.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/quoteItemInput.zod.js +2 -2
- package/dist/billing/type/order/v1/generated/validators/quoteRenewal.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/quoteRenewal.zod.js +3 -3
- package/dist/billing/type/order/v1/generated/validators/quoteRequest.zod.d.ts +2 -2
- package/dist/billing/type/order/v1/generated/validators/refund.zod.d.ts +2 -2
- package/dist/billing/type/order/v1/generated/validators/refundList.zod.d.ts +2 -2
- package/dist/billing/type/order/v1/generated/validators/refundPolicy.zod.d.ts +1 -0
- package/dist/billing/type/order/v1/generated/validators/refundPolicy.zod.js +2 -2
- package/dist/billing/type/order/v1/generated/validators/refundReason.zod.js +1 -1
- package/dist/billing/type/order/v1/generated/validators/renewRequest.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/renewRequest.zod.js +3 -3
- package/dist/billing/type/order/v1/generated/validators/renewalOrderRequest.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/renewalOrderRequest.zod.js +2 -2
- package/dist/billing/type/order/v1/generated/validators/renewalPrice.zod.d.ts +4 -1
- package/dist/billing/type/order/v1/generated/validators/renewalPrice.zod.js +4 -2
- package/dist/billing/type/order/v1/generated/validators/renewalPriceList.zod.d.ts +4 -1
- package/dist/billing/type/order/v1/generated/validators/scheduledChange.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/subscription.zod.d.ts +6 -2
- package/dist/billing/type/order/v1/generated/validators/subscription.zod.js +14 -2
- package/dist/billing/type/order/v1/generated/validators/subscriptionList.zod.d.ts +6 -2
- package/dist/billing/type/order/v1/generated/validators/topUp.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/topUpList.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/transaction.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/transactionList.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/withdrawal.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/withdrawalItem.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/withdrawalItemList.zod.d.ts +1 -1
- package/dist/billing/type/order/v1/generated/validators/withdrawalList.zod.d.ts +1 -1
- package/dist/billing/v1/generated/functions.d.ts +1 -1
- package/dist/billing/v1/generated/functions.js +1 -1
- package/dist/billing/v1/generated/models.d.ts +71 -33
- package/dist/billing/v1/generated/models.js +2 -1
- package/dist/billing/v1/generated/schemas.zod.d.ts +8 -8
- package/dist/billing/v1/generated/schemas.zod.js +1 -1
- package/dist/billing/v1/generated/validators/allowance.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/allowanceList.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/cancelSubscriptionRequest.zod.js +2 -2
- package/dist/billing/v1/generated/validators/cancellation.zod.js +2 -2
- package/dist/billing/v1/generated/validators/cancellationCreate.zod.js +2 -2
- package/dist/billing/v1/generated/validators/{terminationPolicy.zod.d.ts → cancellationPolicy.zod.d.ts} +3 -3
- package/dist/billing/v1/generated/validators/{terminationPolicy.zod.js → cancellationPolicy.zod.js} +2 -2
- package/dist/billing/v1/generated/validators/cancellationRefundPreview.zod.d.ts +2 -0
- package/dist/billing/v1/generated/validators/cancellationRefundPreview.zod.js +4 -3
- package/dist/billing/v1/generated/validators/cancellationRefundPreviewItem.zod.d.ts +1 -0
- package/dist/billing/v1/generated/validators/cancellationRefundPreviewItem.zod.js +1 -0
- package/dist/billing/v1/generated/validators/creditGrant.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/creditGrantList.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/discount.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/discountList.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/featureGrant.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/featureGrantList.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/featureGrantStatus.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/listAllowancesParams.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/listCancellationsParams.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/listCreditGrantsParams.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/listFeatureGrantsParams.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/listOrdersParams.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/order.zod.d.ts +7 -5
- package/dist/billing/v1/generated/validators/orderItem.zod.d.ts +6 -4
- package/dist/billing/v1/generated/validators/orderItem.zod.js +10 -6
- package/dist/billing/v1/generated/validators/orderItemList.zod.d.ts +6 -4
- package/dist/billing/v1/generated/validators/orderItemStatus.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/orderList.zod.d.ts +7 -5
- package/dist/billing/v1/generated/validators/orderRefundQuote.zod.js +1 -1
- package/dist/billing/v1/generated/validators/orderStatus.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/paymentMethod.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/paymentMethodList.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/paymentResult.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/price.zod.d.ts +4 -1
- package/dist/billing/v1/generated/validators/price.zod.js +10 -2
- package/dist/billing/v1/generated/validators/priceList.zod.d.ts +4 -1
- package/dist/billing/v1/generated/validators/quote.zod.d.ts +2 -0
- package/dist/billing/v1/generated/validators/quoteCancellation.zod.js +2 -2
- package/dist/billing/v1/generated/validators/quoteItemInput.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/quoteItemInput.zod.js +2 -2
- package/dist/billing/v1/generated/validators/quoteRenewal.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/quoteRenewal.zod.js +3 -3
- package/dist/billing/v1/generated/validators/quoteRequest.zod.d.ts +2 -2
- package/dist/billing/v1/generated/validators/refund.zod.d.ts +2 -2
- package/dist/billing/v1/generated/validators/refundList.zod.d.ts +2 -2
- package/dist/billing/v1/generated/validators/refundPolicy.zod.d.ts +1 -0
- package/dist/billing/v1/generated/validators/refundPolicy.zod.js +2 -2
- package/dist/billing/v1/generated/validators/refundReason.zod.js +1 -1
- package/dist/billing/v1/generated/validators/renewRequest.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/renewRequest.zod.js +3 -3
- package/dist/billing/v1/generated/validators/renewalOrderRequest.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/renewalOrderRequest.zod.js +2 -2
- package/dist/billing/v1/generated/validators/renewalPrice.zod.d.ts +4 -1
- package/dist/billing/v1/generated/validators/renewalPrice.zod.js +4 -2
- package/dist/billing/v1/generated/validators/renewalPriceList.zod.d.ts +4 -1
- package/dist/billing/v1/generated/validators/scheduledChange.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/subscription.zod.d.ts +6 -2
- package/dist/billing/v1/generated/validators/subscription.zod.js +14 -2
- package/dist/billing/v1/generated/validators/subscriptionList.zod.d.ts +6 -2
- package/dist/billing/v1/generated/validators/topUp.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/topUpList.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/transaction.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/transactionList.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/withdrawal.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/withdrawalItem.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/withdrawalItemList.zod.d.ts +1 -1
- package/dist/billing/v1/generated/validators/withdrawalList.zod.d.ts +1 -1
- package/dist/canopy/v1/generated/functions.d.ts +81 -6
- package/dist/canopy/v1/generated/functions.js +110 -6
- package/dist/canopy/v1/generated/models.d.ts +105 -49
- package/dist/canopy/v1/generated/models.js +7 -6
- package/dist/canopy/v1/generated/schemas.zod.d.ts +39 -5
- package/dist/canopy/v1/generated/schemas.zod.js +38 -5
- package/dist/canopy/v1/generated/validators/aPIKeyResource.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/aPIKeyResource.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/aPIKeyUsageListResponseBody.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/aPIKeyUsageListResponseBody.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/aPIKeyUsageResource.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/aPIKeyUsageResource.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/accountBalance.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/accountBalance.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/accountIdentity.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/accountIdentity.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/activeResource.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/activeResource.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/activeResourceList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/activeResourceList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/allowance.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/allowance.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/allowanceList.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/allowanceList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/applicability.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/applicability.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/applicablePlan.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/applicablePlan.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/appliedCredit.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/appliedCredit.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/autoRenewSet.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/autoRenewSet.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/billingAccount.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/billingAccount.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/billingAccountCreate.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/billingAccountCreate.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/billingAccountList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/billingAccountList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/billingAccountUpdate.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/billingAccountUpdate.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/billingScheme.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/billingScheme.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/cancelSubscriptionRequest.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/cancelSubscriptionRequest.zod.js +14 -6
- package/dist/canopy/v1/generated/validators/cancellation.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/cancellation.zod.js +14 -6
- package/dist/canopy/v1/generated/validators/cancellationCreate.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/cancellationCreate.zod.js +14 -6
- package/dist/canopy/v1/generated/validators/cancellationItem.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/cancellationItem.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/cancellationList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/cancellationList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/cancellationPolicy.zod.d.ts +47 -0
- package/dist/canopy/v1/generated/validators/cancellationPolicy.zod.js +44 -0
- package/dist/canopy/v1/generated/validators/cancellationRefundPreview.zod.d.ts +14 -4
- package/dist/canopy/v1/generated/validators/cancellationRefundPreview.zod.js +16 -7
- package/dist/canopy/v1/generated/validators/cancellationRefundPreviewItem.zod.d.ts +13 -4
- package/dist/canopy/v1/generated/validators/cancellationRefundPreviewItem.zod.js +13 -4
- package/dist/canopy/v1/generated/validators/chatCompletion.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/chatCompletion.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/chatCompletionRequest.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/chatCompletionRequest.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/checkoutMode.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/checkoutMode.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/checkoutOptions.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/checkoutOptions.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/contact.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/contact.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/contactCreate.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/contactCreate.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/contactList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/contactList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/contactUpdate.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/contactUpdate.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/createAPIKeyRequestBody.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/createAPIKeyRequestBody.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/createServiceRequestBody.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/createServiceRequestBody.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/createServiceResponseBody.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/createServiceResponseBody.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/creditGrant.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/creditGrant.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/creditGrantList.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/creditGrantList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/creditGroup.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/creditGroup.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/creditNote.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/creditNote.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/creditNoteItem.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/creditNoteItem.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/creditNoteItemList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/creditNoteItemList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/creditNoteList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/creditNoteList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/currency.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/currency.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/currencyList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/currencyList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/cursorPageRequestResource.zod.d.ts +12 -10
- package/dist/canopy/v1/generated/validators/cursorPageRequestResource.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/cursorPagination.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/cursorPagination.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/discount.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/discount.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/discountList.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/discountList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/embeddingRequest.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/embeddingRequest.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/embeddingResponse.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/embeddingResponse.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/endpointCapabilities.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/endpointCapabilities.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/entitlement.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/entitlement.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/entitlementList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/entitlementList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/error.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/error.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/errorA200529.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/errorA200529.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/featureGrant.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/featureGrant.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/featureGrantList.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/featureGrantList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/featureGrantStatus.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/featureGrantStatus.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/funds.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/funds.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/getUsageSummaryParams.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/getUsageSummaryParams.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/getUsageTimelineParams.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/getUsageTimelineParams.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/inferenceError.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/inferenceError.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/invoice.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/invoice.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/invoiceItem.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/invoiceItem.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/invoiceItemList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/invoiceItemList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/invoiceItemProration.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/invoiceItemProration.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/invoiceList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/invoiceList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/invoiceStatus.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/invoiceStatus.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/invoiceSummary.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/invoiceSummary.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/issuedAPIKeyResource.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/issuedAPIKeyResource.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/lengthAwarePageAPIKeyResource.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/lengthAwarePageAPIKeyResource.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/listApiKeysParams.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/listApiKeysParams.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/listRequestsParams.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/listRequestsParams.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/listUsageByApiKeyParams.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/listUsageByApiKeyParams.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/listUsageByModelParams.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/listUsageByModelParams.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/modality.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/modality.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/model.zod.d.ts +14 -4
- package/dist/canopy/v1/generated/validators/model.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/modelCapabilities.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/modelCapabilities.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/modelEndpoint.zod.d.ts +14 -4
- package/dist/canopy/v1/generated/validators/modelEndpoint.zod.js +14 -4
- package/dist/canopy/v1/generated/validators/modelList.zod.d.ts +14 -4
- package/dist/canopy/v1/generated/validators/modelList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/modelListResponseBody.zod.d.ts +14 -4
- package/dist/canopy/v1/generated/validators/modelListResponseBody.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/modelPricing.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/modelPricing.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/modelResource.zod.d.ts +14 -4
- package/dist/canopy/v1/generated/validators/modelResource.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/modelUsageListResponseBody.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/modelUsageListResponseBody.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/modelUsageResource.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/modelUsageResource.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/money.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/money.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/monthlyStatement.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/monthlyStatement.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/monthlyStatementList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/monthlyStatementList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/namedIdentity.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/namedIdentity.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/nativeRequest.zod.d.ts +44 -0
- package/dist/canopy/v1/generated/validators/nativeRequest.zod.js +44 -0
- package/dist/canopy/v1/generated/validators/nativeResponse.zod.d.ts +44 -0
- package/dist/canopy/v1/generated/validators/{terminationPolicy.zod.js → nativeResponse.zod.js} +15 -7
- package/dist/canopy/v1/generated/validators/objectIdentity.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/objectIdentity.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/offsetPagination.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/offsetPagination.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/order.zod.d.ts +19 -9
- package/dist/canopy/v1/generated/validators/order.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/orderCancel.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/orderCancel.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/orderItem.zod.d.ts +18 -8
- package/dist/canopy/v1/generated/validators/orderItem.zod.js +22 -10
- package/dist/canopy/v1/generated/validators/orderItemList.zod.d.ts +18 -8
- package/dist/canopy/v1/generated/validators/orderItemList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/orderItemStatus.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/orderItemStatus.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/orderList.zod.d.ts +19 -9
- package/dist/canopy/v1/generated/validators/orderList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/orderRefundQuote.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/orderRefundQuote.zod.js +13 -5
- package/dist/canopy/v1/generated/validators/orderRefundQuoteInput.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/orderRefundQuoteInput.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/orderStatus.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/orderStatus.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/paidWith.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/paidWith.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/payInvoiceRequest.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/payInvoiceRequest.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/payTogetherRequest.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/payTogetherRequest.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/paymentAction.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/paymentAction.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/paymentCancellationReason.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/paymentCancellationReason.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/paymentMethod.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/paymentMethod.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/paymentMethodList.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/paymentMethodList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/paymentMethodSetup.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/paymentMethodSetup.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/paymentMethodSetupResult.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/paymentMethodSetupResult.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/paymentOption.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/paymentOption.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/paymentOptionList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/paymentOptionList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/paymentOptionMethod.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/paymentOptionMethod.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/paymentPreview.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/paymentPreview.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/paymentPreviewInvoice.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/paymentPreviewInvoice.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/paymentResult.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/paymentResult.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/paymentStatus.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/paymentStatus.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/placedOrder.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/placedOrder.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/plan.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/plan.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/planFeature.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/planFeature.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/planList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/planList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/price.zod.d.ts +16 -5
- package/dist/canopy/v1/generated/validators/price.zod.js +22 -6
- package/dist/canopy/v1/generated/validators/priceList.zod.d.ts +16 -5
- package/dist/canopy/v1/generated/validators/priceList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/priceOption.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/priceOption.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/priceType.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/priceType.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/product.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/product.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/productID.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/productID.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/productList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/productList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/projectAssignment.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/projectAssignment.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/projectAssignmentList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/projectAssignmentList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/purchaseOperation.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/purchaseOperation.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/quote.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/quote.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/quote5f60d00.zod.d.ts +14 -4
- package/dist/canopy/v1/generated/validators/quote5f60d00.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/quoteA200529.zod.d.ts +14 -4
- package/dist/canopy/v1/generated/validators/quoteA200529.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/quoteCancellation.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/quoteCancellation.zod.js +14 -6
- package/dist/canopy/v1/generated/validators/quoteItem.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/quoteItem.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/quoteItemDc1fddb.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/quoteItemDc1fddb.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/quoteItemInput.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/quoteItemInput.zod.js +14 -6
- package/dist/canopy/v1/generated/validators/quoteRenewal.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/quoteRenewal.zod.js +15 -7
- package/dist/canopy/v1/generated/validators/quoteRenewalResult.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/quoteRenewalResult.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/quoteRequest.zod.d.ts +14 -6
- package/dist/canopy/v1/generated/validators/quoteRequest.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/quotedDiscount.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/quotedDiscount.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/rate.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/rate.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/rateList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/rateList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/reasoningCapabilities.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/reasoningCapabilities.zod.js +13 -5
- package/dist/canopy/v1/generated/validators/reasoningDiagnostics.zod.d.ts +12 -10
- package/dist/canopy/v1/generated/validators/reasoningDiagnostics.zod.js +12 -6
- package/dist/canopy/v1/generated/validators/refund.zod.d.ts +14 -6
- package/dist/canopy/v1/generated/validators/refund.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/refundList.zod.d.ts +14 -6
- package/dist/canopy/v1/generated/validators/refundList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/refundPolicy.zod.d.ts +13 -4
- package/dist/canopy/v1/generated/validators/refundPolicy.zod.js +14 -6
- package/dist/canopy/v1/generated/validators/refundReason.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/refundReason.zod.js +13 -5
- package/dist/canopy/v1/generated/validators/renewRequest.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/renewRequest.zod.js +15 -7
- package/dist/canopy/v1/generated/validators/renewalOrderRequest.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/renewalOrderRequest.zod.js +14 -6
- package/dist/canopy/v1/generated/validators/renewalPrice.zod.d.ts +16 -5
- package/dist/canopy/v1/generated/validators/renewalPrice.zod.js +16 -6
- package/dist/canopy/v1/generated/validators/renewalPriceList.zod.d.ts +16 -5
- package/dist/canopy/v1/generated/validators/renewalPriceList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/requestResource.zod.d.ts +12 -10
- package/dist/canopy/v1/generated/validators/requestResource.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/responseCreate.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/responseCreate.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/responseDeleted.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/responseDeleted.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/responseResource.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/responseResource.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/scheduledChange.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/scheduledChange.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/serviceResource.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/serviceResource.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/setProjectAssignmentRequest.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/setProjectAssignmentRequest.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/spendRow.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/spendRow.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/spendRowList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/spendRowList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/statement.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/statement.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/statementAmounts.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/statementAmounts.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/statementItem.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/statementItem.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/statementList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/statementList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/statementStatus.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/statementStatus.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/statementSummary.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/statementSummary.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/statementType.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/statementType.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/streamGenerateContentParams.zod.d.ts +48 -0
- package/dist/canopy/v1/generated/validators/{terminationPolicy.zod.d.ts → streamGenerateContentParams.zod.js} +15 -10
- package/dist/canopy/v1/generated/validators/subscription.zod.d.ts +18 -6
- package/dist/canopy/v1/generated/validators/subscription.zod.js +26 -6
- package/dist/canopy/v1/generated/validators/subscriptionCancellation.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/subscriptionCancellation.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/subscriptionList.zod.d.ts +18 -6
- package/dist/canopy/v1/generated/validators/subscriptionList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/subscriptionRestriction.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/subscriptionRestriction.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/taxItem.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/taxItem.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/tier.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/tier.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/tokenPrice.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/tokenPrice.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/topUp.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/topUp.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/topUpCreate.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/topUpCreate.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/topUpList.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/topUpList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/totalsResource.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/totalsResource.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/transaction.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/transaction.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/transactionList.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/transactionList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/transactionType.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/transactionType.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/updateAPIKeyRequestBody.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/updateAPIKeyRequestBody.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/usageBucketResource.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/usageBucketResource.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/usageCharge.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/usageCharge.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/usageChargeList.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/usageChargeList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/usageTimelineResponseBody.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/usageTimelineResponseBody.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/usageType.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/usageType.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/withdrawal.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/withdrawal.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/withdrawalAllocation.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/withdrawalAllocation.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/withdrawalCreate.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/withdrawalCreate.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/withdrawalItem.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/withdrawalItem.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/withdrawalItemList.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/withdrawalItemList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/withdrawalList.zod.d.ts +13 -5
- package/dist/canopy/v1/generated/validators/withdrawalList.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/withdrawalPreview.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/withdrawalPreview.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/withdrawalPreviewItem.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/withdrawalPreviewItem.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/withdrawalPreviewRequest.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/withdrawalPreviewRequest.zod.js +12 -4
- package/dist/canopy/v1/generated/validators/withdrawalSource.zod.d.ts +12 -4
- package/dist/canopy/v1/generated/validators/withdrawalSource.zod.js +12 -4
- package/dist/compute/v1/generated/validators/allocateFloatingIPResponseBody.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/backupCapacityPack.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/backupCapacityPackListResponseBody.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/backupService.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/createBackupCapacityPackResponseBody.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/createBackupServiceResponseBody.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/createDiskResponseBody.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/createImageResponseBody.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/diskListResponseBody.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/diskResource.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/floatingIPListResponseBody.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/floatingIPResource.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/imageListResponseBody.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/imageResource.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/instanceListResponseBody.zod.d.ts +3 -3
- package/dist/compute/v1/generated/validators/instanceResource.zod.d.ts +3 -3
- package/dist/compute/v1/generated/validators/launchInstanceResponseBody.zod.d.ts +3 -3
- package/dist/compute/v1/generated/validators/peeringListResponseBody.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/peeringResource.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/rebuildInstanceResponseBody.zod.d.ts +3 -3
- package/dist/compute/v1/generated/validators/resizeDiskResponseBody.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/resizeInstanceResponseBody.zod.d.ts +3 -3
- package/dist/compute/v1/generated/validators/setFloatingIPBandwidthResponseBody.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/setSnapshotQuotaResponseBody.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/snapshotListResponseBody.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/snapshotQuota.zod.d.ts +1 -1
- package/dist/compute/v1/generated/validators/snapshotResource.zod.d.ts +1 -1
- package/dist/membership/v1/generated/models.d.ts +71 -33
- package/dist/membership/v1/generated/models.js +2 -1
- package/dist/membership/v1/generated/validators/allowance.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/allowanceList.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/cancelSubscriptionRequest.zod.js +2 -2
- package/dist/membership/v1/generated/validators/cancellation.zod.js +2 -2
- package/dist/membership/v1/generated/validators/cancellationCreate.zod.js +2 -2
- package/dist/membership/v1/generated/validators/{terminationPolicy.zod.d.ts → cancellationPolicy.zod.d.ts} +3 -3
- package/dist/membership/v1/generated/validators/{terminationPolicy.zod.js → cancellationPolicy.zod.js} +2 -2
- package/dist/membership/v1/generated/validators/cancellationRefundPreview.zod.d.ts +2 -0
- package/dist/membership/v1/generated/validators/cancellationRefundPreview.zod.js +4 -3
- package/dist/membership/v1/generated/validators/cancellationRefundPreviewItem.zod.d.ts +1 -0
- package/dist/membership/v1/generated/validators/cancellationRefundPreviewItem.zod.js +1 -0
- package/dist/membership/v1/generated/validators/creditGrant.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/creditGrantList.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/discount.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/discountList.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/featureGrant.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/featureGrantList.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/featureGrantStatus.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/order.zod.d.ts +7 -5
- package/dist/membership/v1/generated/validators/orderItem.zod.d.ts +6 -4
- package/dist/membership/v1/generated/validators/orderItem.zod.js +10 -6
- package/dist/membership/v1/generated/validators/orderItemList.zod.d.ts +6 -4
- package/dist/membership/v1/generated/validators/orderItemStatus.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/orderList.zod.d.ts +7 -5
- package/dist/membership/v1/generated/validators/orderRefundQuote.zod.js +1 -1
- package/dist/membership/v1/generated/validators/orderStatus.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/paymentMethod.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/paymentMethodList.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/paymentResult.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/price.zod.d.ts +4 -1
- package/dist/membership/v1/generated/validators/price.zod.js +10 -2
- package/dist/membership/v1/generated/validators/priceList.zod.d.ts +4 -1
- package/dist/membership/v1/generated/validators/quote.zod.d.ts +2 -0
- package/dist/membership/v1/generated/validators/quoteCancellation.zod.js +2 -2
- package/dist/membership/v1/generated/validators/quoteItemInput.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/quoteItemInput.zod.js +2 -2
- package/dist/membership/v1/generated/validators/quoteRenewal.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/quoteRenewal.zod.js +3 -3
- package/dist/membership/v1/generated/validators/quoteRequest.zod.d.ts +2 -2
- package/dist/membership/v1/generated/validators/refund.zod.d.ts +2 -2
- package/dist/membership/v1/generated/validators/refundList.zod.d.ts +2 -2
- package/dist/membership/v1/generated/validators/refundPolicy.zod.d.ts +1 -0
- package/dist/membership/v1/generated/validators/refundPolicy.zod.js +2 -2
- package/dist/membership/v1/generated/validators/refundReason.zod.js +1 -1
- package/dist/membership/v1/generated/validators/renewRequest.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/renewRequest.zod.js +3 -3
- package/dist/membership/v1/generated/validators/renewalOrderRequest.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/renewalOrderRequest.zod.js +2 -2
- package/dist/membership/v1/generated/validators/renewalPrice.zod.d.ts +4 -1
- package/dist/membership/v1/generated/validators/renewalPrice.zod.js +4 -2
- package/dist/membership/v1/generated/validators/renewalPriceList.zod.d.ts +4 -1
- package/dist/membership/v1/generated/validators/scheduledChange.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/subscription.zod.d.ts +6 -2
- package/dist/membership/v1/generated/validators/subscription.zod.js +14 -2
- package/dist/membership/v1/generated/validators/subscriptionList.zod.d.ts +6 -2
- package/dist/membership/v1/generated/validators/topUp.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/topUpList.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/transaction.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/transactionList.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/withdrawal.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/withdrawalItem.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/withdrawalItemList.zod.d.ts +1 -1
- package/dist/membership/v1/generated/validators/withdrawalList.zod.d.ts +1 -1
- package/dist/notification/v1/generated/schemas.zod.d.ts +3 -3
- package/dist/notification/v1/generated/validators/channelListResponseBody.zod.d.ts +1 -1
- package/dist/notification/v1/generated/validators/channelResource.zod.d.ts +1 -1
- package/dist/notification/v1/generated/validators/channelScope.zod.d.ts +1 -1
- package/dist/notification/v1/generated/validators/createChannelRequestBody.zod.d.ts +1 -1
- package/dist/notification/v1/generated/validators/listUserChannelsParams.zod.d.ts +1 -1
- package/dist/notification/v1/generated/validators/notificationChannel.zod.d.ts +1 -1
- package/dist/notification/v1/generated/validators/notificationTypeDescriptor.zod.d.ts +2 -2
- package/dist/notification/v1/generated/validators/notificationTypeListResponseBody.zod.d.ts +2 -2
- package/dist/notification/v1/generated/validators/typePreferenceListResponseBody.zod.d.ts +1 -1
- package/dist/notification/v1/generated/validators/typePreferenceResource.zod.d.ts +1 -1
- package/dist/notification/v1/generated/validators/updateTypePreferenceRequestBody.zod.d.ts +1 -1
- package/dist/routes.d.ts +350 -78
- package/dist/routes.js +384 -78
- package/dist/type/resource/v1/generated/validators/reclamationState.zod.d.ts +1 -1
- package/package.json +1 -1
- package/dist/assistant/v1/generated/validators/answerRequestBody.zod.d.ts +0 -54
- package/dist/assistant/v1/generated/validators/answerRequestBody.zod.js +0 -54
- package/dist/assistant/v1/generated/validators/choice.zod.d.ts +0 -55
- package/dist/assistant/v1/generated/validators/choice.zod.js +0 -53
- package/dist/assistant/v1/generated/validators/contextResource.zod.d.ts +0 -59
- package/dist/assistant/v1/generated/validators/contextResource.zod.js +0 -62
- package/dist/assistant/v1/generated/validators/decideRequestBody.zod.d.ts +0 -55
- package/dist/assistant/v1/generated/validators/decideRequestBody.zod.js +0 -53
- package/dist/assistant/v1/generated/validators/documentResource.zod.d.ts +0 -181
- package/dist/assistant/v1/generated/validators/documentResource.zod.js +0 -71
- package/dist/assistant/v1/generated/validators/dynamicCallResultRequestBody.zod.d.ts +0 -60
- package/dist/assistant/v1/generated/validators/dynamicCallResultRequestBody.zod.js +0 -72
- package/dist/assistant/v1/generated/validators/earlierResource.zod.d.ts +0 -55
- package/dist/assistant/v1/generated/validators/earlierResource.zod.js +0 -53
- package/dist/assistant/v1/generated/validators/earlierResponseBody.zod.d.ts +0 -130
- package/dist/assistant/v1/generated/validators/earlierResponseBody.zod.js +0 -55
- package/dist/assistant/v1/generated/validators/itemResource.zod.d.ts +0 -124
- package/dist/assistant/v1/generated/validators/itemResource.zod.js +0 -101
- package/dist/assistant/v1/generated/validators/listEarlierItemsParams.zod.d.ts +0 -55
- package/dist/assistant/v1/generated/validators/listEarlierItemsParams.zod.js +0 -56
- package/dist/assistant/v1/generated/validators/listThreadsParams.zod.d.ts +0 -63
- package/dist/assistant/v1/generated/validators/listThreadsParams.zod.js +0 -72
- package/dist/assistant/v1/generated/validators/modelListResponseBody.zod.d.ts +0 -69
- package/dist/assistant/v1/generated/validators/modelListResponseBody.zod.js +0 -65
- package/dist/assistant/v1/generated/validators/modelResource.zod.d.ts +0 -65
- package/dist/assistant/v1/generated/validators/modelResource.zod.js +0 -81
- package/dist/assistant/v1/generated/validators/question.zod.d.ts +0 -60
- package/dist/assistant/v1/generated/validators/question.zod.js +0 -56
- package/dist/assistant/v1/generated/validators/streamResource.zod.d.ts +0 -55
- package/dist/assistant/v1/generated/validators/streamResource.zod.js +0 -53
- package/dist/assistant/v1/generated/validators/threadSummaryResource.zod.d.ts +0 -68
- package/dist/assistant/v1/generated/validators/threadSummaryResource.zod.js +0 -73
- package/dist/assistant/v1/generated/validators/turnIDResponseBody.zod.d.ts +0 -56
- package/dist/assistant/v1/generated/validators/turnIDResponseBody.zod.js +0 -61
- package/dist/assistant/v1/generated/validators/turnResource.zod.d.ts +0 -58
- package/dist/assistant/v1/generated/validators/turnResource.zod.js +0 -52
- package/dist/assistant/v1/generated/validators/waitResource.zod.d.ts +0 -71
- package/dist/assistant/v1/generated/validators/waitResource.zod.js +0 -59
|
@@ -1,44 +1,794 @@
|
|
|
1
|
-
export const
|
|
2
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1
|
+
export const getCreateThreadUrl = () => {
|
|
2
|
+
return `https://assistant.leaflow.cloud/api/v1/threads`;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Creates a conversation and, when `message` is given, sends it as the first message in the same
|
|
6
|
+
* request, so starting a task is one round trip.
|
|
7
|
+
*
|
|
8
|
+
* The model is chosen in this order: `modelId` from the request, the caller's default from
|
|
9
|
+
* /api/v1/settings, then the first model in the Canopy catalogue that can run an agent. Fails with
|
|
10
|
+
* 422 and code MODEL_UNAVAILABLE when the chosen model cannot run an agent, and with 422 and code
|
|
11
|
+
* REASONING_UNSUPPORTED when `reasoningEffort` is given for a model without reasoning.
|
|
12
|
+
*
|
|
13
|
+
* Without `message`, creating a conversation does not contact a model provider.
|
|
14
|
+
* @summary Create a conversation
|
|
15
|
+
*/
|
|
16
|
+
export const createThread = async (createThreadRequestBody, options, fetchFn) => {
|
|
17
|
+
const getHeaders = (h) => {
|
|
18
|
+
if (!h)
|
|
19
|
+
return {};
|
|
20
|
+
if (h instanceof Headers)
|
|
21
|
+
return Object.fromEntries(h.entries());
|
|
22
|
+
if (Symbol.iterator in h) {
|
|
23
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
24
|
+
}
|
|
25
|
+
const headers = {};
|
|
26
|
+
for (const [name, value] of Object.entries(h)) {
|
|
27
|
+
if (value !== undefined)
|
|
28
|
+
headers[name] = value;
|
|
29
|
+
}
|
|
30
|
+
return headers;
|
|
31
|
+
};
|
|
32
|
+
const res = await (fetchFn ?? fetch)(getCreateThreadUrl(), {
|
|
33
|
+
...options,
|
|
34
|
+
method: "POST",
|
|
35
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
36
|
+
body: JSON.stringify(createThreadRequestBody),
|
|
37
|
+
});
|
|
38
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
39
|
+
const data = body ? JSON.parse(body) : {};
|
|
40
|
+
return { data, status: res.status, headers: res.headers };
|
|
41
|
+
};
|
|
42
|
+
export const getSearchThreadsUrl = () => {
|
|
43
|
+
return `https://assistant.leaflow.cloud/api/v1/threads`;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Lists the caller's conversations in this project with their state, progress and usage. The
|
|
47
|
+
* criteria travel in the request body. Keep the same criteria when following `nextCursor`.
|
|
48
|
+
*
|
|
49
|
+
* Subagents are conversations too. They are excluded unless `parentId` or `role` asks for them.
|
|
50
|
+
* `ids` reads a bounded batch, including subagents and archived conversations, and cannot be
|
|
51
|
+
* combined with a cursor.
|
|
52
|
+
*
|
|
53
|
+
* Counts over everything the criteria match cost more than the page itself; ask for them with
|
|
54
|
+
* `include: [counts]`, typically on the first page only.
|
|
55
|
+
* @summary Search conversations
|
|
56
|
+
*/
|
|
57
|
+
export const searchThreads = async (searchThreadsRequestBody, options, fetchFn) => {
|
|
58
|
+
const getHeaders = (h) => {
|
|
59
|
+
if (!h)
|
|
60
|
+
return {};
|
|
61
|
+
if (h instanceof Headers)
|
|
62
|
+
return Object.fromEntries(h.entries());
|
|
63
|
+
if (Symbol.iterator in h) {
|
|
64
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
65
|
+
}
|
|
66
|
+
const headers = {};
|
|
67
|
+
for (const [name, value] of Object.entries(h)) {
|
|
68
|
+
if (value !== undefined)
|
|
69
|
+
headers[name] = value;
|
|
70
|
+
}
|
|
71
|
+
return headers;
|
|
72
|
+
};
|
|
73
|
+
const res = await (fetchFn ?? fetch)(getSearchThreadsUrl(), {
|
|
74
|
+
...options,
|
|
75
|
+
method: "QUERY",
|
|
76
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
77
|
+
body: JSON.stringify(searchThreadsRequestBody),
|
|
78
|
+
});
|
|
79
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
80
|
+
const data = body ? JSON.parse(body) : {};
|
|
81
|
+
return { data, status: res.status, headers: res.headers };
|
|
82
|
+
};
|
|
83
|
+
export const getGetThreadUrl = (thread) => {
|
|
84
|
+
return `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}`;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* The conversation's state: model, reasoning effort, approval mode, what it is doing now, its
|
|
88
|
+
* plan, what it is waiting for, context usage and token usage. The transcript is read separately
|
|
89
|
+
* from /items.
|
|
90
|
+
* @summary Get a conversation
|
|
91
|
+
*/
|
|
92
|
+
export const getThread = async (thread, options, fetchFn) => {
|
|
93
|
+
const res = await (fetchFn ?? fetch)(getGetThreadUrl(thread), {
|
|
94
|
+
...options,
|
|
95
|
+
method: "GET",
|
|
96
|
+
});
|
|
97
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
98
|
+
const data = body ? JSON.parse(body) : {};
|
|
99
|
+
return { data, status: res.status, headers: res.headers };
|
|
100
|
+
};
|
|
101
|
+
export const getUpdateThreadUrl = (thread) => {
|
|
102
|
+
return `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}`;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Changes the title, model, reasoning effort, approval mode, or whether the conversation is
|
|
106
|
+
* archived. Omitted fields stay as they are.
|
|
107
|
+
*
|
|
108
|
+
* Model, reasoning and approval changes apply to the next model request; a request already in
|
|
109
|
+
* flight keeps its settings. A model that cannot run an agent fails with 422 and code
|
|
110
|
+
* MODEL_UNAVAILABLE. Switching to a model without reasoning clears `reasoningEffort`.
|
|
111
|
+
*
|
|
112
|
+
* Archiving makes the conversation read-only and fails with 409 and code THREAD_RUNNING while a
|
|
113
|
+
* turn is running.
|
|
114
|
+
* @summary Update a conversation
|
|
115
|
+
*/
|
|
116
|
+
export const updateThread = async (thread, updateThreadRequestBody, options, fetchFn) => {
|
|
117
|
+
const getHeaders = (h) => {
|
|
118
|
+
if (!h)
|
|
119
|
+
return {};
|
|
120
|
+
if (h instanceof Headers)
|
|
121
|
+
return Object.fromEntries(h.entries());
|
|
122
|
+
if (Symbol.iterator in h) {
|
|
123
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
124
|
+
}
|
|
125
|
+
const headers = {};
|
|
126
|
+
for (const [name, value] of Object.entries(h)) {
|
|
127
|
+
if (value !== undefined)
|
|
128
|
+
headers[name] = value;
|
|
129
|
+
}
|
|
130
|
+
return headers;
|
|
131
|
+
};
|
|
132
|
+
const res = await (fetchFn ?? fetch)(getUpdateThreadUrl(thread), {
|
|
133
|
+
...options,
|
|
134
|
+
method: "PATCH",
|
|
135
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
136
|
+
body: JSON.stringify(updateThreadRequestBody),
|
|
137
|
+
});
|
|
138
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
139
|
+
const data = body ? JSON.parse(body) : {};
|
|
140
|
+
return { data, status: res.status, headers: res.headers };
|
|
141
|
+
};
|
|
142
|
+
export const getDeleteThreadUrl = (thread) => {
|
|
143
|
+
return `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}`;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Removes the conversation and its subagents from every list and makes them unreachable by id,
|
|
147
|
+
* including for the assistant. Deleting cannot be undone; archive instead to keep it readable.
|
|
148
|
+
*
|
|
149
|
+
* Fails with 409 and code THREAD_RUNNING while a turn is running. Deleting an already deleted
|
|
150
|
+
* conversation succeeds.
|
|
151
|
+
* @summary Delete a conversation
|
|
152
|
+
*/
|
|
153
|
+
export const deleteThread = async (thread, options, fetchFn) => {
|
|
154
|
+
const res = await (fetchFn ?? fetch)(getDeleteThreadUrl(thread), {
|
|
155
|
+
...options,
|
|
156
|
+
method: "DELETE",
|
|
157
|
+
});
|
|
158
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
159
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
160
|
+
return { data, status: res.status, headers: res.headers };
|
|
161
|
+
};
|
|
162
|
+
export const getInterruptThreadUrl = (thread) => {
|
|
163
|
+
return `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/interrupt`;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Stops this conversation's running turn and discards its queued messages. Subagents keep
|
|
167
|
+
* running; stop them through their own conversations.
|
|
168
|
+
*
|
|
169
|
+
* Succeeds when nothing is running, because pressing stop races with the turn finishing on its
|
|
170
|
+
* own. Available while the project is suspended or being cleaned up.
|
|
171
|
+
* @summary Stop the running turn
|
|
172
|
+
*/
|
|
173
|
+
export const interruptThread = async (thread, options, fetchFn) => {
|
|
174
|
+
const res = await (fetchFn ?? fetch)(getInterruptThreadUrl(thread), {
|
|
175
|
+
...options,
|
|
176
|
+
method: "POST",
|
|
177
|
+
});
|
|
178
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
179
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
180
|
+
return { data, status: res.status, headers: res.headers };
|
|
181
|
+
};
|
|
182
|
+
export const getResumeThreadUrl = (thread) => {
|
|
183
|
+
return `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/resume`;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Starts a new turn that continues from where the conversation stopped, for example after it
|
|
187
|
+
* was interrupted or failed. An optional message is added first.
|
|
188
|
+
*
|
|
189
|
+
* Fails with 409 and code THREAD_RUNNING while a turn is running.
|
|
190
|
+
* @summary Resume a stopped conversation
|
|
191
|
+
*/
|
|
192
|
+
export const resumeThread = async (thread, resumeThreadRequestBody, options, fetchFn) => {
|
|
193
|
+
const getHeaders = (h) => {
|
|
194
|
+
if (!h)
|
|
195
|
+
return {};
|
|
196
|
+
if (h instanceof Headers)
|
|
197
|
+
return Object.fromEntries(h.entries());
|
|
198
|
+
if (Symbol.iterator in h) {
|
|
199
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
200
|
+
}
|
|
201
|
+
const headers = {};
|
|
202
|
+
for (const [name, value] of Object.entries(h)) {
|
|
203
|
+
if (value !== undefined)
|
|
204
|
+
headers[name] = value;
|
|
205
|
+
}
|
|
206
|
+
return headers;
|
|
207
|
+
};
|
|
208
|
+
const res = await (fetchFn ?? fetch)(getResumeThreadUrl(thread), {
|
|
209
|
+
...options,
|
|
210
|
+
method: "POST",
|
|
211
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
212
|
+
body: JSON.stringify(resumeThreadRequestBody),
|
|
213
|
+
});
|
|
214
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
215
|
+
const data = body ? JSON.parse(body) : {};
|
|
216
|
+
return { data, status: res.status, headers: res.headers };
|
|
217
|
+
};
|
|
218
|
+
export const getCompactThreadUrl = (thread) => {
|
|
219
|
+
return `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/compact`;
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Starts a compaction turn that summarizes the history before the latest user message, the same
|
|
223
|
+
* way the service does automatically when the context window fills up. The result appears in the
|
|
224
|
+
* transcript as a `compaction` item and the turn reports its own token usage.
|
|
225
|
+
*
|
|
226
|
+
* Fails with 409 and code THREAD_RUNNING while a turn is running, and with 409 and code
|
|
227
|
+
* NOTHING_TO_COMPACT when there is no history to summarize.
|
|
228
|
+
* @summary Compact the conversation now
|
|
229
|
+
*/
|
|
230
|
+
export const compactThread = async (thread, options, fetchFn) => {
|
|
231
|
+
const res = await (fetchFn ?? fetch)(getCompactThreadUrl(thread), {
|
|
232
|
+
...options,
|
|
233
|
+
method: "POST",
|
|
234
|
+
});
|
|
235
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
236
|
+
const data = body ? JSON.parse(body) : {};
|
|
237
|
+
return { data, status: res.status, headers: res.headers };
|
|
238
|
+
};
|
|
239
|
+
export const getRevertThreadUrl = (thread) => {
|
|
240
|
+
return `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/revert`;
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* Reverts the item at `ordinal` and everything after it. Reverted items stay in the transcript
|
|
244
|
+
* marked `reverted` and are left out of later model requests; ordinals are not renumbered.
|
|
245
|
+
* Executed tools and external changes are not undone. Returns how many items were reverted.
|
|
246
|
+
* @summary Revert from a given point
|
|
247
|
+
*/
|
|
248
|
+
export const revertThread = async (thread, revertRequestBody, options, fetchFn) => {
|
|
249
|
+
const getHeaders = (h) => {
|
|
250
|
+
if (!h)
|
|
251
|
+
return {};
|
|
252
|
+
if (h instanceof Headers)
|
|
253
|
+
return Object.fromEntries(h.entries());
|
|
254
|
+
if (Symbol.iterator in h) {
|
|
255
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
256
|
+
}
|
|
257
|
+
const headers = {};
|
|
258
|
+
for (const [name, value] of Object.entries(h)) {
|
|
259
|
+
if (value !== undefined)
|
|
260
|
+
headers[name] = value;
|
|
261
|
+
}
|
|
262
|
+
return headers;
|
|
263
|
+
};
|
|
264
|
+
const res = await (fetchFn ?? fetch)(getRevertThreadUrl(thread), {
|
|
265
|
+
...options,
|
|
266
|
+
method: "POST",
|
|
267
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
268
|
+
body: JSON.stringify(revertRequestBody),
|
|
269
|
+
});
|
|
270
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
271
|
+
const data = body ? JSON.parse(body) : {};
|
|
272
|
+
return { data, status: res.status, headers: res.headers };
|
|
273
|
+
};
|
|
274
|
+
export const getMarkThreadReadUrl = (thread) => {
|
|
275
|
+
return `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/read`;
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* Clears `unread` until the assistant replies again.
|
|
279
|
+
* @summary Mark a conversation as read
|
|
280
|
+
*/
|
|
281
|
+
export const markThreadRead = async (thread, options, fetchFn) => {
|
|
282
|
+
const res = await (fetchFn ?? fetch)(getMarkThreadReadUrl(thread), {
|
|
283
|
+
...options,
|
|
284
|
+
method: "POST",
|
|
285
|
+
});
|
|
286
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
287
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
288
|
+
return { data, status: res.status, headers: res.headers };
|
|
289
|
+
};
|
|
290
|
+
export const getListThreadItemsUrl = (thread, params) => {
|
|
291
|
+
const normalizedParams = new URLSearchParams();
|
|
292
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
293
|
+
if (value !== undefined) {
|
|
294
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
const stringifiedParams = normalizedParams.toString();
|
|
298
|
+
return stringifiedParams.length > 0
|
|
299
|
+
? `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/items?${stringifiedParams}`
|
|
300
|
+
: `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/items`;
|
|
301
|
+
};
|
|
302
|
+
/**
|
|
303
|
+
* A window of the conversation's transcript, oldest first: messages, reasoning, tool calls and
|
|
304
|
+
* compaction markers. A window holds whole turns, so a turn's messages and tool calls arrive
|
|
305
|
+
* together; a single turn larger than the size limit is split across windows.
|
|
306
|
+
*
|
|
307
|
+
* Without a position the window ends at the latest item. `before` reads the window above an
|
|
308
|
+
* ordinal and `after` the window below it; pass `startOrdinal` and `endOrdinal` from the response.
|
|
309
|
+
* `around` opens a window that contains an ordinal, for jumping to a turn from list-thread-turns or
|
|
310
|
+
* to a search result.
|
|
311
|
+
*
|
|
312
|
+
* Long reasoning and tool arguments are cut to a preview and marked `truncated`; read the item for
|
|
313
|
+
* all of it. Messages are never cut.
|
|
314
|
+
*
|
|
315
|
+
* When the window reaches the end, `queued` holds the messages waiting for the assistant and
|
|
316
|
+
* `streamCursor` is set: subscribe to `thread:{id}` on /api/v1/realtime from it to follow what is
|
|
317
|
+
* written next.
|
|
318
|
+
* @summary List transcript items
|
|
319
|
+
*/
|
|
320
|
+
export const listThreadItems = async (thread, params, options, fetchFn) => {
|
|
321
|
+
const res = await (fetchFn ?? fetch)(getListThreadItemsUrl(thread, params), {
|
|
322
|
+
...options,
|
|
323
|
+
method: "GET",
|
|
324
|
+
});
|
|
325
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
326
|
+
const data = body ? JSON.parse(body) : {};
|
|
327
|
+
return { data, status: res.status, headers: res.headers };
|
|
328
|
+
};
|
|
329
|
+
export const getGetThreadItemUrl = (thread, item) => {
|
|
330
|
+
return `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/items/${encodeURIComponent(String(item))}`;
|
|
331
|
+
};
|
|
332
|
+
/**
|
|
333
|
+
* One item in full, including what list-thread-items cut from it.
|
|
334
|
+
* @summary Get a transcript item
|
|
335
|
+
*/
|
|
336
|
+
export const getThreadItem = async (thread, item, options, fetchFn) => {
|
|
337
|
+
const res = await (fetchFn ?? fetch)(getGetThreadItemUrl(thread, item), {
|
|
338
|
+
...options,
|
|
339
|
+
method: "GET",
|
|
340
|
+
});
|
|
341
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
342
|
+
const data = body ? JSON.parse(body) : {};
|
|
343
|
+
return { data, status: res.status, headers: res.headers };
|
|
344
|
+
};
|
|
345
|
+
export const getSendMessageUrl = (thread) => {
|
|
346
|
+
return `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/messages`;
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* Starts a turn and returns at once; a turn can run for tens of minutes and its progress arrives
|
|
350
|
+
* on /api/v1/realtime. Sending while the assistant is working is allowed: the message is queued
|
|
351
|
+
* and read at the next step of the running turn, and `queued` is true.
|
|
352
|
+
*
|
|
353
|
+
* Fails with 409 and code THREAD_ARCHIVED for an archived conversation.
|
|
354
|
+
* @summary Send a message
|
|
355
|
+
*/
|
|
356
|
+
export const sendMessage = async (thread, sendMessageRequestBody, options, fetchFn) => {
|
|
357
|
+
const getHeaders = (h) => {
|
|
358
|
+
if (!h)
|
|
359
|
+
return {};
|
|
360
|
+
if (h instanceof Headers)
|
|
361
|
+
return Object.fromEntries(h.entries());
|
|
362
|
+
if (Symbol.iterator in h) {
|
|
363
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
364
|
+
}
|
|
365
|
+
const headers = {};
|
|
366
|
+
for (const [name, value] of Object.entries(h)) {
|
|
367
|
+
if (value !== undefined)
|
|
368
|
+
headers[name] = value;
|
|
369
|
+
}
|
|
370
|
+
return headers;
|
|
371
|
+
};
|
|
372
|
+
const res = await (fetchFn ?? fetch)(getSendMessageUrl(thread), {
|
|
373
|
+
...options,
|
|
374
|
+
method: "POST",
|
|
375
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
376
|
+
body: JSON.stringify(sendMessageRequestBody),
|
|
377
|
+
});
|
|
378
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
379
|
+
const data = body ? JSON.parse(body) : {};
|
|
380
|
+
return { data, status: res.status, headers: res.headers };
|
|
381
|
+
};
|
|
382
|
+
export const getDecideToolCallsUrl = (thread) => {
|
|
383
|
+
return `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/approvals`;
|
|
384
|
+
};
|
|
385
|
+
/**
|
|
386
|
+
* Decides the tool calls the conversation is waiting on, listed in `pendingAction.itemIds`. One
|
|
387
|
+
* decision applies to the whole batch, so `itemIds` must name exactly the calls awaiting approval.
|
|
388
|
+
*
|
|
389
|
+
* Repeating a decision that is already in effect succeeds. Fails with 409 and code
|
|
390
|
+
* APPROVAL_MISMATCH when `itemIds` is not the current batch, for example because another tab
|
|
391
|
+
* decided first and the assistant has moved on.
|
|
392
|
+
* @summary Approve or decline tool calls
|
|
393
|
+
*/
|
|
394
|
+
export const decideToolCalls = async (thread, decideToolCallsRequestBody, options, fetchFn) => {
|
|
395
|
+
const getHeaders = (h) => {
|
|
396
|
+
if (!h)
|
|
397
|
+
return {};
|
|
398
|
+
if (h instanceof Headers)
|
|
399
|
+
return Object.fromEntries(h.entries());
|
|
400
|
+
if (Symbol.iterator in h) {
|
|
401
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
402
|
+
}
|
|
403
|
+
const headers = {};
|
|
404
|
+
for (const [name, value] of Object.entries(h)) {
|
|
405
|
+
if (value !== undefined)
|
|
406
|
+
headers[name] = value;
|
|
407
|
+
}
|
|
408
|
+
return headers;
|
|
409
|
+
};
|
|
410
|
+
const res = await (fetchFn ?? fetch)(getDecideToolCallsUrl(thread), {
|
|
411
|
+
...options,
|
|
412
|
+
method: "POST",
|
|
413
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
414
|
+
body: JSON.stringify(decideToolCallsRequestBody),
|
|
415
|
+
});
|
|
416
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
417
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
418
|
+
return { data, status: res.status, headers: res.headers };
|
|
419
|
+
};
|
|
420
|
+
export const getAnswerQuestionUrl = (thread, item) => {
|
|
421
|
+
return `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/items/${encodeURIComponent(String(item))}/answer`;
|
|
422
|
+
};
|
|
423
|
+
/**
|
|
424
|
+
* Answers an `ask` tool call. Its questions are in the item's `questions`. An item that is already
|
|
425
|
+
* answered also succeeds: another tab may have answered first, or the auto-answer window may have
|
|
426
|
+
* passed, and either way the turn has continued.
|
|
427
|
+
* @summary Answer the assistant's questions
|
|
428
|
+
*/
|
|
429
|
+
export const answerQuestion = async (thread, item, answerQuestionRequestBody, options, fetchFn) => {
|
|
430
|
+
const getHeaders = (h) => {
|
|
431
|
+
if (!h)
|
|
432
|
+
return {};
|
|
433
|
+
if (h instanceof Headers)
|
|
434
|
+
return Object.fromEntries(h.entries());
|
|
435
|
+
if (Symbol.iterator in h) {
|
|
436
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
437
|
+
}
|
|
438
|
+
const headers = {};
|
|
439
|
+
for (const [name, value] of Object.entries(h)) {
|
|
440
|
+
if (value !== undefined)
|
|
441
|
+
headers[name] = value;
|
|
442
|
+
}
|
|
443
|
+
return headers;
|
|
444
|
+
};
|
|
445
|
+
const res = await (fetchFn ?? fetch)(getAnswerQuestionUrl(thread, item), {
|
|
446
|
+
...options,
|
|
447
|
+
method: "POST",
|
|
448
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
449
|
+
body: JSON.stringify(answerQuestionRequestBody),
|
|
450
|
+
});
|
|
451
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
452
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
453
|
+
return { data, status: res.status, headers: res.headers };
|
|
454
|
+
};
|
|
455
|
+
export const getSubmitToolResultUrl = (thread, item) => {
|
|
456
|
+
return `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/items/${encodeURIComponent(String(item))}/result`;
|
|
457
|
+
};
|
|
458
|
+
/**
|
|
459
|
+
* The assistant asks the client to run one of the actions it declared by writing a tool call with
|
|
460
|
+
* the namespace `client`; the client runs it when the item turns in_progress and reports here.
|
|
461
|
+
*
|
|
462
|
+
* The first result counts. A later one fails with 409 and code RESULT_ALREADY_SUBMITTED.
|
|
463
|
+
* @summary Report what a client tool produced
|
|
464
|
+
*/
|
|
465
|
+
export const submitToolResult = async (thread, item, toolResultRequestBody, options, fetchFn) => {
|
|
466
|
+
const getHeaders = (h) => {
|
|
467
|
+
if (!h)
|
|
468
|
+
return {};
|
|
469
|
+
if (h instanceof Headers)
|
|
470
|
+
return Object.fromEntries(h.entries());
|
|
471
|
+
if (Symbol.iterator in h) {
|
|
472
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
473
|
+
}
|
|
474
|
+
const headers = {};
|
|
475
|
+
for (const [name, value] of Object.entries(h)) {
|
|
476
|
+
if (value !== undefined)
|
|
477
|
+
headers[name] = value;
|
|
478
|
+
}
|
|
479
|
+
return headers;
|
|
480
|
+
};
|
|
481
|
+
const res = await (fetchFn ?? fetch)(getSubmitToolResultUrl(thread, item), {
|
|
482
|
+
...options,
|
|
483
|
+
method: "POST",
|
|
484
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
485
|
+
body: JSON.stringify(toolResultRequestBody),
|
|
486
|
+
});
|
|
487
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
488
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
489
|
+
return { data, status: res.status, headers: res.headers };
|
|
490
|
+
};
|
|
491
|
+
export const getListThreadTurnsUrl = (thread, params) => {
|
|
492
|
+
const normalizedParams = new URLSearchParams();
|
|
493
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
494
|
+
if (value !== undefined) {
|
|
495
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
const stringifiedParams = normalizedParams.toString();
|
|
499
|
+
return stringifiedParams.length > 0
|
|
500
|
+
? `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/turns?${stringifiedParams}`
|
|
501
|
+
: `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/turns`;
|
|
502
|
+
};
|
|
503
|
+
/**
|
|
504
|
+
* The conversation's turns, newest first, each with the model and reasoning effort it ran with,
|
|
505
|
+
* how long it took and the tokens it used. Cache hit rate is `cachedInputTokens / inputTokens`.
|
|
506
|
+
*
|
|
507
|
+
* Each turn names the ordinals it wrote and the message that started it, so a client can draw a
|
|
508
|
+
* timeline from this list and open a turn with list-thread-items `around`.
|
|
509
|
+
*
|
|
510
|
+
* `ids` reads the turns behind a page of transcript items in one request and cannot be combined
|
|
511
|
+
* with a cursor.
|
|
512
|
+
* @summary List turns
|
|
513
|
+
*/
|
|
514
|
+
export const listThreadTurns = async (thread, params, options, fetchFn) => {
|
|
515
|
+
const res = await (fetchFn ?? fetch)(getListThreadTurnsUrl(thread, params), {
|
|
516
|
+
...options,
|
|
517
|
+
method: "GET",
|
|
518
|
+
});
|
|
519
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
520
|
+
const data = body ? JSON.parse(body) : {};
|
|
521
|
+
return { data, status: res.status, headers: res.headers };
|
|
522
|
+
};
|
|
523
|
+
export const getListCommandsUrl = () => {
|
|
524
|
+
return `https://assistant.leaflow.cloud/api/v1/commands`;
|
|
525
|
+
};
|
|
526
|
+
/**
|
|
527
|
+
* The slash commands a person can type in a conversation, such as /status or /compact. The same
|
|
528
|
+
* commands work in the console and in chat apps, so a client builds its command menu from this
|
|
529
|
+
* list.
|
|
530
|
+
* @summary List commands
|
|
531
|
+
*/
|
|
532
|
+
export const listCommands = async (options, fetchFn) => {
|
|
533
|
+
const res = await (fetchFn ?? fetch)(getListCommandsUrl(), {
|
|
534
|
+
...options,
|
|
535
|
+
method: "GET",
|
|
536
|
+
});
|
|
537
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
538
|
+
const data = body ? JSON.parse(body) : {};
|
|
539
|
+
return { data, status: res.status, headers: res.headers };
|
|
540
|
+
};
|
|
541
|
+
export const getRunCommandUrl = (thread) => {
|
|
542
|
+
return `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/commands`;
|
|
543
|
+
};
|
|
544
|
+
/**
|
|
545
|
+
* Runs a slash command against the conversation. Commands act directly and never reach the model.
|
|
546
|
+
* The result carries a plain-text `message`, which is what a chat app shows, and structured fields
|
|
547
|
+
* for clients that render more, such as `status` for /status.
|
|
548
|
+
*
|
|
549
|
+
* /new is carried out by the client, which opens an empty conversation, and fails here with 422
|
|
550
|
+
* and code COMMAND_CLIENT_ONLY. Fails with 404 and code COMMAND_NOT_FOUND for an unknown command,
|
|
551
|
+
* and with 422 and code COMMAND_ARGUMENTS_INVALID when the arguments do not fit.
|
|
552
|
+
* @summary Run a command
|
|
553
|
+
*/
|
|
554
|
+
export const runCommand = async (thread, runCommandRequestBody, options, fetchFn) => {
|
|
555
|
+
const getHeaders = (h) => {
|
|
556
|
+
if (!h)
|
|
557
|
+
return {};
|
|
558
|
+
if (h instanceof Headers)
|
|
559
|
+
return Object.fromEntries(h.entries());
|
|
560
|
+
if (Symbol.iterator in h) {
|
|
561
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
562
|
+
}
|
|
563
|
+
const headers = {};
|
|
564
|
+
for (const [name, value] of Object.entries(h)) {
|
|
565
|
+
if (value !== undefined)
|
|
566
|
+
headers[name] = value;
|
|
567
|
+
}
|
|
568
|
+
return headers;
|
|
569
|
+
};
|
|
570
|
+
const res = await (fetchFn ?? fetch)(getRunCommandUrl(thread), {
|
|
571
|
+
...options,
|
|
572
|
+
method: "POST",
|
|
573
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
574
|
+
body: JSON.stringify(runCommandRequestBody),
|
|
575
|
+
});
|
|
576
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
577
|
+
const data = body ? JSON.parse(body) : {};
|
|
578
|
+
return { data, status: res.status, headers: res.headers };
|
|
579
|
+
};
|
|
580
|
+
export const getListFoldersUrl = () => {
|
|
581
|
+
return `https://assistant.leaflow.cloud/api/v1/folders`;
|
|
582
|
+
};
|
|
583
|
+
/**
|
|
584
|
+
* The caller's folders in this project in their own order, inbox first. Every conversation is in
|
|
585
|
+
* exactly one folder; the inbox holds the ones nobody filed. Not paginated: the number of folders
|
|
586
|
+
* is capped and all of them come back at once.
|
|
587
|
+
* @summary List folders
|
|
588
|
+
*/
|
|
589
|
+
export const listFolders = async (options, fetchFn) => {
|
|
590
|
+
const res = await (fetchFn ?? fetch)(getListFoldersUrl(), {
|
|
591
|
+
...options,
|
|
592
|
+
method: "GET",
|
|
593
|
+
});
|
|
594
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
595
|
+
const data = body ? JSON.parse(body) : {};
|
|
596
|
+
return { data, status: res.status, headers: res.headers };
|
|
597
|
+
};
|
|
598
|
+
export const getCreateFolderUrl = () => {
|
|
599
|
+
return `https://assistant.leaflow.cloud/api/v1/folders`;
|
|
600
|
+
};
|
|
601
|
+
/**
|
|
602
|
+
* A folder groups conversations on the board and does nothing else: the assistant is never told
|
|
603
|
+
* which folder a conversation is in. New folders go after the existing ones.
|
|
604
|
+
*
|
|
605
|
+
* Names are unique among the caller's folders in this project; a duplicate fails with 409 and
|
|
606
|
+
* code FOLDER_EXISTS.
|
|
607
|
+
* @summary Create a folder
|
|
608
|
+
*/
|
|
609
|
+
export const createFolder = async (createFolderRequestBody, options, fetchFn) => {
|
|
610
|
+
const getHeaders = (h) => {
|
|
611
|
+
if (!h)
|
|
612
|
+
return {};
|
|
613
|
+
if (h instanceof Headers)
|
|
614
|
+
return Object.fromEntries(h.entries());
|
|
615
|
+
if (Symbol.iterator in h) {
|
|
616
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
617
|
+
}
|
|
618
|
+
const headers = {};
|
|
619
|
+
for (const [name, value] of Object.entries(h)) {
|
|
620
|
+
if (value !== undefined)
|
|
621
|
+
headers[name] = value;
|
|
622
|
+
}
|
|
623
|
+
return headers;
|
|
624
|
+
};
|
|
625
|
+
const res = await (fetchFn ?? fetch)(getCreateFolderUrl(), {
|
|
626
|
+
...options,
|
|
627
|
+
method: "POST",
|
|
628
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
629
|
+
body: JSON.stringify(createFolderRequestBody),
|
|
630
|
+
});
|
|
631
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
632
|
+
const data = body ? JSON.parse(body) : {};
|
|
633
|
+
return { data, status: res.status, headers: res.headers };
|
|
634
|
+
};
|
|
635
|
+
export const getGetFolderUrl = (folder) => {
|
|
636
|
+
return `https://assistant.leaflow.cloud/api/v1/folders/${encodeURIComponent(String(folder))}`;
|
|
637
|
+
};
|
|
638
|
+
/**
|
|
639
|
+
* Its conversations are read with search-threads and `folderId`.
|
|
640
|
+
* @summary Get a folder
|
|
641
|
+
*/
|
|
642
|
+
export const getFolder = async (folder, options, fetchFn) => {
|
|
643
|
+
const res = await (fetchFn ?? fetch)(getGetFolderUrl(folder), {
|
|
644
|
+
...options,
|
|
645
|
+
method: "GET",
|
|
646
|
+
});
|
|
647
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
648
|
+
const data = body ? JSON.parse(body) : {};
|
|
649
|
+
return { data, status: res.status, headers: res.headers };
|
|
650
|
+
};
|
|
651
|
+
export const getUpdateFolderUrl = (folder) => {
|
|
652
|
+
return `https://assistant.leaflow.cloud/api/v1/folders/${encodeURIComponent(String(folder))}`;
|
|
653
|
+
};
|
|
654
|
+
/**
|
|
655
|
+
* The inbox cannot be renamed and fails with 409 and code INBOX_READ_ONLY.
|
|
656
|
+
* @summary Rename a folder
|
|
657
|
+
*/
|
|
658
|
+
export const updateFolder = async (folder, updateFolderRequestBody, options, fetchFn) => {
|
|
659
|
+
const getHeaders = (h) => {
|
|
660
|
+
if (!h)
|
|
661
|
+
return {};
|
|
662
|
+
if (h instanceof Headers)
|
|
663
|
+
return Object.fromEntries(h.entries());
|
|
664
|
+
if (Symbol.iterator in h) {
|
|
665
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
666
|
+
}
|
|
667
|
+
const headers = {};
|
|
668
|
+
for (const [name, value] of Object.entries(h)) {
|
|
669
|
+
if (value !== undefined)
|
|
670
|
+
headers[name] = value;
|
|
671
|
+
}
|
|
672
|
+
return headers;
|
|
673
|
+
};
|
|
674
|
+
const res = await (fetchFn ?? fetch)(getUpdateFolderUrl(folder), {
|
|
675
|
+
...options,
|
|
676
|
+
method: "PATCH",
|
|
677
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
678
|
+
body: JSON.stringify(updateFolderRequestBody),
|
|
679
|
+
});
|
|
680
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
681
|
+
const data = body ? JSON.parse(body) : {};
|
|
682
|
+
return { data, status: res.status, headers: res.headers };
|
|
683
|
+
};
|
|
684
|
+
export const getDeleteFolderUrl = (folder) => {
|
|
685
|
+
return `https://assistant.leaflow.cloud/api/v1/folders/${encodeURIComponent(String(folder))}`;
|
|
686
|
+
};
|
|
687
|
+
/**
|
|
688
|
+
* The conversations inside are not deleted; they move to the end of the inbox. The inbox cannot
|
|
689
|
+
* be deleted and fails with 409 and code INBOX_READ_ONLY. Deleting a folder that is already gone
|
|
690
|
+
* succeeds.
|
|
691
|
+
* @summary Delete a folder
|
|
692
|
+
*/
|
|
693
|
+
export const deleteFolder = async (folder, options, fetchFn) => {
|
|
694
|
+
const res = await (fetchFn ?? fetch)(getDeleteFolderUrl(folder), {
|
|
695
|
+
...options,
|
|
696
|
+
method: "DELETE",
|
|
697
|
+
});
|
|
698
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
699
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
700
|
+
return { data, status: res.status, headers: res.headers };
|
|
701
|
+
};
|
|
702
|
+
export const getMoveFolderUrl = (folder) => {
|
|
703
|
+
return `https://assistant.leaflow.cloud/api/v1/folders/${encodeURIComponent(String(folder))}/move`;
|
|
3
704
|
};
|
|
4
705
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* This operation reads capabilities without making an inference request. It does not check live provider health or the inference key's model restrictions. If Canopy cannot be read and no usable cached snapshot exists, it returns 503 with code MODEL_CATALOG_UNAVAILABLE; a failed read is not an empty catalogue. An empty allowlist returns an empty list without needing Canopy. Supplier connection details and credentials are not returned.
|
|
10
|
-
* @summary List assistant model choices
|
|
706
|
+
* Places the folder before `beforeFolderId`, or last when it is null. The inbox stays first.
|
|
707
|
+
* Fails with 409 and code ORDER_CHANGED when `expectedVersion` is stale; read the folders again
|
|
708
|
+
* and retry.
|
|
709
|
+
* @summary Reorder a folder
|
|
11
710
|
*/
|
|
12
|
-
export const
|
|
13
|
-
const
|
|
711
|
+
export const moveFolder = async (folder, moveFolderRequestBody, options, fetchFn) => {
|
|
712
|
+
const getHeaders = (h) => {
|
|
713
|
+
if (!h)
|
|
714
|
+
return {};
|
|
715
|
+
if (h instanceof Headers)
|
|
716
|
+
return Object.fromEntries(h.entries());
|
|
717
|
+
if (Symbol.iterator in h) {
|
|
718
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
719
|
+
}
|
|
720
|
+
const headers = {};
|
|
721
|
+
for (const [name, value] of Object.entries(h)) {
|
|
722
|
+
if (value !== undefined)
|
|
723
|
+
headers[name] = value;
|
|
724
|
+
}
|
|
725
|
+
return headers;
|
|
726
|
+
};
|
|
727
|
+
const res = await (fetchFn ?? fetch)(getMoveFolderUrl(folder), {
|
|
14
728
|
...options,
|
|
15
|
-
method: "
|
|
729
|
+
method: "POST",
|
|
730
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
731
|
+
body: JSON.stringify(moveFolderRequestBody),
|
|
16
732
|
});
|
|
17
733
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
18
734
|
const data = body ? JSON.parse(body) : {};
|
|
19
735
|
return { data, status: res.status, headers: res.headers };
|
|
20
736
|
};
|
|
21
|
-
export const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
737
|
+
export const getPlaceThreadUrl = (folder, thread) => {
|
|
738
|
+
return `https://assistant.leaflow.cloud/api/v1/folders/${encodeURIComponent(String(folder))}/threads/${encodeURIComponent(String(thread))}`;
|
|
739
|
+
};
|
|
740
|
+
/**
|
|
741
|
+
* Puts the conversation into this folder at the given position, moving it out of the folder it
|
|
742
|
+
* was in. Give `beforeThreadId` or `afterThreadId` to place it next to a conversation of this
|
|
743
|
+
* folder; with neither it goes last. Moving does not change the conversation's activity time.
|
|
744
|
+
*
|
|
745
|
+
* Subagents are not filed and fail with 409 and code SUBAGENT_NOT_FILED. Fails with 409 and code
|
|
746
|
+
* ORDER_CHANGED when `expectedVersion` is stale.
|
|
747
|
+
* @summary Place a conversation in a folder
|
|
748
|
+
*/
|
|
749
|
+
export const placeThread = async (folder, thread, placeThreadRequestBody, options, fetchFn) => {
|
|
750
|
+
const getHeaders = (h) => {
|
|
751
|
+
if (!h)
|
|
752
|
+
return {};
|
|
753
|
+
if (h instanceof Headers)
|
|
754
|
+
return Object.fromEntries(h.entries());
|
|
755
|
+
if (Symbol.iterator in h) {
|
|
756
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
757
|
+
}
|
|
758
|
+
const headers = {};
|
|
759
|
+
for (const [name, value] of Object.entries(h)) {
|
|
760
|
+
if (value !== undefined)
|
|
761
|
+
headers[name] = value;
|
|
26
762
|
}
|
|
763
|
+
return headers;
|
|
764
|
+
};
|
|
765
|
+
const res = await (fetchFn ?? fetch)(getPlaceThreadUrl(folder, thread), {
|
|
766
|
+
...options,
|
|
767
|
+
method: "PUT",
|
|
768
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
769
|
+
body: JSON.stringify(placeThreadRequestBody),
|
|
27
770
|
});
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
771
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
772
|
+
const data = body ? JSON.parse(body) : {};
|
|
773
|
+
return { data, status: res.status, headers: res.headers };
|
|
774
|
+
};
|
|
775
|
+
export const getCreateTaskUrl = () => {
|
|
776
|
+
return `https://assistant.leaflow.cloud/api/v1/tasks`;
|
|
32
777
|
};
|
|
33
778
|
/**
|
|
34
|
-
*
|
|
779
|
+
* A task does something on a trigger and reports to a conversation. Its action either sends a
|
|
780
|
+
* prompt to the conversation, which starts a turn there, or runs a command on an instance and
|
|
781
|
+
* sends the result to the conversation when it ends.
|
|
35
782
|
*
|
|
36
|
-
*
|
|
783
|
+
* `trigger.type` `now` runs once immediately; `at` runs once at `runAt`; `interval` repeats every
|
|
784
|
+
* `intervalSeconds` from `anchorAt`; `cron` repeats on a cron expression in `timezone`. Each
|
|
785
|
+
* execution is a run, listed under /runs.
|
|
37
786
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
787
|
+
* Fails with 404 when the conversation does not exist and with 409 and code THREAD_ARCHIVED when
|
|
788
|
+
* it is archived.
|
|
789
|
+
* @summary Create a task
|
|
40
790
|
*/
|
|
41
|
-
export const
|
|
791
|
+
export const createTask = async (createTaskRequestBody, options, fetchFn) => {
|
|
42
792
|
const getHeaders = (h) => {
|
|
43
793
|
if (!h)
|
|
44
794
|
return {};
|
|
@@ -54,52 +804,57 @@ export const uploadAttachment = async (uploadAttachmentBody, params, options, fe
|
|
|
54
804
|
}
|
|
55
805
|
return headers;
|
|
56
806
|
};
|
|
57
|
-
const res = await (fetchFn ?? fetch)(
|
|
807
|
+
const res = await (fetchFn ?? fetch)(getCreateTaskUrl(), {
|
|
58
808
|
...options,
|
|
59
809
|
method: "POST",
|
|
60
|
-
headers: { "Content-Type": "
|
|
61
|
-
body:
|
|
810
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
811
|
+
body: JSON.stringify(createTaskRequestBody),
|
|
62
812
|
});
|
|
63
813
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
64
814
|
const data = body ? JSON.parse(body) : {};
|
|
65
815
|
return { data, status: res.status, headers: res.headers };
|
|
66
816
|
};
|
|
67
|
-
export const
|
|
68
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
817
|
+
export const getSearchTasksUrl = () => {
|
|
818
|
+
return `https://assistant.leaflow.cloud/api/v1/tasks`;
|
|
69
819
|
};
|
|
70
820
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* Only an attachment whose `kind` is `image` comes back with its own image type and is usable as the address of an `<img>`. Everything else is served as `application/octet-stream` with `Content-Disposition: attachment`, deliberately: an uploaded file is arbitrary bytes under a name its uploader chose, and serving it back inline would run it on this origin.
|
|
74
|
-
* @summary Download a file
|
|
821
|
+
* The caller's tasks in this project, most recently created first.
|
|
822
|
+
* @summary Search tasks
|
|
75
823
|
*/
|
|
76
|
-
export const
|
|
77
|
-
const
|
|
824
|
+
export const searchTasks = async (searchTasksRequestBody, options, fetchFn) => {
|
|
825
|
+
const getHeaders = (h) => {
|
|
826
|
+
if (!h)
|
|
827
|
+
return {};
|
|
828
|
+
if (h instanceof Headers)
|
|
829
|
+
return Object.fromEntries(h.entries());
|
|
830
|
+
if (Symbol.iterator in h) {
|
|
831
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
832
|
+
}
|
|
833
|
+
const headers = {};
|
|
834
|
+
for (const [name, value] of Object.entries(h)) {
|
|
835
|
+
if (value !== undefined)
|
|
836
|
+
headers[name] = value;
|
|
837
|
+
}
|
|
838
|
+
return headers;
|
|
839
|
+
};
|
|
840
|
+
const res = await (fetchFn ?? fetch)(getSearchTasksUrl(), {
|
|
78
841
|
...options,
|
|
79
|
-
method: "
|
|
842
|
+
method: "QUERY",
|
|
843
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
844
|
+
body: JSON.stringify(searchTasksRequestBody),
|
|
80
845
|
});
|
|
81
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.
|
|
82
|
-
const data = body;
|
|
846
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
847
|
+
const data = body ? JSON.parse(body) : {};
|
|
83
848
|
return { data, status: res.status, headers: res.headers };
|
|
84
849
|
};
|
|
85
|
-
export const
|
|
86
|
-
|
|
87
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
88
|
-
if (value !== undefined) {
|
|
89
|
-
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
const stringifiedParams = normalizedParams.toString();
|
|
93
|
-
return stringifiedParams.length > 0
|
|
94
|
-
? `https://assistant.leaflow.cloud/api/v1/bindings?${stringifiedParams}`
|
|
95
|
-
: `https://assistant.leaflow.cloud/api/v1/bindings`;
|
|
850
|
+
export const getGetTaskUrl = (task) => {
|
|
851
|
+
return `https://assistant.leaflow.cloud/api/v1/tasks/${encodeURIComponent(String(task))}`;
|
|
96
852
|
};
|
|
97
853
|
/**
|
|
98
|
-
*
|
|
99
|
-
* @summary List bindings
|
|
854
|
+
* @summary Get a task
|
|
100
855
|
*/
|
|
101
|
-
export const
|
|
102
|
-
const res = await (fetchFn ?? fetch)(
|
|
856
|
+
export const getTask = async (task, options, fetchFn) => {
|
|
857
|
+
const res = await (fetchFn ?? fetch)(getGetTaskUrl(task), {
|
|
103
858
|
...options,
|
|
104
859
|
method: "GET",
|
|
105
860
|
});
|
|
@@ -107,29 +862,49 @@ export const listBindings = async (params, options, fetchFn) => {
|
|
|
107
862
|
const data = body ? JSON.parse(body) : {};
|
|
108
863
|
return { data, status: res.status, headers: res.headers };
|
|
109
864
|
};
|
|
110
|
-
export const
|
|
111
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
865
|
+
export const getUpdateTaskUrl = (task) => {
|
|
866
|
+
return `https://assistant.leaflow.cloud/api/v1/tasks/${encodeURIComponent(String(task))}`;
|
|
112
867
|
};
|
|
113
868
|
/**
|
|
114
|
-
*
|
|
869
|
+
* Changes the name, trigger or action. Omitted fields stay as they are; `trigger` and `action`
|
|
870
|
+
* are replaced as a whole. A run already in progress keeps the settings it started with.
|
|
871
|
+
* @summary Update a task
|
|
115
872
|
*/
|
|
116
|
-
export const
|
|
117
|
-
const
|
|
873
|
+
export const updateTask = async (task, updateTaskRequestBody, options, fetchFn) => {
|
|
874
|
+
const getHeaders = (h) => {
|
|
875
|
+
if (!h)
|
|
876
|
+
return {};
|
|
877
|
+
if (h instanceof Headers)
|
|
878
|
+
return Object.fromEntries(h.entries());
|
|
879
|
+
if (Symbol.iterator in h) {
|
|
880
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
881
|
+
}
|
|
882
|
+
const headers = {};
|
|
883
|
+
for (const [name, value] of Object.entries(h)) {
|
|
884
|
+
if (value !== undefined)
|
|
885
|
+
headers[name] = value;
|
|
886
|
+
}
|
|
887
|
+
return headers;
|
|
888
|
+
};
|
|
889
|
+
const res = await (fetchFn ?? fetch)(getUpdateTaskUrl(task), {
|
|
118
890
|
...options,
|
|
119
|
-
method: "
|
|
891
|
+
method: "PATCH",
|
|
892
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
893
|
+
body: JSON.stringify(updateTaskRequestBody),
|
|
120
894
|
});
|
|
121
895
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
122
896
|
const data = body ? JSON.parse(body) : {};
|
|
123
897
|
return { data, status: res.status, headers: res.headers };
|
|
124
898
|
};
|
|
125
|
-
export const
|
|
126
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
899
|
+
export const getDeleteTaskUrl = (task) => {
|
|
900
|
+
return `https://assistant.leaflow.cloud/api/v1/tasks/${encodeURIComponent(String(task))}`;
|
|
127
901
|
};
|
|
128
902
|
/**
|
|
129
|
-
*
|
|
903
|
+
* Cancels a run in progress and removes the task. Its runs stay readable in the conversation's transcript.
|
|
904
|
+
* @summary Delete a task
|
|
130
905
|
*/
|
|
131
|
-
export const
|
|
132
|
-
const res = await (fetchFn ?? fetch)(
|
|
906
|
+
export const deleteTask = async (task, options, fetchFn) => {
|
|
907
|
+
const res = await (fetchFn ?? fetch)(getDeleteTaskUrl(task), {
|
|
133
908
|
...options,
|
|
134
909
|
method: "DELETE",
|
|
135
910
|
});
|
|
@@ -137,7 +912,72 @@ export const deleteBinding = async (binding, options, fetchFn) => {
|
|
|
137
912
|
const data = body ? JSON.parse(body) : undefined;
|
|
138
913
|
return { data, status: res.status, headers: res.headers };
|
|
139
914
|
};
|
|
140
|
-
export const
|
|
915
|
+
export const getRunTaskUrl = (task) => {
|
|
916
|
+
return `https://assistant.leaflow.cloud/api/v1/tasks/${encodeURIComponent(String(task))}/run`;
|
|
917
|
+
};
|
|
918
|
+
/**
|
|
919
|
+
* Starts a run immediately, outside its trigger. Fails with 409 and code TASK_RUNNING when a run
|
|
920
|
+
* is already in progress and the overlap policy is `skip`.
|
|
921
|
+
* @summary Run a task now
|
|
922
|
+
*/
|
|
923
|
+
export const runTask = async (task, options, fetchFn) => {
|
|
924
|
+
const res = await (fetchFn ?? fetch)(getRunTaskUrl(task), {
|
|
925
|
+
...options,
|
|
926
|
+
method: "POST",
|
|
927
|
+
});
|
|
928
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
929
|
+
const data = body ? JSON.parse(body) : {};
|
|
930
|
+
return { data, status: res.status, headers: res.headers };
|
|
931
|
+
};
|
|
932
|
+
export const getPauseTaskUrl = (task) => {
|
|
933
|
+
return `https://assistant.leaflow.cloud/api/v1/tasks/${encodeURIComponent(String(task))}/pause`;
|
|
934
|
+
};
|
|
935
|
+
/**
|
|
936
|
+
* Stops future runs from its trigger. A run in progress continues. Pausing a paused task succeeds.
|
|
937
|
+
* @summary Pause a task
|
|
938
|
+
*/
|
|
939
|
+
export const pauseTask = async (task, options, fetchFn) => {
|
|
940
|
+
const res = await (fetchFn ?? fetch)(getPauseTaskUrl(task), {
|
|
941
|
+
...options,
|
|
942
|
+
method: "POST",
|
|
943
|
+
});
|
|
944
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
945
|
+
const data = body ? JSON.parse(body) : {};
|
|
946
|
+
return { data, status: res.status, headers: res.headers };
|
|
947
|
+
};
|
|
948
|
+
export const getResumeTaskUrl = (task) => {
|
|
949
|
+
return `https://assistant.leaflow.cloud/api/v1/tasks/${encodeURIComponent(String(task))}/resume`;
|
|
950
|
+
};
|
|
951
|
+
/**
|
|
952
|
+
* Lets its trigger start runs again. Missed runs within `catchupSeconds` are started. Resuming an active task succeeds.
|
|
953
|
+
* @summary Resume a task
|
|
954
|
+
*/
|
|
955
|
+
export const resumeTask = async (task, options, fetchFn) => {
|
|
956
|
+
const res = await (fetchFn ?? fetch)(getResumeTaskUrl(task), {
|
|
957
|
+
...options,
|
|
958
|
+
method: "POST",
|
|
959
|
+
});
|
|
960
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
961
|
+
const data = body ? JSON.parse(body) : {};
|
|
962
|
+
return { data, status: res.status, headers: res.headers };
|
|
963
|
+
};
|
|
964
|
+
export const getCancelTaskRunUrl = (task) => {
|
|
965
|
+
return `https://assistant.leaflow.cloud/api/v1/tasks/${encodeURIComponent(String(task))}/cancel`;
|
|
966
|
+
};
|
|
967
|
+
/**
|
|
968
|
+
* Stops the run in progress. The conversation is told the run was cancelled. Succeeds when nothing is running.
|
|
969
|
+
* @summary Cancel the running run
|
|
970
|
+
*/
|
|
971
|
+
export const cancelTaskRun = async (task, options, fetchFn) => {
|
|
972
|
+
const res = await (fetchFn ?? fetch)(getCancelTaskRunUrl(task), {
|
|
973
|
+
...options,
|
|
974
|
+
method: "POST",
|
|
975
|
+
});
|
|
976
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
977
|
+
const data = body ? JSON.parse(body) : {};
|
|
978
|
+
return { data, status: res.status, headers: res.headers };
|
|
979
|
+
};
|
|
980
|
+
export const getListTaskRunsUrl = (task, params) => {
|
|
141
981
|
const normalizedParams = new URLSearchParams();
|
|
142
982
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
143
983
|
if (value !== undefined) {
|
|
@@ -146,14 +986,15 @@ export const getListChannelsUrl = (params) => {
|
|
|
146
986
|
});
|
|
147
987
|
const stringifiedParams = normalizedParams.toString();
|
|
148
988
|
return stringifiedParams.length > 0
|
|
149
|
-
? `https://assistant.leaflow.cloud/api/v1/
|
|
150
|
-
: `https://assistant.leaflow.cloud/api/v1/
|
|
989
|
+
? `https://assistant.leaflow.cloud/api/v1/tasks/${encodeURIComponent(String(task))}/runs?${stringifiedParams}`
|
|
990
|
+
: `https://assistant.leaflow.cloud/api/v1/tasks/${encodeURIComponent(String(task))}/runs`;
|
|
151
991
|
};
|
|
152
992
|
/**
|
|
153
|
-
*
|
|
993
|
+
* Newest first, without output; read a run with get-task-run for it.
|
|
994
|
+
* @summary List a task's runs
|
|
154
995
|
*/
|
|
155
|
-
export const
|
|
156
|
-
const res = await (fetchFn ?? fetch)(
|
|
996
|
+
export const listTaskRuns = async (task, params, options, fetchFn) => {
|
|
997
|
+
const res = await (fetchFn ?? fetch)(getListTaskRunsUrl(task, params), {
|
|
157
998
|
...options,
|
|
158
999
|
method: "GET",
|
|
159
1000
|
});
|
|
@@ -161,47 +1002,33 @@ export const listChannels = async (params, options, fetchFn) => {
|
|
|
161
1002
|
const data = body ? JSON.parse(body) : {};
|
|
162
1003
|
return { data, status: res.status, headers: res.headers };
|
|
163
1004
|
};
|
|
164
|
-
export const
|
|
165
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1005
|
+
export const getGetTaskRunUrl = (task, run) => {
|
|
1006
|
+
return `https://assistant.leaflow.cloud/api/v1/tasks/${encodeURIComponent(String(task))}/runs/${encodeURIComponent(String(run))}`;
|
|
166
1007
|
};
|
|
167
1008
|
/**
|
|
168
|
-
*
|
|
169
|
-
* @summary
|
|
1009
|
+
* One run with the end of its output.
|
|
1010
|
+
* @summary Get a task run
|
|
170
1011
|
*/
|
|
171
|
-
export const
|
|
172
|
-
const
|
|
173
|
-
if (!h)
|
|
174
|
-
return {};
|
|
175
|
-
if (h instanceof Headers)
|
|
176
|
-
return Object.fromEntries(h.entries());
|
|
177
|
-
if (Symbol.iterator in h) {
|
|
178
|
-
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
179
|
-
}
|
|
180
|
-
const headers = {};
|
|
181
|
-
for (const [name, value] of Object.entries(h)) {
|
|
182
|
-
if (value !== undefined)
|
|
183
|
-
headers[name] = value;
|
|
184
|
-
}
|
|
185
|
-
return headers;
|
|
186
|
-
};
|
|
187
|
-
const res = await (fetchFn ?? fetch)(getCreateChannelUrl(), {
|
|
1012
|
+
export const getTaskRun = async (task, run, options, fetchFn) => {
|
|
1013
|
+
const res = await (fetchFn ?? fetch)(getGetTaskRunUrl(task, run), {
|
|
188
1014
|
...options,
|
|
189
|
-
method: "
|
|
190
|
-
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
191
|
-
body: JSON.stringify(createChannelRequestBody),
|
|
1015
|
+
method: "GET",
|
|
192
1016
|
});
|
|
193
1017
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
194
1018
|
const data = body ? JSON.parse(body) : {};
|
|
195
1019
|
return { data, status: res.status, headers: res.headers };
|
|
196
1020
|
};
|
|
197
|
-
export const
|
|
198
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1021
|
+
export const getGetSettingsUrl = () => {
|
|
1022
|
+
return `https://assistant.leaflow.cloud/api/v1/settings`;
|
|
199
1023
|
};
|
|
200
1024
|
/**
|
|
201
|
-
*
|
|
1025
|
+
* The caller's assistant settings in this project. `defaultModel` is what a new conversation uses
|
|
1026
|
+
* when it names no model: the caller's choice, or the first model in the Canopy catalogue that can
|
|
1027
|
+
* run an agent.
|
|
1028
|
+
* @summary Get settings
|
|
202
1029
|
*/
|
|
203
|
-
export const
|
|
204
|
-
const res = await (fetchFn ?? fetch)(
|
|
1030
|
+
export const getSettings = async (options, fetchFn) => {
|
|
1031
|
+
const res = await (fetchFn ?? fetch)(getGetSettingsUrl(), {
|
|
205
1032
|
...options,
|
|
206
1033
|
method: "GET",
|
|
207
1034
|
});
|
|
@@ -209,14 +1036,18 @@ export const getChannel = async (channel, options, fetchFn) => {
|
|
|
209
1036
|
const data = body ? JSON.parse(body) : {};
|
|
210
1037
|
return { data, status: res.status, headers: res.headers };
|
|
211
1038
|
};
|
|
212
|
-
export const
|
|
213
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1039
|
+
export const getUpdateSettingsUrl = () => {
|
|
1040
|
+
return `https://assistant.leaflow.cloud/api/v1/settings`;
|
|
214
1041
|
};
|
|
215
1042
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
1043
|
+
* Omitted fields stay as they are; null clears a choice so the catalogue default applies again.
|
|
1044
|
+
* Existing conversations keep their models.
|
|
1045
|
+
*
|
|
1046
|
+
* Fails with 422 and code MODEL_UNAVAILABLE when the model cannot run an agent, and with 422 and
|
|
1047
|
+
* code REASONING_UNSUPPORTED when a reasoning effort is set for a model without reasoning.
|
|
1048
|
+
* @summary Update settings
|
|
218
1049
|
*/
|
|
219
|
-
export const
|
|
1050
|
+
export const updateSettings = async (updateSettingsRequestBody, options, fetchFn) => {
|
|
220
1051
|
const getHeaders = (h) => {
|
|
221
1052
|
if (!h)
|
|
222
1053
|
return {};
|
|
@@ -232,41 +1063,36 @@ export const updateChannel = async (channel, updateChannelRequestBody, options,
|
|
|
232
1063
|
}
|
|
233
1064
|
return headers;
|
|
234
1065
|
};
|
|
235
|
-
const res = await (fetchFn ?? fetch)(
|
|
1066
|
+
const res = await (fetchFn ?? fetch)(getUpdateSettingsUrl(), {
|
|
236
1067
|
...options,
|
|
237
1068
|
method: "PATCH",
|
|
238
1069
|
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
239
|
-
body: JSON.stringify(
|
|
1070
|
+
body: JSON.stringify(updateSettingsRequestBody),
|
|
240
1071
|
});
|
|
241
1072
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
242
1073
|
const data = body ? JSON.parse(body) : {};
|
|
243
1074
|
return { data, status: res.status, headers: res.headers };
|
|
244
1075
|
};
|
|
245
|
-
export const
|
|
246
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
247
|
-
};
|
|
248
|
-
/**
|
|
249
|
-
* The channel stops accepting inbound messages and every binding on it stops working. This operation remains available while the project is suspended or being cleaned up.
|
|
250
|
-
* @summary Delete a channel
|
|
251
|
-
*/
|
|
252
|
-
export const deleteChannel = async (channel, options, fetchFn) => {
|
|
253
|
-
const res = await (fetchFn ?? fetch)(getDeleteChannelUrl(channel), {
|
|
254
|
-
...options,
|
|
255
|
-
method: "DELETE",
|
|
256
|
-
});
|
|
257
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
258
|
-
const data = body ? JSON.parse(body) : undefined;
|
|
259
|
-
return { data, status: res.status, headers: res.headers };
|
|
260
|
-
};
|
|
261
|
-
export const getCreateBindingCodeUrl = (channel) => {
|
|
262
|
-
return `https://assistant.leaflow.cloud/api/v1/channels/${encodeURIComponent(String(channel))}/binding-codes`;
|
|
1076
|
+
export const getCreateRealtimeTicketUrl = () => {
|
|
1077
|
+
return `https://assistant.leaflow.cloud/api/v1/realtime/tickets`;
|
|
263
1078
|
};
|
|
264
1079
|
/**
|
|
265
|
-
*
|
|
266
|
-
*
|
|
1080
|
+
* Returns the address and a short-lived ticket for the realtime WebSocket. Open
|
|
1081
|
+
* `{url}?ticket={ticket}`; the ticket stands in for the bearer token, which a browser cannot set
|
|
1082
|
+
* on a WebSocket. One connection carries every subscription of a client.
|
|
1083
|
+
*
|
|
1084
|
+
* Messages are JSON text frames. The client sends `RealtimeClientMessage` and receives
|
|
1085
|
+
* `RealtimeServerMessage`. Subscribe to `workspace` for every conversation, folder and task of the
|
|
1086
|
+
* caller in this project, and to `thread:{id}` for the transcript of one conversation. A
|
|
1087
|
+
* transcript subscription takes the `streamCursor` from list-thread-items and replays what was
|
|
1088
|
+
* written after it; when the cursor is too old the server sends `resync` and the client reads the
|
|
1089
|
+
* items again.
|
|
1090
|
+
*
|
|
1091
|
+
* Reconnect with a new ticket after the connection closes. Ping at least every 30 seconds.
|
|
1092
|
+
* @summary Issue a realtime ticket
|
|
267
1093
|
*/
|
|
268
|
-
export const
|
|
269
|
-
const res = await (fetchFn ?? fetch)(
|
|
1094
|
+
export const createRealtimeTicket = async (options, fetchFn) => {
|
|
1095
|
+
const res = await (fetchFn ?? fetch)(getCreateRealtimeTicketUrl(), {
|
|
270
1096
|
...options,
|
|
271
1097
|
method: "POST",
|
|
272
1098
|
});
|
|
@@ -274,7 +1100,7 @@ export const createBindingCode = async (channel, options, fetchFn) => {
|
|
|
274
1100
|
const data = body ? JSON.parse(body) : {};
|
|
275
1101
|
return { data, status: res.status, headers: res.headers };
|
|
276
1102
|
};
|
|
277
|
-
export const
|
|
1103
|
+
export const getOpenRealtimeUrl = (params) => {
|
|
278
1104
|
const normalizedParams = new URLSearchParams();
|
|
279
1105
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
280
1106
|
if (value !== undefined) {
|
|
@@ -283,15 +1109,17 @@ export const getListChannelRejectionsUrl = (channel, params) => {
|
|
|
283
1109
|
});
|
|
284
1110
|
const stringifiedParams = normalizedParams.toString();
|
|
285
1111
|
return stringifiedParams.length > 0
|
|
286
|
-
? `https://assistant.leaflow.cloud/api/v1/
|
|
287
|
-
: `https://assistant.leaflow.cloud/api/v1/
|
|
1112
|
+
? `https://assistant.leaflow.cloud/api/v1/realtime?${stringifiedParams}`
|
|
1113
|
+
: `https://assistant.leaflow.cloud/api/v1/realtime`;
|
|
288
1114
|
};
|
|
289
1115
|
/**
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
1116
|
+
* Upgrades to a WebSocket. The ticket from create-realtime-ticket authenticates the connection;
|
|
1117
|
+
* a missing, expired or foreign ticket closes it with code 4401. The 200 response documents the
|
|
1118
|
+
* message a client receives on the socket; the endpoint never answers with a plain HTTP body.
|
|
1119
|
+
* @summary Open the realtime WebSocket
|
|
1120
|
+
*/
|
|
1121
|
+
export const openRealtime = async (params, options, fetchFn) => {
|
|
1122
|
+
const res = await (fetchFn ?? fetch)(getOpenRealtimeUrl(params), {
|
|
295
1123
|
...options,
|
|
296
1124
|
method: "GET",
|
|
297
1125
|
});
|
|
@@ -299,14 +1127,27 @@ export const listChannelRejections = async (channel, params, options, fetchFn) =
|
|
|
299
1127
|
const data = body ? JSON.parse(body) : {};
|
|
300
1128
|
return { data, status: res.status, headers: res.headers };
|
|
301
1129
|
};
|
|
302
|
-
export const
|
|
303
|
-
|
|
1130
|
+
export const getUploadAttachmentUrl = (params) => {
|
|
1131
|
+
const normalizedParams = new URLSearchParams();
|
|
1132
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1133
|
+
if (value !== undefined) {
|
|
1134
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1135
|
+
}
|
|
1136
|
+
});
|
|
1137
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1138
|
+
return stringifiedParams.length > 0
|
|
1139
|
+
? `https://assistant.leaflow.cloud/api/v1/attachments?${stringifiedParams}`
|
|
1140
|
+
: `https://assistant.leaflow.cloud/api/v1/attachments`;
|
|
304
1141
|
};
|
|
305
1142
|
/**
|
|
306
|
-
*
|
|
307
|
-
*
|
|
1143
|
+
* The body is the file bytes themselves, not multipart, one file per request. The type is determined from the content, not from Content-Type or from the name. Put the returned id in attachmentIds when sending a message.
|
|
1144
|
+
*
|
|
1145
|
+
* An upload that no message ever references is a draft, and drafts are collected — `draftExpiresAt` in the response says when this one goes. Sending a message with the id makes it permanent.
|
|
1146
|
+
*
|
|
1147
|
+
* The returned `type` says how the assistant will see it. An `image` is read directly, and only by models that accept image input. A small `text` file is placed inline in the message. A large `text` file, and anything `binary`, arrives as a reference the assistant reads on demand — for a binary that usually means downloading it onto one of the project's cloud instances.
|
|
1148
|
+
* @summary Upload a file
|
|
308
1149
|
*/
|
|
309
|
-
export const
|
|
1150
|
+
export const uploadAttachment = async (uploadAttachmentBody, params, options, fetchFn) => {
|
|
310
1151
|
const getHeaders = (h) => {
|
|
311
1152
|
if (!h)
|
|
312
1153
|
return {};
|
|
@@ -322,34 +1163,42 @@ export const rotateChannelSecret = async (channel, rotateSecretRequestBody, opti
|
|
|
322
1163
|
}
|
|
323
1164
|
return headers;
|
|
324
1165
|
};
|
|
325
|
-
const res = await (fetchFn ?? fetch)(
|
|
1166
|
+
const res = await (fetchFn ?? fetch)(getUploadAttachmentUrl(params), {
|
|
326
1167
|
...options,
|
|
327
1168
|
method: "POST",
|
|
328
|
-
headers: { "Content-Type": "
|
|
329
|
-
body:
|
|
1169
|
+
headers: { "Content-Type": "*/*", ...getHeaders(options?.headers) },
|
|
1170
|
+
body: uploadAttachmentBody,
|
|
330
1171
|
});
|
|
331
1172
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
332
1173
|
const data = body ? JSON.parse(body) : {};
|
|
333
1174
|
return { data, status: res.status, headers: res.headers };
|
|
334
1175
|
};
|
|
335
|
-
export const
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
1176
|
+
export const getDownloadAttachmentUrl = (attachment) => {
|
|
1177
|
+
return `https://assistant.leaflow.cloud/api/v1/attachments/${encodeURIComponent(String(attachment))}`;
|
|
1178
|
+
};
|
|
1179
|
+
/**
|
|
1180
|
+
* Returns the original bytes for an attachment id. The response carries long-lived cache headers because the content never changes. Returns 404 when the attachment does not exist or does not belong to the current user.
|
|
1181
|
+
*
|
|
1182
|
+
* Only an attachment whose `type` is `image` comes back with its own image type and is usable as the address of an `<img>`. Everything else is served as `application/octet-stream` with `Content-Disposition: attachment`, deliberately: an uploaded file is arbitrary bytes under a name its uploader chose, and serving it back inline would run it on this origin.
|
|
1183
|
+
* @summary Download a file
|
|
1184
|
+
*/
|
|
1185
|
+
export const downloadAttachment = async (attachment, options, fetchFn) => {
|
|
1186
|
+
const res = await (fetchFn ?? fetch)(getDownloadAttachmentUrl(attachment), {
|
|
1187
|
+
...options,
|
|
1188
|
+
method: "GET",
|
|
341
1189
|
});
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
1190
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.blob();
|
|
1191
|
+
const data = body;
|
|
1192
|
+
return { data, status: res.status, headers: res.headers };
|
|
1193
|
+
};
|
|
1194
|
+
export const getGetUploadConfigurationUrl = () => {
|
|
1195
|
+
return `https://assistant.leaflow.cloud/api/v1/upload-configuration`;
|
|
346
1196
|
};
|
|
347
1197
|
/**
|
|
348
|
-
*
|
|
349
|
-
* @summary Test whether a sender would be let through
|
|
1198
|
+
* @summary Get upload configuration
|
|
350
1199
|
*/
|
|
351
|
-
export const
|
|
352
|
-
const res = await (fetchFn ?? fetch)(
|
|
1200
|
+
export const getUploadConfiguration = async (options, fetchFn) => {
|
|
1201
|
+
const res = await (fetchFn ?? fetch)(getGetUploadConfigurationUrl(), {
|
|
353
1202
|
...options,
|
|
354
1203
|
method: "GET",
|
|
355
1204
|
});
|
|
@@ -357,31 +1206,46 @@ export const checkSender = async (channel, params, options, fetchFn) => {
|
|
|
357
1206
|
const data = body ? JSON.parse(body) : {};
|
|
358
1207
|
return { data, status: res.status, headers: res.headers };
|
|
359
1208
|
};
|
|
360
|
-
export const
|
|
361
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1209
|
+
export const getCreateUploadUrl = () => {
|
|
1210
|
+
return `https://assistant.leaflow.cloud/api/v1/uploads`;
|
|
362
1211
|
};
|
|
363
1212
|
/**
|
|
364
|
-
*
|
|
365
|
-
* @summary Begin a WeChat QR login
|
|
1213
|
+
* @summary Create upload
|
|
366
1214
|
*/
|
|
367
|
-
export const
|
|
368
|
-
const
|
|
1215
|
+
export const createUpload = async (createUploadRequestBody, options, fetchFn) => {
|
|
1216
|
+
const getHeaders = (h) => {
|
|
1217
|
+
if (!h)
|
|
1218
|
+
return {};
|
|
1219
|
+
if (h instanceof Headers)
|
|
1220
|
+
return Object.fromEntries(h.entries());
|
|
1221
|
+
if (Symbol.iterator in h) {
|
|
1222
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1223
|
+
}
|
|
1224
|
+
const headers = {};
|
|
1225
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1226
|
+
if (value !== undefined)
|
|
1227
|
+
headers[name] = value;
|
|
1228
|
+
}
|
|
1229
|
+
return headers;
|
|
1230
|
+
};
|
|
1231
|
+
const res = await (fetchFn ?? fetch)(getCreateUploadUrl(), {
|
|
369
1232
|
...options,
|
|
370
1233
|
method: "POST",
|
|
1234
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1235
|
+
body: JSON.stringify(createUploadRequestBody),
|
|
371
1236
|
});
|
|
372
1237
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
373
1238
|
const data = body ? JSON.parse(body) : {};
|
|
374
1239
|
return { data, status: res.status, headers: res.headers };
|
|
375
1240
|
};
|
|
376
|
-
export const
|
|
377
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1241
|
+
export const getListUploadsUrl = () => {
|
|
1242
|
+
return `https://assistant.leaflow.cloud/api/v1/uploads`;
|
|
378
1243
|
};
|
|
379
1244
|
/**
|
|
380
|
-
*
|
|
381
|
-
* @summary List platforms that can be connected
|
|
1245
|
+
* @summary List uploads
|
|
382
1246
|
*/
|
|
383
|
-
export const
|
|
384
|
-
const res = await (fetchFn ?? fetch)(
|
|
1247
|
+
export const listUploads = async (options, fetchFn) => {
|
|
1248
|
+
const res = await (fetchFn ?? fetch)(getListUploadsUrl(), {
|
|
385
1249
|
...options,
|
|
386
1250
|
method: "GET",
|
|
387
1251
|
});
|
|
@@ -389,15 +1253,14 @@ export const listPlatforms = async (options, fetchFn) => {
|
|
|
389
1253
|
const data = body ? JSON.parse(body) : {};
|
|
390
1254
|
return { data, status: res.status, headers: res.headers };
|
|
391
1255
|
};
|
|
392
|
-
export const
|
|
393
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1256
|
+
export const getGetUploadUrl = (upload) => {
|
|
1257
|
+
return `https://assistant.leaflow.cloud/api/v1/uploads/${encodeURIComponent(String(upload))}`;
|
|
394
1258
|
};
|
|
395
1259
|
/**
|
|
396
|
-
*
|
|
397
|
-
* @summary Get the state of a QR login
|
|
1260
|
+
* @summary Get upload
|
|
398
1261
|
*/
|
|
399
|
-
export const
|
|
400
|
-
const res = await (fetchFn ?? fetch)(
|
|
1262
|
+
export const getUpload = async (upload, options, fetchFn) => {
|
|
1263
|
+
const res = await (fetchFn ?? fetch)(getGetUploadUrl(upload), {
|
|
401
1264
|
...options,
|
|
402
1265
|
method: "GET",
|
|
403
1266
|
});
|
|
@@ -405,14 +1268,13 @@ export const getWeixinLogin = async (login, options, fetchFn) => {
|
|
|
405
1268
|
const data = body ? JSON.parse(body) : {};
|
|
406
1269
|
return { data, status: res.status, headers: res.headers };
|
|
407
1270
|
};
|
|
408
|
-
export const
|
|
409
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1271
|
+
export const getUpdateUploadUrl = (upload) => {
|
|
1272
|
+
return `https://assistant.leaflow.cloud/api/v1/uploads/${encodeURIComponent(String(upload))}`;
|
|
410
1273
|
};
|
|
411
1274
|
/**
|
|
412
|
-
*
|
|
413
|
-
* @summary Submit a login verification code
|
|
1275
|
+
* @summary Update upload
|
|
414
1276
|
*/
|
|
415
|
-
export const
|
|
1277
|
+
export const updateUpload = async (upload, updateUploadRequestBody, options, fetchFn) => {
|
|
416
1278
|
const getHeaders = (h) => {
|
|
417
1279
|
if (!h)
|
|
418
1280
|
return {};
|
|
@@ -428,79 +1290,53 @@ export const submitWeixinVerifyCode = async (login, verifyCodeRequestBody, optio
|
|
|
428
1290
|
}
|
|
429
1291
|
return headers;
|
|
430
1292
|
};
|
|
431
|
-
const res = await (fetchFn ?? fetch)(
|
|
1293
|
+
const res = await (fetchFn ?? fetch)(getUpdateUploadUrl(upload), {
|
|
432
1294
|
...options,
|
|
433
|
-
method: "
|
|
1295
|
+
method: "PATCH",
|
|
434
1296
|
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
435
|
-
body: JSON.stringify(
|
|
1297
|
+
body: JSON.stringify(updateUploadRequestBody),
|
|
436
1298
|
});
|
|
437
1299
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
438
1300
|
const data = body ? JSON.parse(body) : {};
|
|
439
1301
|
return { data, status: res.status, headers: res.headers };
|
|
440
1302
|
};
|
|
441
|
-
export const
|
|
442
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1303
|
+
export const getDeleteUploadUrl = (upload) => {
|
|
1304
|
+
return `https://assistant.leaflow.cloud/api/v1/uploads/${encodeURIComponent(String(upload))}`;
|
|
443
1305
|
};
|
|
444
1306
|
/**
|
|
445
|
-
*
|
|
446
|
-
* with the namespace `dynamic`; the client acts when that entry turns in_progress and reports
|
|
447
|
-
* back here.
|
|
448
|
-
*
|
|
449
|
-
* The first result is the one that counts. A later one is refused rather than replacing it.
|
|
450
|
-
* @summary Report what an action produced
|
|
1307
|
+
* @summary Delete upload
|
|
451
1308
|
*/
|
|
452
|
-
export const
|
|
453
|
-
const
|
|
454
|
-
if (!h)
|
|
455
|
-
return {};
|
|
456
|
-
if (h instanceof Headers)
|
|
457
|
-
return Object.fromEntries(h.entries());
|
|
458
|
-
if (Symbol.iterator in h) {
|
|
459
|
-
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
460
|
-
}
|
|
461
|
-
const headers = {};
|
|
462
|
-
for (const [name, value] of Object.entries(h)) {
|
|
463
|
-
if (value !== undefined)
|
|
464
|
-
headers[name] = value;
|
|
465
|
-
}
|
|
466
|
-
return headers;
|
|
467
|
-
};
|
|
468
|
-
const res = await (fetchFn ?? fetch)(getSubmitDynamicCallResultUrl(call), {
|
|
1309
|
+
export const deleteUpload = async (upload, options, fetchFn) => {
|
|
1310
|
+
const res = await (fetchFn ?? fetch)(getDeleteUploadUrl(upload), {
|
|
469
1311
|
...options,
|
|
470
|
-
method: "
|
|
471
|
-
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
472
|
-
body: JSON.stringify(dynamicCallResultRequestBody),
|
|
1312
|
+
method: "DELETE",
|
|
473
1313
|
});
|
|
474
1314
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
475
1315
|
const data = body ? JSON.parse(body) : undefined;
|
|
476
1316
|
return { data, status: res.status, headers: res.headers };
|
|
477
1317
|
};
|
|
478
|
-
export const
|
|
479
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1318
|
+
export const getCancelUploadUrl = (upload) => {
|
|
1319
|
+
return `https://assistant.leaflow.cloud/api/v1/uploads/${encodeURIComponent(String(upload))}/cancel`;
|
|
480
1320
|
};
|
|
481
1321
|
/**
|
|
482
|
-
*
|
|
483
|
-
* @summary List folders
|
|
1322
|
+
* @summary Cancel upload
|
|
484
1323
|
*/
|
|
485
|
-
export const
|
|
486
|
-
const res = await (fetchFn ?? fetch)(
|
|
1324
|
+
export const cancelUpload = async (upload, options, fetchFn) => {
|
|
1325
|
+
const res = await (fetchFn ?? fetch)(getCancelUploadUrl(upload), {
|
|
487
1326
|
...options,
|
|
488
|
-
method: "
|
|
1327
|
+
method: "POST",
|
|
489
1328
|
});
|
|
490
1329
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
491
|
-
const data = body ? JSON.parse(body) :
|
|
1330
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
492
1331
|
return { data, status: res.status, headers: res.headers };
|
|
493
1332
|
};
|
|
494
|
-
export const
|
|
495
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1333
|
+
export const getCompleteUploadUrl = (upload) => {
|
|
1334
|
+
return `https://assistant.leaflow.cloud/api/v1/uploads/${encodeURIComponent(String(upload))}/complete`;
|
|
496
1335
|
};
|
|
497
1336
|
/**
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
* Names are unique within an account's folders in this project, because the only way to aim at a folder is to read its name.
|
|
501
|
-
* @summary Create a folder
|
|
1337
|
+
* @summary Complete upload
|
|
502
1338
|
*/
|
|
503
|
-
export const
|
|
1339
|
+
export const completeUpload = async (upload, completeUploadRequestBody, options, fetchFn) => {
|
|
504
1340
|
const getHeaders = (h) => {
|
|
505
1341
|
if (!h)
|
|
506
1342
|
return {};
|
|
@@ -516,40 +1352,32 @@ export const createFolder = async (createFolderRequestBody, options, fetchFn) =>
|
|
|
516
1352
|
}
|
|
517
1353
|
return headers;
|
|
518
1354
|
};
|
|
519
|
-
const res = await (fetchFn ?? fetch)(
|
|
1355
|
+
const res = await (fetchFn ?? fetch)(getCompleteUploadUrl(upload), {
|
|
520
1356
|
...options,
|
|
521
1357
|
method: "POST",
|
|
522
1358
|
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
523
|
-
body: JSON.stringify(
|
|
1359
|
+
body: JSON.stringify(completeUploadRequestBody),
|
|
524
1360
|
});
|
|
525
1361
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
526
1362
|
const data = body ? JSON.parse(body) : {};
|
|
527
1363
|
return { data, status: res.status, headers: res.headers };
|
|
528
1364
|
};
|
|
529
|
-
export const
|
|
530
|
-
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
*/
|
|
536
|
-
export const getFolder = async (folder, options, fetchFn) => {
|
|
537
|
-
const res = await (fetchFn ?? fetch)(getGetFolderUrl(folder), {
|
|
538
|
-
...options,
|
|
539
|
-
method: "GET",
|
|
1365
|
+
export const getPutUploadPartUrl = (upload, part, params) => {
|
|
1366
|
+
const normalizedParams = new URLSearchParams();
|
|
1367
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1368
|
+
if (value !== undefined) {
|
|
1369
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1370
|
+
}
|
|
540
1371
|
});
|
|
541
|
-
const
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
export const getUpdateFolderUrl = (folder) => {
|
|
546
|
-
return `https://assistant.leaflow.cloud/api/v1/folders/${encodeURIComponent(String(folder))}`;
|
|
1372
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1373
|
+
return stringifiedParams.length > 0
|
|
1374
|
+
? `https://assistant.leaflow.cloud/api/v1/uploads/${encodeURIComponent(String(upload))}/parts/${encodeURIComponent(String(part))}?${stringifiedParams}`
|
|
1375
|
+
: `https://assistant.leaflow.cloud/api/v1/uploads/${encodeURIComponent(String(upload))}/parts/${encodeURIComponent(String(part))}`;
|
|
547
1376
|
};
|
|
548
1377
|
/**
|
|
549
|
-
*
|
|
550
|
-
* @summary Rename a folder
|
|
1378
|
+
* @summary Put upload part
|
|
551
1379
|
*/
|
|
552
|
-
export const
|
|
1380
|
+
export const putUploadPart = async (upload, part, putUploadPartBody, params, headers, options, fetchFn) => {
|
|
553
1381
|
const getHeaders = (h) => {
|
|
554
1382
|
if (!h)
|
|
555
1383
|
return {};
|
|
@@ -565,34 +1393,20 @@ export const updateFolder = async (folder, updateFolderRequestBody, options, fet
|
|
|
565
1393
|
}
|
|
566
1394
|
return headers;
|
|
567
1395
|
};
|
|
568
|
-
const res = await (fetchFn ?? fetch)(
|
|
1396
|
+
const res = await (fetchFn ?? fetch)(getPutUploadPartUrl(upload, part, params), {
|
|
569
1397
|
...options,
|
|
570
|
-
method: "
|
|
571
|
-
headers: {
|
|
572
|
-
|
|
1398
|
+
method: "PUT",
|
|
1399
|
+
headers: {
|
|
1400
|
+
"Content-Type": "application/octet-stream",
|
|
1401
|
+
...Object.fromEntries(Object.entries(headers).map(([name, value]) => [name, String(value)])),
|
|
1402
|
+
...getHeaders(options?.headers),
|
|
1403
|
+
},
|
|
1404
|
+
body: putUploadPartBody,
|
|
573
1405
|
});
|
|
574
1406
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
575
1407
|
const data = body ? JSON.parse(body) : {};
|
|
576
1408
|
return { data, status: res.status, headers: res.headers };
|
|
577
1409
|
};
|
|
578
|
-
export const getDeleteFolderUrl = (folder) => {
|
|
579
|
-
return `https://assistant.leaflow.cloud/api/v1/folders/${encodeURIComponent(String(folder))}`;
|
|
580
|
-
};
|
|
581
|
-
/**
|
|
582
|
-
* The conversations inside are **not** deleted. They leave the folder and go back to the ungrouped list, where they can be filed again. Emptying a shelf is not the same as throwing out what was on it, and deleting a conversation is a different request.
|
|
583
|
-
*
|
|
584
|
-
* Idempotent: deleting a folder that is already gone succeeds and changes nothing.
|
|
585
|
-
* @summary Delete a folder
|
|
586
|
-
*/
|
|
587
|
-
export const deleteFolder = async (folder, options, fetchFn) => {
|
|
588
|
-
const res = await (fetchFn ?? fetch)(getDeleteFolderUrl(folder), {
|
|
589
|
-
...options,
|
|
590
|
-
method: "DELETE",
|
|
591
|
-
});
|
|
592
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
593
|
-
const data = body ? JSON.parse(body) : undefined;
|
|
594
|
-
return { data, status: res.status, headers: res.headers };
|
|
595
|
-
};
|
|
596
1410
|
export const getListMemoriesUrl = () => {
|
|
597
1411
|
return `https://assistant.leaflow.cloud/api/v1/memories`;
|
|
598
1412
|
};
|
|
@@ -703,48 +1517,103 @@ export const getSetSkillEnabledUrl = (skill) => {
|
|
|
703
1517
|
return `https://assistant.leaflow.cloud/api/v1/skills/${encodeURIComponent(String(skill))}`;
|
|
704
1518
|
};
|
|
705
1519
|
/**
|
|
706
|
-
* Separate from writing it, because this is the frequent one: a skill that is off costs
|
|
707
|
-
* nothing and stays where it is.
|
|
708
|
-
*
|
|
709
|
-
* Only skills belonging to the project can be switched. To keep a built-in one out of the
|
|
710
|
-
* way, write a project skill of the same name and turn that off.
|
|
711
|
-
* @summary Turn a skill on or off
|
|
1520
|
+
* Separate from writing it, because this is the frequent one: a skill that is off costs
|
|
1521
|
+
* nothing and stays where it is.
|
|
1522
|
+
*
|
|
1523
|
+
* Only skills belonging to the project can be switched. To keep a built-in one out of the
|
|
1524
|
+
* way, write a project skill of the same name and turn that off.
|
|
1525
|
+
* @summary Turn a skill on or off
|
|
1526
|
+
*/
|
|
1527
|
+
export const setSkillEnabled = async (skill, skillEnabledRequestBody, options, fetchFn) => {
|
|
1528
|
+
const getHeaders = (h) => {
|
|
1529
|
+
if (!h)
|
|
1530
|
+
return {};
|
|
1531
|
+
if (h instanceof Headers)
|
|
1532
|
+
return Object.fromEntries(h.entries());
|
|
1533
|
+
if (Symbol.iterator in h) {
|
|
1534
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1535
|
+
}
|
|
1536
|
+
const headers = {};
|
|
1537
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1538
|
+
if (value !== undefined)
|
|
1539
|
+
headers[name] = value;
|
|
1540
|
+
}
|
|
1541
|
+
return headers;
|
|
1542
|
+
};
|
|
1543
|
+
const res = await (fetchFn ?? fetch)(getSetSkillEnabledUrl(skill), {
|
|
1544
|
+
...options,
|
|
1545
|
+
method: "PATCH",
|
|
1546
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1547
|
+
body: JSON.stringify(skillEnabledRequestBody),
|
|
1548
|
+
});
|
|
1549
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1550
|
+
const data = body ? JSON.parse(body) : {};
|
|
1551
|
+
return { data, status: res.status, headers: res.headers };
|
|
1552
|
+
};
|
|
1553
|
+
export const getDeleteSkillUrl = (skill) => {
|
|
1554
|
+
return `https://assistant.leaflow.cloud/api/v1/skills/${encodeURIComponent(String(skill))}`;
|
|
1555
|
+
};
|
|
1556
|
+
/**
|
|
1557
|
+
* A built-in skill of the same name, if there was one, becomes visible again.
|
|
1558
|
+
* @summary Delete this project's skill
|
|
1559
|
+
*/
|
|
1560
|
+
export const deleteSkill = async (skill, options, fetchFn) => {
|
|
1561
|
+
const res = await (fetchFn ?? fetch)(getDeleteSkillUrl(skill), {
|
|
1562
|
+
...options,
|
|
1563
|
+
method: "DELETE",
|
|
1564
|
+
});
|
|
1565
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1566
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
1567
|
+
return { data, status: res.status, headers: res.headers };
|
|
1568
|
+
};
|
|
1569
|
+
export const getListBindingsUrl = (params) => {
|
|
1570
|
+
const normalizedParams = new URLSearchParams();
|
|
1571
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1572
|
+
if (value !== undefined) {
|
|
1573
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1574
|
+
}
|
|
1575
|
+
});
|
|
1576
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1577
|
+
return stringifiedParams.length > 0
|
|
1578
|
+
? `https://assistant.leaflow.cloud/api/v1/bindings?${stringifiedParams}`
|
|
1579
|
+
: `https://assistant.leaflow.cloud/api/v1/bindings`;
|
|
1580
|
+
};
|
|
1581
|
+
/**
|
|
1582
|
+
* Filter by channelId to show, per channel, who is bound to it.
|
|
1583
|
+
* @summary List bindings
|
|
1584
|
+
*/
|
|
1585
|
+
export const listBindings = async (params, options, fetchFn) => {
|
|
1586
|
+
const res = await (fetchFn ?? fetch)(getListBindingsUrl(params), {
|
|
1587
|
+
...options,
|
|
1588
|
+
method: "GET",
|
|
1589
|
+
});
|
|
1590
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1591
|
+
const data = body ? JSON.parse(body) : {};
|
|
1592
|
+
return { data, status: res.status, headers: res.headers };
|
|
1593
|
+
};
|
|
1594
|
+
export const getGetBindingUrl = (binding) => {
|
|
1595
|
+
return `https://assistant.leaflow.cloud/api/v1/bindings/${encodeURIComponent(String(binding))}`;
|
|
1596
|
+
};
|
|
1597
|
+
/**
|
|
1598
|
+
* @summary Get a binding
|
|
712
1599
|
*/
|
|
713
|
-
export const
|
|
714
|
-
const
|
|
715
|
-
if (!h)
|
|
716
|
-
return {};
|
|
717
|
-
if (h instanceof Headers)
|
|
718
|
-
return Object.fromEntries(h.entries());
|
|
719
|
-
if (Symbol.iterator in h) {
|
|
720
|
-
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
721
|
-
}
|
|
722
|
-
const headers = {};
|
|
723
|
-
for (const [name, value] of Object.entries(h)) {
|
|
724
|
-
if (value !== undefined)
|
|
725
|
-
headers[name] = value;
|
|
726
|
-
}
|
|
727
|
-
return headers;
|
|
728
|
-
};
|
|
729
|
-
const res = await (fetchFn ?? fetch)(getSetSkillEnabledUrl(skill), {
|
|
1600
|
+
export const getBinding = async (binding, options, fetchFn) => {
|
|
1601
|
+
const res = await (fetchFn ?? fetch)(getGetBindingUrl(binding), {
|
|
730
1602
|
...options,
|
|
731
|
-
method: "
|
|
732
|
-
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
733
|
-
body: JSON.stringify(skillEnabledRequestBody),
|
|
1603
|
+
method: "GET",
|
|
734
1604
|
});
|
|
735
1605
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
736
1606
|
const data = body ? JSON.parse(body) : {};
|
|
737
1607
|
return { data, status: res.status, headers: res.headers };
|
|
738
1608
|
};
|
|
739
|
-
export const
|
|
740
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1609
|
+
export const getDeleteBindingUrl = (binding) => {
|
|
1610
|
+
return `https://assistant.leaflow.cloud/api/v1/bindings/${encodeURIComponent(String(binding))}`;
|
|
741
1611
|
};
|
|
742
1612
|
/**
|
|
743
|
-
*
|
|
744
|
-
* @summary Delete this project's skill
|
|
1613
|
+
* @summary Remove a binding
|
|
745
1614
|
*/
|
|
746
|
-
export const
|
|
747
|
-
const res = await (fetchFn ?? fetch)(
|
|
1615
|
+
export const deleteBinding = async (binding, options, fetchFn) => {
|
|
1616
|
+
const res = await (fetchFn ?? fetch)(getDeleteBindingUrl(binding), {
|
|
748
1617
|
...options,
|
|
749
1618
|
method: "DELETE",
|
|
750
1619
|
});
|
|
@@ -752,7 +1621,7 @@ export const deleteSkill = async (skill, options, fetchFn) => {
|
|
|
752
1621
|
const data = body ? JSON.parse(body) : undefined;
|
|
753
1622
|
return { data, status: res.status, headers: res.headers };
|
|
754
1623
|
};
|
|
755
|
-
export const
|
|
1624
|
+
export const getListChannelsUrl = (params) => {
|
|
756
1625
|
const normalizedParams = new URLSearchParams();
|
|
757
1626
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
758
1627
|
if (value !== undefined) {
|
|
@@ -761,17 +1630,14 @@ export const getListThreadsUrl = (params) => {
|
|
|
761
1630
|
});
|
|
762
1631
|
const stringifiedParams = normalizedParams.toString();
|
|
763
1632
|
return stringifiedParams.length > 0
|
|
764
|
-
? `https://assistant.leaflow.cloud/api/v1/
|
|
765
|
-
: `https://assistant.leaflow.cloud/api/v1/
|
|
1633
|
+
? `https://assistant.leaflow.cloud/api/v1/channels?${stringifiedParams}`
|
|
1634
|
+
: `https://assistant.leaflow.cloud/api/v1/channels`;
|
|
766
1635
|
};
|
|
767
1636
|
/**
|
|
768
|
-
*
|
|
769
|
-
*
|
|
770
|
-
* Pass the returned nextCursor as cursor; omit cursor on the first page. Continue with the same q, archived and folder filters. The cursor marks a position in the activity order, so changing filters between pages does not continue the same list.
|
|
771
|
-
* @summary List conversations
|
|
1637
|
+
* @summary List channels
|
|
772
1638
|
*/
|
|
773
|
-
export const
|
|
774
|
-
const res = await (fetchFn ?? fetch)(
|
|
1639
|
+
export const listChannels = async (params, options, fetchFn) => {
|
|
1640
|
+
const res = await (fetchFn ?? fetch)(getListChannelsUrl(params), {
|
|
775
1641
|
...options,
|
|
776
1642
|
method: "GET",
|
|
777
1643
|
});
|
|
@@ -779,16 +1645,14 @@ export const listThreads = async (params, options, fetchFn) => {
|
|
|
779
1645
|
const data = body ? JSON.parse(body) : {};
|
|
780
1646
|
return { data, status: res.status, headers: res.headers };
|
|
781
1647
|
};
|
|
782
|
-
export const
|
|
783
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1648
|
+
export const getCreateChannelUrl = () => {
|
|
1649
|
+
return `https://assistant.leaflow.cloud/api/v1/channels`;
|
|
784
1650
|
};
|
|
785
1651
|
/**
|
|
786
|
-
*
|
|
787
|
-
*
|
|
788
|
-
* A well-formed preference for a Canopy model that is no longer allowed or has been retired or removed is retained and uses the default when a turn starts. This also handles a catalogue change between displaying the selector and submitting the choice. Creating a conversation does not contact a model provider and remains possible when generation is unavailable.
|
|
789
|
-
* @summary Create a conversation
|
|
1652
|
+
* Which side owns the webhook secret is decided by the platform; see secretSource on list-platforms. For a `generated` platform, do not send webhookSecret — the one we generate is returned exactly once in this response and cannot be retrieved again; miss it and the only way forward is rotating to a new one. For a `supplied` platform you must pass the secret from that platform's own console, and webhookSecret in the response is null.
|
|
1653
|
+
* @summary Create a channel
|
|
790
1654
|
*/
|
|
791
|
-
export const
|
|
1655
|
+
export const createChannel = async (createChannelRequestBody, options, fetchFn) => {
|
|
792
1656
|
const getHeaders = (h) => {
|
|
793
1657
|
if (!h)
|
|
794
1658
|
return {};
|
|
@@ -804,25 +1668,24 @@ export const createThread = async (createThreadRequestBody, options, fetchFn) =>
|
|
|
804
1668
|
}
|
|
805
1669
|
return headers;
|
|
806
1670
|
};
|
|
807
|
-
const res = await (fetchFn ?? fetch)(
|
|
1671
|
+
const res = await (fetchFn ?? fetch)(getCreateChannelUrl(), {
|
|
808
1672
|
...options,
|
|
809
1673
|
method: "POST",
|
|
810
1674
|
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
811
|
-
body: JSON.stringify(
|
|
1675
|
+
body: JSON.stringify(createChannelRequestBody),
|
|
812
1676
|
});
|
|
813
1677
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
814
1678
|
const data = body ? JSON.parse(body) : {};
|
|
815
1679
|
return { data, status: res.status, headers: res.headers };
|
|
816
1680
|
};
|
|
817
|
-
export const
|
|
818
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1681
|
+
export const getGetChannelUrl = (channel) => {
|
|
1682
|
+
return `https://assistant.leaflow.cloud/api/v1/channels/${encodeURIComponent(String(channel))}`;
|
|
819
1683
|
};
|
|
820
1684
|
/**
|
|
821
|
-
*
|
|
822
|
-
* @summary Fetch the conversation document
|
|
1685
|
+
* @summary Get a channel
|
|
823
1686
|
*/
|
|
824
|
-
export const
|
|
825
|
-
const res = await (fetchFn ?? fetch)(
|
|
1687
|
+
export const getChannel = async (channel, options, fetchFn) => {
|
|
1688
|
+
const res = await (fetchFn ?? fetch)(getGetChannelUrl(channel), {
|
|
826
1689
|
...options,
|
|
827
1690
|
method: "GET",
|
|
828
1691
|
});
|
|
@@ -830,22 +1693,14 @@ export const getThread = async (thread, options, fetchFn) => {
|
|
|
830
1693
|
const data = body ? JSON.parse(body) : {};
|
|
831
1694
|
return { data, status: res.status, headers: res.headers };
|
|
832
1695
|
};
|
|
833
|
-
export const
|
|
834
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1696
|
+
export const getUpdateChannelUrl = (channel) => {
|
|
1697
|
+
return `https://assistant.leaflow.cloud/api/v1/channels/${encodeURIComponent(String(channel))}`;
|
|
835
1698
|
};
|
|
836
1699
|
/**
|
|
837
|
-
*
|
|
838
|
-
*
|
|
839
|
-
* Omit preferredModelId to leave the preference unchanged, or set it to null to follow the platform default. A non-null preference is accepted only while model selection is enabled; otherwise the whole request fails with 403 and code MODEL_SELECTION_DISABLED and none of its fields are changed. Clearing a preference remains allowed while selection is disabled. A well-formed preference for a disallowed, retired or removed Canopy model is retained and falls back to the default when used.
|
|
840
|
-
*
|
|
841
|
-
* Model switching is allowed on an existing conversation, including while a turn is generating or waiting for approval or an answer. The response immediately returns the saved preferredModelId, while model continues to identify the running turn's effective model until it finishes. Messages queued into that running turn also keep its captured model choices. The next turn uses the latest saved preference.
|
|
842
|
-
*
|
|
843
|
-
* Changing the preference does not create a new conversation, start a turn, call a model provider, clear the transcript, or rewrite historical model attribution. Before the next turn sends its first request to the selected model, the service checks that model's input capabilities and usable context budget. A switch to a smaller window may require compaction under the compaction policy above; saving the preference alone does not establish that the conversation fits.
|
|
844
|
-
*
|
|
845
|
-
* Archiving makes a conversation read-only: it stays in the list under "archived", stays readable, and the assistant can still find it when it searches past conversations — it just takes no new input. Unarchive it to continue. Archiving fails while a turn is running; stop it first.
|
|
846
|
-
* @summary Update conversation settings
|
|
1700
|
+
* Only the fields present are changed. senderPolicy and allowFrom go together, and senderPolicy decides whether they are replaced. For platforms held open by a long-lived connection the change applies once that connection is rebuilt; for webhook platforms it applies at once.
|
|
1701
|
+
* @summary Update a channel
|
|
847
1702
|
*/
|
|
848
|
-
export const
|
|
1703
|
+
export const updateChannel = async (channel, updateChannelRequestBody, options, fetchFn) => {
|
|
849
1704
|
const getHeaders = (h) => {
|
|
850
1705
|
if (!h)
|
|
851
1706
|
return {};
|
|
@@ -861,31 +1716,25 @@ export const updateThread = async (thread, updateThreadRequestBody, options, fet
|
|
|
861
1716
|
}
|
|
862
1717
|
return headers;
|
|
863
1718
|
};
|
|
864
|
-
const res = await (fetchFn ?? fetch)(
|
|
1719
|
+
const res = await (fetchFn ?? fetch)(getUpdateChannelUrl(channel), {
|
|
865
1720
|
...options,
|
|
866
1721
|
method: "PATCH",
|
|
867
1722
|
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
868
|
-
body: JSON.stringify(
|
|
1723
|
+
body: JSON.stringify(updateChannelRequestBody),
|
|
869
1724
|
});
|
|
870
1725
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
871
1726
|
const data = body ? JSON.parse(body) : {};
|
|
872
1727
|
return { data, status: res.status, headers: res.headers };
|
|
873
1728
|
};
|
|
874
|
-
export const
|
|
875
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1729
|
+
export const getDeleteChannelUrl = (channel) => {
|
|
1730
|
+
return `https://assistant.leaflow.cloud/api/v1/channels/${encodeURIComponent(String(channel))}`;
|
|
876
1731
|
};
|
|
877
1732
|
/**
|
|
878
|
-
*
|
|
879
|
-
*
|
|
880
|
-
* Deleting is not the same as archiving, and the two are not degrees of the same thing. An archived conversation is still there and still readable, it just takes no new input; a deleted one is gone from view. Archiving can be undone; this cannot.
|
|
881
|
-
*
|
|
882
|
-
* What survives is the record itself, because a conversation with this assistant is an account of what was done to real infrastructure — which machine was changed, which disk was removed. That record is kept even though nobody can reach it here.
|
|
883
|
-
*
|
|
884
|
-
* Fails while a turn is running: stop it first. Deleting an already deleted conversation succeeds and changes nothing.
|
|
885
|
-
* @summary Delete a conversation
|
|
1733
|
+
* The channel stops accepting inbound messages and every binding on it stops working. This operation remains available while the project is suspended or being cleaned up.
|
|
1734
|
+
* @summary Delete a channel
|
|
886
1735
|
*/
|
|
887
|
-
export const
|
|
888
|
-
const res = await (fetchFn ?? fetch)(
|
|
1736
|
+
export const deleteChannel = async (channel, options, fetchFn) => {
|
|
1737
|
+
const res = await (fetchFn ?? fetch)(getDeleteChannelUrl(channel), {
|
|
889
1738
|
...options,
|
|
890
1739
|
method: "DELETE",
|
|
891
1740
|
});
|
|
@@ -893,40 +1742,23 @@ export const deleteThread = async (thread, options, fetchFn) => {
|
|
|
893
1742
|
const data = body ? JSON.parse(body) : undefined;
|
|
894
1743
|
return { data, status: res.status, headers: res.headers };
|
|
895
1744
|
};
|
|
896
|
-
export const
|
|
897
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1745
|
+
export const getCreateBindingCodeUrl = (channel) => {
|
|
1746
|
+
return `https://assistant.leaflow.cloud/api/v1/channels/${encodeURIComponent(String(channel))}/binding-codes`;
|
|
898
1747
|
};
|
|
899
1748
|
/**
|
|
900
|
-
*
|
|
901
|
-
* @summary
|
|
1749
|
+
* Produces a single-use code to hand to the person being bound. They send that code to the assistant from their own account on that platform, which completes the binding. A binding can only be established this way, by the person themselves — a platform account cannot be named directly. Codes expire and have to be reissued.
|
|
1750
|
+
* @summary Issue a binding code
|
|
902
1751
|
*/
|
|
903
|
-
export const
|
|
904
|
-
const
|
|
905
|
-
if (!h)
|
|
906
|
-
return {};
|
|
907
|
-
if (h instanceof Headers)
|
|
908
|
-
return Object.fromEntries(h.entries());
|
|
909
|
-
if (Symbol.iterator in h) {
|
|
910
|
-
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
911
|
-
}
|
|
912
|
-
const headers = {};
|
|
913
|
-
for (const [name, value] of Object.entries(h)) {
|
|
914
|
-
if (value !== undefined)
|
|
915
|
-
headers[name] = value;
|
|
916
|
-
}
|
|
917
|
-
return headers;
|
|
918
|
-
};
|
|
919
|
-
const res = await (fetchFn ?? fetch)(getDecideApprovalUrl(thread, batch), {
|
|
1752
|
+
export const createBindingCode = async (channel, options, fetchFn) => {
|
|
1753
|
+
const res = await (fetchFn ?? fetch)(getCreateBindingCodeUrl(channel), {
|
|
920
1754
|
...options,
|
|
921
1755
|
method: "POST",
|
|
922
|
-
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
923
|
-
body: JSON.stringify(decideRequestBody),
|
|
924
1756
|
});
|
|
925
1757
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
926
|
-
const data = body ? JSON.parse(body) :
|
|
1758
|
+
const data = body ? JSON.parse(body) : {};
|
|
927
1759
|
return { data, status: res.status, headers: res.headers };
|
|
928
1760
|
};
|
|
929
|
-
export const
|
|
1761
|
+
export const getListChannelRejectionsUrl = (channel, params) => {
|
|
930
1762
|
const normalizedParams = new URLSearchParams();
|
|
931
1763
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
932
1764
|
if (value !== undefined) {
|
|
@@ -935,15 +1767,15 @@ export const getListEarlierItemsUrl = (thread, params) => {
|
|
|
935
1767
|
});
|
|
936
1768
|
const stringifiedParams = normalizedParams.toString();
|
|
937
1769
|
return stringifiedParams.length > 0
|
|
938
|
-
? `https://assistant.leaflow.cloud/api/v1/
|
|
939
|
-
: `https://assistant.leaflow.cloud/api/v1/
|
|
1770
|
+
? `https://assistant.leaflow.cloud/api/v1/channels/${encodeURIComponent(String(channel))}/rejections?${stringifiedParams}`
|
|
1771
|
+
: `https://assistant.leaflow.cloud/api/v1/channels/${encodeURIComponent(String(channel))}/rejections`;
|
|
940
1772
|
};
|
|
941
1773
|
/**
|
|
942
|
-
*
|
|
943
|
-
* @summary
|
|
1774
|
+
* For diagnosing "I sent a message and the assistant never answered". Returns the inbound messages this channel rejected most recently, newest first, each with its reason. The most common reason is that the sender is not bound yet.
|
|
1775
|
+
* @summary List recently rejected inbound messages
|
|
944
1776
|
*/
|
|
945
|
-
export const
|
|
946
|
-
const res = await (fetchFn ?? fetch)(
|
|
1777
|
+
export const listChannelRejections = async (channel, params, options, fetchFn) => {
|
|
1778
|
+
const res = await (fetchFn ?? fetch)(getListChannelRejectionsUrl(channel, params), {
|
|
947
1779
|
...options,
|
|
948
1780
|
method: "GET",
|
|
949
1781
|
});
|
|
@@ -951,30 +1783,14 @@ export const listEarlierItems = async (thread, params, options, fetchFn) => {
|
|
|
951
1783
|
const data = body ? JSON.parse(body) : {};
|
|
952
1784
|
return { data, status: res.status, headers: res.headers };
|
|
953
1785
|
};
|
|
954
|
-
export const
|
|
955
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
956
|
-
};
|
|
957
|
-
/**
|
|
958
|
-
* Calling this on a conversation with no running turn also returns 204 rather than an error — the user pressing stop races with the turn finishing on its own, and both outcomes are the same. This operation remains available while the project is suspended or being cleaned up.
|
|
959
|
-
* @summary Interrupt a running turn
|
|
960
|
-
*/
|
|
961
|
-
export const interruptThread = async (thread, options, fetchFn) => {
|
|
962
|
-
const res = await (fetchFn ?? fetch)(getInterruptThreadUrl(thread), {
|
|
963
|
-
...options,
|
|
964
|
-
method: "POST",
|
|
965
|
-
});
|
|
966
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
967
|
-
const data = body ? JSON.parse(body) : undefined;
|
|
968
|
-
return { data, status: res.status, headers: res.headers };
|
|
969
|
-
};
|
|
970
|
-
export const getSendMessageUrl = (thread) => {
|
|
971
|
-
return `https://assistant.leaflow.cloud/api/v1/threads/${encodeURIComponent(String(thread))}/messages`;
|
|
1786
|
+
export const getRotateChannelSecretUrl = (channel) => {
|
|
1787
|
+
return `https://assistant.leaflow.cloud/api/v1/channels/${encodeURIComponent(String(channel))}/secret`;
|
|
972
1788
|
};
|
|
973
1789
|
/**
|
|
974
|
-
*
|
|
975
|
-
* @summary
|
|
1790
|
+
* Replaces the webhook secret. The old one stops working immediately and the channel drops back to awaiting confirmation from the platform. Which side owns the secret is decided by the platform; see secretSource on list-platforms. For a `generated` platform, send no body — the new secret is returned in this response only and cannot be retrieved again. For a `supplied` platform you must pass the new secret from that platform's own console.
|
|
1791
|
+
* @summary Rotate the webhook secret
|
|
976
1792
|
*/
|
|
977
|
-
export const
|
|
1793
|
+
export const rotateChannelSecret = async (channel, rotateSecretRequestBody, options, fetchFn) => {
|
|
978
1794
|
const getHeaders = (h) => {
|
|
979
1795
|
if (!h)
|
|
980
1796
|
return {};
|
|
@@ -990,72 +1806,97 @@ export const sendMessage = async (thread, sendMessageRequestBody, options, fetch
|
|
|
990
1806
|
}
|
|
991
1807
|
return headers;
|
|
992
1808
|
};
|
|
993
|
-
const res = await (fetchFn ?? fetch)(
|
|
1809
|
+
const res = await (fetchFn ?? fetch)(getRotateChannelSecretUrl(channel), {
|
|
994
1810
|
...options,
|
|
995
1811
|
method: "POST",
|
|
996
1812
|
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
997
|
-
body: JSON.stringify(
|
|
1813
|
+
body: JSON.stringify(rotateSecretRequestBody),
|
|
998
1814
|
});
|
|
999
1815
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1000
1816
|
const data = body ? JSON.parse(body) : {};
|
|
1001
1817
|
return { data, status: res.status, headers: res.headers };
|
|
1002
1818
|
};
|
|
1003
|
-
export const
|
|
1004
|
-
|
|
1819
|
+
export const getCheckSenderUrl = (channel, params) => {
|
|
1820
|
+
const normalizedParams = new URLSearchParams();
|
|
1821
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1822
|
+
if (value !== undefined) {
|
|
1823
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1824
|
+
}
|
|
1825
|
+
});
|
|
1826
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1827
|
+
return stringifiedParams.length > 0
|
|
1828
|
+
? `https://assistant.leaflow.cloud/api/v1/channels/${encodeURIComponent(String(channel))}/sender-check?${stringifiedParams}`
|
|
1829
|
+
: `https://assistant.leaflow.cloud/api/v1/channels/${encodeURIComponent(String(channel))}/sender-check`;
|
|
1005
1830
|
};
|
|
1006
1831
|
/**
|
|
1007
|
-
*
|
|
1008
|
-
* @summary
|
|
1832
|
+
* For checking a sender policy after changing it. Sends nothing and changes nothing: it runs exactly the same decision a real inbound message goes through, and says which rule produced the answer. The binding-code rule cannot be tested this way — whether something is a binding code depends on what the sender actually wrote.
|
|
1833
|
+
* @summary Test whether a sender would be let through
|
|
1009
1834
|
*/
|
|
1010
|
-
export const
|
|
1011
|
-
const
|
|
1012
|
-
if (!h)
|
|
1013
|
-
return {};
|
|
1014
|
-
if (h instanceof Headers)
|
|
1015
|
-
return Object.fromEntries(h.entries());
|
|
1016
|
-
if (Symbol.iterator in h) {
|
|
1017
|
-
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1018
|
-
}
|
|
1019
|
-
const headers = {};
|
|
1020
|
-
for (const [name, value] of Object.entries(h)) {
|
|
1021
|
-
if (value !== undefined)
|
|
1022
|
-
headers[name] = value;
|
|
1023
|
-
}
|
|
1024
|
-
return headers;
|
|
1025
|
-
};
|
|
1026
|
-
const res = await (fetchFn ?? fetch)(getAnswerQuestionUrl(thread, item), {
|
|
1835
|
+
export const checkSender = async (channel, params, options, fetchFn) => {
|
|
1836
|
+
const res = await (fetchFn ?? fetch)(getCheckSenderUrl(channel, params), {
|
|
1027
1837
|
...options,
|
|
1028
|
-
method: "
|
|
1029
|
-
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1030
|
-
body: JSON.stringify(answerRequestBody),
|
|
1838
|
+
method: "GET",
|
|
1031
1839
|
});
|
|
1032
1840
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1033
|
-
const data = body ? JSON.parse(body) :
|
|
1841
|
+
const data = body ? JSON.parse(body) : {};
|
|
1034
1842
|
return { data, status: res.status, headers: res.headers };
|
|
1035
1843
|
};
|
|
1036
|
-
export const
|
|
1037
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1844
|
+
export const getBeginWeixinLoginUrl = (channel) => {
|
|
1845
|
+
return `https://assistant.leaflow.cloud/api/v1/channels/${encodeURIComponent(String(channel))}/weixin-logins`;
|
|
1038
1846
|
};
|
|
1039
1847
|
/**
|
|
1040
|
-
*
|
|
1848
|
+
* A personal WeChat channel can only send and receive once its owner has signed in by scanning a QR code. This returns that code; poll `GET /v1/weixin-logins/{login}` for progress, and when the status asks for a verification code, submit it with `POST /v1/weixin-logins/{login}/verify-code`.
|
|
1849
|
+
* @summary Begin a WeChat QR login
|
|
1041
1850
|
*/
|
|
1042
|
-
export const
|
|
1043
|
-
const res = await (fetchFn ?? fetch)(
|
|
1851
|
+
export const beginWeixinLogin = async (channel, options, fetchFn) => {
|
|
1852
|
+
const res = await (fetchFn ?? fetch)(getBeginWeixinLoginUrl(channel), {
|
|
1044
1853
|
...options,
|
|
1045
1854
|
method: "POST",
|
|
1046
1855
|
});
|
|
1047
1856
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1048
|
-
const data = body ? JSON.parse(body) :
|
|
1857
|
+
const data = body ? JSON.parse(body) : {};
|
|
1049
1858
|
return { data, status: res.status, headers: res.headers };
|
|
1050
1859
|
};
|
|
1051
|
-
export const
|
|
1052
|
-
return `https://assistant.leaflow.cloud/api/v1/
|
|
1860
|
+
export const getListPlatformsUrl = () => {
|
|
1861
|
+
return `https://assistant.leaflow.cloud/api/v1/platforms`;
|
|
1053
1862
|
};
|
|
1054
1863
|
/**
|
|
1055
|
-
*
|
|
1056
|
-
* @summary
|
|
1864
|
+
* The instant messaging platforms that can currently be connected, along with the flow and the credential fields each one needs. The create-channel form is driven entirely by this response: setupMethod decides between a credential form and a QR flow, credentialFields is what to ask for, and secretSource decides whether there is a webhook secret field at all.
|
|
1865
|
+
* @summary List platforms that can be connected
|
|
1057
1866
|
*/
|
|
1058
|
-
export const
|
|
1867
|
+
export const listPlatforms = async (options, fetchFn) => {
|
|
1868
|
+
const res = await (fetchFn ?? fetch)(getListPlatformsUrl(), {
|
|
1869
|
+
...options,
|
|
1870
|
+
method: "GET",
|
|
1871
|
+
});
|
|
1872
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1873
|
+
const data = body ? JSON.parse(body) : {};
|
|
1874
|
+
return { data, status: res.status, headers: res.headers };
|
|
1875
|
+
};
|
|
1876
|
+
export const getGetWeixinLoginUrl = (login) => {
|
|
1877
|
+
return `https://assistant.leaflow.cloud/api/v1/weixin-logins/${encodeURIComponent(String(login))}`;
|
|
1878
|
+
};
|
|
1879
|
+
/**
|
|
1880
|
+
* Poll this until the status is success or failure. When the status asks for a verification code, submit it with the verification-code operation.
|
|
1881
|
+
* @summary Get the state of a QR login
|
|
1882
|
+
*/
|
|
1883
|
+
export const getWeixinLogin = async (login, options, fetchFn) => {
|
|
1884
|
+
const res = await (fetchFn ?? fetch)(getGetWeixinLoginUrl(login), {
|
|
1885
|
+
...options,
|
|
1886
|
+
method: "GET",
|
|
1887
|
+
});
|
|
1888
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1889
|
+
const data = body ? JSON.parse(body) : {};
|
|
1890
|
+
return { data, status: res.status, headers: res.headers };
|
|
1891
|
+
};
|
|
1892
|
+
export const getSubmitWeixinVerifyCodeUrl = (login) => {
|
|
1893
|
+
return `https://assistant.leaflow.cloud/api/v1/weixin-logins/${encodeURIComponent(String(login))}/verify-code`;
|
|
1894
|
+
};
|
|
1895
|
+
/**
|
|
1896
|
+
* For when WeChat asks for an SMS or device code after the scan. The person who started the login gets that code on their own phone.
|
|
1897
|
+
* @summary Submit a login verification code
|
|
1898
|
+
*/
|
|
1899
|
+
export const submitWeixinVerifyCode = async (login, verifyCodeRequestBody, options, fetchFn) => {
|
|
1059
1900
|
const getHeaders = (h) => {
|
|
1060
1901
|
if (!h)
|
|
1061
1902
|
return {};
|
|
@@ -1071,11 +1912,11 @@ export const revertThread = async (thread, revertRequestBody, options, fetchFn)
|
|
|
1071
1912
|
}
|
|
1072
1913
|
return headers;
|
|
1073
1914
|
};
|
|
1074
|
-
const res = await (fetchFn ?? fetch)(
|
|
1915
|
+
const res = await (fetchFn ?? fetch)(getSubmitWeixinVerifyCodeUrl(login), {
|
|
1075
1916
|
...options,
|
|
1076
1917
|
method: "POST",
|
|
1077
1918
|
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1078
|
-
body: JSON.stringify(
|
|
1919
|
+
body: JSON.stringify(verifyCodeRequestBody),
|
|
1079
1920
|
});
|
|
1080
1921
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1081
1922
|
const data = body ? JSON.parse(body) : {};
|