@epam/ai-dial-chat-hooks 1.3.0-dev.96 → 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 +24 -3
- package/conversation/create-chat-stream-api.d.ts.map +1 -1
- package/conversation/create-chat-stream-api.js +67 -56
- 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 -325
- 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
|
@@ -1,336 +1,152 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { DEFAULT_GENERATION_CONFLICT_MESSAGE as e, DEFAULT_GENERATION_INTERRUPTED_ERROR_MESSAGE as t, DEFAULT_GENERATION_PERSISTENCE_ERROR_MESSAGE as n } from "../create-chat-stream-api.js";
|
|
2
|
+
import { getConversationPath as r } from "./conversation-path.js";
|
|
3
|
+
import { restoreBufferedMessage as i } from "./buffered-generation.js";
|
|
4
|
+
import { createResumeIfAwaitingGeneration as a, isAwaitingGenerationResume as o } from "./generation-resume.js";
|
|
5
|
+
import { createFrameScheduler as s } from "./frame-scheduler.js";
|
|
6
|
+
import { findResumedBackgroundGenerationId as ee } from "./stream-errors.js";
|
|
7
|
+
import { runStreamSession as c } from "./stream-session.js";
|
|
8
|
+
import { useConversationReloadErrors as l } from "./useConversationReloadErrors.js";
|
|
9
|
+
import { useStopGeneration as te } from "./useStopGeneration.js";
|
|
10
|
+
import { useStreamPathState as ne } from "./useStreamPathState.js";
|
|
11
|
+
import { MessageRole as re } from "@epam/ai-dial-chat-shared";
|
|
12
|
+
import { useCallback as u, useEffect as d, useMemo as ie, useRef as f, useState as ae } from "react";
|
|
11
13
|
//#region src/conversation/useConversationStream/useConversationStream.ts
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}, [
|
|
21
|
-
let
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}, [D]);
|
|
25
|
-
let [k] = h(re), [A, j] = h(() => /* @__PURE__ */ new Set()), [M, N] = h(() => /* @__PURE__ */ new Set()), P = m(/* @__PURE__ */ new Map()), F = m(/* @__PURE__ */ new Set()), I = m(/* @__PURE__ */ new Map()), L = m(/* @__PURE__ */ new Set()), pe = m(/* @__PURE__ */ new Map()), R = m(!0), z = m(/* @__PURE__ */ new Map()), [B, V] = h(z.current), H = m(/* @__PURE__ */ new Set()), [me, U] = h(H.current);
|
|
26
|
-
p(() => (R.current = !0, () => {
|
|
27
|
-
R.current = !1;
|
|
14
|
+
var p = ({ conversationId: p, state: { setConversation: m, conversationRef: h }, transport: g, generation: { startGeneration: _, completeGeneration: v }, channel: y, overlay: b, onStopError: oe, generationConflictMessage: x = e, generationPersistenceErrorMessage: S = n, generationInterruptedMessage: C = t, onStreamError: w, batchChunksPerFrame: T = !1 }) => {
|
|
15
|
+
let E = f(w);
|
|
16
|
+
d(() => {
|
|
17
|
+
E.current = w;
|
|
18
|
+
}, [w]);
|
|
19
|
+
let D = f(T);
|
|
20
|
+
d(() => {
|
|
21
|
+
D.current = T;
|
|
22
|
+
}, [T]);
|
|
23
|
+
let [O] = ae(s), k = f(!0);
|
|
24
|
+
d(() => (k.current = !0, () => {
|
|
25
|
+
k.current = !1;
|
|
28
26
|
}), []);
|
|
29
|
-
let
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
W(e), j((t) => {
|
|
55
|
-
if (t.has(e)) return t;
|
|
56
|
-
let n = new Set(t);
|
|
57
|
-
return n.add(e), n;
|
|
58
|
-
});
|
|
59
|
-
}, [W]), Y = f((e) => {
|
|
60
|
-
j((t) => {
|
|
61
|
-
if (!t.has(e)) return t;
|
|
62
|
-
let n = new Set(t);
|
|
63
|
-
return n.delete(e), n;
|
|
64
|
-
});
|
|
65
|
-
}, []), X = f((e, t) => {
|
|
66
|
-
N((n) => {
|
|
67
|
-
if (n.has(e) === t) return n;
|
|
68
|
-
let r = new Set(n);
|
|
69
|
-
return t ? r.add(e) : r.delete(e), r;
|
|
70
|
-
});
|
|
71
|
-
}, []), Z = f((e, t) => {
|
|
72
|
-
P.current.get(e) === t && (P.current.delete(e), X(e, !1));
|
|
73
|
-
}, [X]), Q = oe(() => ee({
|
|
74
|
-
transport: b,
|
|
75
|
-
setConversation: v,
|
|
76
|
-
conversationRef: y,
|
|
77
|
-
resumingPathsRef: F,
|
|
78
|
-
bufferedGenerationsRef: I,
|
|
79
|
-
addStreamingPath: J,
|
|
80
|
-
removeStreamingPath: Y,
|
|
81
|
-
isPathDisplayed: q,
|
|
82
|
-
generationPersistenceErrorMessage: T,
|
|
83
|
-
frameScheduler: D ? k : void 0,
|
|
84
|
-
stoppedGenerationIdsRef: L,
|
|
85
|
-
onReloadError: G,
|
|
86
|
-
onReloadSuccess: W
|
|
27
|
+
let { reloadFailuresRef: A, reloadFailures: j, retrying: M, clearReloadError: N, reportReloadError: P, retryConversationReload: se } = l({
|
|
28
|
+
conversationId: p,
|
|
29
|
+
mountedRef: k
|
|
30
|
+
}), { streamingPaths: ce, streamingPathsRef: le, stoppablePaths: ue, activeGenerationIdsRef: F, resumedGenerationIdsRef: I, resumingPathsRef: L, bufferedGenerationsRef: R, stoppedGenerationIdsRef: z, stopRequestedIdsRef: B, latestGenerationIdsRef: V, isPathDisplayed: H, addStreamingPath: U, removeStreamingPath: W, setPathStoppable: G, releaseActiveGeneration: K, rememberResumedGenerationId: q, forgetResumedGenerationId: J } = ne({
|
|
31
|
+
conversationId: p,
|
|
32
|
+
frameScheduler: O,
|
|
33
|
+
mountedRef: k,
|
|
34
|
+
clearReloadError: N
|
|
35
|
+
}), Y = ie(() => a({
|
|
36
|
+
transport: g,
|
|
37
|
+
setConversation: m,
|
|
38
|
+
conversationRef: h,
|
|
39
|
+
resumingPathsRef: L,
|
|
40
|
+
bufferedGenerationsRef: R,
|
|
41
|
+
addStreamingPath: U,
|
|
42
|
+
removeStreamingPath: W,
|
|
43
|
+
isPathDisplayed: H,
|
|
44
|
+
generationPersistenceErrorMessage: S,
|
|
45
|
+
generationInterruptedMessage: C,
|
|
46
|
+
frameScheduler: T ? O : void 0,
|
|
47
|
+
stoppedGenerationIdsRef: z,
|
|
48
|
+
rememberResumedGenerationId: q,
|
|
49
|
+
forgetResumedGenerationId: J,
|
|
50
|
+
onReloadError: P,
|
|
51
|
+
onReloadSuccess: N
|
|
87
52
|
}), [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
D,
|
|
94
|
-
k,
|
|
95
|
-
G,
|
|
96
|
-
W
|
|
97
|
-
]), ge = f((t, n, o, ee, re, f, p = g.Append, oe = {}) => {
|
|
98
|
-
let m = f ?? ae(), h = s(t);
|
|
99
|
-
k.flush(h), F.current.delete(h), P.current.set(h, m), pe.current.set(h, m), X(h, !0);
|
|
100
|
-
let _;
|
|
101
|
-
p === g.Regenerate ? _ = o : p === g.Edit && (_ = o - 1);
|
|
102
|
-
let w = () => pe.current.get(h) !== m, E = ue(h, m), D = y.current?.messages[o];
|
|
103
|
-
D ? I.current.set(h, {
|
|
104
|
-
generationId: m,
|
|
105
|
-
messageIndex: o,
|
|
106
|
-
message: D
|
|
107
|
-
}) : I.current.delete(h), J(h), C?.notifyGenerationStart?.(), S?.ensureConnected();
|
|
108
|
-
let A = () => {
|
|
109
|
-
w() || Y(h), Z(h, m), x(h, m), S?.notifyGenerationSettled?.();
|
|
110
|
-
}, j = () => {
|
|
111
|
-
if (w()) return;
|
|
112
|
-
let e = I.current.get(h);
|
|
113
|
-
!e || e.generationId !== m || (e.message = {
|
|
114
|
-
...e.message,
|
|
115
|
-
streamErrorMessage: T
|
|
116
|
-
}, O.current?.(new i()), q(h) && v((t) => {
|
|
117
|
-
if (!t || w() || !q(h)) return t;
|
|
118
|
-
let n = l(t, e);
|
|
119
|
-
return y.current = n, n;
|
|
120
|
-
}));
|
|
121
|
-
}, M = I.current.get(h), N = () => R.current && !w() && I.current.get(h) === M, z = async () => {
|
|
122
|
-
if (N()) {
|
|
123
|
-
if (!q(h)) {
|
|
124
|
-
M && I.current.delete(h);
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
try {
|
|
128
|
-
let n = await b.getConversation(e(t));
|
|
129
|
-
if (!N()) return;
|
|
130
|
-
if (W(h), !q(h)) {
|
|
131
|
-
M && I.current.delete(h);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
if (u(n) !== -1) {
|
|
135
|
-
Q(t, n, { seedMessage: M?.message });
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (M && M.messageIndex === n.messages.length - 1 && d(n) && ne(M.message)) {
|
|
139
|
-
j();
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
M && I.current.delete(h), v(n), y.current = n;
|
|
143
|
-
} catch {
|
|
144
|
-
N() && G(h, z, N);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}, B = {
|
|
148
|
-
signal: E.signal,
|
|
149
|
-
onChunk: (e) => {
|
|
150
|
-
if (w()) return;
|
|
151
|
-
let t = I.current.get(h);
|
|
152
|
-
if (t?.generationId === m) {
|
|
153
|
-
let n = c([t.message], 0, e);
|
|
154
|
-
n && (t.message = n[0]);
|
|
155
|
-
}
|
|
156
|
-
if (q(h)) {
|
|
157
|
-
if (fe.current && t?.generationId === m) {
|
|
158
|
-
k.schedule(h, () => {
|
|
159
|
-
let e = I.current.get(h);
|
|
160
|
-
if (w() || !q(h) || e?.generationId !== m) return;
|
|
161
|
-
let t = { ...e };
|
|
162
|
-
v((e) => {
|
|
163
|
-
if (!e) return e;
|
|
164
|
-
let n = l(e, t);
|
|
165
|
-
return y.current = n, n;
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
v((t) => {
|
|
171
|
-
if (!t) return t;
|
|
172
|
-
let n = I.current.get(h), r;
|
|
173
|
-
if (n?.generationId === m) r = l(t, n);
|
|
174
|
-
else {
|
|
175
|
-
let n = c(t.messages, o, e);
|
|
176
|
-
if (!n) return t;
|
|
177
|
-
r = {
|
|
178
|
-
...t,
|
|
179
|
-
messages: n
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
return y.current = r, r;
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
onComplete: async () => {
|
|
187
|
-
k.flush(h), A(), L.current.has(m) ? L.current.delete(m) : w() || C?.notifyGenerationEnd?.(), await z();
|
|
188
|
-
},
|
|
189
|
-
onError: (e) => {
|
|
190
|
-
if (k.flush(h), O.current?.(e), e instanceof a && !w()) {
|
|
191
|
-
he(e);
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
if (e instanceof r && oe.resumeOnConflict && !w()) {
|
|
195
|
-
K(e);
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
V(e);
|
|
199
|
-
}
|
|
200
|
-
}, V = (e) => {
|
|
201
|
-
let t = I.current.get(h), n = t?.generationId === m ? t : void 0;
|
|
202
|
-
if (n && !(e instanceof i) && I.current.delete(h), A(), n && b.saveConversation && e instanceof i && e.status === ce) {
|
|
203
|
-
me(e, n, b.saveConversation.bind(b));
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
H(e, n);
|
|
207
|
-
}, H = (e, t) => {
|
|
208
|
-
if (t && e instanceof i && (t.message = {
|
|
209
|
-
...t.message,
|
|
210
|
-
streamErrorMessage: T
|
|
211
|
-
}), w() || !q(h)) return;
|
|
212
|
-
let n = le(e, de, T);
|
|
213
|
-
v((e) => {
|
|
214
|
-
if (!e || w() || !q(h)) return e;
|
|
215
|
-
let r = t?.generationId === m ? l(e, t) : e, i = {
|
|
216
|
-
...r,
|
|
217
|
-
messages: r.messages.map((e, t) => t === o ? {
|
|
218
|
-
...e,
|
|
219
|
-
streamErrorMessage: n
|
|
220
|
-
} : e)
|
|
221
|
-
};
|
|
222
|
-
return y.current = i, i;
|
|
223
|
-
});
|
|
224
|
-
}, me = async (n, r, i) => {
|
|
225
|
-
let a = () => R.current && !w() && I.current.get(h) === r;
|
|
226
|
-
try {
|
|
227
|
-
let o = await b.getConversation(e(t));
|
|
228
|
-
if (!a()) return;
|
|
229
|
-
if (r.messageIndex !== o.messages.length - 1 || !d(o)) {
|
|
230
|
-
H(n, r);
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
let s = await i(h, l(o, r));
|
|
234
|
-
if (!a() || (I.current.delete(h), !q(h))) return;
|
|
235
|
-
v(s), y.current = s;
|
|
236
|
-
} catch {
|
|
237
|
-
a() && H(n, r);
|
|
238
|
-
}
|
|
239
|
-
}, U = () => {
|
|
240
|
-
A(), L.current.has(m) ? L.current.delete(m) : w() || C?.notifyGenerationEnd?.();
|
|
241
|
-
}, he = async (n) => {
|
|
242
|
-
F.current.add(h), ge(await te(() => b.getConversation(e(t)), w), n, !1);
|
|
243
|
-
}, K = async (n) => {
|
|
244
|
-
P.current.get(h) === m && X(h, !1), F.current.add(h), ge(await te(() => b.getConversation(e(t)), w, (e) => e.messages.length === o && e.messages.at(-1)?.role === ie.User), n, !0);
|
|
245
|
-
}, ge = (e, n, r) => {
|
|
246
|
-
if (w()) {
|
|
247
|
-
A();
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
let i = e?.messages[e.messages.length - 1], a = e != null && e.messages.length - 1 === o && i?.role === ie.Assistant, s = r && e != null && u(e) !== -1;
|
|
251
|
-
if (!e || !a && !s) {
|
|
252
|
-
F.current.delete(h), V(n);
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
let c = I.current.get(h), l = c?.generationId === m ? c : void 0;
|
|
256
|
-
if (d(e)) {
|
|
257
|
-
Q(t, e, {
|
|
258
|
-
seedMessage: a ? l?.message : void 0,
|
|
259
|
-
skipDedupe: !0,
|
|
260
|
-
onSettled: U
|
|
261
|
-
});
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
F.current.delete(h), l && I.current.delete(h), q(h) && (v(e), y.current = e), U();
|
|
265
|
-
};
|
|
266
|
-
(async () => {
|
|
267
|
-
try {
|
|
268
|
-
let e = S?.channelId ?? await S?.waitForChannel(se) ?? void 0, t = L.current.has(m);
|
|
269
|
-
if (E.signal.aborted || w() || t) {
|
|
270
|
-
I.current.get(h)?.generationId === m && I.current.delete(h), w() || Y(h), Z(h, m), x(h, m), S?.notifyGenerationSettled?.(), t ? L.current.delete(m) : w() || C?.notifyGenerationEnd?.();
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
b.streamCompletion(h, n, ee, B, re, m, p, _, e);
|
|
274
|
-
} catch (e) {
|
|
275
|
-
B.onError(e instanceof Error ? e : Error(String(e)));
|
|
276
|
-
}
|
|
277
|
-
})();
|
|
278
|
-
}, [
|
|
279
|
-
ue,
|
|
280
|
-
x,
|
|
281
|
-
J,
|
|
282
|
-
Y,
|
|
283
|
-
X,
|
|
284
|
-
Z,
|
|
285
|
-
q,
|
|
286
|
-
S?.channelId,
|
|
287
|
-
S?.ensureConnected,
|
|
288
|
-
S?.waitForChannel,
|
|
289
|
-
S?.notifyGenerationSettled,
|
|
53
|
+
U,
|
|
54
|
+
W,
|
|
55
|
+
H,
|
|
56
|
+
g,
|
|
57
|
+
S,
|
|
290
58
|
C,
|
|
291
|
-
b,
|
|
292
|
-
Q,
|
|
293
|
-
de,
|
|
294
59
|
T,
|
|
295
|
-
|
|
60
|
+
O,
|
|
61
|
+
q,
|
|
62
|
+
J,
|
|
63
|
+
P,
|
|
64
|
+
N
|
|
65
|
+
]), de = u((e, t, n, r, i, a, o, s) => c({
|
|
66
|
+
transport: g,
|
|
67
|
+
channel: y,
|
|
68
|
+
overlay: b,
|
|
69
|
+
startGeneration: _,
|
|
70
|
+
completeGeneration: v,
|
|
71
|
+
setConversation: m,
|
|
72
|
+
conversationRef: h,
|
|
73
|
+
generationConflictMessage: x,
|
|
74
|
+
generationPersistenceErrorMessage: S,
|
|
75
|
+
onStreamErrorRef: E,
|
|
76
|
+
batchChunksPerFrameRef: D,
|
|
77
|
+
mountedRef: k,
|
|
78
|
+
frameScheduler: O,
|
|
79
|
+
resumeGeneration: Y,
|
|
80
|
+
activeGenerationIdsRef: F,
|
|
81
|
+
latestGenerationIdsRef: V,
|
|
82
|
+
resumingPathsRef: L,
|
|
83
|
+
bufferedGenerationsRef: R,
|
|
84
|
+
stoppedGenerationIdsRef: z,
|
|
85
|
+
addStreamingPath: U,
|
|
86
|
+
removeStreamingPath: W,
|
|
87
|
+
setPathStoppable: G,
|
|
88
|
+
releaseActiveGeneration: K,
|
|
89
|
+
isPathDisplayed: H,
|
|
90
|
+
reportReloadError: P,
|
|
91
|
+
clearReloadError: N
|
|
92
|
+
}, e, t, n, r, i, a, o, s), [
|
|
93
|
+
_,
|
|
94
|
+
v,
|
|
95
|
+
U,
|
|
96
|
+
W,
|
|
296
97
|
G,
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
});
|
|
98
|
+
K,
|
|
99
|
+
H,
|
|
100
|
+
y?.channelId,
|
|
101
|
+
y?.ensureConnected,
|
|
102
|
+
y?.waitForChannel,
|
|
103
|
+
y?.notifyGenerationSettled,
|
|
104
|
+
b,
|
|
105
|
+
g,
|
|
106
|
+
Y,
|
|
107
|
+
x,
|
|
108
|
+
S,
|
|
109
|
+
O,
|
|
110
|
+
P,
|
|
111
|
+
N
|
|
112
|
+
]), fe = u((e, t) => {
|
|
113
|
+
let n = r(e), a = R.current.get(n);
|
|
114
|
+
return A.current.get(n)?.isCurrent() && a && t.messages.length - 1 >= a.messageIndex && t.messages[a.messageIndex].role === re.Assistant && !o(t) ? (N(n), R.current.delete(n), t) : a ? i(t, a) : t;
|
|
315
115
|
}, [
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
116
|
+
R,
|
|
117
|
+
N,
|
|
118
|
+
A
|
|
119
|
+
]), pe = te({
|
|
120
|
+
conversationId: p,
|
|
121
|
+
conversationRef: h,
|
|
122
|
+
transport: g,
|
|
123
|
+
overlay: b,
|
|
124
|
+
onStopError: oe,
|
|
125
|
+
frameScheduler: O,
|
|
126
|
+
mountedRef: k,
|
|
127
|
+
activeGenerationIdsRef: F,
|
|
128
|
+
resumedGenerationIdsRef: I,
|
|
129
|
+
bufferedGenerationsRef: R,
|
|
130
|
+
stoppedGenerationIdsRef: z,
|
|
131
|
+
stopRequestedIdsRef: B,
|
|
132
|
+
streamingPathsRef: le
|
|
133
|
+
}), me = u((e, t) => {
|
|
134
|
+
F.current.has(r(e)) || Y(e, t, {
|
|
135
|
+
trackAttachGenerationId: !0,
|
|
136
|
+
shouldMarkOrphanedAsInterrupted: !0
|
|
137
|
+
});
|
|
138
|
+
}, [F, Y]), X = p != null && ce.has(r(p)), Z = p == null ? null : r(p), he = Z != null && (ue.has(Z) || X && ee(h.current) != null), Q = Z ? j.get(Z) : void 0, $ = Q?.isCurrent() ?? !1;
|
|
323
139
|
return {
|
|
324
|
-
hasConversationReloadError:
|
|
325
|
-
isReloadingConversation: !!
|
|
326
|
-
retryConversationReload:
|
|
327
|
-
startStream:
|
|
328
|
-
handleStop:
|
|
329
|
-
resumeIfAwaitingGeneration:
|
|
330
|
-
restoreBufferedGeneration:
|
|
331
|
-
isStreaming:
|
|
332
|
-
canStopStreaming:
|
|
140
|
+
hasConversationReloadError: $,
|
|
141
|
+
isReloadingConversation: !!Q && $ && M.has(Q),
|
|
142
|
+
retryConversationReload: se,
|
|
143
|
+
startStream: de,
|
|
144
|
+
handleStop: pe,
|
|
145
|
+
resumeIfAwaitingGeneration: me,
|
|
146
|
+
restoreBufferedGeneration: fe,
|
|
147
|
+
isStreaming: X,
|
|
148
|
+
canStopStreaming: he
|
|
333
149
|
};
|
|
334
150
|
};
|
|
335
151
|
//#endregion
|
|
336
|
-
export {
|
|
152
|
+
export { p as useConversationStream };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { ConversationStateAccessor, ConversationStreamOverlayNotifier, ConversationStreamTransport } from './conversation-stream.types';
|
|
3
|
+
import { FrameScheduler } from './frame-scheduler';
|
|
4
|
+
import { useStreamPathState } from './useStreamPathState';
|
|
5
|
+
type PathState = ReturnType<typeof useStreamPathState>;
|
|
6
|
+
interface UseStopGenerationParams {
|
|
7
|
+
conversationId: string | undefined;
|
|
8
|
+
conversationRef: ConversationStateAccessor['conversationRef'];
|
|
9
|
+
transport: ConversationStreamTransport;
|
|
10
|
+
overlay: ConversationStreamOverlayNotifier | undefined;
|
|
11
|
+
onStopError: ((error: Error) => void) | undefined;
|
|
12
|
+
frameScheduler: FrameScheduler;
|
|
13
|
+
mountedRef: MutableRefObject<boolean>;
|
|
14
|
+
activeGenerationIdsRef: PathState['activeGenerationIdsRef'];
|
|
15
|
+
resumedGenerationIdsRef: PathState['resumedGenerationIdsRef'];
|
|
16
|
+
bufferedGenerationsRef: PathState['bufferedGenerationsRef'];
|
|
17
|
+
stoppedGenerationIdsRef: PathState['stoppedGenerationIdsRef'];
|
|
18
|
+
stopRequestedIdsRef: PathState['stopRequestedIdsRef'];
|
|
19
|
+
streamingPathsRef: PathState['streamingPathsRef'];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Stop for the displayed conversation's generation: resolves its id (local,
|
|
23
|
+
* then a pending background generation, then a resumed one), flushes pending
|
|
24
|
+
* display writes, and asks the backend to stop it. A `404` within a short
|
|
25
|
+
* grace window is the generation ending on its own and is not reported.
|
|
26
|
+
*/
|
|
27
|
+
export declare const useStopGeneration: ({ conversationId, conversationRef, transport, overlay, onStopError, frameScheduler, mountedRef, activeGenerationIdsRef, resumedGenerationIdsRef, bufferedGenerationsRef, stoppedGenerationIdsRef, stopRequestedIdsRef, streamingPathsRef, }: UseStopGenerationParams) => () => void;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=useStopGeneration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStopGeneration.d.ts","sourceRoot":"","sources":["../../../src/conversation/useConversationStream/useStopGeneration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAe,MAAM,OAAO,CAAC;AAG3D,OAAO,KAAK,EACV,yBAAyB,EACzB,iCAAiC,EACjC,2BAA2B,EAC5B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEvD,UAAU,uBAAuB;IAC/B,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,eAAe,EAAE,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;IAC9D,SAAS,EAAE,2BAA2B,CAAC;IACvC,OAAO,EAAE,iCAAiC,GAAG,SAAS,CAAC;IACvD,WAAW,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAClD,cAAc,EAAE,cAAc,CAAC;IAE/B,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACtC,sBAAsB,EAAE,SAAS,CAAC,wBAAwB,CAAC,CAAC;IAC5D,uBAAuB,EAAE,SAAS,CAAC,yBAAyB,CAAC,CAAC;IAC9D,sBAAsB,EAAE,SAAS,CAAC,wBAAwB,CAAC,CAAC;IAC5D,uBAAuB,EAAE,SAAS,CAAC,yBAAyB,CAAC,CAAC;IAC9D,mBAAmB,EAAE,SAAS,CAAC,qBAAqB,CAAC,CAAC;IACtD,iBAAiB,EAAE,SAAS,CAAC,mBAAmB,CAAC,CAAC;CACnD;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,6OAc/B,uBAAuB,eAiFzB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { StopCompletionError as e } from "../create-chat-stream-api.js";
|
|
2
|
+
import { getConversationPath as t } from "./conversation-path.js";
|
|
3
|
+
import { STOP_NOT_FOUND_GRACE_MS as n, findResumedBackgroundGenerationId as r } from "./stream-errors.js";
|
|
4
|
+
import { useCallback as i } from "react";
|
|
5
|
+
//#region src/conversation/useConversationStream/useStopGeneration.ts
|
|
6
|
+
var a = ({ conversationId: a, conversationRef: o, transport: s, overlay: c, onStopError: l, frameScheduler: u, mountedRef: d, activeGenerationIdsRef: f, resumedGenerationIdsRef: p, bufferedGenerationsRef: m, stoppedGenerationIdsRef: h, stopRequestedIdsRef: g, streamingPathsRef: _ }) => i(() => {
|
|
7
|
+
if (!a) return;
|
|
8
|
+
let i = t(a), v = f.current.get(i), y = v ?? r(o.current) ?? p.current.get(i);
|
|
9
|
+
if (!y || g.current.has(y)) return;
|
|
10
|
+
g.current.add(y), h.current.add(y), u.flush(i), c?.notifyStopGenerating?.();
|
|
11
|
+
let b = m.current.get(i)?.message.content, x = () => f.current.get(i) === y || v == null && _.current.has(i), S = async () => {
|
|
12
|
+
let e = n / 100;
|
|
13
|
+
for (let t = 0; t < e; t++) {
|
|
14
|
+
if (!x() || !d.current) return !0;
|
|
15
|
+
await new Promise((e) => setTimeout(e, 100));
|
|
16
|
+
}
|
|
17
|
+
return !x();
|
|
18
|
+
};
|
|
19
|
+
(async () => {
|
|
20
|
+
try {
|
|
21
|
+
await s.stopCompletion({
|
|
22
|
+
generationId: y,
|
|
23
|
+
path: i,
|
|
24
|
+
content: b
|
|
25
|
+
});
|
|
26
|
+
} catch (t) {
|
|
27
|
+
let n = t instanceof Error ? t : Error(String(t));
|
|
28
|
+
if (n instanceof e && n.status === 404 && await S()) return;
|
|
29
|
+
g.current.delete(y), l?.(n);
|
|
30
|
+
}
|
|
31
|
+
})();
|
|
32
|
+
}, [
|
|
33
|
+
f,
|
|
34
|
+
m,
|
|
35
|
+
a,
|
|
36
|
+
o,
|
|
37
|
+
u,
|
|
38
|
+
d,
|
|
39
|
+
l,
|
|
40
|
+
c,
|
|
41
|
+
p,
|
|
42
|
+
g,
|
|
43
|
+
h,
|
|
44
|
+
_,
|
|
45
|
+
s
|
|
46
|
+
]);
|
|
47
|
+
//#endregion
|
|
48
|
+
export { a as useStopGeneration };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { BufferedGeneration } from './buffered-generation';
|
|
3
|
+
import { FrameScheduler } from './frame-scheduler';
|
|
4
|
+
interface UseStreamPathStateParams {
|
|
5
|
+
conversationId: string | undefined;
|
|
6
|
+
frameScheduler: FrameScheduler;
|
|
7
|
+
mountedRef: MutableRefObject<boolean>;
|
|
8
|
+
clearReloadError: (path: string) => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Per-path generation state of `useConversationStream`: which paths are
|
|
12
|
+
* streaming and which offer Stop, and the refs that own each path's local,
|
|
13
|
+
* latest, resumed and stopped generation ids, its live buffered message and
|
|
14
|
+
* its resume reservation, plus the displayed-conversation guard that keeps a
|
|
15
|
+
* stream from writing into a conversation that is no longer shown.
|
|
16
|
+
* `streamingPathsRef` is synced during render so Stop polling reads the
|
|
17
|
+
* latest set.
|
|
18
|
+
*/
|
|
19
|
+
export declare const useStreamPathState: ({ conversationId, frameScheduler, mountedRef, clearReloadError, }: UseStreamPathStateParams) => {
|
|
20
|
+
streamingPaths: Set<string>;
|
|
21
|
+
streamingPathsRef: import('react').RefObject<Set<string>>;
|
|
22
|
+
stoppablePaths: Set<string>;
|
|
23
|
+
activeGenerationIdsRef: import('react').RefObject<Map<string, string>>;
|
|
24
|
+
resumedGenerationIdsRef: import('react').RefObject<Map<string, string>>;
|
|
25
|
+
resumingPathsRef: import('react').RefObject<Set<string>>;
|
|
26
|
+
bufferedGenerationsRef: import('react').RefObject<Map<string, BufferedGeneration>>;
|
|
27
|
+
stoppedGenerationIdsRef: import('react').RefObject<Set<string>>;
|
|
28
|
+
stopRequestedIdsRef: import('react').RefObject<Set<string>>;
|
|
29
|
+
latestGenerationIdsRef: import('react').RefObject<Map<string, string>>;
|
|
30
|
+
isPathDisplayed: (path: string) => boolean;
|
|
31
|
+
addStreamingPath: (path: string) => void;
|
|
32
|
+
removeStreamingPath: (path: string) => void;
|
|
33
|
+
setPathStoppable: (path: string, isStoppable: boolean) => void;
|
|
34
|
+
releaseActiveGeneration: (path: string, genId: string) => void;
|
|
35
|
+
rememberResumedGenerationId: (path: string, generationId: string) => void;
|
|
36
|
+
forgetResumedGenerationId: (path: string, generationId: string) => void;
|
|
37
|
+
};
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=useStreamPathState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStreamPathState.d.ts","sourceRoot":"","sources":["../../../src/conversation/useConversationStream/useStreamPathState.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EAKtB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,UAAU,wBAAwB;IAChC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC,cAAc,EAAE,cAAc,CAAC;IAE/B,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAEtC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,mEAKhC,wBAAwB;;;;;;;;;;;4BAwDhB,MAAM,KAAG,OAAO;6BAOhB,MAAM;gCAYgC,MAAM;6BAST,MAAM,eAAe,OAAO;oCAY/D,MAAM,SAAS,MAAM;wCAarB,MAAM,gBAAgB,MAAM;sCAU5B,MAAM,gBAAgB,MAAM;CA6BtC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { getConversationPath as e } from "./conversation-path.js";
|
|
2
|
+
import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
|
|
3
|
+
//#region src/conversation/useConversationStream/useStreamPathState.ts
|
|
4
|
+
var a = ({ conversationId: a, frameScheduler: o, mountedRef: s, clearReloadError: c }) => {
|
|
5
|
+
let [l, u] = i(() => /* @__PURE__ */ new Set()), d = r(l);
|
|
6
|
+
d.current = l;
|
|
7
|
+
let [f, p] = i(() => /* @__PURE__ */ new Set()), m = r(/* @__PURE__ */ new Map()), h = r(/* @__PURE__ */ new Map()), g = r(/* @__PURE__ */ new Set()), _ = r(/* @__PURE__ */ new Map()), v = r(/* @__PURE__ */ new Set()), y = r(/* @__PURE__ */ new Set()), b = r(/* @__PURE__ */ new Map()), x = r(a);
|
|
8
|
+
n(() => (x.current = a, () => o.cancelAll()), [a, o]);
|
|
9
|
+
let S = t((t) => s.current && e(x.current ?? "") === t, [s]), C = t((e) => {
|
|
10
|
+
c(e), u((t) => {
|
|
11
|
+
if (t.has(e)) return t;
|
|
12
|
+
let n = new Set(t);
|
|
13
|
+
return n.add(e), n;
|
|
14
|
+
});
|
|
15
|
+
}, [c]), w = t((e) => {
|
|
16
|
+
u((t) => {
|
|
17
|
+
if (!t.has(e)) return t;
|
|
18
|
+
let n = new Set(t);
|
|
19
|
+
return n.delete(e), n;
|
|
20
|
+
});
|
|
21
|
+
}, []), T = t((e, t) => {
|
|
22
|
+
p((n) => {
|
|
23
|
+
if (n.has(e) === t) return n;
|
|
24
|
+
let r = new Set(n);
|
|
25
|
+
return t ? r.add(e) : r.delete(e), r;
|
|
26
|
+
});
|
|
27
|
+
}, []);
|
|
28
|
+
return {
|
|
29
|
+
streamingPaths: l,
|
|
30
|
+
streamingPathsRef: d,
|
|
31
|
+
stoppablePaths: f,
|
|
32
|
+
activeGenerationIdsRef: m,
|
|
33
|
+
resumedGenerationIdsRef: h,
|
|
34
|
+
resumingPathsRef: g,
|
|
35
|
+
bufferedGenerationsRef: _,
|
|
36
|
+
stoppedGenerationIdsRef: v,
|
|
37
|
+
stopRequestedIdsRef: y,
|
|
38
|
+
latestGenerationIdsRef: b,
|
|
39
|
+
isPathDisplayed: S,
|
|
40
|
+
addStreamingPath: C,
|
|
41
|
+
removeStreamingPath: w,
|
|
42
|
+
setPathStoppable: T,
|
|
43
|
+
releaseActiveGeneration: t((e, t) => {
|
|
44
|
+
m.current.get(e) === t && (m.current.delete(e), T(e, !1));
|
|
45
|
+
}, [T]),
|
|
46
|
+
rememberResumedGenerationId: t((e, t) => {
|
|
47
|
+
m.current.has(e) || (h.current.set(e, t), T(e, !0));
|
|
48
|
+
}, [T]),
|
|
49
|
+
forgetResumedGenerationId: t((e, t) => {
|
|
50
|
+
h.current.get(e) === t && (h.current.delete(e), m.current.has(e) || T(e, !1));
|
|
51
|
+
}, [T])
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { a as useStreamPathState };
|