@epam/ai-dial-chat-hooks 1.3.0-dev.37 → 1.3.0-dev.372
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 +23 -6
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.d.ts.map +1 -1
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +108 -107
- 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.d.ts +21 -0
- package/conversation/conversation-draft/conversation-draft-store.d.ts.map +1 -0
- package/conversation/conversation-draft/conversation-draft-store.js +84 -0
- package/conversation/conversation-draft/conversation-draft.d.ts +48 -0
- package/conversation/conversation-draft/conversation-draft.d.ts.map +1 -0
- 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/get-model-id-from-conversation-id.d.ts.map +1 -1
- package/conversation/get-model-id-from-conversation-id.js +1 -1
- 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.d.ts +39 -0
- package/conversation/useConversationComposerDraft/useConversationComposerDraft.d.ts.map +1 -0
- package/conversation/useConversationComposerDraft/useConversationComposerDraft.js +128 -0
- 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 +36 -27
- 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 -33
- 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 +13 -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 +7 -0
- package/entry-points/offline-credentials.d.ts.map +1 -0
- package/entry-points/project.d.ts +20 -0
- package/entry-points/project.d.ts.map +1 -0
- package/entry-points/scheduled-tasks.d.ts +7 -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 +9 -0
- package/entry-points/usage-limits.d.ts.map +1 -0
- 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 +23 -3
- package/files/dial-file-manager-mapping.util.d.ts.map +1 -1
- package/files/dial-file-manager-mapping.util.js +97 -69
- 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.d.ts.map +1 -1
- package/files/useDialFileListing/useDialFileListing.js +97 -109
- 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 +96 -0
- package/index.d.ts.map +1 -1
- package/index.js +244 -149
- 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/popup.d.ts.map +1 -1
- package/oauth/popup.js +19 -17
- 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.d.ts.map +1 -1
- package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.js +41 -42
- 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 +20 -0
- package/offline-credentials/map-offline-credentials-response.d.ts.map +1 -0
- package/offline-credentials/map-offline-credentials-response.js +17 -0
- 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/useOfflineCredentialsAuth/useOfflineCredentialsAuth.d.ts +58 -0
- package/offline-credentials/useOfflineCredentialsAuth/useOfflineCredentialsAuth.d.ts.map +1 -0
- package/offline-credentials/useOfflineCredentialsAuth/useOfflineCredentialsAuth.js +37 -0
- package/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.d.ts +61 -0
- package/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.d.ts.map +1 -0
- package/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.js +37 -0
- package/offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin.d.ts +28 -0
- package/offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin.d.ts.map +1 -0
- package/offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin.js +29 -0
- package/offline-credentials.d.ts +2 -0
- package/offline-credentials.js +7 -0
- package/package.json +49 -25
- 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/check-scheduled-task-auth-session-error.d.ts +27 -0
- package/scheduled-task/check-scheduled-task-auth-session-error.d.ts.map +1 -0
- package/scheduled-task/check-scheduled-task-auth-session-error.js +17 -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 -6
- 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-usage-data-to-dashboard.d.ts +1 -16
- package/usage/map-usage-data-to-dashboard.d.ts.map +1 -1
- 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 +24 -0
- package/usage/usage-banner-source.d.ts.map +1 -0
- package/usage/usage-banner-source.js +61 -0
- 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-period.d.ts +7 -0
- package/usage/usage-period.d.ts.map +1 -0
- package/usage/usage-period.js +6 -0
- package/usage/usage-reset-time.d.ts +78 -0
- package/usage/usage-reset-time.d.ts.map +1 -0
- package/usage/usage-reset-time.js +82 -0
- package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts +56 -0
- package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts.map +1 -0
- package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.js +34 -0
- package/usage/useRefreshUsageAfterGeneration/useRefreshUsageAfterGeneration.d.ts +16 -0
- package/usage/useRefreshUsageAfterGeneration/useRefreshUsageAfterGeneration.d.ts.map +1 -0
- package/usage/useRefreshUsageAfterGeneration/useRefreshUsageAfterGeneration.js +14 -0
- package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts +58 -0
- package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts.map +1 -0
- package/usage/useUsageLimitBanner/useUsageLimitBanner.js +70 -0
- package/usage/useUsageLimitBannerDismissal/useUsageLimitBannerDismissal.d.ts +14 -0
- package/usage/useUsageLimitBannerDismissal/useUsageLimitBannerDismissal.d.ts.map +1 -0
- package/usage/useUsageLimitBannerDismissal/useUsageLimitBannerDismissal.js +19 -0
- package/usage-limits.d.ts +2 -0
- package/usage-limits.js +10 -0
- 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.d.ts.map +1 -1
- package/useShareLink/useShareLink.js +18 -17
- 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,138 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Dispatch, MutableRefObject, SetStateAction } from 'react';
|
|
4
|
-
/** Options accepted by {@link ConversationStreamTransport.streamCompletion}. */
|
|
5
|
-
export interface StreamCompletionOptions {
|
|
6
|
-
onChunk: (chunk: StreamChunk) => void;
|
|
7
|
-
onComplete: () => void | Promise<void>;
|
|
8
|
-
onError: (error: Error) => void;
|
|
9
|
-
signal: AbortSignal;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Host-owned transport for the DIAL Core completion protocol. Implemented at
|
|
13
|
-
* the app edge — never hardcodes an `/api` path, CSRF handling, or a
|
|
14
|
-
* `server-api` import; the library only depends on this interface's shape.
|
|
15
|
-
*/
|
|
16
|
-
export interface ConversationStreamTransport {
|
|
17
|
-
/** Starts a completion; delivers chunks/completion/error through `options`, aborted via `options.signal`. */
|
|
18
|
-
streamCompletion(path: string, message: string | undefined, model: string, options: StreamCompletionOptions, customContent?: MessageCustomContent, generationId?: string, mode?: SendCompletionDtoModeEnum, messageIndex?: number, clientChannelId?: string): void;
|
|
19
|
-
/**
|
|
20
|
-
* Requests the backend stop an active generation. `content` is the answer text shown
|
|
21
|
-
* so far; the backend saves it for a generation whose text it does not hold.
|
|
22
|
-
*/
|
|
23
|
-
stopCompletion(params: {
|
|
24
|
-
generationId: string;
|
|
25
|
-
path: string;
|
|
26
|
-
content?: string;
|
|
27
|
-
}): Promise<void>;
|
|
28
|
-
/** Opens a stream of resource-update events for `path`, until aborted via `signal`. */
|
|
29
|
-
watchConversation(path: string, signal: AbortSignal): Promise<ReadableStream<Uint8Array>>;
|
|
30
|
-
/**
|
|
31
|
-
* Attaches to an active generation's live replay: a `snapshot` event
|
|
32
|
-
* carrying the assistant message as assembled so far, then a `chunk` event
|
|
33
|
-
* per subsequent delta, then exactly one terminal event (`done`/`error`/
|
|
34
|
-
* `stopped`), until aborted via `signal`. Rejects when no active
|
|
35
|
-
* generation exists for `path` — including one that already finished —
|
|
36
|
-
* so the caller can fall back to `watchConversation`.
|
|
37
|
-
*/
|
|
38
|
-
attachToGeneration(path: string, signal: AbortSignal): Promise<ReadableStream<Uint8Array>>;
|
|
39
|
-
/** Reloads the persisted conversation by its full (bucket-qualified) id. */
|
|
40
|
-
getConversation(conversationId: string, signal?: AbortSignal): Promise<Conversation>;
|
|
41
|
-
/**
|
|
42
|
-
* Saves `conversation` at the bucket-stripped `path`, resolving with the saved
|
|
43
|
-
* conversation. Used only for the single recovery save after the backend's
|
|
44
|
-
* terminal save was rejected with `401`; without it that failure shows the
|
|
45
|
-
* persistence warning immediately.
|
|
46
|
-
*/
|
|
47
|
-
saveConversation?(path: string, conversation: Conversation): Promise<Conversation>;
|
|
48
|
-
}
|
|
49
|
-
/** Host-owned generation lifecycle, backing cross-navigation `AbortController` ownership. */
|
|
50
|
-
export interface ConversationGenerationLifecycle {
|
|
51
|
-
/** Starts (or replaces) tracking for a generation on `path`, returning its `AbortController`. */
|
|
52
|
-
startGeneration: (path: string, generationId: string) => AbortController;
|
|
53
|
-
/** Marks the generation identified by `path`/`generationId` complete, if it is still the active one. */
|
|
54
|
-
completeGeneration: (path: string, generationId: string) => void;
|
|
55
|
-
}
|
|
56
|
-
/** Optional host-owned client-channel connection, used to nudge tool-signin delivery. */
|
|
57
|
-
export interface ConversationStreamChannel {
|
|
58
|
-
channelId: string | null;
|
|
59
|
-
ensureConnected: () => void;
|
|
60
|
-
/** Resolves with a channel id, waiting for an in-flight subscribe if one isn't established yet, so a completion sent immediately after mount can still carry it. */
|
|
61
|
-
waitForChannel: (timeoutMs?: number) => Promise<string | null>;
|
|
62
|
-
/** Notifies the host that a generation just ended (completed or errored), so it can consider disconnecting an idle channel. */
|
|
63
|
-
notifyGenerationSettled?: () => void;
|
|
64
|
-
}
|
|
65
|
-
/** Optional host-owned overlay generation-lifecycle notifications. Each method is independently optional. */
|
|
66
|
-
export interface ConversationStreamOverlayNotifier {
|
|
67
|
-
notifyGenerationStart?: () => void;
|
|
68
|
-
notifyGenerationEnd?: () => void;
|
|
69
|
-
notifyStopGenerating?: () => void;
|
|
70
|
-
}
|
|
71
|
-
/** Shared mutable channel through which the displayed conversation's state is read/written. */
|
|
72
|
-
export interface ConversationStateAccessor {
|
|
73
|
-
setConversation: Dispatch<SetStateAction<Conversation | null>>;
|
|
74
|
-
conversationRef: MutableRefObject<Conversation | null>;
|
|
75
|
-
}
|
|
76
|
-
/** Parameters for {@link useConversationStream}. */
|
|
77
|
-
export interface UseConversationStreamParams {
|
|
78
|
-
conversationId: string | undefined;
|
|
79
|
-
state: ConversationStateAccessor;
|
|
80
|
-
transport: ConversationStreamTransport;
|
|
81
|
-
generation: ConversationGenerationLifecycle;
|
|
82
|
-
channel?: ConversationStreamChannel;
|
|
83
|
-
overlay?: ConversationStreamOverlayNotifier;
|
|
84
|
-
onStopError?: (error: Error) => void;
|
|
85
|
-
/**
|
|
86
|
-
* Message shown on the message bubble when the backend rejects a completion
|
|
87
|
-
* because this conversation is already generating — the case a second
|
|
88
|
-
* browser tab of the same session hits. Defaults to
|
|
89
|
-
* {@link DEFAULT_GENERATION_CONFLICT_MESSAGE}.
|
|
90
|
-
*/
|
|
91
|
-
generationConflictMessage?: string;
|
|
92
|
-
/** Host-translated warning shown when the received answer could not be saved. */
|
|
93
|
-
generationPersistenceErrorMessage?: string;
|
|
94
|
-
/**
|
|
95
|
-
* Receives the original error of every failed stream. The hook shows only
|
|
96
|
-
* host-supplied or upstream-supplied text on the message bubble and hides
|
|
97
|
-
* transport detail (e.g. `Failed to fetch`), so this is where the host can
|
|
98
|
-
* still log or report the raw error.
|
|
99
|
-
*/
|
|
100
|
-
onStreamError?: (error: Error) => void;
|
|
101
|
-
/**
|
|
102
|
-
* Coalesces the displayed chunk updates into one `setConversation` per
|
|
103
|
-
* animation frame. Chunks still reach the per-path buffer immediately, and
|
|
104
|
-
* any pending update is flushed before completion, error, stop, or a
|
|
105
|
-
* superseding generation. Defaults to `false` (one update per chunk).
|
|
106
|
-
*/
|
|
107
|
-
batchChunksPerFrame?: boolean;
|
|
108
|
-
}
|
|
109
|
-
/** Per-start options of {@link UseConversationStreamResult.startStream}. */
|
|
110
|
-
export interface StartStreamOptions {
|
|
111
|
-
/**
|
|
112
|
-
* Treats a `GenerationConflictError` as "this turn is already being
|
|
113
|
-
* generated" — e.g. a page reloaded before that generation saved its start
|
|
114
|
-
* state — and joins the running generation instead of showing the conflict
|
|
115
|
-
* message, which remains the fallback. Only for a start that sends no new
|
|
116
|
-
* user text; a send the user typed must keep reporting the conflict.
|
|
117
|
-
*/
|
|
118
|
-
resumeOnConflict?: boolean;
|
|
119
|
-
}
|
|
120
|
-
/** Return value of {@link useConversationStream}. */
|
|
121
|
-
export interface UseConversationStreamResult {
|
|
122
|
-
startStream: (conversationId: string, userContent: string, messageIndex: number, model: string, customContent?: MessageCustomContent, generationId?: string, mode?: SendCompletionDtoModeEnum, options?: StartStreamOptions) => void;
|
|
123
|
-
handleStop: () => void;
|
|
124
|
-
resumeIfAwaitingGeneration: (currentConversationId: string, conversation: Conversation) => void;
|
|
125
|
-
/** Restores the accumulated live assistant message when its conversation is loaded again before completion. */
|
|
126
|
-
restoreBufferedGeneration: (currentConversationId: string, conversation: Conversation) => Conversation;
|
|
127
|
-
isStreaming: boolean;
|
|
128
|
-
canStopStreaming: boolean;
|
|
129
|
-
/** Whether the displayed conversation's terminal read failed. */
|
|
130
|
-
hasConversationReloadError: boolean;
|
|
131
|
-
/** Whether a retry of that read is in flight. */
|
|
132
|
-
isReloadingConversation: boolean;
|
|
133
|
-
/** Retries the failed read without saving or regenerating the answer. */
|
|
134
|
-
retryConversationReload: () => Promise<void>;
|
|
135
|
-
}
|
|
1
|
+
import { UseConversationStreamParams, UseConversationStreamResult } from './conversation-stream.types';
|
|
2
|
+
export type { ConversationGenerationLifecycle, ConversationStateAccessor, ConversationStreamChannel, ConversationStreamOverlayNotifier, ConversationStreamTransport, StartStreamOptions, StreamCompletionOptions, UseConversationStreamParams, UseConversationStreamResult, } from './conversation-stream.types';
|
|
136
3
|
/**
|
|
137
4
|
* Owns completion-streaming state: per-path streaming/stoppable tracking,
|
|
138
5
|
* stale-chunk rejection, cross-navigation live-message buffering,
|
|
@@ -141,5 +8,5 @@ export interface UseConversationStreamResult {
|
|
|
141
8
|
* `transport`/`generation`/`channel`/`overlay` capabilities rather than any
|
|
142
9
|
* app context or `server-api` import.
|
|
143
10
|
*/
|
|
144
|
-
export declare const useConversationStream: ({ conversationId, state: { setConversation, conversationRef }, transport, generation: { startGeneration, completeGeneration }, channel, overlay, onStopError, generationConflictMessage, generationPersistenceErrorMessage, onStreamError, batchChunksPerFrame, }: UseConversationStreamParams) => UseConversationStreamResult;
|
|
11
|
+
export declare const useConversationStream: ({ conversationId, state: { setConversation, conversationRef }, transport, generation: { startGeneration, completeGeneration }, channel, overlay, onStopError, generationConflictMessage, generationPersistenceErrorMessage, generationInterruptedMessage, onStreamError, batchChunksPerFrame, }: UseConversationStreamParams) => UseConversationStreamResult;
|
|
145
12
|
//# sourceMappingURL=useConversationStream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConversationStream.d.ts","sourceRoot":"","sources":["../../../src/conversation/useConversationStream/useConversationStream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useConversationStream.d.ts","sourceRoot":"","sources":["../../../src/conversation/useConversationStream/useConversationStream.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAEV,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,6BAA6B,CAAC;AAYrC,YAAY,EACV,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EACzB,iCAAiC,EACjC,2BAA2B,EAC3B,kBAAkB,EAClB,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,6BAA6B,CAAC;AAErC;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,GAAI,iSAanC,2BAA2B,KAAG,2BAwRhC,CAAC"}
|
|
@@ -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
|