@epam/ai-dial-chat-hooks 1.3.0-dev.98 → 1.3.0-rc.0
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/api-error/api-error.d.ts +2 -0
- package/api-error/api-error.d.ts.map +1 -1
- package/api-error/api-error.js +31 -23
- package/api-transport/create-unauthorized-middleware.js +4 -1
- package/attachment/attach-constraints.d.ts +31 -0
- package/attachment/attach-constraints.d.ts.map +1 -0
- package/attachment/attach-constraints.js +18 -0
- package/attachment/useAttachmentAction/useAttachmentAction.d.ts +1 -1
- package/attachment/useAttachmentAction/useAttachmentAction.d.ts.map +1 -1
- package/attachment/useAttachmentAction/useAttachmentAction.js +25 -28
- package/attachments.js +2 -1
- package/catalog/application-credentials.d.ts +15 -0
- package/catalog/application-credentials.d.ts.map +1 -0
- package/catalog/application-credentials.js +28 -0
- package/catalog/catalog-derivations.d.ts +5 -3
- package/catalog/catalog-derivations.d.ts.map +1 -1
- package/catalog/catalog-derivations.js +13 -6
- package/catalog/catalog-entity-kind.d.ts +31 -0
- package/catalog/catalog-entity-kind.d.ts.map +1 -0
- package/catalog/catalog-entity-kind.js +21 -0
- package/catalog/catalog-preferences.d.ts +8 -0
- package/catalog/catalog-preferences.d.ts.map +1 -0
- package/catalog/catalog-preferences.js +5 -0
- package/catalog/create-publish-api.d.ts +3 -1
- package/catalog/create-publish-api.d.ts.map +1 -1
- package/catalog/create-publish-api.js +4 -0
- package/catalog/deployment-id.d.ts +13 -4
- package/catalog/deployment-id.d.ts.map +1 -1
- package/catalog/deployment-id.js +17 -3
- package/catalog/entity-details.d.ts +2 -0
- package/catalog/entity-details.d.ts.map +1 -1
- package/catalog/favorite-entity-type.d.ts +5 -0
- package/catalog/favorite-entity-type.d.ts.map +1 -0
- package/catalog/favorite-entity-type.js +10 -0
- package/catalog/map-deployment-limits-to-input.d.ts +4 -3
- package/catalog/map-deployment-limits-to-input.d.ts.map +1 -1
- package/catalog/map-deployment-limits-to-input.js +3 -4
- package/catalog/map-deployment-to-catalog-item.d.ts +12 -1
- package/catalog/map-deployment-to-catalog-item.d.ts.map +1 -1
- package/catalog/map-deployment-to-catalog-item.js +22 -15
- package/catalog/map-entity-details-to-catalog.d.ts.map +1 -1
- package/catalog/map-entity-details-to-catalog.js +69 -24
- package/catalog/map-skill-to-catalog-item.d.ts +4 -5
- package/catalog/map-skill-to-catalog-item.d.ts.map +1 -1
- package/catalog/map-skill-to-catalog-item.js +29 -38
- package/catalog/publish.d.ts +1 -1
- package/catalog/publish.d.ts.map +1 -1
- package/catalog/resource-folder.d.ts +8 -0
- package/catalog/resource-folder.d.ts.map +1 -0
- package/catalog/resource-folder.js +13 -0
- package/catalog/resource-name-conflict.d.ts +22 -0
- package/catalog/resource-name-conflict.d.ts.map +1 -0
- package/catalog/resource-name-conflict.js +32 -0
- package/catalog/resource-save-adapter.d.ts +36 -0
- package/catalog/resource-save-adapter.d.ts.map +1 -0
- package/catalog/resource-save-adapter.js +4 -0
- package/catalog/resource-save-adapters.d.ts +93 -0
- package/catalog/resource-save-adapters.d.ts.map +1 -0
- package/catalog/resource-save-adapters.js +116 -0
- package/catalog/resource-save.d.ts +76 -0
- package/catalog/resource-save.d.ts.map +1 -0
- package/catalog/resource-save.js +52 -0
- package/catalog/unpublishable-folders.d.ts +21 -0
- package/catalog/unpublishable-folders.d.ts.map +1 -0
- package/catalog/unpublishable-folders.js +21 -0
- package/catalog/usage-limit-rows.d.ts +14 -0
- package/catalog/usage-limit-rows.d.ts.map +1 -0
- package/catalog/usage-limit-rows.js +19 -0
- package/catalog/use-publish-history.d.ts +19 -0
- package/catalog/use-publish-history.d.ts.map +1 -0
- package/catalog/use-publish-history.js +25 -0
- package/catalog/useApplicationCredentialActions/useApplicationCredentialActions.d.ts +57 -0
- package/catalog/useApplicationCredentialActions/useApplicationCredentialActions.d.ts.map +1 -0
- package/catalog/useApplicationCredentialActions/useApplicationCredentialActions.js +67 -0
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.d.ts +15 -5
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.d.ts.map +1 -1
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +71 -89
- package/catalog/useCatalogItemDelete/useCatalogItemDelete.d.ts +41 -0
- package/catalog/useCatalogItemDelete/useCatalogItemDelete.d.ts.map +1 -0
- package/catalog/useCatalogItemDelete/useCatalogItemDelete.js +37 -0
- package/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.d.ts.map +1 -1
- package/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js +72 -77
- package/catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js +1 -1
- package/catalog/usePublishFolders/usePublishFolders.d.ts +8 -0
- package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
- package/catalog/usePublishFolders/usePublishFolders.js +32 -29
- package/catalog/useResourceFolders/useResourceFolders.d.ts +33 -0
- package/catalog/useResourceFolders/useResourceFolders.d.ts.map +1 -0
- package/catalog/useResourceFolders/useResourceFolders.js +58 -0
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts +64 -0
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -0
- package/catalog/useResourceSavePanel/useResourceSavePanel.js +173 -0
- package/catalog/useSkillItemDetails.js +3 -3
- package/catalog/useUnpublishConfirmation/useUnpublishConfirmation.d.ts +43 -0
- package/catalog/useUnpublishConfirmation/useUnpublishConfirmation.d.ts.map +1 -0
- package/catalog/useUnpublishConfirmation/useUnpublishConfirmation.js +46 -0
- package/catalog/useUnpublishableFolders/useUnpublishableFolders.d.ts +22 -0
- package/catalog/useUnpublishableFolders/useUnpublishableFolders.d.ts.map +1 -0
- package/catalog/useUnpublishableFolders/useUnpublishableFolders.js +53 -0
- package/catalog.js +41 -23
- package/conversation/conversation-data-source.d.ts +47 -0
- package/conversation/conversation-data-source.d.ts.map +1 -0
- package/conversation/conversation-data-source.js +11 -0
- package/conversation/conversation-draft/conversation-draft-store.js +40 -40
- package/conversation/conversation-list.d.ts +6 -0
- package/conversation/conversation-list.d.ts.map +1 -0
- package/conversation/conversation-list.js +5 -0
- package/conversation/conversation-title-stream.d.ts +33 -0
- package/conversation/conversation-title-stream.d.ts.map +1 -0
- package/conversation/conversation-title-stream.js +103 -0
- package/conversation/conversation-transfer/attachment-refs.d.ts +10 -2
- package/conversation/conversation-transfer/attachment-refs.d.ts.map +1 -1
- package/conversation/conversation-transfer/attachment-refs.js +31 -9
- package/conversation/conversation-transfer/export-conversation.d.ts +5 -1
- package/conversation/conversation-transfer/export-conversation.d.ts.map +1 -1
- package/conversation/conversation-transfer/export-conversation.js +19 -18
- package/conversation/conversation-transfer/import-conversation.d.ts +11 -6
- package/conversation/conversation-transfer/import-conversation.d.ts.map +1 -1
- package/conversation/conversation-transfer/import-conversation.js +65 -69
- package/conversation/conversation-transfer/progress.js +1 -1
- package/conversation/conversation-transfer/zip-export.js +1 -7
- package/conversation/conversation-transfer/zip-import.js +1 -1
- package/conversation/create-chat-stream-api.d.ts +18 -3
- package/conversation/create-chat-stream-api.d.ts.map +1 -1
- package/conversation/create-chat-stream-api.js +67 -61
- package/conversation/generation-registry.d.ts +30 -0
- package/conversation/generation-registry.d.ts.map +1 -0
- package/conversation/generation-registry.js +33 -0
- package/conversation/message-utils.d.ts +6 -0
- package/conversation/message-utils.d.ts.map +1 -1
- package/conversation/message-utils.js +14 -10
- package/conversation/scheduled-task-grouping.d.ts +53 -0
- package/conversation/scheduled-task-grouping.d.ts.map +1 -0
- package/conversation/scheduled-task-grouping.js +45 -0
- package/conversation/useActiveConversationSync/useActiveConversationSync.d.ts +4 -2
- package/conversation/useActiveConversationSync/useActiveConversationSync.d.ts.map +1 -1
- package/conversation/useActiveConversationSync/useActiveConversationSync.js +19 -12
- package/conversation/useAttachmentUpload/useAttachmentUpload.d.ts.map +1 -1
- package/conversation/useAttachmentUpload/useAttachmentUpload.js +4 -1
- package/conversation/useConversationComposerDraft/useConversationComposerDraft.js +1 -5
- package/conversation/useConversationDiscovery/useConversationDiscovery.d.ts +22 -0
- package/conversation/useConversationDiscovery/useConversationDiscovery.d.ts.map +1 -0
- package/conversation/useConversationDiscovery/useConversationDiscovery.js +60 -0
- package/conversation/useConversationExport/useConversationExport.d.ts.map +1 -1
- package/conversation/useConversationExport/useConversationExport.js +113 -122
- package/conversation/useConversationHandlers/message-utils.js +2 -2
- package/conversation/useConversationHandlers/useConversationHandlers.js +41 -41
- package/conversation/useConversationImport/useConversationImport.js +24 -24
- package/conversation/useConversationPanelItems/useConversationPanelItems.d.ts +18 -5
- package/conversation/useConversationPanelItems/useConversationPanelItems.d.ts.map +1 -1
- package/conversation/useConversationPanelItems/useConversationPanelItems.js +34 -30
- package/conversation/useConversationScroll/useConversationScroll.d.ts.map +1 -1
- package/conversation/useConversationScroll/useConversationScroll.js +69 -72
- package/conversation/useConversationStream/conversation-path.js +2 -2
- package/conversation/useConversationStream/conversation-stream.types.d.ts +142 -0
- package/conversation/useConversationStream/conversation-stream.types.d.ts.map +1 -0
- package/conversation/useConversationStream/frame-scheduler.js +17 -17
- package/conversation/useConversationStream/generation-resume.d.ts +24 -2
- package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
- package/conversation/useConversationStream/generation-resume.js +110 -121
- package/conversation/useConversationStream/stream-errors.d.ts +10 -0
- package/conversation/useConversationStream/stream-errors.d.ts.map +1 -0
- package/conversation/useConversationStream/stream-errors.js +10 -0
- package/conversation/useConversationStream/stream-session.d.ts +51 -0
- package/conversation/useConversationStream/stream-session.d.ts.map +1 -0
- package/conversation/useConversationStream/stream-session.js +179 -0
- package/conversation/useConversationStream/useConversationReloadErrors.d.ts +25 -0
- package/conversation/useConversationStream/useConversationReloadErrors.d.ts.map +1 -0
- package/conversation/useConversationStream/useConversationReloadErrors.js +38 -0
- package/conversation/useConversationStream/useConversationStream.d.ts +3 -136
- package/conversation/useConversationStream/useConversationStream.d.ts.map +1 -1
- package/conversation/useConversationStream/useConversationStream.js +141 -339
- package/conversation/useConversationStream/useStopGeneration.d.ts +29 -0
- package/conversation/useConversationStream/useStopGeneration.d.ts.map +1 -0
- package/conversation/useConversationStream/useStopGeneration.js +48 -0
- package/conversation/useConversationStream/useStreamPathState.d.ts +39 -0
- package/conversation/useConversationStream/useStreamPathState.d.ts.map +1 -0
- package/conversation/useConversationStream/useStreamPathState.js +55 -0
- package/conversation/useConversationTitleEnrichmentController.d.ts +64 -0
- package/conversation/useConversationTitleEnrichmentController.d.ts.map +1 -0
- package/conversation/useConversationTitleEnrichmentController.js +155 -0
- package/conversation/useDeploymentChangeTracking.d.ts +14 -0
- package/conversation/useDeploymentChangeTracking.d.ts.map +1 -0
- package/conversation/useDeploymentChangeTracking.js +23 -0
- package/conversation/useEntityPreselection/useEntityPreselection.d.ts +108 -0
- package/conversation/useEntityPreselection/useEntityPreselection.d.ts.map +1 -0
- package/conversation/useEntityPreselection/useEntityPreselection.js +78 -0
- package/conversation/useMessageSelectionReply/useMessageSelectionReply.js +4 -10
- package/conversation/useTranscribeAudio/useTranscribeAudio.d.ts +8 -1
- package/conversation/useTranscribeAudio/useTranscribeAudio.d.ts.map +1 -1
- package/conversation/useTranscribeAudio/useTranscribeAudio.js +23 -17
- package/conversation/useVisibleConversationIdsReporter/useVisibleConversationIdsReporter.d.ts +16 -0
- package/conversation/useVisibleConversationIdsReporter/useVisibleConversationIdsReporter.d.ts.map +1 -0
- package/conversation/useVisibleConversationIdsReporter/useVisibleConversationIdsReporter.js +17 -0
- package/conversation-overlay.js +1 -2
- package/conversation-sources/stage-citations.d.ts +9 -0
- package/conversation-sources/stage-citations.d.ts.map +1 -0
- package/conversation-sources/stage-citations.js +8 -0
- package/conversation-sources/useConversationAnnotationPool/useConversationAnnotationPool.d.ts +4 -0
- package/conversation-sources/useConversationAnnotationPool/useConversationAnnotationPool.d.ts.map +1 -0
- package/conversation-sources/useConversationAnnotationPool/useConversationAnnotationPool.js +5 -0
- package/conversation-sources.js +3 -1
- package/conversation.js +45 -35
- package/entry-points/attachments.d.ts +1 -0
- package/entry-points/attachments.d.ts.map +1 -1
- package/entry-points/catalog.d.ts +17 -0
- package/entry-points/catalog.d.ts.map +1 -1
- package/entry-points/conversation-sources.d.ts +2 -0
- package/entry-points/conversation-sources.d.ts.map +1 -1
- package/entry-points/conversation.d.ts +10 -0
- package/entry-points/conversation.d.ts.map +1 -1
- package/entry-points/external-services.d.ts +6 -0
- package/entry-points/external-services.d.ts.map +1 -0
- package/entry-points/file-manager-canvas.d.ts +1 -0
- package/entry-points/file-manager-canvas.d.ts.map +1 -1
- package/entry-points/file-manager.d.ts +2 -0
- package/entry-points/file-manager.d.ts.map +1 -1
- package/entry-points/oauth.d.ts +1 -0
- package/entry-points/oauth.d.ts.map +1 -1
- package/entry-points/offline-credentials.d.ts +2 -0
- package/entry-points/offline-credentials.d.ts.map +1 -1
- package/entry-points/project.d.ts +20 -0
- package/entry-points/project.d.ts.map +1 -0
- package/entry-points/scheduled-tasks.d.ts +6 -0
- package/entry-points/scheduled-tasks.d.ts.map +1 -1
- package/entry-points/sharing.d.ts +4 -0
- package/entry-points/sharing.d.ts.map +1 -1
- package/entry-points/skill-editor.d.ts +2 -0
- package/entry-points/skill-editor.d.ts.map +1 -1
- package/entry-points/skills-state.d.ts +1 -0
- package/entry-points/skills-state.d.ts.map +1 -1
- package/entry-points/usage-limits.d.ts +1 -0
- package/entry-points/usage-limits.d.ts.map +1 -1
- package/entry-points/utils.d.ts +6 -0
- package/entry-points/utils.d.ts.map +1 -1
- package/entry-points/viewport-layout.d.ts +1 -0
- package/entry-points/viewport-layout.d.ts.map +1 -1
- package/external-services/useExternalServiceLogin.d.ts +99 -0
- package/external-services/useExternalServiceLogin.d.ts.map +1 -0
- package/external-services/useExternalServiceLogin.js +93 -0
- package/external-services.d.ts +2 -0
- package/external-services.js +5 -0
- package/file-manager-canvas.js +3 -2
- package/file-manager.js +32 -30
- package/files/attachment-canvas.d.ts +12 -0
- package/files/attachment-canvas.d.ts.map +1 -1
- package/files/attachment-canvas.js +18 -10
- package/files/attachment-dto-to-display.d.ts.map +1 -1
- package/files/attachment-dto-to-display.js +13 -12
- package/files/attachment-types.js +1 -1
- package/files/browser-download.d.ts +9 -0
- package/files/browser-download.d.ts.map +1 -0
- package/files/browser-download.js +23 -0
- package/files/create-files-api.d.ts +3 -4
- package/files/create-files-api.d.ts.map +1 -1
- package/files/create-files-api.js +1 -1
- package/files/create-upload-file-with-progress.d.ts +21 -1
- package/files/create-upload-file-with-progress.d.ts.map +1 -1
- package/files/create-upload-file-with-progress.js +50 -34
- package/files/dial-file-manager-copy-move.util.d.ts.map +1 -1
- package/files/dial-file-manager-copy-move.util.js +28 -28
- package/files/dial-file-manager-mapping.util.d.ts +6 -2
- package/files/dial-file-manager-mapping.util.d.ts.map +1 -1
- package/files/dial-file-manager-mapping.util.js +85 -72
- package/files/dial-file-manager.types.d.ts +15 -5
- package/files/dial-file-manager.types.d.ts.map +1 -1
- package/files/dial-file-to-attachment.js +3 -3
- package/files/dial-file.d.ts +19 -0
- package/files/dial-file.d.ts.map +1 -1
- package/files/dial-file.js +20 -12
- package/files/dial-files-api.d.ts +2 -2
- package/files/dial-files-api.d.ts.map +1 -1
- package/files/download-progress.d.ts +33 -0
- package/files/download-progress.d.ts.map +1 -0
- package/files/download-progress.js +28 -0
- package/files/source-content.js +1 -1
- package/files/useDialFileListing/useDialFileListing.js +51 -66
- package/files/useDialFileManager/useDialFileManager.d.ts.map +1 -1
- package/files/useDialFileManager/useDialFileManager.js +5 -2
- package/files/useDialFileManagerSections/useDialFileManagerSections.d.ts.map +1 -1
- package/files/useDialFileManagerSections/useDialFileManagerSections.js +59 -68
- package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +1 -1
- package/files/useDialFileMetadata/useDialFileMetadata.js +3 -3
- package/files/useDialFileMutations/useDialFileMutations.d.ts +9 -0
- package/files/useDialFileMutations/useDialFileMutations.d.ts.map +1 -1
- package/files/useDialFileMutations/useDialFileMutations.js +232 -159
- package/files/useDialFilePreview/useDialFilePreview.d.ts +33 -0
- package/files/useDialFilePreview/useDialFilePreview.d.ts.map +1 -0
- package/files/useDialFilePreview/useDialFilePreview.js +45 -0
- package/files/useDialFileUploadBatch/useDialFileUploadBatch.d.ts.map +1 -1
- package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +114 -103
- package/files/useFileAttachmentModalState/useFileAttachmentModalState.d.ts +25 -0
- package/files/useFileAttachmentModalState/useFileAttachmentModalState.d.ts.map +1 -0
- package/files/useFileAttachmentModalState/useFileAttachmentModalState.js +19 -0
- package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +2 -2
- package/files/useUnshareConfirmationState/useUnshareConfirmationState.d.ts +23 -0
- package/files/useUnshareConfirmationState/useUnshareConfirmationState.d.ts.map +1 -0
- package/files/useUnshareConfirmationState/useUnshareConfirmationState.js +18 -0
- package/index.d.ts +81 -0
- package/index.d.ts.map +1 -1
- package/index.js +244 -163
- package/mcp-apps/mcp-apps-api-client.d.ts.map +1 -1
- package/mcp-apps/mcp-apps-api-client.js +18 -17
- package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.d.ts +3 -2
- package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.d.ts.map +1 -1
- package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +28 -10
- package/mcp-apps/useMcpAppTools/useMcpAppTools.d.ts.map +1 -1
- package/mcp-apps/useMcpAppTools/useMcpAppTools.js +45 -45
- package/oauth/authorize-url.d.ts +7 -1
- package/oauth/authorize-url.d.ts.map +1 -1
- package/oauth/authorize-url.js +14 -4
- package/oauth/callback-exchange.d.ts +49 -0
- package/oauth/callback-exchange.d.ts.map +1 -0
- package/oauth/callback-exchange.js +29 -0
- package/oauth/handshake.js +3 -10
- package/oauth/models.d.ts +25 -0
- package/oauth/models.d.ts.map +1 -1
- package/oauth/toolset-id.d.ts +7 -0
- package/oauth/toolset-id.d.ts.map +1 -1
- package/oauth/toolset-id.js +9 -2
- package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.js +2 -5
- package/oauth/useToolsetLogin/useToolsetLogin.d.ts +7 -1
- package/oauth/useToolsetLogin/useToolsetLogin.d.ts.map +1 -1
- package/oauth/useToolsetLogin/useToolsetLogin.js +51 -42
- package/oauth.js +9 -8
- package/offline-credentials/map-offline-credentials-response.d.ts +5 -2
- package/offline-credentials/map-offline-credentials-response.d.ts.map +1 -1
- package/offline-credentials/map-offline-credentials-response.js +9 -7
- package/offline-credentials/scheduled-tasks-login-banner.d.ts +31 -0
- package/offline-credentials/scheduled-tasks-login-banner.d.ts.map +1 -0
- package/offline-credentials/scheduled-tasks-login-banner.js +17 -0
- package/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.d.ts +5 -1
- package/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.d.ts.map +1 -1
- package/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.js +25 -22
- package/offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin.js +13 -13
- package/offline-credentials.js +6 -4
- package/package.json +36 -26
- package/project/create-project-chat.d.ts +34 -0
- package/project/create-project-chat.d.ts.map +1 -0
- package/project/create-project-chat.js +27 -0
- package/project/project-conversation-data-source.d.ts +36 -0
- package/project/project-conversation-data-source.d.ts.map +1 -0
- package/project/project-conversation-data-source.js +67 -0
- package/project/project-events.d.ts +14 -0
- package/project/project-events.d.ts.map +1 -0
- package/project/project-events.js +25 -0
- package/project/project-file-preview.d.ts +32 -0
- package/project/project-file-preview.d.ts.map +1 -0
- package/project/project-file-preview.js +25 -0
- package/project/project-form-errors.d.ts +23 -0
- package/project/project-form-errors.d.ts.map +1 -0
- package/project/project-form-errors.js +46 -0
- package/project/project-limits.d.ts +17 -0
- package/project/project-limits.d.ts.map +1 -0
- package/project/project-limits.js +11 -0
- package/project/project-mapping.d.ts +16 -0
- package/project/project-mapping.d.ts.map +1 -0
- package/project/project-mapping.js +43 -0
- package/project/project-refresh.d.ts +12 -0
- package/project/project-refresh.d.ts.map +1 -0
- package/project/project-refresh.js +6 -0
- package/project/project-viewed-marks.d.ts +9 -0
- package/project/project-viewed-marks.d.ts.map +1 -0
- package/project/project-viewed-marks.js +8 -0
- package/project/project-watch-stream.d.ts +26 -0
- package/project/project-watch-stream.d.ts.map +1 -0
- package/project/project-watch-stream.js +39 -0
- package/project/projects-api-client.d.ts +179 -0
- package/project/projects-api-client.d.ts.map +1 -0
- package/project/projects-api-client.js +90 -0
- package/project/use-pinned-project-chats.d.ts +58 -0
- package/project/use-pinned-project-chats.d.ts.map +1 -0
- package/project/use-pinned-project-chats.js +269 -0
- package/project/use-project-actions.d.ts +53 -0
- package/project/use-project-actions.d.ts.map +1 -0
- package/project/use-project-actions.js +92 -0
- package/project/use-project-artifacts.d.ts +24 -0
- package/project/use-project-artifacts.d.ts.map +1 -0
- package/project/use-project-artifacts.js +78 -0
- package/project/use-project-conversations.d.ts +32 -0
- package/project/use-project-conversations.d.ts.map +1 -0
- package/project/use-project-conversations.js +200 -0
- package/project/use-project-draft.d.ts +46 -0
- package/project/use-project-draft.d.ts.map +1 -0
- package/project/use-project-draft.js +54 -0
- package/project/use-project-file-preview.d.ts +47 -0
- package/project/use-project-file-preview.d.ts.map +1 -0
- package/project/use-project-file-preview.js +50 -0
- package/project/use-project-submit.d.ts +49 -0
- package/project/use-project-submit.d.ts.map +1 -0
- package/project/use-project-submit.js +73 -0
- package/project/use-project-watch.d.ts +24 -0
- package/project/use-project-watch.d.ts.map +1 -0
- package/project/use-project-watch.js +41 -0
- package/project/use-project.d.ts +23 -0
- package/project/use-project.d.ts.map +1 -0
- package/project/use-project.js +73 -0
- package/project/use-projects.d.ts +27 -0
- package/project/use-projects.d.ts.map +1 -0
- package/project/use-projects.js +92 -0
- package/project.d.ts +2 -0
- package/project.js +20 -0
- package/prompt/prompt.d.ts +11 -0
- package/prompt/prompt.d.ts.map +1 -1
- package/prompt/prompt.js +7 -3
- package/scheduled-task/active-scheduled-task.d.ts +58 -0
- package/scheduled-task/active-scheduled-task.d.ts.map +1 -0
- package/scheduled-task/active-scheduled-task.js +18 -0
- package/scheduled-task/scheduled-task-description.d.ts +2 -0
- package/scheduled-task/scheduled-task-description.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-description.js +33 -24
- package/scheduled-task/scheduled-task-display.d.ts +106 -0
- package/scheduled-task/scheduled-task-display.d.ts.map +1 -0
- package/scheduled-task/scheduled-task-display.js +69 -0
- package/scheduled-task/scheduled-task-next-occurrence.d.ts +9 -0
- package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -0
- package/scheduled-task/scheduled-task-next-occurrence.js +20 -0
- package/scheduled-task/scheduled-task-preparation.d.ts +1 -1
- package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-trigger.js +75 -48
- package/scheduled-task/use-scheduled-task-runs.js +19 -31
- package/scheduled-task/use-scheduled-tasks.d.ts +2 -2
- package/scheduled-task/use-scheduled-tasks.js +1 -1
- package/scheduled-task/useActiveScheduledTaskDetails.d.ts +18 -0
- package/scheduled-task/useActiveScheduledTaskDetails.d.ts.map +1 -0
- package/scheduled-task/useActiveScheduledTaskDetails.js +40 -0
- package/scheduled-task/useScheduledTaskSkillDisplayNames/useScheduledTaskSkillDisplayNames.d.ts +17 -0
- package/scheduled-task/useScheduledTaskSkillDisplayNames/useScheduledTaskSkillDisplayNames.d.ts.map +1 -0
- package/scheduled-task/useScheduledTaskSkillDisplayNames/useScheduledTaskSkillDisplayNames.js +29 -0
- package/scheduled-task/useStartScheduledTask.d.ts +41 -0
- package/scheduled-task/useStartScheduledTask.d.ts.map +1 -0
- package/scheduled-task/useStartScheduledTask.js +169 -0
- package/scheduled-tasks.js +13 -7
- package/scroll-anchoring.js +1 -2
- package/share-invitation/models.d.ts +46 -0
- package/share-invitation/models.d.ts.map +1 -0
- package/share-invitation/share-invitation-error.d.ts +6 -0
- package/share-invitation/share-invitation-error.d.ts.map +1 -0
- package/share-invitation/share-invitation-error.js +37 -0
- package/share-invitation/types.d.ts +10 -0
- package/share-invitation/types.d.ts.map +1 -0
- package/share-invitation/types.js +6 -0
- package/share-invitation/useAcceptShareInvitation/useAcceptShareInvitation.d.ts +9 -0
- package/share-invitation/useAcceptShareInvitation/useAcceptShareInvitation.d.ts.map +1 -0
- package/share-invitation/useAcceptShareInvitation/useAcceptShareInvitation.js +26 -0
- package/shared/application-schema.js +3 -3
- package/shared/client-channel.d.ts +53 -0
- package/shared/client-channel.d.ts.map +1 -0
- package/shared/client-channel.js +6 -0
- package/shared/cron-day-of-month.js +10 -10
- package/shared/external-services.d.ts +1 -1
- package/shared/locale.d.ts +6 -2
- package/shared/locale.d.ts.map +1 -1
- package/shared/locale.js +4 -4
- package/shared/read-sse-events.d.ts +10 -0
- package/shared/read-sse-events.d.ts.map +1 -0
- package/shared/read-sse-events.js +33 -0
- package/shared/serialized-writer.d.ts +12 -0
- package/shared/serialized-writer.d.ts.map +1 -0
- package/shared/serialized-writer.js +44 -0
- package/shared/sleep.d.ts +3 -0
- package/shared/sleep.d.ts.map +1 -0
- package/shared/sleep.js +13 -0
- package/shared/theme-colors.d.ts +16 -0
- package/shared/theme-colors.d.ts.map +1 -0
- package/shared/theme-colors.js +14 -0
- package/shared/url-cleanup.d.ts +18 -0
- package/shared/url-cleanup.d.ts.map +1 -0
- package/shared/url-cleanup.js +18 -0
- package/shared/usage-stat.d.ts +3 -0
- package/shared/usage-stat.d.ts.map +1 -0
- package/shared/usage-stat.js +4 -0
- package/shared/useAppVersionCheck/useAppVersionCheck.d.ts +22 -0
- package/shared/useAppVersionCheck/useAppVersionCheck.d.ts.map +1 -0
- package/shared/useAppVersionCheck/useAppVersionCheck.js +36 -0
- package/shared/usePersistedState/usePersistedState.d.ts +28 -0
- package/shared/usePersistedState/usePersistedState.d.ts.map +1 -0
- package/shared/usePersistedState/usePersistedState.js +24 -0
- package/sharing.js +5 -2
- package/signin-interrupt/models.d.ts +48 -0
- package/signin-interrupt/models.d.ts.map +1 -0
- package/signin-interrupt/signin-row-info.d.ts +10 -0
- package/signin-interrupt/signin-row-info.d.ts.map +1 -0
- package/signin-interrupt/signin-row-info.js +21 -0
- package/signin-interrupt/types.d.ts +28 -0
- package/signin-interrupt/types.d.ts.map +1 -0
- package/signin-interrupt/types.js +10 -0
- package/signin-interrupt/useSigninInterrupt/useSigninInterrupt.d.ts +52 -0
- package/signin-interrupt/useSigninInterrupt/useSigninInterrupt.d.ts.map +1 -0
- package/signin-interrupt/useSigninInterrupt/useSigninInterrupt.js +270 -0
- package/skill/skill-file-batch-validation.d.ts +4 -0
- package/skill/skill-file-batch-validation.d.ts.map +1 -1
- package/skill/skill-file-batch-validation.js +34 -33
- package/skill/skill-lookup.d.ts +20 -0
- package/skill/skill-lookup.d.ts.map +1 -0
- package/skill/skill-lookup.js +12 -0
- package/skill/skill-types.js +1 -1
- package/skill/skill.d.ts +5 -1
- package/skill/skill.d.ts.map +1 -1
- package/skill/skill.js +27 -28
- package/skill/useSkillArchiveImport/useSkillArchiveImport.js +1 -7
- package/skill/useSkillEditorSubmit.d.ts +15 -1
- package/skill/useSkillEditorSubmit.d.ts.map +1 -1
- package/skill/useSkillEditorSubmit.js +164 -87
- package/skill/useSkillFileActions.d.ts +2 -0
- package/skill/useSkillFileActions.d.ts.map +1 -1
- package/skill/useSkillFileActions.js +36 -21
- package/skill-editor/useSkillFilePreviewSyncController.d.ts +41 -0
- package/skill-editor/useSkillFilePreviewSyncController.d.ts.map +1 -0
- package/skill-editor/useSkillFilePreviewSyncController.js +58 -0
- package/skill-editor/useSkillFileSystemPicker/useSkillFileSystemPicker.d.ts +23 -0
- package/skill-editor/useSkillFileSystemPicker/useSkillFileSystemPicker.d.ts.map +1 -0
- package/skill-editor/useSkillFileSystemPicker/useSkillFileSystemPicker.js +43 -0
- package/skill-editor.js +11 -9
- package/skills-state.js +3 -2
- package/source-content.js +1 -2
- package/usage/map-user-usage-to-model-limits.d.ts.map +1 -1
- package/usage/map-user-usage-to-model-limits.js +24 -24
- package/usage/usage-banner-source.d.ts +8 -7
- package/usage/usage-banner-source.d.ts.map +1 -1
- package/usage/usage-banner-source.js +46 -21
- package/usage/usage-gauge.d.ts +3 -0
- package/usage/usage-gauge.d.ts.map +1 -0
- package/usage/usage-gauge.js +4 -0
- package/usage/usage-reset-time.d.ts +12 -3
- package/usage/usage-reset-time.d.ts.map +1 -1
- package/usage/usage-reset-time.js +48 -38
- package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts +42 -18
- package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts.map +1 -1
- package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.js +23 -28
- package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts +10 -8
- package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts.map +1 -1
- package/usage/useUsageLimitBanner/useUsageLimitBanner.js +28 -25
- package/usage/useUsageLimitBannerDismissal/useUsageLimitBannerDismissal.js +1 -1
- package/usage-limits.js +10 -8
- package/useChatSettingsFormConfig/useChatSettingsFormConfig.d.ts +2 -0
- package/useChatSettingsFormConfig/useChatSettingsFormConfig.d.ts.map +1 -1
- package/useChatSettingsFormConfig/useChatSettingsFormConfig.js +25 -21
- package/usePageFileDrag/usePageFileDrag.js +3 -3
- package/useShareLink/useShareLink.js +18 -18
- package/utils.js +23 -17
- package/viewport-layout/canvas-width.d.ts +39 -0
- package/viewport-layout/canvas-width.d.ts.map +1 -0
- package/viewport-layout/canvas-width.js +23 -0
- package/viewport-layout.js +2 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { SendCompletionDtoModeEnum } from '@epam/ai-dial-chat-api-client';
|
|
2
|
+
import { Conversation, MessageCustomContent, StreamChunk } from '@epam/ai-dial-chat-shared';
|
|
3
|
+
import { Dispatch, MutableRefObject, SetStateAction } from 'react';
|
|
4
|
+
/** Options accepted by {@link ConversationStreamTransport.streamCompletion}. */
|
|
5
|
+
export interface StreamCompletionOptions {
|
|
6
|
+
onChunk: (chunk: StreamChunk) => void;
|
|
7
|
+
onComplete: () => void | Promise<void>;
|
|
8
|
+
onError: (error: Error) => void;
|
|
9
|
+
signal: AbortSignal;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Host-owned transport for the DIAL Core completion protocol. Implemented at
|
|
13
|
+
* the app edge — never hardcodes an `/api` path, CSRF handling, or a
|
|
14
|
+
* `server-api` import; the library only depends on this interface's shape.
|
|
15
|
+
*/
|
|
16
|
+
export interface ConversationStreamTransport {
|
|
17
|
+
/** Starts a completion; delivers chunks/completion/error through `options`, aborted via `options.signal`. */
|
|
18
|
+
streamCompletion(path: string, message: string | undefined, model: string, options: StreamCompletionOptions, customContent?: MessageCustomContent, generationId?: string, mode?: SendCompletionDtoModeEnum, messageIndex?: number, clientChannelId?: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Requests the backend stop an active generation. `content` is the answer text shown
|
|
21
|
+
* so far; the backend saves it for a generation whose text it does not hold.
|
|
22
|
+
*/
|
|
23
|
+
stopCompletion(params: {
|
|
24
|
+
generationId: string;
|
|
25
|
+
path: string;
|
|
26
|
+
content?: string;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
/** Opens a stream of resource-update events for `path`, until aborted via `signal`. */
|
|
29
|
+
watchConversation(path: string, signal: AbortSignal): Promise<ReadableStream<Uint8Array>>;
|
|
30
|
+
/**
|
|
31
|
+
* Attaches to an active generation's live replay: a `snapshot` event
|
|
32
|
+
* carrying the assistant message as assembled so far, then a `chunk` event
|
|
33
|
+
* per subsequent delta, then exactly one terminal event (`done`/`error`/
|
|
34
|
+
* `stopped`), until aborted via `signal`. Rejects when no active
|
|
35
|
+
* generation exists for `path` — including one that already finished —
|
|
36
|
+
* so the caller can fall back to `watchConversation`.
|
|
37
|
+
*/
|
|
38
|
+
attachToGeneration(path: string, signal: AbortSignal): Promise<ReadableStream<Uint8Array>>;
|
|
39
|
+
/** Reloads the persisted conversation by its full (bucket-qualified) id. */
|
|
40
|
+
getConversation(conversationId: string, signal?: AbortSignal): Promise<Conversation>;
|
|
41
|
+
/**
|
|
42
|
+
* Saves `conversation` at the bucket-stripped `path`, resolving with the saved
|
|
43
|
+
* conversation. Used only for the single recovery save after the backend's
|
|
44
|
+
* terminal save was rejected with `401`; without it that failure shows the
|
|
45
|
+
* persistence warning immediately.
|
|
46
|
+
*/
|
|
47
|
+
saveConversation?(path: string, conversation: Conversation): Promise<Conversation>;
|
|
48
|
+
}
|
|
49
|
+
/** Host-owned generation lifecycle, backing cross-navigation `AbortController` ownership. */
|
|
50
|
+
export interface ConversationGenerationLifecycle {
|
|
51
|
+
/** Starts (or replaces) tracking for a generation on `path`, returning its `AbortController`. */
|
|
52
|
+
startGeneration: (path: string, generationId: string) => AbortController;
|
|
53
|
+
/** Marks the generation identified by `path`/`generationId` complete, if it is still the active one. */
|
|
54
|
+
completeGeneration: (path: string, generationId: string) => void;
|
|
55
|
+
}
|
|
56
|
+
/** Optional host-owned client-channel connection, used to nudge tool-signin delivery. */
|
|
57
|
+
export interface ConversationStreamChannel {
|
|
58
|
+
channelId: string | null;
|
|
59
|
+
ensureConnected: () => void;
|
|
60
|
+
/** Resolves with a channel id, waiting for an in-flight subscribe if one isn't established yet, so a completion sent immediately after mount can still carry it. */
|
|
61
|
+
waitForChannel: (timeoutMs?: number) => Promise<string | null>;
|
|
62
|
+
/** Notifies the host that a generation just ended (completed or errored), so it can consider disconnecting an idle channel. */
|
|
63
|
+
notifyGenerationSettled?: () => void;
|
|
64
|
+
}
|
|
65
|
+
/** Optional host-owned overlay generation-lifecycle notifications. Each method is independently optional. */
|
|
66
|
+
export interface ConversationStreamOverlayNotifier {
|
|
67
|
+
notifyGenerationStart?: () => void;
|
|
68
|
+
notifyGenerationEnd?: () => void;
|
|
69
|
+
notifyStopGenerating?: () => void;
|
|
70
|
+
}
|
|
71
|
+
/** Shared mutable channel through which the displayed conversation's state is read/written. */
|
|
72
|
+
export interface ConversationStateAccessor {
|
|
73
|
+
setConversation: Dispatch<SetStateAction<Conversation | null>>;
|
|
74
|
+
conversationRef: MutableRefObject<Conversation | null>;
|
|
75
|
+
}
|
|
76
|
+
/** Parameters for {@link useConversationStream}. */
|
|
77
|
+
export interface UseConversationStreamParams {
|
|
78
|
+
conversationId: string | undefined;
|
|
79
|
+
state: ConversationStateAccessor;
|
|
80
|
+
transport: ConversationStreamTransport;
|
|
81
|
+
generation: ConversationGenerationLifecycle;
|
|
82
|
+
channel?: ConversationStreamChannel;
|
|
83
|
+
overlay?: ConversationStreamOverlayNotifier;
|
|
84
|
+
onStopError?: (error: Error) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Message shown on the message bubble when the backend rejects a completion
|
|
87
|
+
* because this conversation is already generating — the case a second
|
|
88
|
+
* browser tab of the same session hits. Defaults to
|
|
89
|
+
* {@link DEFAULT_GENERATION_CONFLICT_MESSAGE}.
|
|
90
|
+
*/
|
|
91
|
+
generationConflictMessage?: string;
|
|
92
|
+
/** Host-translated warning shown when the received answer could not be saved. */
|
|
93
|
+
generationPersistenceErrorMessage?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Host-translated text shown on an assistant message whose generation was lost: a reloaded
|
|
96
|
+
* chat whose stored copy still ends in the empty placeholder while attach finds nothing
|
|
97
|
+
* running. Defaults to {@link DEFAULT_GENERATION_INTERRUPTED_ERROR_MESSAGE}.
|
|
98
|
+
*/
|
|
99
|
+
generationInterruptedMessage?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Receives the original error of every failed stream. The hook shows only
|
|
102
|
+
* host-supplied or upstream-supplied text on the message bubble and hides
|
|
103
|
+
* transport detail (e.g. `Failed to fetch`), so this is where the host can
|
|
104
|
+
* still log or report the raw error.
|
|
105
|
+
*/
|
|
106
|
+
onStreamError?: (error: Error) => void;
|
|
107
|
+
/**
|
|
108
|
+
* Coalesces the displayed chunk updates into one `setConversation` per
|
|
109
|
+
* animation frame. Chunks still reach the per-path buffer immediately, and
|
|
110
|
+
* any pending update is flushed before completion, error, stop, or a
|
|
111
|
+
* superseding generation. Defaults to `false` (one update per chunk).
|
|
112
|
+
*/
|
|
113
|
+
batchChunksPerFrame?: boolean;
|
|
114
|
+
}
|
|
115
|
+
/** Per-start options of {@link UseConversationStreamResult.startStream}. */
|
|
116
|
+
export interface StartStreamOptions {
|
|
117
|
+
/**
|
|
118
|
+
* Treats a `GenerationConflictError` as "this turn is already being
|
|
119
|
+
* generated" — e.g. a page reloaded before that generation saved its start
|
|
120
|
+
* state — and joins the running generation instead of showing the conflict
|
|
121
|
+
* message, which remains the fallback. Only for a start that sends no new
|
|
122
|
+
* user text; a send the user typed must keep reporting the conflict.
|
|
123
|
+
*/
|
|
124
|
+
resumeOnConflict?: boolean;
|
|
125
|
+
}
|
|
126
|
+
/** Return value of {@link useConversationStream}. */
|
|
127
|
+
export interface UseConversationStreamResult {
|
|
128
|
+
startStream: (conversationId: string, userContent: string, messageIndex: number, model: string, customContent?: MessageCustomContent, generationId?: string, mode?: SendCompletionDtoModeEnum, options?: StartStreamOptions) => void;
|
|
129
|
+
handleStop: () => void;
|
|
130
|
+
resumeIfAwaitingGeneration: (currentConversationId: string, conversation: Conversation) => void;
|
|
131
|
+
/** Restores the accumulated live assistant message when its conversation is loaded again before completion. */
|
|
132
|
+
restoreBufferedGeneration: (currentConversationId: string, conversation: Conversation) => Conversation;
|
|
133
|
+
isStreaming: boolean;
|
|
134
|
+
canStopStreaming: boolean;
|
|
135
|
+
/** Whether the displayed conversation's terminal read failed. */
|
|
136
|
+
hasConversationReloadError: boolean;
|
|
137
|
+
/** Whether a retry of that read is in flight. */
|
|
138
|
+
isReloadingConversation: boolean;
|
|
139
|
+
/** Retries the failed read without saving or regenerating the answer. */
|
|
140
|
+
retryConversationReload: () => Promise<void>;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=conversation-stream.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-stream.types.d.ts","sourceRoot":"","sources":["../../../src/conversation/useConversationStream/conversation-stream.types.ts"],"names":[],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AY,EAAE,YAAY,KACvB,YAAY,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,iEAAiE;IACjE,0BAA0B,EAAE,OAAO,CAAC;IACpC,iDAAiD;IACjD,uBAAuB,EAAE,OAAO,CAAC;IACjC,yEAAyE;IACzE,uBAAuB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
//#region src/conversation/useConversationStream/frame-scheduler.ts
|
|
2
|
-
var e =
|
|
2
|
+
var e = (e) => {
|
|
3
3
|
if (typeof requestAnimationFrame == "function") {
|
|
4
|
-
let
|
|
5
|
-
return () => cancelAnimationFrame(
|
|
4
|
+
let t = requestAnimationFrame(e);
|
|
5
|
+
return () => cancelAnimationFrame(t);
|
|
6
6
|
}
|
|
7
|
-
let
|
|
8
|
-
return () => clearTimeout(
|
|
9
|
-
},
|
|
10
|
-
let
|
|
11
|
-
let n =
|
|
12
|
-
n && (
|
|
7
|
+
let t = setTimeout(e, 16);
|
|
8
|
+
return () => clearTimeout(t);
|
|
9
|
+
}, t = () => {
|
|
10
|
+
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
11
|
+
let n = t.get(e);
|
|
12
|
+
n && (t.delete(e), n.task());
|
|
13
13
|
};
|
|
14
14
|
return {
|
|
15
15
|
schedule: (r, i) => {
|
|
16
|
-
let a =
|
|
16
|
+
let a = t.get(r);
|
|
17
17
|
if (a) {
|
|
18
18
|
a.task = i;
|
|
19
19
|
return;
|
|
@@ -22,18 +22,18 @@ var e = 16, t = (t) => {
|
|
|
22
22
|
task: i,
|
|
23
23
|
cancelFrame: () => void 0
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
t.set(r, o), o.cancelFrame = e(() => n(r));
|
|
26
26
|
},
|
|
27
|
-
flush: (
|
|
28
|
-
|
|
27
|
+
flush: (e) => {
|
|
28
|
+
t.get(e)?.cancelFrame(), n(e);
|
|
29
29
|
},
|
|
30
|
-
cancel: (
|
|
31
|
-
|
|
30
|
+
cancel: (e) => {
|
|
31
|
+
t.get(e)?.cancelFrame(), t.delete(e);
|
|
32
32
|
},
|
|
33
33
|
cancelAll: () => {
|
|
34
|
-
|
|
34
|
+
t.forEach((e) => e.cancelFrame()), t.clear();
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
38
|
//#endregion
|
|
39
|
-
export {
|
|
39
|
+
export { t as createFrameScheduler };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Conversation, Message } from '@epam/ai-dial-chat-shared';
|
|
2
2
|
import { Dispatch, MutableRefObject, SetStateAction } from 'react';
|
|
3
3
|
import { BufferedGeneration } from './buffered-generation';
|
|
4
|
+
import { ConversationStreamTransport } from './conversation-stream.types';
|
|
4
5
|
import { FrameScheduler } from './frame-scheduler';
|
|
5
|
-
import { ConversationStreamTransport } from './useConversationStream';
|
|
6
6
|
/**
|
|
7
7
|
* True when the assistant message carries anything the backend's finalize save
|
|
8
8
|
* would have written. Text alone is not enough to tell a finished response from
|
|
@@ -42,6 +42,19 @@ export interface ResumeGenerationOptions {
|
|
|
42
42
|
onSettled?: () => void;
|
|
43
43
|
/** Resumes even though the path is already in `resumingPathsRef`, for a caller that reserved it itself. */
|
|
44
44
|
skipDedupe?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Takes the `generationId` the attach `snapshot` carries so Stop can reach a resumed
|
|
47
|
+
* non-background generation. Set only by the public entry point: stream recovery
|
|
48
|
+
* already knows its local id, and the conflict handover keeps Stop unavailable.
|
|
49
|
+
*/
|
|
50
|
+
trackAttachGenerationId?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Releases the chat and shows an unresolved placeholder as interrupted once nothing is
|
|
53
|
+
* producing the answer here (attach unavailable, stored copy still the placeholder). Set
|
|
54
|
+
* only by the public entry point: stream recovery and the conflict handover know a
|
|
55
|
+
* generation exists, so they keep their own behaviour.
|
|
56
|
+
*/
|
|
57
|
+
shouldMarkOrphanedAsInterrupted?: boolean;
|
|
45
58
|
}
|
|
46
59
|
/** Host-owned state {@link createResumeIfAwaitingGeneration} reads/writes through. */
|
|
47
60
|
export interface ResumeIfAwaitingGenerationDeps {
|
|
@@ -54,6 +67,8 @@ export interface ResumeIfAwaitingGenerationDeps {
|
|
|
54
67
|
removeStreamingPath: (path: string) => void;
|
|
55
68
|
isPathDisplayed: (path: string) => boolean;
|
|
56
69
|
generationPersistenceErrorMessage?: string;
|
|
70
|
+
/** Host-translated text shown on a placeholder nothing is producing. Defaults to {@link DEFAULT_GENERATION_INTERRUPTED_ERROR_MESSAGE}. */
|
|
71
|
+
generationInterruptedMessage?: string;
|
|
57
72
|
/** Records a terminal read failure and its guarded read-only retry. */
|
|
58
73
|
onReloadError?: (path: string, retry: () => Promise<void>, isCurrent: () => boolean) => void;
|
|
59
74
|
/** Clears a previous read failure after reconciliation. */
|
|
@@ -66,6 +81,13 @@ export interface ResumeIfAwaitingGenerationDeps {
|
|
|
66
81
|
* its id is removed when the resume settles.
|
|
67
82
|
*/
|
|
68
83
|
stoppedGenerationIdsRef?: MutableRefObject<Set<string>>;
|
|
84
|
+
/** Records the id an attach `snapshot` supplied for `path`, so the host can offer Stop for it. */
|
|
85
|
+
rememberResumedGenerationId?: (path: string, generationId: string) => void;
|
|
86
|
+
/**
|
|
87
|
+
* Drops that id again once the resume no longer owns an attached generation. Compare-and-clear:
|
|
88
|
+
* the host removes the entry only while it still holds `generationId`.
|
|
89
|
+
*/
|
|
90
|
+
forgetResumedGenerationId?: (path: string, generationId: string) => void;
|
|
69
91
|
}
|
|
70
92
|
/**
|
|
71
93
|
* Builds `resumeIfAwaitingGeneration`: a hard refresh mid-generation loads a
|
|
@@ -81,5 +103,5 @@ export interface ResumeIfAwaitingGenerationDeps {
|
|
|
81
103
|
* backend's finalize save resolves the placeholder whenever attach is
|
|
82
104
|
* unavailable or ends without a terminal event.
|
|
83
105
|
*/
|
|
84
|
-
export declare const createResumeIfAwaitingGeneration: ({ transport, setConversation, conversationRef, resumingPathsRef, bufferedGenerationsRef, addStreamingPath, removeStreamingPath, isPathDisplayed, generationPersistenceErrorMessage, frameScheduler, stoppedGenerationIdsRef, onReloadError, onReloadSuccess, }: ResumeIfAwaitingGenerationDeps) => (currentConversationId: string, conversation: Conversation, options?: ResumeGenerationOptions) => void;
|
|
106
|
+
export declare const createResumeIfAwaitingGeneration: ({ transport, setConversation, conversationRef, resumingPathsRef, bufferedGenerationsRef, addStreamingPath, removeStreamingPath, isPathDisplayed, generationPersistenceErrorMessage, generationInterruptedMessage, frameScheduler, stoppedGenerationIdsRef, rememberResumedGenerationId, forgetResumedGenerationId, onReloadError, onReloadSuccess, }: ResumeIfAwaitingGenerationDeps) => (currentConversationId: string, conversation: Conversation, options?: ResumeGenerationOptions) => void;
|
|
85
107
|
//# sourceMappingURL=generation-resume.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generation-resume.d.ts","sourceRoot":"","sources":["../../../src/conversation/useConversationStream/generation-resume.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,OAAO,EAEb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"generation-resume.d.ts","sourceRoot":"","sources":["../../../src/conversation/useConversationStream/generation-resume.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,OAAO,EAEb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AASxE,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,KAAK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EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,mBAAmB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAC3C,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAC3C,0IAA0I;IAC1I,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,uEAAuE;IACvE,aAAa,CAAC,EAAE,CACd,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAC1B,SAAS,EAAE,MAAM,OAAO,KACrB,IAAI,CAAC;IACV,2DAA2D;IAC3D,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,iFAAiF;IACjF,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACxD,kGAAkG;IAClG,2BAA2B,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3E;;;OAGG;IACH,yBAAyB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1E;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gCAAgC,GAAI,sVAiB9C,8BAA8B,MAE7B,uBAAuB,MAAM,EAC7B,cAAc,YAAY,EAC1B,UAAS,uBAA4B,KACpC,IAyVJ,CAAC"}
|
|
@@ -1,184 +1,173 @@
|
|
|
1
1
|
import { safeDecodeURI as e } from "../../shared/string-utils.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { DEFAULT_GENERATION_INTERRUPTED_ERROR_MESSAGE as t, DEFAULT_GENERATION_PERSISTENCE_ERROR_MESSAGE as n, GenerationPersistenceError as r } from "../create-chat-stream-api.js";
|
|
3
|
+
import { readSseEvents as i } from "../../shared/read-sse-events.js";
|
|
4
|
+
import { getConversationPath as a } from "./conversation-path.js";
|
|
5
|
+
import { applyChunkToMessages as o } from "./apply-chunk.js";
|
|
6
|
+
import { restoreBufferedMessage as s } from "./buffered-generation.js";
|
|
7
|
+
import { BackgroundGenerationStatus as c, MessageRole as l } from "@epam/ai-dial-chat-shared";
|
|
7
8
|
//#region src/conversation/useConversationStream/generation-resume.ts
|
|
8
|
-
var
|
|
9
|
+
var u = (e) => {
|
|
9
10
|
let t = e.custom_content;
|
|
10
11
|
return !!e.content || e.responseId != null || !!t?.attachments?.length || !!t?.stages?.length || !!t?.annotations?.length || !!t?.form_schema || t?.state != null;
|
|
11
|
-
},
|
|
12
|
-
if (
|
|
12
|
+
}, d = (e) => e.messages.findIndex((e) => e.backgroundGeneration?.status === c.Pending), f = (e) => {
|
|
13
|
+
if (d(e) !== -1) return !0;
|
|
13
14
|
let t = e.messages[e.messages.length - 1];
|
|
14
|
-
return !!t && t.role ===
|
|
15
|
-
},
|
|
15
|
+
return !!t && t.role === l.Assistant && !u(t) && t.streamErrorMessage == null && !t.wasStoppedByUser;
|
|
16
|
+
}, p = 3e5, m = "awaiting-resume", h = [
|
|
16
17
|
1e3,
|
|
17
18
|
2e3,
|
|
18
19
|
4e3,
|
|
19
20
|
8e3,
|
|
20
21
|
16e3
|
|
21
|
-
],
|
|
22
|
+
], g = (e) => new Promise((t) => {
|
|
22
23
|
let n = typeof window < "u", r = () => {
|
|
23
24
|
clearTimeout(i), n && window.removeEventListener("online", r), t();
|
|
24
25
|
}, i = setTimeout(r, e);
|
|
25
26
|
n && window.addEventListener("online", r);
|
|
26
|
-
}),
|
|
27
|
-
for (let r = 0; r <=
|
|
27
|
+
}), _ = async (e, t, n) => {
|
|
28
|
+
for (let r = 0; r <= h.length; r++) {
|
|
28
29
|
if (t()) return null;
|
|
29
30
|
try {
|
|
30
31
|
let t = await e();
|
|
31
32
|
if (!n?.(t)) return t;
|
|
32
33
|
} catch {}
|
|
33
|
-
if (r ===
|
|
34
|
-
await
|
|
34
|
+
if (r === h.length) return null;
|
|
35
|
+
await g(h[r]);
|
|
35
36
|
}
|
|
36
37
|
return null;
|
|
37
|
-
}, g =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
for (;;) {
|
|
41
|
-
let { done: e, value: a } = await n.read();
|
|
42
|
-
if (e) break;
|
|
43
|
-
i += r.decode(a, { stream: !0 });
|
|
44
|
-
let o = i.split("\n");
|
|
45
|
-
i = o.pop() ?? "";
|
|
46
|
-
let s = !1;
|
|
47
|
-
for (let e of o) {
|
|
48
|
-
let n = e.trim();
|
|
49
|
-
if (!n.startsWith("data:")) continue;
|
|
50
|
-
let r = n.slice(5).trim(), i;
|
|
51
|
-
try {
|
|
52
|
-
i = JSON.parse(r);
|
|
53
|
-
} catch {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
if (await t(i)) {
|
|
57
|
-
s = !0;
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (s) break;
|
|
62
|
-
}
|
|
63
|
-
} catch {} finally {
|
|
64
|
-
n.releaseLock();
|
|
65
|
-
}
|
|
66
|
-
}, _ = ({ transport: o, setConversation: s, conversationRef: p, resumingPathsRef: m, bufferedGenerationsRef: h, addStreamingPath: _, removeStreamingPath: v, isPathDisplayed: y, generationPersistenceErrorMessage: b = t, frameScheduler: x, stoppedGenerationIdsRef: S, onReloadError: C, onReloadSuccess: w }) => (t, T, E = {}) => {
|
|
67
|
-
if (!u(T)) {
|
|
68
|
-
E.onSettled?.();
|
|
38
|
+
}, v = ({ transport: c, setConversation: l, conversationRef: h, resumingPathsRef: g, bufferedGenerationsRef: _, addStreamingPath: v, removeStreamingPath: y, isPathDisplayed: b, generationPersistenceErrorMessage: x = n, generationInterruptedMessage: S = t, frameScheduler: C, stoppedGenerationIdsRef: w, rememberResumedGenerationId: T, forgetResumedGenerationId: E, onReloadError: D, onReloadSuccess: O }) => (t, n, k = {}) => {
|
|
39
|
+
if (!f(n)) {
|
|
40
|
+
k.onSettled?.();
|
|
69
41
|
return;
|
|
70
42
|
}
|
|
71
|
-
let
|
|
72
|
-
if (!
|
|
73
|
-
|
|
74
|
-
let
|
|
75
|
-
generationId:
|
|
76
|
-
messageIndex:
|
|
77
|
-
message:
|
|
43
|
+
let A = a(t);
|
|
44
|
+
if (!k.skipDedupe && g.current.has(A)) return;
|
|
45
|
+
g.current.add(A), v(A);
|
|
46
|
+
let j = d(n), M = j !== -1, N = M ? j : n.messages.length - 1, P = {
|
|
47
|
+
generationId: m,
|
|
48
|
+
messageIndex: N,
|
|
49
|
+
message: k.seedMessage ?? n.messages[N]
|
|
78
50
|
};
|
|
79
|
-
|
|
80
|
-
let
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
51
|
+
_.current.set(A, P);
|
|
52
|
+
let F = () => _.current.get(A) === P, I = M ? n.messages[N].backgroundGeneration?.generationId : void 0, L, R = () => {
|
|
53
|
+
let e = I ?? L;
|
|
54
|
+
return e != null && (w?.current.has(e) ?? !1);
|
|
55
|
+
}, z = (e) => {
|
|
56
|
+
k.trackAttachGenerationId && !M && e != null && F() && (L = e, T?.(A, e));
|
|
57
|
+
}, B = () => {
|
|
58
|
+
if (L == null) return;
|
|
59
|
+
let e = L;
|
|
60
|
+
L = void 0, w?.current.delete(e), E?.(A, e);
|
|
61
|
+
}, V = (e) => !!k.shouldMarkOrphanedAsInterrupted && !M && !!e && e.messages.length - 1 === N && d(e) === -1 && f(e) && !u(P.message), H = () => {
|
|
62
|
+
P.message = {
|
|
63
|
+
...P.message,
|
|
64
|
+
streamErrorMessage: S
|
|
65
|
+
};
|
|
66
|
+
}, U = () => {
|
|
67
|
+
F() && (H(), g.current.delete(A), y(A), B(), b(A) && l((e) => {
|
|
68
|
+
if (!e || !F() || !b(A)) return e;
|
|
69
|
+
let t = s(e, P);
|
|
70
|
+
return h.current = t, t;
|
|
71
|
+
}));
|
|
72
|
+
}, W = (e, t = !1) => {
|
|
73
|
+
if (C?.flush(A), I != null && w?.current.delete(I), B(), !F()) return;
|
|
74
|
+
g.current.delete(A), y(A);
|
|
75
|
+
let n = !M && e && e.messages.length - 1 === N && f(e) && u(P.message);
|
|
76
|
+
if (t || n) P.message = {
|
|
77
|
+
...P.message,
|
|
78
|
+
streamErrorMessage: x
|
|
79
|
+
}, b(A) && l((e) => {
|
|
80
|
+
if (!e || !F() || !b(A)) return e;
|
|
81
|
+
let t = s(e, P);
|
|
82
|
+
return h.current = t, t;
|
|
83
|
+
});
|
|
84
|
+
else if (_.current.delete(A), e && b(A)) {
|
|
85
|
+
let t = V(e);
|
|
86
|
+
t && H();
|
|
87
|
+
let n = t ? s(e, P) : e;
|
|
88
|
+
l(n), h.current = n;
|
|
94
89
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
w?.(D), F(n);
|
|
90
|
+
}, G = async () => {
|
|
91
|
+
if (F()) try {
|
|
92
|
+
let n = await c.getConversation(e(t));
|
|
93
|
+
if (!F()) return;
|
|
94
|
+
O?.(A), W(n);
|
|
101
95
|
} catch {
|
|
102
|
-
if (!
|
|
103
|
-
|
|
96
|
+
if (!F()) return;
|
|
97
|
+
C?.flush(A), g.current.delete(A), y(A), I != null && w?.current.delete(I), B(), D?.(A, G, F);
|
|
104
98
|
}
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
if (!e || !
|
|
108
|
-
let t =
|
|
109
|
-
return
|
|
99
|
+
}, K = (e) => {
|
|
100
|
+
C?.cancel(A), F() && (P.message = e, b(A) && l((e) => {
|
|
101
|
+
if (!e || !F() || !b(A)) return e;
|
|
102
|
+
let t = s(e, P);
|
|
103
|
+
return h.current = t, t;
|
|
110
104
|
}));
|
|
111
|
-
},
|
|
112
|
-
if (!e || !
|
|
113
|
-
let t =
|
|
114
|
-
return
|
|
115
|
-
}),
|
|
116
|
-
if (!
|
|
117
|
-
let t =
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
x.schedule(D, R);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
R();
|
|
124
|
-
}
|
|
125
|
-
}, B = async () => {
|
|
105
|
+
}, q = () => l((e) => {
|
|
106
|
+
if (!e || !F() || !b(A)) return e;
|
|
107
|
+
let t = s(e, P);
|
|
108
|
+
return h.current = t, t;
|
|
109
|
+
}), J = (e) => {
|
|
110
|
+
if (!F() || R()) return;
|
|
111
|
+
let t = o([P.message], 0, e);
|
|
112
|
+
t && (P.message = t[0]), b(A) && (C ? C.schedule(A, q) : q());
|
|
113
|
+
}, Y = async () => {
|
|
126
114
|
let n = new AbortController(), r;
|
|
127
115
|
try {
|
|
128
|
-
r = await
|
|
116
|
+
r = await c.watchConversation(A, n.signal);
|
|
129
117
|
} catch {
|
|
130
|
-
await
|
|
118
|
+
await G();
|
|
131
119
|
return;
|
|
132
120
|
}
|
|
133
121
|
try {
|
|
134
|
-
let i = await
|
|
135
|
-
if (!
|
|
136
|
-
n.abort(), r.cancel().catch(() => void 0),
|
|
122
|
+
let i = await c.getConversation(e(t));
|
|
123
|
+
if (!f(i)) {
|
|
124
|
+
n.abort(), r.cancel().catch(() => void 0), W(i);
|
|
137
125
|
return;
|
|
138
126
|
}
|
|
127
|
+
V(i) && U();
|
|
139
128
|
} catch {}
|
|
140
|
-
let
|
|
129
|
+
let a = !1, o = window.setTimeout(() => {
|
|
141
130
|
n.abort();
|
|
142
|
-
},
|
|
131
|
+
}, p);
|
|
143
132
|
try {
|
|
144
|
-
await
|
|
133
|
+
await i(r, async (n) => {
|
|
145
134
|
if (n?.action !== "UPDATE") return !1;
|
|
146
135
|
try {
|
|
147
|
-
let n = await
|
|
148
|
-
if (!
|
|
136
|
+
let n = await c.getConversation(e(t));
|
|
137
|
+
if (!f(n)) return W(n), a = !0, !0;
|
|
149
138
|
} catch {}
|
|
150
139
|
return !1;
|
|
151
140
|
});
|
|
152
141
|
} finally {
|
|
153
|
-
clearTimeout(
|
|
142
|
+
clearTimeout(o);
|
|
154
143
|
}
|
|
155
|
-
|
|
156
|
-
},
|
|
144
|
+
a || await G();
|
|
145
|
+
}, X = async () => {
|
|
157
146
|
let e = new AbortController(), t;
|
|
158
147
|
try {
|
|
159
|
-
t = await
|
|
148
|
+
t = await c.attachToGeneration(A, e.signal);
|
|
160
149
|
} catch {
|
|
161
150
|
return !1;
|
|
162
151
|
}
|
|
163
|
-
let
|
|
164
|
-
return await
|
|
165
|
-
if (!
|
|
152
|
+
let n = !1, a = !1;
|
|
153
|
+
return await i(t, (e) => {
|
|
154
|
+
if (!F()) return !0;
|
|
166
155
|
switch (e.type) {
|
|
167
|
-
case "snapshot": return
|
|
168
|
-
case "chunk": return
|
|
156
|
+
case "snapshot": return z(e.generationId), K(e.message), !1;
|
|
157
|
+
case "chunk": return J(e.chunk), !1;
|
|
169
158
|
case "done":
|
|
170
159
|
case "error":
|
|
171
|
-
case "stopped": return
|
|
160
|
+
case "stopped": return a = e.type === "error" && e.errorType === r.type, n = !0, !0;
|
|
172
161
|
}
|
|
173
|
-
}),
|
|
162
|
+
}), n ? (a ? W(void 0, !0) : await G(), !0) : (B(), !F());
|
|
174
163
|
};
|
|
175
164
|
(async () => {
|
|
176
165
|
try {
|
|
177
|
-
await
|
|
166
|
+
await X() || await Y();
|
|
178
167
|
} finally {
|
|
179
|
-
|
|
168
|
+
k.onSettled?.();
|
|
180
169
|
}
|
|
181
170
|
})();
|
|
182
171
|
};
|
|
183
172
|
//#endregion
|
|
184
|
-
export {
|
|
173
|
+
export { h as RECOVERY_REFETCH_DELAYS_MS, v as createResumeIfAwaitingGeneration, _ as fetchConversationForRecovery, d as findPendingBackgroundMessageIndex, u as hasGeneratedPayload, f as isAwaitingGenerationResume };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Conversation } from '@epam/ai-dial-chat-shared';
|
|
2
|
+
export declare const CHANNEL_WAIT_TIMEOUT_MS = 20000;
|
|
3
|
+
export declare const UNAUTHORIZED_STATUS = 401;
|
|
4
|
+
export declare const NOT_FOUND_STATUS = 404;
|
|
5
|
+
export declare const STOP_NOT_FOUND_GRACE_MS = 2000;
|
|
6
|
+
export declare const STOP_NOT_FOUND_POLL_MS = 100;
|
|
7
|
+
export declare const resolveStreamErrorMessage: (error: Error, generationConflictMessage: string, generationPersistenceErrorMessage: string) => string;
|
|
8
|
+
/** Generation id of the displayed conversation's pending background message, if any. */
|
|
9
|
+
export declare const findResumedBackgroundGenerationId: (conversation: Conversation | null) => string | undefined;
|
|
10
|
+
//# sourceMappingURL=stream-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-errors.d.ts","sourceRoot":"","sources":["../../../src/conversation/useConversationStream/stream-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAoB9D,eAAO,MAAM,uBAAuB,QAAQ,CAAC;AAG7C,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAKpC,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAC5C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAQ1C,eAAO,MAAM,yBAAyB,GACpC,OAAO,KAAK,EACZ,2BAA2B,MAAM,EACjC,mCAAmC,MAAM,KACxC,MAOF,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,iCAAiC,GAC5C,cAAc,YAAY,GAAG,IAAI,KAChC,MAAM,GAAG,SAMX,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GenerationConflictError as e, GenerationPersistenceError as t, StreamUpstreamError as n } from "../create-chat-stream-api.js";
|
|
2
|
+
import { findPendingBackgroundMessageIndex as r } from "./generation-resume.js";
|
|
3
|
+
//#region src/conversation/useConversationStream/stream-errors.ts
|
|
4
|
+
var i = 2e4, a = 2e3, o = (r, i, a) => r instanceof t ? a : r instanceof e ? i : r instanceof n ? r.message : "", s = (e) => {
|
|
5
|
+
if (!e) return;
|
|
6
|
+
let t = r(e);
|
|
7
|
+
return t === -1 ? void 0 : e.messages[t].backgroundGeneration?.generationId;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { i as CHANNEL_WAIT_TIMEOUT_MS, a as STOP_NOT_FOUND_GRACE_MS, s as findResumedBackgroundGenerationId, o as resolveStreamErrorMessage };
|