@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.
Files changed (578) hide show
  1. package/api-error/api-error.d.ts +2 -0
  2. package/api-error/api-error.d.ts.map +1 -1
  3. package/api-error/api-error.js +31 -23
  4. package/api-transport/create-unauthorized-middleware.js +4 -1
  5. package/attachment/attach-constraints.d.ts +31 -0
  6. package/attachment/attach-constraints.d.ts.map +1 -0
  7. package/attachment/attach-constraints.js +18 -0
  8. package/attachment/useAttachmentAction/useAttachmentAction.d.ts +1 -1
  9. package/attachment/useAttachmentAction/useAttachmentAction.d.ts.map +1 -1
  10. package/attachment/useAttachmentAction/useAttachmentAction.js +25 -28
  11. package/attachments.js +2 -1
  12. package/catalog/application-credentials.d.ts +15 -0
  13. package/catalog/application-credentials.d.ts.map +1 -0
  14. package/catalog/application-credentials.js +28 -0
  15. package/catalog/catalog-derivations.d.ts +5 -3
  16. package/catalog/catalog-derivations.d.ts.map +1 -1
  17. package/catalog/catalog-derivations.js +13 -6
  18. package/catalog/catalog-entity-kind.d.ts +31 -0
  19. package/catalog/catalog-entity-kind.d.ts.map +1 -0
  20. package/catalog/catalog-entity-kind.js +21 -0
  21. package/catalog/catalog-preferences.d.ts +8 -0
  22. package/catalog/catalog-preferences.d.ts.map +1 -0
  23. package/catalog/catalog-preferences.js +5 -0
  24. package/catalog/create-publish-api.d.ts +3 -1
  25. package/catalog/create-publish-api.d.ts.map +1 -1
  26. package/catalog/create-publish-api.js +4 -0
  27. package/catalog/deployment-id.d.ts +13 -4
  28. package/catalog/deployment-id.d.ts.map +1 -1
  29. package/catalog/deployment-id.js +17 -3
  30. package/catalog/entity-details.d.ts +2 -0
  31. package/catalog/entity-details.d.ts.map +1 -1
  32. package/catalog/favorite-entity-type.d.ts +5 -0
  33. package/catalog/favorite-entity-type.d.ts.map +1 -0
  34. package/catalog/favorite-entity-type.js +10 -0
  35. package/catalog/map-deployment-limits-to-input.d.ts +4 -3
  36. package/catalog/map-deployment-limits-to-input.d.ts.map +1 -1
  37. package/catalog/map-deployment-limits-to-input.js +3 -4
  38. package/catalog/map-deployment-to-catalog-item.d.ts +12 -1
  39. package/catalog/map-deployment-to-catalog-item.d.ts.map +1 -1
  40. package/catalog/map-deployment-to-catalog-item.js +22 -15
  41. package/catalog/map-entity-details-to-catalog.d.ts.map +1 -1
  42. package/catalog/map-entity-details-to-catalog.js +69 -24
  43. package/catalog/map-skill-to-catalog-item.d.ts +4 -5
  44. package/catalog/map-skill-to-catalog-item.d.ts.map +1 -1
  45. package/catalog/map-skill-to-catalog-item.js +29 -38
  46. package/catalog/publish.d.ts +1 -1
  47. package/catalog/publish.d.ts.map +1 -1
  48. package/catalog/resource-folder.d.ts +8 -0
  49. package/catalog/resource-folder.d.ts.map +1 -0
  50. package/catalog/resource-folder.js +13 -0
  51. package/catalog/resource-name-conflict.d.ts +22 -0
  52. package/catalog/resource-name-conflict.d.ts.map +1 -0
  53. package/catalog/resource-name-conflict.js +32 -0
  54. package/catalog/resource-save-adapter.d.ts +36 -0
  55. package/catalog/resource-save-adapter.d.ts.map +1 -0
  56. package/catalog/resource-save-adapter.js +4 -0
  57. package/catalog/resource-save-adapters.d.ts +93 -0
  58. package/catalog/resource-save-adapters.d.ts.map +1 -0
  59. package/catalog/resource-save-adapters.js +116 -0
  60. package/catalog/resource-save.d.ts +76 -0
  61. package/catalog/resource-save.d.ts.map +1 -0
  62. package/catalog/resource-save.js +52 -0
  63. package/catalog/unpublishable-folders.d.ts +21 -0
  64. package/catalog/unpublishable-folders.d.ts.map +1 -0
  65. package/catalog/unpublishable-folders.js +21 -0
  66. package/catalog/usage-limit-rows.d.ts +14 -0
  67. package/catalog/usage-limit-rows.d.ts.map +1 -0
  68. package/catalog/usage-limit-rows.js +19 -0
  69. package/catalog/use-publish-history.d.ts +19 -0
  70. package/catalog/use-publish-history.d.ts.map +1 -0
  71. package/catalog/use-publish-history.js +25 -0
  72. package/catalog/useApplicationCredentialActions/useApplicationCredentialActions.d.ts +57 -0
  73. package/catalog/useApplicationCredentialActions/useApplicationCredentialActions.d.ts.map +1 -0
  74. package/catalog/useApplicationCredentialActions/useApplicationCredentialActions.js +67 -0
  75. package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.d.ts +23 -6
  76. package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.d.ts.map +1 -1
  77. package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +108 -107
  78. package/catalog/useCatalogItemDelete/useCatalogItemDelete.d.ts +41 -0
  79. package/catalog/useCatalogItemDelete/useCatalogItemDelete.d.ts.map +1 -0
  80. package/catalog/useCatalogItemDelete/useCatalogItemDelete.js +37 -0
  81. package/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.d.ts.map +1 -1
  82. package/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js +72 -77
  83. package/catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js +1 -1
  84. package/catalog/usePublishFolders/usePublishFolders.d.ts +8 -0
  85. package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
  86. package/catalog/usePublishFolders/usePublishFolders.js +32 -29
  87. package/catalog/useResourceFolders/useResourceFolders.d.ts +33 -0
  88. package/catalog/useResourceFolders/useResourceFolders.d.ts.map +1 -0
  89. package/catalog/useResourceFolders/useResourceFolders.js +58 -0
  90. package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts +64 -0
  91. package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -0
  92. package/catalog/useResourceSavePanel/useResourceSavePanel.js +173 -0
  93. package/catalog/useSkillItemDetails.js +3 -3
  94. package/catalog/useUnpublishConfirmation/useUnpublishConfirmation.d.ts +43 -0
  95. package/catalog/useUnpublishConfirmation/useUnpublishConfirmation.d.ts.map +1 -0
  96. package/catalog/useUnpublishConfirmation/useUnpublishConfirmation.js +46 -0
  97. package/catalog/useUnpublishableFolders/useUnpublishableFolders.d.ts +22 -0
  98. package/catalog/useUnpublishableFolders/useUnpublishableFolders.d.ts.map +1 -0
  99. package/catalog/useUnpublishableFolders/useUnpublishableFolders.js +53 -0
  100. package/catalog.js +41 -23
  101. package/conversation/conversation-data-source.d.ts +47 -0
  102. package/conversation/conversation-data-source.d.ts.map +1 -0
  103. package/conversation/conversation-data-source.js +11 -0
  104. package/conversation/conversation-draft/conversation-draft-store.d.ts +21 -0
  105. package/conversation/conversation-draft/conversation-draft-store.d.ts.map +1 -0
  106. package/conversation/conversation-draft/conversation-draft-store.js +84 -0
  107. package/conversation/conversation-draft/conversation-draft.d.ts +48 -0
  108. package/conversation/conversation-draft/conversation-draft.d.ts.map +1 -0
  109. package/conversation/conversation-list.d.ts +6 -0
  110. package/conversation/conversation-list.d.ts.map +1 -0
  111. package/conversation/conversation-list.js +5 -0
  112. package/conversation/conversation-title-stream.d.ts +33 -0
  113. package/conversation/conversation-title-stream.d.ts.map +1 -0
  114. package/conversation/conversation-title-stream.js +103 -0
  115. package/conversation/conversation-transfer/attachment-refs.d.ts +10 -2
  116. package/conversation/conversation-transfer/attachment-refs.d.ts.map +1 -1
  117. package/conversation/conversation-transfer/attachment-refs.js +31 -9
  118. package/conversation/conversation-transfer/export-conversation.d.ts +5 -1
  119. package/conversation/conversation-transfer/export-conversation.d.ts.map +1 -1
  120. package/conversation/conversation-transfer/export-conversation.js +19 -18
  121. package/conversation/conversation-transfer/import-conversation.d.ts +11 -6
  122. package/conversation/conversation-transfer/import-conversation.d.ts.map +1 -1
  123. package/conversation/conversation-transfer/import-conversation.js +65 -69
  124. package/conversation/conversation-transfer/progress.js +1 -1
  125. package/conversation/conversation-transfer/zip-export.js +1 -7
  126. package/conversation/conversation-transfer/zip-import.js +1 -1
  127. package/conversation/create-chat-stream-api.d.ts +24 -3
  128. package/conversation/create-chat-stream-api.d.ts.map +1 -1
  129. package/conversation/create-chat-stream-api.js +67 -56
  130. package/conversation/generation-registry.d.ts +30 -0
  131. package/conversation/generation-registry.d.ts.map +1 -0
  132. package/conversation/generation-registry.js +33 -0
  133. package/conversation/get-model-id-from-conversation-id.d.ts.map +1 -1
  134. package/conversation/get-model-id-from-conversation-id.js +1 -1
  135. package/conversation/message-utils.d.ts +6 -0
  136. package/conversation/message-utils.d.ts.map +1 -1
  137. package/conversation/message-utils.js +14 -10
  138. package/conversation/scheduled-task-grouping.d.ts +53 -0
  139. package/conversation/scheduled-task-grouping.d.ts.map +1 -0
  140. package/conversation/scheduled-task-grouping.js +45 -0
  141. package/conversation/useActiveConversationSync/useActiveConversationSync.d.ts +4 -2
  142. package/conversation/useActiveConversationSync/useActiveConversationSync.d.ts.map +1 -1
  143. package/conversation/useActiveConversationSync/useActiveConversationSync.js +19 -12
  144. package/conversation/useAttachmentUpload/useAttachmentUpload.d.ts.map +1 -1
  145. package/conversation/useAttachmentUpload/useAttachmentUpload.js +4 -1
  146. package/conversation/useConversationComposerDraft/useConversationComposerDraft.d.ts +39 -0
  147. package/conversation/useConversationComposerDraft/useConversationComposerDraft.d.ts.map +1 -0
  148. package/conversation/useConversationComposerDraft/useConversationComposerDraft.js +128 -0
  149. package/conversation/useConversationDiscovery/useConversationDiscovery.d.ts +22 -0
  150. package/conversation/useConversationDiscovery/useConversationDiscovery.d.ts.map +1 -0
  151. package/conversation/useConversationDiscovery/useConversationDiscovery.js +60 -0
  152. package/conversation/useConversationExport/useConversationExport.d.ts.map +1 -1
  153. package/conversation/useConversationExport/useConversationExport.js +113 -122
  154. package/conversation/useConversationHandlers/message-utils.js +2 -2
  155. package/conversation/useConversationHandlers/useConversationHandlers.js +41 -41
  156. package/conversation/useConversationImport/useConversationImport.js +24 -24
  157. package/conversation/useConversationPanelItems/useConversationPanelItems.d.ts +18 -5
  158. package/conversation/useConversationPanelItems/useConversationPanelItems.d.ts.map +1 -1
  159. package/conversation/useConversationPanelItems/useConversationPanelItems.js +34 -30
  160. package/conversation/useConversationScroll/useConversationScroll.d.ts.map +1 -1
  161. package/conversation/useConversationScroll/useConversationScroll.js +69 -72
  162. package/conversation/useConversationStream/conversation-path.js +2 -2
  163. package/conversation/useConversationStream/conversation-stream.types.d.ts +142 -0
  164. package/conversation/useConversationStream/conversation-stream.types.d.ts.map +1 -0
  165. package/conversation/useConversationStream/frame-scheduler.js +17 -17
  166. package/conversation/useConversationStream/generation-resume.d.ts +24 -2
  167. package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
  168. package/conversation/useConversationStream/generation-resume.js +110 -121
  169. package/conversation/useConversationStream/stream-errors.d.ts +10 -0
  170. package/conversation/useConversationStream/stream-errors.d.ts.map +1 -0
  171. package/conversation/useConversationStream/stream-errors.js +10 -0
  172. package/conversation/useConversationStream/stream-session.d.ts +51 -0
  173. package/conversation/useConversationStream/stream-session.d.ts.map +1 -0
  174. package/conversation/useConversationStream/stream-session.js +179 -0
  175. package/conversation/useConversationStream/useConversationReloadErrors.d.ts +25 -0
  176. package/conversation/useConversationStream/useConversationReloadErrors.d.ts.map +1 -0
  177. package/conversation/useConversationStream/useConversationReloadErrors.js +38 -0
  178. package/conversation/useConversationStream/useConversationStream.d.ts +3 -136
  179. package/conversation/useConversationStream/useConversationStream.d.ts.map +1 -1
  180. package/conversation/useConversationStream/useConversationStream.js +141 -325
  181. package/conversation/useConversationStream/useStopGeneration.d.ts +29 -0
  182. package/conversation/useConversationStream/useStopGeneration.d.ts.map +1 -0
  183. package/conversation/useConversationStream/useStopGeneration.js +48 -0
  184. package/conversation/useConversationStream/useStreamPathState.d.ts +39 -0
  185. package/conversation/useConversationStream/useStreamPathState.d.ts.map +1 -0
  186. package/conversation/useConversationStream/useStreamPathState.js +55 -0
  187. package/conversation/useConversationTitleEnrichmentController.d.ts +64 -0
  188. package/conversation/useConversationTitleEnrichmentController.d.ts.map +1 -0
  189. package/conversation/useConversationTitleEnrichmentController.js +155 -0
  190. package/conversation/useDeploymentChangeTracking.d.ts +14 -0
  191. package/conversation/useDeploymentChangeTracking.d.ts.map +1 -0
  192. package/conversation/useDeploymentChangeTracking.js +23 -0
  193. package/conversation/useEntityPreselection/useEntityPreselection.d.ts +108 -0
  194. package/conversation/useEntityPreselection/useEntityPreselection.d.ts.map +1 -0
  195. package/conversation/useEntityPreselection/useEntityPreselection.js +78 -0
  196. package/conversation/useMessageSelectionReply/useMessageSelectionReply.js +4 -10
  197. package/conversation/useTranscribeAudio/useTranscribeAudio.d.ts +8 -1
  198. package/conversation/useTranscribeAudio/useTranscribeAudio.d.ts.map +1 -1
  199. package/conversation/useTranscribeAudio/useTranscribeAudio.js +36 -27
  200. package/conversation/useVisibleConversationIdsReporter/useVisibleConversationIdsReporter.d.ts +16 -0
  201. package/conversation/useVisibleConversationIdsReporter/useVisibleConversationIdsReporter.d.ts.map +1 -0
  202. package/conversation/useVisibleConversationIdsReporter/useVisibleConversationIdsReporter.js +17 -0
  203. package/conversation-overlay.js +1 -2
  204. package/conversation-sources/stage-citations.d.ts +9 -0
  205. package/conversation-sources/stage-citations.d.ts.map +1 -0
  206. package/conversation-sources/stage-citations.js +8 -0
  207. package/conversation-sources/useConversationAnnotationPool/useConversationAnnotationPool.d.ts +4 -0
  208. package/conversation-sources/useConversationAnnotationPool/useConversationAnnotationPool.d.ts.map +1 -0
  209. package/conversation-sources/useConversationAnnotationPool/useConversationAnnotationPool.js +5 -0
  210. package/conversation-sources.js +3 -1
  211. package/conversation.js +45 -33
  212. package/entry-points/attachments.d.ts +1 -0
  213. package/entry-points/attachments.d.ts.map +1 -1
  214. package/entry-points/catalog.d.ts +17 -0
  215. package/entry-points/catalog.d.ts.map +1 -1
  216. package/entry-points/conversation-sources.d.ts +2 -0
  217. package/entry-points/conversation-sources.d.ts.map +1 -1
  218. package/entry-points/conversation.d.ts +13 -0
  219. package/entry-points/conversation.d.ts.map +1 -1
  220. package/entry-points/external-services.d.ts +6 -0
  221. package/entry-points/external-services.d.ts.map +1 -0
  222. package/entry-points/file-manager-canvas.d.ts +1 -0
  223. package/entry-points/file-manager-canvas.d.ts.map +1 -1
  224. package/entry-points/file-manager.d.ts +2 -0
  225. package/entry-points/file-manager.d.ts.map +1 -1
  226. package/entry-points/oauth.d.ts +1 -0
  227. package/entry-points/oauth.d.ts.map +1 -1
  228. package/entry-points/offline-credentials.d.ts +7 -0
  229. package/entry-points/offline-credentials.d.ts.map +1 -0
  230. package/entry-points/project.d.ts +20 -0
  231. package/entry-points/project.d.ts.map +1 -0
  232. package/entry-points/scheduled-tasks.d.ts +7 -0
  233. package/entry-points/scheduled-tasks.d.ts.map +1 -1
  234. package/entry-points/sharing.d.ts +4 -0
  235. package/entry-points/sharing.d.ts.map +1 -1
  236. package/entry-points/skill-editor.d.ts +2 -0
  237. package/entry-points/skill-editor.d.ts.map +1 -1
  238. package/entry-points/skills-state.d.ts +1 -0
  239. package/entry-points/skills-state.d.ts.map +1 -1
  240. package/entry-points/usage-limits.d.ts +9 -0
  241. package/entry-points/usage-limits.d.ts.map +1 -0
  242. package/entry-points/utils.d.ts +6 -0
  243. package/entry-points/utils.d.ts.map +1 -1
  244. package/entry-points/viewport-layout.d.ts +1 -0
  245. package/entry-points/viewport-layout.d.ts.map +1 -1
  246. package/external-services/useExternalServiceLogin.d.ts +99 -0
  247. package/external-services/useExternalServiceLogin.d.ts.map +1 -0
  248. package/external-services/useExternalServiceLogin.js +93 -0
  249. package/external-services.d.ts +2 -0
  250. package/external-services.js +5 -0
  251. package/file-manager-canvas.js +3 -2
  252. package/file-manager.js +32 -30
  253. package/files/attachment-canvas.d.ts +12 -0
  254. package/files/attachment-canvas.d.ts.map +1 -1
  255. package/files/attachment-canvas.js +18 -10
  256. package/files/attachment-dto-to-display.d.ts.map +1 -1
  257. package/files/attachment-dto-to-display.js +13 -12
  258. package/files/attachment-types.js +1 -1
  259. package/files/browser-download.d.ts +9 -0
  260. package/files/browser-download.d.ts.map +1 -0
  261. package/files/browser-download.js +23 -0
  262. package/files/create-files-api.d.ts +3 -4
  263. package/files/create-files-api.d.ts.map +1 -1
  264. package/files/create-files-api.js +1 -1
  265. package/files/create-upload-file-with-progress.d.ts +21 -1
  266. package/files/create-upload-file-with-progress.d.ts.map +1 -1
  267. package/files/create-upload-file-with-progress.js +50 -34
  268. package/files/dial-file-manager-copy-move.util.d.ts.map +1 -1
  269. package/files/dial-file-manager-copy-move.util.js +28 -28
  270. package/files/dial-file-manager-mapping.util.d.ts +23 -3
  271. package/files/dial-file-manager-mapping.util.d.ts.map +1 -1
  272. package/files/dial-file-manager-mapping.util.js +97 -69
  273. package/files/dial-file-manager.types.d.ts +15 -5
  274. package/files/dial-file-manager.types.d.ts.map +1 -1
  275. package/files/dial-file-to-attachment.js +3 -3
  276. package/files/dial-file.d.ts +19 -0
  277. package/files/dial-file.d.ts.map +1 -1
  278. package/files/dial-file.js +20 -12
  279. package/files/dial-files-api.d.ts +2 -2
  280. package/files/dial-files-api.d.ts.map +1 -1
  281. package/files/download-progress.d.ts +33 -0
  282. package/files/download-progress.d.ts.map +1 -0
  283. package/files/download-progress.js +28 -0
  284. package/files/source-content.js +1 -1
  285. package/files/useDialFileListing/useDialFileListing.d.ts.map +1 -1
  286. package/files/useDialFileListing/useDialFileListing.js +97 -109
  287. package/files/useDialFileManager/useDialFileManager.d.ts.map +1 -1
  288. package/files/useDialFileManager/useDialFileManager.js +5 -2
  289. package/files/useDialFileManagerSections/useDialFileManagerSections.d.ts.map +1 -1
  290. package/files/useDialFileManagerSections/useDialFileManagerSections.js +59 -68
  291. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +1 -1
  292. package/files/useDialFileMetadata/useDialFileMetadata.js +3 -3
  293. package/files/useDialFileMutations/useDialFileMutations.d.ts +9 -0
  294. package/files/useDialFileMutations/useDialFileMutations.d.ts.map +1 -1
  295. package/files/useDialFileMutations/useDialFileMutations.js +232 -159
  296. package/files/useDialFilePreview/useDialFilePreview.d.ts +33 -0
  297. package/files/useDialFilePreview/useDialFilePreview.d.ts.map +1 -0
  298. package/files/useDialFilePreview/useDialFilePreview.js +45 -0
  299. package/files/useDialFileUploadBatch/useDialFileUploadBatch.d.ts.map +1 -1
  300. package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +114 -103
  301. package/files/useFileAttachmentModalState/useFileAttachmentModalState.d.ts +25 -0
  302. package/files/useFileAttachmentModalState/useFileAttachmentModalState.d.ts.map +1 -0
  303. package/files/useFileAttachmentModalState/useFileAttachmentModalState.js +19 -0
  304. package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +2 -2
  305. package/files/useUnshareConfirmationState/useUnshareConfirmationState.d.ts +23 -0
  306. package/files/useUnshareConfirmationState/useUnshareConfirmationState.d.ts.map +1 -0
  307. package/files/useUnshareConfirmationState/useUnshareConfirmationState.js +18 -0
  308. package/index.d.ts +96 -0
  309. package/index.d.ts.map +1 -1
  310. package/index.js +244 -149
  311. package/mcp-apps/mcp-apps-api-client.d.ts.map +1 -1
  312. package/mcp-apps/mcp-apps-api-client.js +18 -17
  313. package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.d.ts +3 -2
  314. package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.d.ts.map +1 -1
  315. package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +28 -10
  316. package/mcp-apps/useMcpAppTools/useMcpAppTools.d.ts.map +1 -1
  317. package/mcp-apps/useMcpAppTools/useMcpAppTools.js +45 -45
  318. package/oauth/authorize-url.d.ts +7 -1
  319. package/oauth/authorize-url.d.ts.map +1 -1
  320. package/oauth/authorize-url.js +14 -4
  321. package/oauth/callback-exchange.d.ts +49 -0
  322. package/oauth/callback-exchange.d.ts.map +1 -0
  323. package/oauth/callback-exchange.js +29 -0
  324. package/oauth/handshake.js +3 -10
  325. package/oauth/models.d.ts +25 -0
  326. package/oauth/models.d.ts.map +1 -1
  327. package/oauth/popup.d.ts.map +1 -1
  328. package/oauth/popup.js +19 -17
  329. package/oauth/toolset-id.d.ts +7 -0
  330. package/oauth/toolset-id.d.ts.map +1 -1
  331. package/oauth/toolset-id.js +9 -2
  332. package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.d.ts.map +1 -1
  333. package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.js +41 -42
  334. package/oauth/useToolsetLogin/useToolsetLogin.d.ts +7 -1
  335. package/oauth/useToolsetLogin/useToolsetLogin.d.ts.map +1 -1
  336. package/oauth/useToolsetLogin/useToolsetLogin.js +51 -42
  337. package/oauth.js +9 -8
  338. package/offline-credentials/map-offline-credentials-response.d.ts +20 -0
  339. package/offline-credentials/map-offline-credentials-response.d.ts.map +1 -0
  340. package/offline-credentials/map-offline-credentials-response.js +17 -0
  341. package/offline-credentials/scheduled-tasks-login-banner.d.ts +31 -0
  342. package/offline-credentials/scheduled-tasks-login-banner.d.ts.map +1 -0
  343. package/offline-credentials/scheduled-tasks-login-banner.js +17 -0
  344. package/offline-credentials/useOfflineCredentialsAuth/useOfflineCredentialsAuth.d.ts +58 -0
  345. package/offline-credentials/useOfflineCredentialsAuth/useOfflineCredentialsAuth.d.ts.map +1 -0
  346. package/offline-credentials/useOfflineCredentialsAuth/useOfflineCredentialsAuth.js +37 -0
  347. package/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.d.ts +61 -0
  348. package/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.d.ts.map +1 -0
  349. package/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.js +37 -0
  350. package/offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin.d.ts +28 -0
  351. package/offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin.d.ts.map +1 -0
  352. package/offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin.js +29 -0
  353. package/offline-credentials.d.ts +2 -0
  354. package/offline-credentials.js +7 -0
  355. package/package.json +49 -25
  356. package/project/create-project-chat.d.ts +34 -0
  357. package/project/create-project-chat.d.ts.map +1 -0
  358. package/project/create-project-chat.js +27 -0
  359. package/project/project-conversation-data-source.d.ts +36 -0
  360. package/project/project-conversation-data-source.d.ts.map +1 -0
  361. package/project/project-conversation-data-source.js +67 -0
  362. package/project/project-events.d.ts +14 -0
  363. package/project/project-events.d.ts.map +1 -0
  364. package/project/project-events.js +25 -0
  365. package/project/project-file-preview.d.ts +32 -0
  366. package/project/project-file-preview.d.ts.map +1 -0
  367. package/project/project-file-preview.js +25 -0
  368. package/project/project-form-errors.d.ts +23 -0
  369. package/project/project-form-errors.d.ts.map +1 -0
  370. package/project/project-form-errors.js +46 -0
  371. package/project/project-limits.d.ts +17 -0
  372. package/project/project-limits.d.ts.map +1 -0
  373. package/project/project-limits.js +11 -0
  374. package/project/project-mapping.d.ts +16 -0
  375. package/project/project-mapping.d.ts.map +1 -0
  376. package/project/project-mapping.js +43 -0
  377. package/project/project-refresh.d.ts +12 -0
  378. package/project/project-refresh.d.ts.map +1 -0
  379. package/project/project-refresh.js +6 -0
  380. package/project/project-viewed-marks.d.ts +9 -0
  381. package/project/project-viewed-marks.d.ts.map +1 -0
  382. package/project/project-viewed-marks.js +8 -0
  383. package/project/project-watch-stream.d.ts +26 -0
  384. package/project/project-watch-stream.d.ts.map +1 -0
  385. package/project/project-watch-stream.js +39 -0
  386. package/project/projects-api-client.d.ts +179 -0
  387. package/project/projects-api-client.d.ts.map +1 -0
  388. package/project/projects-api-client.js +90 -0
  389. package/project/use-pinned-project-chats.d.ts +58 -0
  390. package/project/use-pinned-project-chats.d.ts.map +1 -0
  391. package/project/use-pinned-project-chats.js +269 -0
  392. package/project/use-project-actions.d.ts +53 -0
  393. package/project/use-project-actions.d.ts.map +1 -0
  394. package/project/use-project-actions.js +92 -0
  395. package/project/use-project-artifacts.d.ts +24 -0
  396. package/project/use-project-artifacts.d.ts.map +1 -0
  397. package/project/use-project-artifacts.js +78 -0
  398. package/project/use-project-conversations.d.ts +32 -0
  399. package/project/use-project-conversations.d.ts.map +1 -0
  400. package/project/use-project-conversations.js +200 -0
  401. package/project/use-project-draft.d.ts +46 -0
  402. package/project/use-project-draft.d.ts.map +1 -0
  403. package/project/use-project-draft.js +54 -0
  404. package/project/use-project-file-preview.d.ts +47 -0
  405. package/project/use-project-file-preview.d.ts.map +1 -0
  406. package/project/use-project-file-preview.js +50 -0
  407. package/project/use-project-submit.d.ts +49 -0
  408. package/project/use-project-submit.d.ts.map +1 -0
  409. package/project/use-project-submit.js +73 -0
  410. package/project/use-project-watch.d.ts +24 -0
  411. package/project/use-project-watch.d.ts.map +1 -0
  412. package/project/use-project-watch.js +41 -0
  413. package/project/use-project.d.ts +23 -0
  414. package/project/use-project.d.ts.map +1 -0
  415. package/project/use-project.js +73 -0
  416. package/project/use-projects.d.ts +27 -0
  417. package/project/use-projects.d.ts.map +1 -0
  418. package/project/use-projects.js +92 -0
  419. package/project.d.ts +2 -0
  420. package/project.js +20 -0
  421. package/prompt/prompt.d.ts +11 -0
  422. package/prompt/prompt.d.ts.map +1 -1
  423. package/prompt/prompt.js +7 -3
  424. package/scheduled-task/active-scheduled-task.d.ts +58 -0
  425. package/scheduled-task/active-scheduled-task.d.ts.map +1 -0
  426. package/scheduled-task/active-scheduled-task.js +18 -0
  427. package/scheduled-task/check-scheduled-task-auth-session-error.d.ts +27 -0
  428. package/scheduled-task/check-scheduled-task-auth-session-error.d.ts.map +1 -0
  429. package/scheduled-task/check-scheduled-task-auth-session-error.js +17 -0
  430. package/scheduled-task/scheduled-task-description.d.ts +2 -0
  431. package/scheduled-task/scheduled-task-description.d.ts.map +1 -1
  432. package/scheduled-task/scheduled-task-description.js +33 -24
  433. package/scheduled-task/scheduled-task-display.d.ts +106 -0
  434. package/scheduled-task/scheduled-task-display.d.ts.map +1 -0
  435. package/scheduled-task/scheduled-task-display.js +69 -0
  436. package/scheduled-task/scheduled-task-next-occurrence.d.ts +9 -0
  437. package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -0
  438. package/scheduled-task/scheduled-task-next-occurrence.js +20 -0
  439. package/scheduled-task/scheduled-task-preparation.d.ts +1 -1
  440. package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
  441. package/scheduled-task/scheduled-task-trigger.js +75 -48
  442. package/scheduled-task/use-scheduled-task-runs.js +19 -31
  443. package/scheduled-task/use-scheduled-tasks.d.ts +2 -2
  444. package/scheduled-task/use-scheduled-tasks.js +1 -1
  445. package/scheduled-task/useActiveScheduledTaskDetails.d.ts +18 -0
  446. package/scheduled-task/useActiveScheduledTaskDetails.d.ts.map +1 -0
  447. package/scheduled-task/useActiveScheduledTaskDetails.js +40 -0
  448. package/scheduled-task/useScheduledTaskSkillDisplayNames/useScheduledTaskSkillDisplayNames.d.ts +17 -0
  449. package/scheduled-task/useScheduledTaskSkillDisplayNames/useScheduledTaskSkillDisplayNames.d.ts.map +1 -0
  450. package/scheduled-task/useScheduledTaskSkillDisplayNames/useScheduledTaskSkillDisplayNames.js +29 -0
  451. package/scheduled-task/useStartScheduledTask.d.ts +41 -0
  452. package/scheduled-task/useStartScheduledTask.d.ts.map +1 -0
  453. package/scheduled-task/useStartScheduledTask.js +169 -0
  454. package/scheduled-tasks.js +13 -6
  455. package/scroll-anchoring.js +1 -2
  456. package/share-invitation/models.d.ts +46 -0
  457. package/share-invitation/models.d.ts.map +1 -0
  458. package/share-invitation/share-invitation-error.d.ts +6 -0
  459. package/share-invitation/share-invitation-error.d.ts.map +1 -0
  460. package/share-invitation/share-invitation-error.js +37 -0
  461. package/share-invitation/types.d.ts +10 -0
  462. package/share-invitation/types.d.ts.map +1 -0
  463. package/share-invitation/types.js +6 -0
  464. package/share-invitation/useAcceptShareInvitation/useAcceptShareInvitation.d.ts +9 -0
  465. package/share-invitation/useAcceptShareInvitation/useAcceptShareInvitation.d.ts.map +1 -0
  466. package/share-invitation/useAcceptShareInvitation/useAcceptShareInvitation.js +26 -0
  467. package/shared/application-schema.js +3 -3
  468. package/shared/client-channel.d.ts +53 -0
  469. package/shared/client-channel.d.ts.map +1 -0
  470. package/shared/client-channel.js +6 -0
  471. package/shared/cron-day-of-month.js +10 -10
  472. package/shared/external-services.d.ts +1 -1
  473. package/shared/locale.d.ts +6 -2
  474. package/shared/locale.d.ts.map +1 -1
  475. package/shared/locale.js +4 -4
  476. package/shared/read-sse-events.d.ts +10 -0
  477. package/shared/read-sse-events.d.ts.map +1 -0
  478. package/shared/read-sse-events.js +33 -0
  479. package/shared/serialized-writer.d.ts +12 -0
  480. package/shared/serialized-writer.d.ts.map +1 -0
  481. package/shared/serialized-writer.js +44 -0
  482. package/shared/sleep.d.ts +3 -0
  483. package/shared/sleep.d.ts.map +1 -0
  484. package/shared/sleep.js +13 -0
  485. package/shared/theme-colors.d.ts +16 -0
  486. package/shared/theme-colors.d.ts.map +1 -0
  487. package/shared/theme-colors.js +14 -0
  488. package/shared/url-cleanup.d.ts +18 -0
  489. package/shared/url-cleanup.d.ts.map +1 -0
  490. package/shared/url-cleanup.js +18 -0
  491. package/shared/usage-stat.d.ts +3 -0
  492. package/shared/usage-stat.d.ts.map +1 -0
  493. package/shared/usage-stat.js +4 -0
  494. package/shared/useAppVersionCheck/useAppVersionCheck.d.ts +22 -0
  495. package/shared/useAppVersionCheck/useAppVersionCheck.d.ts.map +1 -0
  496. package/shared/useAppVersionCheck/useAppVersionCheck.js +36 -0
  497. package/shared/usePersistedState/usePersistedState.d.ts +28 -0
  498. package/shared/usePersistedState/usePersistedState.d.ts.map +1 -0
  499. package/shared/usePersistedState/usePersistedState.js +24 -0
  500. package/sharing.js +5 -2
  501. package/signin-interrupt/models.d.ts +48 -0
  502. package/signin-interrupt/models.d.ts.map +1 -0
  503. package/signin-interrupt/signin-row-info.d.ts +10 -0
  504. package/signin-interrupt/signin-row-info.d.ts.map +1 -0
  505. package/signin-interrupt/signin-row-info.js +21 -0
  506. package/signin-interrupt/types.d.ts +28 -0
  507. package/signin-interrupt/types.d.ts.map +1 -0
  508. package/signin-interrupt/types.js +10 -0
  509. package/signin-interrupt/useSigninInterrupt/useSigninInterrupt.d.ts +52 -0
  510. package/signin-interrupt/useSigninInterrupt/useSigninInterrupt.d.ts.map +1 -0
  511. package/signin-interrupt/useSigninInterrupt/useSigninInterrupt.js +270 -0
  512. package/skill/skill-file-batch-validation.d.ts +4 -0
  513. package/skill/skill-file-batch-validation.d.ts.map +1 -1
  514. package/skill/skill-file-batch-validation.js +34 -33
  515. package/skill/skill-lookup.d.ts +20 -0
  516. package/skill/skill-lookup.d.ts.map +1 -0
  517. package/skill/skill-lookup.js +12 -0
  518. package/skill/skill-types.js +1 -1
  519. package/skill/skill.d.ts +5 -1
  520. package/skill/skill.d.ts.map +1 -1
  521. package/skill/skill.js +27 -28
  522. package/skill/useSkillArchiveImport/useSkillArchiveImport.js +1 -7
  523. package/skill/useSkillEditorSubmit.d.ts +15 -1
  524. package/skill/useSkillEditorSubmit.d.ts.map +1 -1
  525. package/skill/useSkillEditorSubmit.js +164 -87
  526. package/skill/useSkillFileActions.d.ts +2 -0
  527. package/skill/useSkillFileActions.d.ts.map +1 -1
  528. package/skill/useSkillFileActions.js +36 -21
  529. package/skill-editor/useSkillFilePreviewSyncController.d.ts +41 -0
  530. package/skill-editor/useSkillFilePreviewSyncController.d.ts.map +1 -0
  531. package/skill-editor/useSkillFilePreviewSyncController.js +58 -0
  532. package/skill-editor/useSkillFileSystemPicker/useSkillFileSystemPicker.d.ts +23 -0
  533. package/skill-editor/useSkillFileSystemPicker/useSkillFileSystemPicker.d.ts.map +1 -0
  534. package/skill-editor/useSkillFileSystemPicker/useSkillFileSystemPicker.js +43 -0
  535. package/skill-editor.js +11 -9
  536. package/skills-state.js +3 -2
  537. package/source-content.js +1 -2
  538. package/usage/map-usage-data-to-dashboard.d.ts +1 -16
  539. package/usage/map-usage-data-to-dashboard.d.ts.map +1 -1
  540. package/usage/map-user-usage-to-model-limits.d.ts.map +1 -1
  541. package/usage/map-user-usage-to-model-limits.js +24 -24
  542. package/usage/usage-banner-source.d.ts +24 -0
  543. package/usage/usage-banner-source.d.ts.map +1 -0
  544. package/usage/usage-banner-source.js +61 -0
  545. package/usage/usage-gauge.d.ts +3 -0
  546. package/usage/usage-gauge.d.ts.map +1 -0
  547. package/usage/usage-gauge.js +4 -0
  548. package/usage/usage-period.d.ts +7 -0
  549. package/usage/usage-period.d.ts.map +1 -0
  550. package/usage/usage-period.js +6 -0
  551. package/usage/usage-reset-time.d.ts +78 -0
  552. package/usage/usage-reset-time.d.ts.map +1 -0
  553. package/usage/usage-reset-time.js +82 -0
  554. package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts +56 -0
  555. package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts.map +1 -0
  556. package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.js +34 -0
  557. package/usage/useRefreshUsageAfterGeneration/useRefreshUsageAfterGeneration.d.ts +16 -0
  558. package/usage/useRefreshUsageAfterGeneration/useRefreshUsageAfterGeneration.d.ts.map +1 -0
  559. package/usage/useRefreshUsageAfterGeneration/useRefreshUsageAfterGeneration.js +14 -0
  560. package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts +58 -0
  561. package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts.map +1 -0
  562. package/usage/useUsageLimitBanner/useUsageLimitBanner.js +70 -0
  563. package/usage/useUsageLimitBannerDismissal/useUsageLimitBannerDismissal.d.ts +14 -0
  564. package/usage/useUsageLimitBannerDismissal/useUsageLimitBannerDismissal.d.ts.map +1 -0
  565. package/usage/useUsageLimitBannerDismissal/useUsageLimitBannerDismissal.js +19 -0
  566. package/usage-limits.d.ts +2 -0
  567. package/usage-limits.js +10 -0
  568. package/useChatSettingsFormConfig/useChatSettingsFormConfig.d.ts +2 -0
  569. package/useChatSettingsFormConfig/useChatSettingsFormConfig.d.ts.map +1 -1
  570. package/useChatSettingsFormConfig/useChatSettingsFormConfig.js +25 -21
  571. package/usePageFileDrag/usePageFileDrag.js +3 -3
  572. package/useShareLink/useShareLink.d.ts.map +1 -1
  573. package/useShareLink/useShareLink.js +18 -17
  574. package/utils.js +23 -17
  575. package/viewport-layout/canvas-width.d.ts +39 -0
  576. package/viewport-layout/canvas-width.d.ts.map +1 -0
  577. package/viewport-layout/canvas-width.js +23 -0
  578. package/viewport-layout.js +2 -1
