@epam/ai-dial-chat-hooks 1.3.0-dev.98 → 1.4.0-dev.5
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 +19 -4
- 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 +32 -2
- package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
- package/conversation/useConversationStream/generation-resume.js +114 -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
|
@@ -1,350 +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
|
-
}, w
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}, [
|
|
21
|
-
let
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}, [j]);
|
|
25
|
-
let [M] = v(re), [N, P] = v(() => /* @__PURE__ */ new Set()), F = _(N);
|
|
26
|
-
F.current = N;
|
|
27
|
-
let [I, me] = v(() => /* @__PURE__ */ new Set()), L = _(/* @__PURE__ */ new Map()), R = _(/* @__PURE__ */ new Set()), z = _(/* @__PURE__ */ new Map()), B = _(/* @__PURE__ */ new Set()), V = _(/* @__PURE__ */ new Set()), he = _(/* @__PURE__ */ new Map()), H = _(!0), U = _(/* @__PURE__ */ new Map()), [ge, W] = v(U.current), G = _(/* @__PURE__ */ new Set()), [_e, ve] = v(G.current);
|
|
28
|
-
h(() => (H.current = !0, () => {
|
|
29
|
-
H.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;
|
|
30
26
|
}), []);
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
K(e), P((t) => {
|
|
57
|
-
if (t.has(e)) return t;
|
|
58
|
-
let n = new Set(t);
|
|
59
|
-
return n.add(e), n;
|
|
60
|
-
});
|
|
61
|
-
}, [K]), X = m((e) => {
|
|
62
|
-
P((t) => {
|
|
63
|
-
if (!t.has(e)) return t;
|
|
64
|
-
let n = new Set(t);
|
|
65
|
-
return n.delete(e), n;
|
|
66
|
-
});
|
|
67
|
-
}, []), Z = m((e, t) => {
|
|
68
|
-
me((n) => {
|
|
69
|
-
if (n.has(e) === t) return n;
|
|
70
|
-
let r = new Set(n);
|
|
71
|
-
return t ? r.add(e) : r.delete(e), r;
|
|
72
|
-
});
|
|
73
|
-
}, []), xe = m((e, t) => {
|
|
74
|
-
L.current.get(e) === t && (L.current.delete(e), Z(e, !1));
|
|
75
|
-
}, [Z]), Q = g(() => ee({
|
|
76
|
-
transport: E,
|
|
77
|
-
setConversation: w,
|
|
78
|
-
conversationRef: T,
|
|
79
|
-
resumingPathsRef: R,
|
|
80
|
-
bufferedGenerationsRef: z,
|
|
81
|
-
addStreamingPath: Y,
|
|
82
|
-
removeStreamingPath: X,
|
|
83
|
-
isPathDisplayed: J,
|
|
84
|
-
generationPersistenceErrorMessage: k,
|
|
85
|
-
frameScheduler: j ? M : void 0,
|
|
86
|
-
stoppedGenerationIdsRef: B,
|
|
87
|
-
onReloadError: q,
|
|
88
|
-
onReloadSuccess: K
|
|
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
|
|
89
52
|
}), [
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
53
|
+
U,
|
|
54
|
+
W,
|
|
55
|
+
H,
|
|
56
|
+
g,
|
|
57
|
+
S,
|
|
58
|
+
C,
|
|
59
|
+
T,
|
|
60
|
+
O,
|
|
97
61
|
q,
|
|
98
|
-
K
|
|
99
|
-
]), Se = m((t, n, a, s, ee, re, m = y.Append, h = {}) => {
|
|
100
|
-
let g = re ?? ie(), _ = c(t);
|
|
101
|
-
M.flush(_), R.current.delete(_), L.current.set(_, g), he.current.set(_, g), Z(_, !0);
|
|
102
|
-
let v;
|
|
103
|
-
m === y.Regenerate ? v = a : m === y.Edit && (v = a - 1);
|
|
104
|
-
let b = () => he.current.get(_) !== g, x = ce(_, g), S = T.current?.messages[a];
|
|
105
|
-
S ? z.current.set(_, {
|
|
106
|
-
generationId: g,
|
|
107
|
-
messageIndex: a,
|
|
108
|
-
message: S
|
|
109
|
-
}) : z.current.delete(_), Y(_), O?.notifyGenerationStart?.(), D?.ensureConnected();
|
|
110
|
-
let C = () => {
|
|
111
|
-
b() || X(_), xe(_, g), le(_, g), D?.notifyGenerationSettled?.();
|
|
112
|
-
}, ue = () => {
|
|
113
|
-
if (b()) return;
|
|
114
|
-
let e = z.current.get(_);
|
|
115
|
-
!e || e.generationId !== g || (e.message = {
|
|
116
|
-
...e.message,
|
|
117
|
-
streamErrorMessage: k
|
|
118
|
-
}, fe.current?.(new i()), J(_) && w((t) => {
|
|
119
|
-
if (!t || b() || !J(_)) return t;
|
|
120
|
-
let n = u(t, e);
|
|
121
|
-
return T.current = n, n;
|
|
122
|
-
}));
|
|
123
|
-
}, A = z.current.get(_), j = () => H.current && !b() && z.current.get(_) === A, N = async () => {
|
|
124
|
-
if (j()) {
|
|
125
|
-
if (!J(_)) {
|
|
126
|
-
A && z.current.delete(_);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
try {
|
|
130
|
-
let n = await E.getConversation(e(t));
|
|
131
|
-
if (!j()) return;
|
|
132
|
-
if (K(_), !J(_)) {
|
|
133
|
-
A && z.current.delete(_);
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
if (d(n) !== -1) {
|
|
137
|
-
Q(t, n, { seedMessage: A?.message });
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
if (A && A.messageIndex === n.messages.length - 1 && f(n) && ne(A.message)) {
|
|
141
|
-
ue();
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
A && z.current.delete(_), w(n), T.current = n;
|
|
145
|
-
} catch {
|
|
146
|
-
j() && q(_, N, j);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}, P = {
|
|
150
|
-
signal: x.signal,
|
|
151
|
-
onChunk: (e) => {
|
|
152
|
-
if (b()) return;
|
|
153
|
-
let t = z.current.get(_);
|
|
154
|
-
if (t?.generationId === g) {
|
|
155
|
-
let n = l([t.message], 0, e);
|
|
156
|
-
n && (t.message = n[0]);
|
|
157
|
-
}
|
|
158
|
-
if (J(_)) {
|
|
159
|
-
if (pe.current && t?.generationId === g) {
|
|
160
|
-
M.schedule(_, () => {
|
|
161
|
-
let e = z.current.get(_);
|
|
162
|
-
if (b() || !J(_) || e?.generationId !== g) return;
|
|
163
|
-
let t = { ...e };
|
|
164
|
-
w((e) => {
|
|
165
|
-
if (!e) return e;
|
|
166
|
-
let n = u(e, t);
|
|
167
|
-
return T.current = n, n;
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
w((t) => {
|
|
173
|
-
if (!t) return t;
|
|
174
|
-
let n = z.current.get(_), r;
|
|
175
|
-
if (n?.generationId === g) r = u(t, n);
|
|
176
|
-
else {
|
|
177
|
-
let n = l(t.messages, a, e);
|
|
178
|
-
if (!n) return t;
|
|
179
|
-
r = {
|
|
180
|
-
...t,
|
|
181
|
-
messages: n
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
return T.current = r, r;
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
onComplete: async () => {
|
|
189
|
-
M.flush(_), C(), B.current.has(g) ? B.current.delete(g) : b() || O?.notifyGenerationEnd?.(), await N();
|
|
190
|
-
},
|
|
191
|
-
onError: (e) => {
|
|
192
|
-
if (M.flush(_), fe.current?.(e), e instanceof o && !b()) {
|
|
193
|
-
U(e);
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
if (e instanceof r && h.resumeOnConflict && !b()) {
|
|
197
|
-
ge(e);
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
F(e);
|
|
201
|
-
}
|
|
202
|
-
}, F = (e) => {
|
|
203
|
-
let t = z.current.get(_), n = t?.generationId === g ? t : void 0;
|
|
204
|
-
if (n && !(e instanceof i) && z.current.delete(_), C(), n && E.saveConversation && e instanceof i && e.status === oe) {
|
|
205
|
-
me(e, n, E.saveConversation.bind(E));
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
I(e, n);
|
|
209
|
-
}, I = (e, t) => {
|
|
210
|
-
if (t && e instanceof i && (t.message = {
|
|
211
|
-
...t.message,
|
|
212
|
-
streamErrorMessage: k
|
|
213
|
-
}), b() || !J(_)) return;
|
|
214
|
-
let n = se(e, de, k);
|
|
215
|
-
w((e) => {
|
|
216
|
-
if (!e || b() || !J(_)) return e;
|
|
217
|
-
let r = t?.generationId === g ? u(e, t) : e, i = {
|
|
218
|
-
...r,
|
|
219
|
-
messages: r.messages.map((e, t) => t === a ? {
|
|
220
|
-
...e,
|
|
221
|
-
streamErrorMessage: n
|
|
222
|
-
} : e)
|
|
223
|
-
};
|
|
224
|
-
return T.current = i, i;
|
|
225
|
-
});
|
|
226
|
-
}, me = async (n, r, i) => {
|
|
227
|
-
let a = () => H.current && !b() && z.current.get(_) === r;
|
|
228
|
-
try {
|
|
229
|
-
let o = await E.getConversation(e(t));
|
|
230
|
-
if (!a()) return;
|
|
231
|
-
if (r.messageIndex !== o.messages.length - 1 || !f(o)) {
|
|
232
|
-
I(n, r);
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
let s = await i(_, u(o, r));
|
|
236
|
-
if (!a() || (z.current.delete(_), !J(_))) return;
|
|
237
|
-
w(s), T.current = s;
|
|
238
|
-
} catch {
|
|
239
|
-
a() && I(n, r);
|
|
240
|
-
}
|
|
241
|
-
}, V = () => {
|
|
242
|
-
C(), B.current.has(g) ? B.current.delete(g) : b() || O?.notifyGenerationEnd?.();
|
|
243
|
-
}, U = async (n) => {
|
|
244
|
-
R.current.add(_), W(await te(() => E.getConversation(e(t)), b), n, !1);
|
|
245
|
-
}, ge = async (n) => {
|
|
246
|
-
L.current.get(_) === g && Z(_, !1), R.current.add(_), W(await te(() => E.getConversation(e(t)), b, (e) => e.messages.length === a && e.messages.at(-1)?.role === p.User), n, !0);
|
|
247
|
-
}, W = (e, n, r) => {
|
|
248
|
-
if (b()) {
|
|
249
|
-
C();
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
let i = e?.messages[e.messages.length - 1], o = e != null && e.messages.length - 1 === a && i?.role === p.Assistant, s = r && e != null && d(e) !== -1;
|
|
253
|
-
if (!e || !o && !s) {
|
|
254
|
-
R.current.delete(_), F(n);
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
let c = z.current.get(_), l = c?.generationId === g ? c : void 0;
|
|
258
|
-
if (f(e)) {
|
|
259
|
-
Q(t, e, {
|
|
260
|
-
seedMessage: o ? l?.message : void 0,
|
|
261
|
-
skipDedupe: !0,
|
|
262
|
-
onSettled: V
|
|
263
|
-
});
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
R.current.delete(_), l && z.current.delete(_), J(_) && (w(e), T.current = e), V();
|
|
267
|
-
};
|
|
268
|
-
(async () => {
|
|
269
|
-
try {
|
|
270
|
-
let e = D?.channelId ?? await D?.waitForChannel(ae) ?? void 0, t = B.current.has(g);
|
|
271
|
-
if (x.signal.aborted || b() || t) {
|
|
272
|
-
z.current.get(_)?.generationId === g && z.current.delete(_), b() || X(_), xe(_, g), le(_, g), D?.notifyGenerationSettled?.(), t ? B.current.delete(g) : b() || O?.notifyGenerationEnd?.();
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
E.streamCompletion(_, n, s, P, ee, g, m, v, e);
|
|
276
|
-
} catch (e) {
|
|
277
|
-
P.onError(e instanceof Error ? e : Error(String(e)));
|
|
278
|
-
}
|
|
279
|
-
})();
|
|
280
|
-
}, [
|
|
281
|
-
ce,
|
|
282
|
-
le,
|
|
283
|
-
Y,
|
|
284
|
-
X,
|
|
285
|
-
Z,
|
|
286
|
-
xe,
|
|
287
62
|
J,
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
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,
|
|
97
|
+
G,
|
|
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,
|
|
292
109
|
O,
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
q,
|
|
299
|
-
K
|
|
300
|
-
]), Ce = m((e, t) => {
|
|
301
|
-
let n = c(e), r = z.current.get(n);
|
|
302
|
-
return U.current.get(n)?.isCurrent() && r && t.messages.length - 1 >= r.messageIndex && t.messages[r.messageIndex].role === p.Assistant && !f(t) ? (K(n), z.current.delete(n), t) : r ? u(t, r) : t;
|
|
303
|
-
}, [K]), we = m(() => {
|
|
304
|
-
if (!s) return;
|
|
305
|
-
let e = c(s), t = L.current.get(e), n = t ?? C(T.current);
|
|
306
|
-
if (!n || V.current.has(n)) return;
|
|
307
|
-
V.current.add(n), B.current.add(n), M.flush(e), O?.notifyStopGenerating?.();
|
|
308
|
-
let r = z.current.get(e)?.message.content, i = () => L.current.get(e) === n || t == null && F.current.has(e), o = async () => {
|
|
309
|
-
let e = x / S;
|
|
310
|
-
for (let t = 0; t < e; t++) {
|
|
311
|
-
if (!i() || !H.current) return !0;
|
|
312
|
-
await new Promise((e) => setTimeout(e, S));
|
|
313
|
-
}
|
|
314
|
-
return !i();
|
|
315
|
-
};
|
|
316
|
-
(async () => {
|
|
317
|
-
try {
|
|
318
|
-
await E.stopCompletion({
|
|
319
|
-
generationId: n,
|
|
320
|
-
path: e,
|
|
321
|
-
content: r
|
|
322
|
-
});
|
|
323
|
-
} catch (e) {
|
|
324
|
-
let t = e instanceof Error ? e : Error(String(e));
|
|
325
|
-
if (t instanceof a && t.status === b && await o()) return;
|
|
326
|
-
V.current.delete(n), ue?.(t);
|
|
327
|
-
}
|
|
328
|
-
})();
|
|
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;
|
|
329
115
|
}, [
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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;
|
|
337
139
|
return {
|
|
338
|
-
hasConversationReloadError:
|
|
339
|
-
isReloadingConversation: !!
|
|
340
|
-
retryConversationReload:
|
|
341
|
-
startStream:
|
|
342
|
-
handleStop:
|
|
343
|
-
resumeIfAwaitingGeneration:
|
|
344
|
-
restoreBufferedGeneration:
|
|
345
|
-
isStreaming:
|
|
346
|
-
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
|
|
347
149
|
};
|
|
348
150
|
};
|
|
349
151
|
//#endregion
|
|
350
|
-
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 };
|