@@ -0,0 +1,200 @@
1
+ import { applyViewedMark as e } from "./project-viewed-marks.js";
2
+ import { useCallback as t, useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
3
+ //#region src/project/use-project-conversations.ts
4
+ var o = 20, s = 100, c = {
5
+ rows: [],
6
+ visibleCount: o,
7
+ isLoading: !0,
8
+ hasError: !1,
9
+ isLoadingMore: !1
10
+ }, l = {
11
+ ...c,
12
+ isLoading: !1
13
+ }, u = (t, n) => t.map((t) => {
14
+ let { id: r, name: i, title: a, author: o, isTitlePending: s } = t;
15
+ return {
16
+ id: r,
17
+ name: i,
18
+ title: a,
19
+ authorName: o,
20
+ isTitlePending: s === !0,
21
+ ...e(n, t) ? { isUnread: !0 } : {}
22
+ };
23
+ }), d = (e, t) => {
24
+ if (t.length === 0) return e;
25
+ let n = new Map(t.map((e) => [e.id, e]));
26
+ return e.map((e) => n.get(e.id) ?? e);
27
+ }, f = ({ id: e, title: t, authorName: n, isUnread: r }) => ({
28
+ id: e,
29
+ title: t,
30
+ authorName: n,
31
+ ...r ? { isUnread: !0 } : {}
32
+ }), p = (e, p) => {
33
+ let [m, h] = a(c), [g, _] = a(0), v = i(null), y = i(null), b = i(!1), x = i(/* @__PURE__ */ new Map()), S = i(/* @__PURE__ */ new Map()), C = i(m);
34
+ n(() => {
35
+ C.current = m;
36
+ });
37
+ let w = t((e) => {
38
+ for (let { id: t, updatedAt: n } of e) S.current.set(t, n);
39
+ }, []), T = t(async (t, n) => {
40
+ if (p == null) return [];
41
+ let r = t.filter((e) => e.isTitlePending).map((e) => e.name), i = [];
42
+ for (let t = 0; t < r.length; t += s) {
43
+ let { items: a } = await e.getProjectConversationTitles(p, r.slice(t, t + s), n);
44
+ i.push(...a);
45
+ }
46
+ return w(i), u(i, x.current);
47
+ }, [
48
+ e,
49
+ p,
50
+ w
51
+ ]), E = t(async (e, t, n) => {
52
+ try {
53
+ let r = await T(e.slice(0, t), n);
54
+ if (n.aborted) return;
55
+ h((e) => ({
56
+ ...e,
57
+ rows: d(e.rows, r)
58
+ }));
59
+ } catch {}
60
+ }, [T]);
61
+ n(() => {
62
+ if (x.current = /* @__PURE__ */ new Map(), S.current = /* @__PURE__ */ new Map(), p == null) {
63
+ h(l);
64
+ return;
65
+ }
66
+ let t = new AbortController();
67
+ return v.current = t, (async () => {
68
+ h((e) => ({
69
+ ...e,
70
+ isLoading: !0,
71
+ hasError: !1,
72
+ isLoadingMore: !1
73
+ }));
74
+ try {
75
+ let { items: n } = await e.listProjectConversations(p, t.signal);
76
+ if (t.signal.aborted) return;
77
+ w(n), h({
78
+ ...l,
79
+ rows: u(n, x.current)
80
+ });
81
+ } catch {
82
+ if (t.signal.aborted) return;
83
+ h({
84
+ ...l,
85
+ hasError: !0
86
+ });
87
+ }
88
+ })(), () => {
89
+ t.abort(), y.current?.abort();
90
+ };
91
+ }, [
92
+ e,
93
+ p,
94
+ g,
95
+ w
96
+ ]);
97
+ let D = t(() => _((e) => e + 1), []), O = t(async () => {
98
+ let e = v.current, t = C.current;
99
+ if (p == null || e == null || b.current) return;
100
+ b.current = !0;
101
+ let n = t.visibleCount + o, r = t.rows.slice(t.visibleCount, n);
102
+ h((e) => ({
103
+ ...e,
104
+ isLoadingMore: !0
105
+ }));
106
+ try {
107
+ let t = await T(r, e.signal);
108
+ if (e.signal.aborted) return;
109
+ h((e) => ({
110
+ ...e,
111
+ rows: d(e.rows, t),
112
+ visibleCount: Math.max(e.visibleCount, n),
113
+ isLoadingMore: !1
114
+ }));
115
+ } catch (t) {
116
+ if (e.signal.aborted) return;
117
+ throw h((e) => ({
118
+ ...e,
119
+ isLoadingMore: !1
120
+ })), t;
121
+ } finally {
122
+ b.current = !1;
123
+ }
124
+ }, [p, T]), k = t(async () => {
125
+ let t = C.current;
126
+ if (p == null || t.isLoading || t.hasError) return;
127
+ y.current?.abort();
128
+ let n = new AbortController();
129
+ y.current = n;
130
+ let r;
131
+ try {
132
+ let { items: t } = await e.listProjectConversations(p, n.signal);
133
+ if (n.signal.aborted) return;
134
+ w(t), r = u(t, x.current);
135
+ } catch {
136
+ return;
137
+ }
138
+ h((e) => ({
139
+ ...e,
140
+ rows: r
141
+ })), await E(r, C.current.visibleCount, n.signal);
142
+ }, [
143
+ e,
144
+ E,
145
+ p,
146
+ w
147
+ ]);
148
+ n(() => () => y.current?.abort(), []);
149
+ let A = t((t) => {
150
+ x.current.set(t, S.current.get(t)), h((e) => ({
151
+ ...e,
152
+ rows: e.rows.map((e) => e.id === t && e.isUnread ? {
153
+ ...e,
154
+ isUnread: !1
155
+ } : e)
156
+ })), (async () => {
157
+ try {
158
+ await e.markProjectConversationViewed?.(t);
159
+ } catch {}
160
+ })();
161
+ }, [e]), j = t(async (t, n) => {
162
+ let { name: r } = await e.renameProjectConversation(t, n);
163
+ h((e) => ({
164
+ ...e,
165
+ rows: e.rows.map((e) => e.id === t ? {
166
+ ...e,
167
+ title: r,
168
+ isTitlePending: !1
169
+ } : e)
170
+ }));
171
+ }, [e]), M = t(async (t) => {
172
+ let { name: n } = await e.generateProjectConversationTitle(t);
173
+ return n;
174
+ }, [e]), N = t(async (t) => {
175
+ await e.deleteProjectConversation(t);
176
+ let { rows: n, visibleCount: r } = C.current, i = n.filter((e) => e.id !== t);
177
+ h((e) => ({
178
+ ...e,
179
+ rows: e.rows.filter((e) => e.id !== t)
180
+ }));
181
+ let a = v.current;
182
+ a != null && E(i, r, a.signal);
183
+ }, [e, E]), { rows: P, visibleCount: F, isLoading: I, hasError: L, isLoadingMore: R } = m;
184
+ return {
185
+ items: r(() => P.slice(0, F).map(f), [P, F]),
186
+ isLoading: I,
187
+ hasError: L,
188
+ hasMore: F < P.length,
189
+ isLoadingMore: R,
190
+ retry: D,
191
+ loadMore: O,
192
+ rename: j,
193
+ generateTitle: M,
194
+ remove: N,
195
+ refresh: k,
196
+ markViewed: A
197
+ };
198
+ };
199
+ //#endregion
200
+ export { p as useProjectConversations };
@@ -0,0 +1,46 @@
1
+ import { ProjectDetailsDto } from '@epam/ai-dial-chat-api-client';
2
+ import { ProjectContextFile, ProjectCreateFormErrors, ProjectCreateFormValues } from '@epam/ai-dial-projects';
3
+ import { Dispatch, SetStateAction } from 'react';
4
+ /** Which project form a {@link useProjectDraft} draft backs. */
5
+ export declare enum ProjectDraftMode {
6
+ /** The New project form: empty at the start, nothing stored yet. */
7
+ Create = "create",
8
+ /** The Edit project form: seeded from a loaded project. */
9
+ Edit = "edit"
10
+ }
11
+ /** Mode of a {@link useProjectDraft} draft, and the loaded project of an edit draft. */
12
+ export type UseProjectDraftOptions = {
13
+ /** The New project form. */
14
+ mode: ProjectDraftMode.Create;
15
+ } | {
16
+ /** The Edit project form. */
17
+ mode: ProjectDraftMode.Edit;
18
+ /** The loaded project, or `null` while none is; the draft is seeded once per its `contentVersion`. */
19
+ project: ProjectDetailsDto | null;
20
+ };
21
+ /** State and handlers of a project form draft. */
22
+ export interface UseProjectDraftResult {
23
+ /** Name and instructions as typed. */
24
+ values: ProjectCreateFormValues;
25
+ /** The form's context file cards: stored files (edit mode) and files added in this session. */
26
+ contextFiles: ProjectContextFile[];
27
+ /** Field errors the host set, e.g. from a rejected request. */
28
+ errors: ProjectCreateFormErrors;
29
+ /** Sets the field errors, for a rejection the host maps to a field. */
30
+ setErrors: Dispatch<SetStateAction<ProjectCreateFormErrors>>;
31
+ /** Changes one text field; a change to the name clears its error. */
32
+ onFieldChange: <K extends keyof ProjectCreateFormValues>(field: K, value: ProjectCreateFormValues[K]) => void;
33
+ /** Replaces the context file cards and clears the context error. */
34
+ onContextFilesChange: (files: ProjectContextFile[]) => void;
35
+ /** Whether the draft is ready to submit: always in create mode, once seeded from the loaded project in edit mode. */
36
+ isSeeded: boolean;
37
+ /** Whether the draft holds edits that leaving would discard. */
38
+ isDirty: boolean;
39
+ /** Names of stored files the user removed (edit mode); empty in create mode. */
40
+ removedFileNames: string[];
41
+ /** Files added in this session, not yet stored. */
42
+ newFiles: File[];
43
+ }
44
+ /** Owns the form state of the New project and Edit project pages: values, context files, field errors, dirtiness, and the removed and new files a save sends. */
45
+ export declare const useProjectDraft: (options: UseProjectDraftOptions) => UseProjectDraftResult;
46
+ //# sourceMappingURL=use-project-draft.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-project-draft.d.ts","sourceRoot":"","sources":["../../src/project/use-project-draft.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAKL,KAAK,QAAQ,EACb,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAGf,gEAAgE;AAChE,oBAAY,gBAAgB;IAC1B,oEAAoE;IACpE,MAAM,WAAW;IACjB,2DAA2D;IAC3D,IAAI,SAAS;CACd;AAED,wFAAwF;AACxF,MAAM,MAAM,sBAAsB,GAC9B;IACE,4BAA4B;IAC5B,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC;CAC/B,GACD;IACE,6BAA6B;IAC7B,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAC5B,sGAAsG;IACtG,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACnC,CAAC;AAEN,kDAAkD;AAClD,MAAM,WAAW,qBAAqB;IACpC,sCAAsC;IACtC,MAAM,EAAE,uBAAuB,CAAC;IAChC,+FAA+F;IAC/F,YAAY,EAAE,kBAAkB,EAAE,CAAC;IACnC,+DAA+D;IAC/D,MAAM,EAAE,uBAAuB,CAAC;IAChC,uEAAuE;IACvE,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAC7D,qEAAqE;IACrE,aAAa,EAAE,CAAC,CAAC,SAAS,MAAM,uBAAuB,EACrD,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,uBAAuB,CAAC,CAAC,CAAC,KAC9B,IAAI,CAAC;IACV,oEAAoE;IACpE,oBAAoB,EAAE,CAAC,KAAK,EAAE,kBAAkB,EAAE,KAAK,IAAI,CAAC;IAC5D,qHAAqH;IACrH,QAAQ,EAAE,OAAO,CAAC;IAClB,gEAAgE;IAChE,OAAO,EAAE,OAAO,CAAC;IACjB,gFAAgF;IAChF,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,mDAAmD;IACnD,QAAQ,EAAE,IAAI,EAAE,CAAC;CAClB;AAKD,iKAAiK;AACjK,eAAO,MAAM,eAAe,GAC1B,SAAS,sBAAsB,KAC9B,qBA4FF,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { mapStoredContextFiles as e } from "./project-mapping.js";
2
+ import { useCallback as t, useEffect as n, useMemo as r, useState as i } from "react";
3
+ import { isStoredContextFile as a } from "@epam/ai-dial-projects";
4
+ //#region src/project/use-project-draft.ts
5
+ var o = /* @__PURE__ */ function(e) {
6
+ return e.Create = "create", e.Edit = "edit", e;
7
+ }({}), s = {
8
+ name: "",
9
+ instructions: ""
10
+ }, c = [], l = (o) => {
11
+ let l = o.mode === "edit" ? o.project : null, u = o.mode === "edit", [d, f] = i(s), [p, m] = i(c), [h, g] = i({}), [_, v] = i(null);
12
+ n(() => {
13
+ u && l != null && l.contentVersion !== _ && (f({
14
+ name: l.name,
15
+ instructions: l.instructions
16
+ }), m(e(l)), g({}), v(l.contentVersion));
17
+ }, [
18
+ u,
19
+ l,
20
+ _
21
+ ]);
22
+ let y = r(() => {
23
+ if (l == null) return [];
24
+ let e = new Set(p.filter(a).map((e) => e.name));
25
+ return l.contextFiles.map((e) => e.name).filter((t) => !e.has(t));
26
+ }, [l, p]), b = r(() => p.flatMap((e) => a(e) ? [] : [e.file]), [p]), x = !u || l != null && _ === l.contentVersion, S = u ? l != null && x && (d.name !== l.name || d.instructions !== l.instructions || y.length > 0 || b.length > 0) : d.name !== "" || d.instructions !== "" || p.length > 0;
27
+ return {
28
+ values: d,
29
+ contextFiles: p,
30
+ errors: h,
31
+ setErrors: g,
32
+ onFieldChange: t((e, t) => {
33
+ f((n) => ({
34
+ ...n,
35
+ [e]: t
36
+ })), e === "name" && g((e) => e.name ? {
37
+ ...e,
38
+ name: void 0
39
+ } : e);
40
+ }, []),
41
+ onContextFilesChange: t((e) => {
42
+ m(e), g((e) => e.context ? {
43
+ ...e,
44
+ context: void 0
45
+ } : e);
46
+ }, []),
47
+ isSeeded: x,
48
+ isDirty: S,
49
+ removedFileNames: y,
50
+ newFiles: b
51
+ };
52
+ };
53
+ //#endregion
54
+ export { o as ProjectDraftMode, l as useProjectDraft };
@@ -0,0 +1,47 @@
1
+ import { DisplayAttachment } from '@epam/ai-dial-chat-shared';
2
+ import { ProjectFileDownloadUrlResolver } from './project-file-preview';
3
+ /** Tells whether the request that produced a result may still show it; `false` once a newer request superseded it. */
4
+ export type ProjectPreviewCommitGuard = () => boolean;
5
+ /** Opens an attachment in the host's canvas under a key, showing it only while the guard allows; the host's `openAttachmentCanvas` fits. */
6
+ export type OpenProjectPreviewAttachment = (attachment: DisplayAttachment, canvasAttachmentId: string, shouldCommit: ProjectPreviewCommitGuard) => unknown;
7
+ /** Host canvas operations and card lookups for the project file preview. */
8
+ export interface UseProjectFilePreviewOptions {
9
+ /** Id of the project the page shows, or a fixed value before it exists; it keeps one file name in two projects apart. */
10
+ scope: string;
11
+ /** Id of the attachment the canvas holds now, or `undefined` when it is closed. */
12
+ attachmentId: string | undefined;
13
+ /** Opens an attachment in the canvas under a key. */
14
+ openAttachment: OpenProjectPreviewAttachment;
15
+ /** Closes the canvas. */
16
+ closeCanvas: () => void;
17
+ /** Starts a canvas request and returns the guard that says whether it is still the latest. */
18
+ startRequest: () => ProjectPreviewCommitGuard;
19
+ /** Returns the attachment to open for a context card id, or `undefined` for a card the page does not hold; it should keep its identity while the cards are unchanged. */
20
+ resolveContextAttachment: (cardId: string) => DisplayAttachment | undefined;
21
+ /** Returns the attachment to open for an output name; omit it where outputs are not shown. */
22
+ resolveOutputAttachment?: (name: string) => DisplayAttachment | undefined;
23
+ /** Resolves a stored file's locator to its download URL; when omitted, only files added in this session download. */
24
+ resolveDownloadUrl?: ProjectFileDownloadUrlResolver;
25
+ }
26
+ /** Selection state and stable card callbacks of the project file preview. */
27
+ export interface UseProjectFilePreviewResult {
28
+ /** Card id of the open project file, an output's card id included, or `undefined` when none of this scope is open. */
29
+ selectedCardId: string | undefined;
30
+ /** Card id of the open context file; `undefined` while an output or nothing is open. */
31
+ selectedContextFileId: string | undefined;
32
+ /** Name of the open output; `undefined` while a context file or nothing is open. */
33
+ selectedOutputName: string | undefined;
34
+ /** Opens a context card, or closes the canvas when that card is already open. */
35
+ onContextFileClick: (cardId: string) => void;
36
+ /** Opens an output, or closes the canvas when that output is already open. */
37
+ onOutputClick: (name: string) => void;
38
+ /** Downloads a context card's file without opening it in the canvas. */
39
+ onContextFileDownload: (cardId: string) => void;
40
+ /** Closes the canvas when the open context card is no longer among the page's cards. */
41
+ closeIfRemoved: (cards: readonly {
42
+ id: string;
43
+ }[]) => void;
44
+ }
45
+ /** Opens project files in the host's attachment canvas for the New project, Edit project and project view pages, deriving the selected card from the canvas. */
46
+ export declare const useProjectFilePreview: ({ scope, attachmentId, openAttachment, closeCanvas, startRequest, resolveContextAttachment, resolveOutputAttachment, resolveDownloadUrl, }: UseProjectFilePreviewOptions) => UseProjectFilePreviewResult;
47
+ //# sourceMappingURL=use-project-file-preview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-project-file-preview.d.ts","sourceRoot":"","sources":["../../src/project/use-project-file-preview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EAIL,KAAK,8BAA8B,EAGpC,MAAM,wBAAwB,CAAC;AAEhC,sHAAsH;AACtH,MAAM,MAAM,yBAAyB,GAAG,MAAM,OAAO,CAAC;AAEtD,4IAA4I;AAC5I,MAAM,MAAM,4BAA4B,GAAG,CACzC,UAAU,EAAE,iBAAiB,EAC7B,kBAAkB,EAAE,MAAM,EAC1B,YAAY,EAAE,yBAAyB,KACpC,OAAO,CAAC;AAEb,4EAA4E;AAC5E,MAAM,WAAW,4BAA4B;IAC3C,yHAAyH;IACzH,KAAK,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,qDAAqD;IACrD,cAAc,EAAE,4BAA4B,CAAC;IAC7C,yBAAyB;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,8FAA8F;IAC9F,YAAY,EAAE,MAAM,yBAAyB,CAAC;IAC9C,yKAAyK;IACzK,wBAAwB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,iBAAiB,GAAG,SAAS,CAAC;IAC5E,8FAA8F;IAC9F,uBAAuB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,iBAAiB,GAAG,SAAS,CAAC;IAC1E,qHAAqH;IACrH,kBAAkB,CAAC,EAAE,8BAA8B,CAAC;CACrD;AAED,6EAA6E;AAC7E,MAAM,WAAW,2BAA2B;IAC1C,sHAAsH;IACtH,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,wFAAwF;IACxF,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,oFAAoF;IACpF,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,iFAAiF;IACjF,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,8EAA8E;IAC9E,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,wEAAwE;IACxE,qBAAqB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,wFAAwF;IACxF,cAAc,EAAE,CAAC,KAAK,EAAE,SAAS;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,IAAI,CAAC;CAC5D;AAED,gKAAgK;AAChK,eAAO,MAAM,qBAAqB,GAAI,4IASnC,4BAA4B,KAAG,2BAuFjC,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { downloadProjectFileAttachment as e, fromProjectOutputCardId as t, fromProjectPreviewKey as n, toProjectOutputCardId as r, toProjectPreviewKey as i } from "./project-file-preview.js";
2
+ import { useCallback as a } from "react";
3
+ //#region src/project/use-project-file-preview.ts
4
+ var o = ({ scope: o, attachmentId: s, openAttachment: c, closeCanvas: l, startRequest: u, resolveContextAttachment: d, resolveOutputAttachment: f, resolveDownloadUrl: p }) => {
5
+ let m = n(o, s), h = t(m), g = h == null ? m : void 0;
6
+ return {
7
+ selectedCardId: m,
8
+ selectedContextFileId: g,
9
+ selectedOutputName: h,
10
+ onContextFileClick: a((e) => {
11
+ if (e === g) {
12
+ l();
13
+ return;
14
+ }
15
+ let t = d(e);
16
+ t && c(t, i(o, e), u());
17
+ }, [
18
+ l,
19
+ c,
20
+ d,
21
+ o,
22
+ g,
23
+ u
24
+ ]),
25
+ onOutputClick: a((e) => {
26
+ if (e === h) {
27
+ l();
28
+ return;
29
+ }
30
+ let t = f?.(e);
31
+ t && c(t, i(o, r(e)), u());
32
+ }, [
33
+ l,
34
+ c,
35
+ f,
36
+ o,
37
+ h,
38
+ u
39
+ ]),
40
+ onContextFileDownload: a((t) => {
41
+ let n = d(t);
42
+ n && e(n, p);
43
+ }, [d, p]),
44
+ closeIfRemoved: a((e) => {
45
+ g != null && !e.some((e) => e.id === g) && l();
46
+ }, [l, g])
47
+ };
48
+ };
49
+ //#endregion
50
+ export { o as useProjectFilePreview };
@@ -0,0 +1,49 @@
1
+ import { CreateProjectResponseDto, UpdateProjectResponseDto } from '@epam/ai-dial-chat-api-client';
2
+ import { ProjectFields, ProjectsApiClient, ProjectUpdateRequest } from './projects-api-client';
3
+ /** A rejected create or save, normalised for the page. */
4
+ export interface ProjectSubmitFailure {
5
+ /** `true` when the page unmounted mid-request; nothing should be shown. */
6
+ isAborted: boolean;
7
+ /** HTTP status of the rejection. */
8
+ status?: number;
9
+ /** The BFF's `ProjectCreateErrorCode`, when the rejection carried one. */
10
+ code?: string;
11
+ /** Trace id for the error toast. */
12
+ requestId?: string;
13
+ }
14
+ /** Result of one {@link useCreateProject} `create` call. */
15
+ export type CreateProjectOutcome = {
16
+ isCreated: true;
17
+ project: CreateProjectResponseDto;
18
+ } | ({
19
+ isCreated: false;
20
+ } & ProjectSubmitFailure);
21
+ /** Result of one {@link useSaveProject} `save` call. */
22
+ export type SaveProjectOutcome = {
23
+ isSaved: true;
24
+ project: UpdateProjectResponseDto;
25
+ } | ({
26
+ isSaved: false;
27
+ } & ProjectSubmitFailure);
28
+ /**
29
+ * Submits the New project form; the page owns the form state and decides
30
+ * what each outcome means.
31
+ *
32
+ * @param client - Configured project requests, from `createProjectsApiClient`.
33
+ */
34
+ export declare const useCreateProject: (client: Pick<ProjectsApiClient, "createProject">) => {
35
+ create: (fields: ProjectFields, files: File[]) => Promise<CreateProjectOutcome>;
36
+ isSubmitting: boolean;
37
+ };
38
+ /**
39
+ * Submits the Edit project form as one atomic update, conditioned on the
40
+ * loaded `contentVersion`; the page owns the draft and decides what each
41
+ * outcome means.
42
+ *
43
+ * @param client - Configured project requests, from `createProjectsApiClient`.
44
+ */
45
+ export declare const useSaveProject: (client: Pick<ProjectsApiClient, "updateProject">) => {
46
+ save: (request: ProjectUpdateRequest) => Promise<SaveProjectOutcome>;
47
+ isSubmitting: boolean;
48
+ };
49
+ //# sourceMappingURL=use-project-submit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-project-submit.d.ts","sourceRoot":"","sources":["../../src/project/use-project-submit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAE/B,0DAA0D;AAC1D,MAAM,WAAW,oBAAoB;IACnC,2EAA2E;IAC3E,SAAS,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,4DAA4D;AAC5D,MAAM,MAAM,oBAAoB,GAC5B;IAAE,SAAS,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,wBAAwB,CAAA;CAAE,GACtD,CAAC;IAAE,SAAS,EAAE,KAAK,CAAA;CAAE,GAAG,oBAAoB,CAAC,CAAC;AAElD,wDAAwD;AACxD,MAAM,MAAM,kBAAkB,GAC1B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,wBAAwB,CAAA;CAAE,GACpD,CAAC;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,GAAG,oBAAoB,CAAC,CAAC;AAkDhD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC;qBAMpC,aAAa,SACd,IAAI,EAAE,KACZ,OAAO,CAAC,oBAAoB,CAAC;;CAYnC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC;oBAK9B,oBAAoB,KAAG,OAAO,CAAC,kBAAkB,CAAC;;CAYrE,CAAC"}
@@ -0,0 +1,73 @@
1
+ import { getApiErrorDetails as e } from "../api-error/api-error.js";
2
+ import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
3
+ //#region src/project/use-project-submit.ts
4
+ var a = () => {
5
+ let [a, o] = i(!1), s = r(null);
6
+ return n(() => () => {
7
+ s.current?.abort();
8
+ }, []), {
9
+ run: t(async (t) => {
10
+ s.current?.abort();
11
+ let n = new AbortController();
12
+ s.current = n, o(!0);
13
+ try {
14
+ return {
15
+ isOk: !0,
16
+ value: await t(n.signal)
17
+ };
18
+ } catch (t) {
19
+ if (n.signal.aborted) return {
20
+ isOk: !1,
21
+ isAborted: !0
22
+ };
23
+ let { status: r, code: i, traceId: a } = await e(t);
24
+ return {
25
+ isOk: !1,
26
+ isAborted: !1,
27
+ status: r,
28
+ code: i,
29
+ requestId: a
30
+ };
31
+ } finally {
32
+ n.signal.aborted || o(!1), s.current === n && (s.current = null);
33
+ }
34
+ }, []),
35
+ isSubmitting: a
36
+ };
37
+ }, o = (e) => {
38
+ let { run: n, isSubmitting: r } = a();
39
+ return {
40
+ create: t(async (t, r) => {
41
+ let i = await n((n) => e.createProject(t, r, n));
42
+ if (i.isOk) return {
43
+ isCreated: !0,
44
+ project: i.value
45
+ };
46
+ let { isOk: a, ...o } = i;
47
+ return {
48
+ isCreated: !1,
49
+ ...o
50
+ };
51
+ }, [e, n]),
52
+ isSubmitting: r
53
+ };
54
+ }, s = (e) => {
55
+ let { run: n, isSubmitting: r } = a();
56
+ return {
57
+ save: t(async (t) => {
58
+ let r = await n((n) => e.updateProject(t, n));
59
+ if (r.isOk) return {
60
+ isSaved: !0,
61
+ project: r.value
62
+ };
63
+ let { isOk: i, ...a } = r;
64
+ return {
65
+ isSaved: !1,
66
+ ...a
67
+ };
68
+ }, [e, n]),
69
+ isSubmitting: r
70
+ };
71
+ };
72
+ //#endregion
73
+ export { o as useCreateProject, s as useSaveProject };
@@ -0,0 +1,24 @@
1
+ import { ProjectsApiClient } from './projects-api-client';
2
+ /** What `useProjectWatch` reports to the page that shows one project. */
3
+ export interface ProjectWatchOptions {
4
+ /** The loaded snapshot's aggregate ETag; the watch opens once it is known, and an event carrying it is skipped. */
5
+ etag: string | undefined;
6
+ /** Silent refresh of everything the page shows; at most one runs at a time, and a rejection is ignored. */
7
+ onChange: () => Promise<void>;
8
+ /** The project was deleted elsewhere; called at most once per project id. */
9
+ onDelete: () => void;
10
+ }
11
+ /**
12
+ * Keeps a page showing one project current: it watches that project, runs
13
+ * `onChange` for each change the page has not loaded yet — one at a time,
14
+ * plus one trailing run for whatever arrived meanwhile — and `onDelete` once
15
+ * when the project is deleted. A dropped stream is reopened with a bounded
16
+ * backoff and followed by one `onChange`; a watch that cannot be opened is
17
+ * not retried for the rest of the visit.
18
+ *
19
+ * @param client - Configured project requests, from `createProjectsApiClient`; it must be referentially stable, because a new object resubscribes.
20
+ * @param projectId - The watched project's DIAL id, or `null` while none is known.
21
+ * @param options - The loaded ETag and the page's callbacks; read at event time, so new identities never resubscribe.
22
+ */
23
+ export declare const useProjectWatch: (client: Pick<ProjectsApiClient, "watchProjects">, projectId: string | null, options: ProjectWatchOptions) => void;
24
+ //# sourceMappingURL=use-project-watch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-project-watch.d.ts","sourceRoot":"","sources":["../../src/project/use-project-watch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,yEAAyE;AACzE,MAAM,WAAW,mBAAmB;IAClC,mHAAmH;IACnH,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,2GAA2G;IAC3G,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,GAC1B,QAAQ,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC,EAChD,WAAW,MAAM,GAAG,IAAI,EACxB,SAAS,mBAAmB,KAC3B,IAwEF,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { runProjectWatch as e } from "./project-watch-stream.js";
2
+ import { ProjectWatchAction as t } from "@epam/ai-dial-chat-api-client";
3
+ import { useEffect as n, useRef as r } from "react";
4
+ //#region src/project/use-project-watch.ts
5
+ var i = (i, a, o) => {
6
+ let s = r(o);
7
+ n(() => {
8
+ s.current = o;
9
+ });
10
+ let c = r(null), l = o.etag != null, { watchProjects: u } = i;
11
+ n(() => {
12
+ if (u == null || a == null || !l || c.current === a) return;
13
+ let n = new AbortController(), r = !1, i = !1, o = () => {
14
+ n.signal.aborted || (r ? i = !0 : (r = !0, (async () => {
15
+ try {
16
+ await s.current.onChange();
17
+ } catch {} finally {
18
+ r = !1, i && (i = !1, o());
19
+ }
20
+ })()));
21
+ };
22
+ return e({
23
+ watchProjects: u,
24
+ ids: [a],
25
+ signal: n.signal,
26
+ onEvent: (e) => {
27
+ e.id !== a || n.signal.aborted || (e.action === t.Delete ? (i = !1, n.abort(), s.current.onDelete()) : (e.etag == null || e.etag !== s.current.etag) && o());
28
+ },
29
+ onReconnected: o,
30
+ onUnavailable: () => {
31
+ c.current = a;
32
+ }
33
+ }), () => n.abort();
34
+ }, [
35
+ u,
36
+ a,
37
+ l
38
+ ]);
39
+ };
40
+ //#endregion
41
+ export { i as useProjectWatch };
@@ -0,0 +1,23 @@
1
+ import { ProjectDetailsDto } from '@epam/ai-dial-chat-api-client';
2
+ import { ProjectRefreshOutcome } from './project-refresh';
3
+ import { ProjectsApiClient } from './projects-api-client';
4
+ /**
5
+ * Loads one project's details. Loading is derived from whether a result
6
+ * answers the current id and reload token, so a page never renders a stale
7
+ * project for a new id. A `404` is a not-found result, every other failure an
8
+ * error; the request is aborted on unmount and on an id change. `refresh`
9
+ * re-reads the loaded project without the loading state, for live updates.
10
+ *
11
+ * @param client - Configured project requests, from `createProjectsApiClient`; it must be referentially stable, because a new object reloads.
12
+ * @param id - The project's DIAL id, or `null` when the route names none.
13
+ * @param enabled - Whether the page is enabled; no request is sent while `false`.
14
+ */
15
+ export declare const useProject: (client: Pick<ProjectsApiClient, "getProject">, id: string | null, enabled: boolean) => {
16
+ project: ProjectDetailsDto | null;
17
+ isLoading: boolean;
18
+ hasError: boolean;
19
+ isNotFound: boolean;
20
+ retry: () => void;
21
+ refresh: () => Promise<ProjectRefreshOutcome>;
22
+ };
23
+ //# sourceMappingURL=use-project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-project.d.ts","sourceRoot":"","sources":["../../src/project/use-project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAU/D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,GACrB,QAAQ,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,EAC7C,IAAI,MAAM,GAAG,IAAI,EACjB,SAAS,OAAO;;;;;;mBA2CsB,OAAO,CAAC,qBAAqB,CAAC;CA8BrE,CAAC"}