local-operator-ui 0.12.4 → 0.12.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/LICENSE +21 -619
  2. package/README.md +3 -2
  3. package/out/main/index.jsc +0 -0
  4. package/out/preload/index.jsc +0 -0
  5. package/out/renderer/assets/{_basePickBy-D-mTy0T7.js → _basePickBy-DBXIOr3H.js} +2 -2
  6. package/out/renderer/assets/{_baseUniq-CVF81xU9.js → _baseUniq-oNXXu8rx.js} +1 -1
  7. package/out/renderer/assets/{arc-BcZxubla.js → arc-dIUhH0vy.js} +1 -1
  8. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-0JBfW8n9.js → architectureDiagram-IEHRJDOE-CcEvEu2C.js} +7 -7
  9. package/out/renderer/assets/{blockDiagram-JOT3LUYC-DIjqxpHX.js → blockDiagram-JOT3LUYC-D5O4-oIj.js} +5 -5
  10. package/out/renderer/assets/{c4Diagram-VJAJSXHY-B8ZTZ0n8.js → c4Diagram-VJAJSXHY-BQMfKd4Q.js} +2 -2
  11. package/out/renderer/assets/{channel-BQBOXiqs.js → channel-L1pqeWuA.js} +1 -1
  12. package/out/renderer/assets/{chunk-4BMEZGHF-BCTXK4C0.js → chunk-4BMEZGHF-tTF-v-04.js} +1 -1
  13. package/out/renderer/assets/{chunk-A2AXSNBT-Dt4gXQBd.js → chunk-A2AXSNBT-BQYMyLBf.js} +2 -2
  14. package/out/renderer/assets/{chunk-AEK57VVT-CAAj-J2-.js → chunk-AEK57VVT-SRljeQZu.js} +2 -2
  15. package/out/renderer/assets/{chunk-D6G4REZN-_hQRwF7v.js → chunk-D6G4REZN-BBcVBD5t.js} +1 -1
  16. package/out/renderer/assets/{chunk-RZ5BOZE2-Vl3-h4SG.js → chunk-RZ5BOZE2-DoaOrKfk.js} +1 -1
  17. package/out/renderer/assets/{chunk-XZIHB7SX-C61iNqnQ.js → chunk-XZIHB7SX-CH_ugfxe.js} +1 -1
  18. package/out/renderer/assets/{classDiagram-GIVACNV2-CNcNWb-o.js → classDiagram-GIVACNV2-BuM30Dyp.js} +3 -3
  19. package/out/renderer/assets/{classDiagram-v2-COTLJTTW-CNcNWb-o.js → classDiagram-v2-COTLJTTW-BuM30Dyp.js} +3 -3
  20. package/out/renderer/assets/{clone-D4Ah0_EU.js → clone-CXK5mu5e.js} +1 -1
  21. package/out/renderer/assets/{dagre-OKDRZEBW-DZOFGtWs.js → dagre-OKDRZEBW-BThe-2D6.js} +6 -6
  22. package/out/renderer/assets/{diagram-SSKATNLV-DGVbLzJc.js → diagram-SSKATNLV-YOJrQHY2.js} +6 -6
  23. package/out/renderer/assets/{diagram-VNBRO52H-DUz0a2Uz.js → diagram-VNBRO52H-BXqgQ9w2.js} +6 -6
  24. package/out/renderer/assets/{erDiagram-Q7BY3M3F-CfYzgE98.js → erDiagram-Q7BY3M3F-IPUKaKH3.js} +3 -3
  25. package/out/renderer/assets/{flowDiagram-4HSFHLVR-tRJWBVYd.js → flowDiagram-4HSFHLVR-B3925mvz.js} +3 -3
  26. package/out/renderer/assets/{ganttDiagram-APWFNJXF-BWG5VLyZ.js → ganttDiagram-APWFNJXF-CKJIfiAY.js} +1 -1
  27. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-Cd11pFbi.js → gitGraphDiagram-7IBYFJ6S-OlXFREtF.js} +7 -7
  28. package/out/renderer/assets/{graph-P5xyWsnt.js → graph-keTJV7XL.js} +2 -2
  29. package/out/renderer/assets/{index-CtrEBFNz.js → index-DNeKpvUS.js} +1 -1
  30. package/out/renderer/assets/{index-B4xrtp2Z.js → index-DyaU6iOA.js} +1 -1
  31. package/out/renderer/assets/{index-C4NwO8de.js → index-Dz6TzBEG.js} +229 -128
  32. package/out/renderer/assets/{infoDiagram-PH2N3AL5-KjJg15gx.js → infoDiagram-PH2N3AL5-DWMqI59j.js} +5 -5
  33. package/out/renderer/assets/{journeyDiagram-U35MCT3I-Dp2FVK6h.js → journeyDiagram-U35MCT3I-BcJ33bp0.js} +3 -3
  34. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-cttuutf_.js → kanban-definition-NDS4AKOZ-vzPmig7Y.js} +1 -1
  35. package/out/renderer/assets/{layout-Bep2Ed3s.js → layout-BFWSU6s_.js} +4 -4
  36. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-DiLxGufv.js → mindmap-definition-ALO5MXBD-O9uBlpHL.js} +1 -1
  37. package/out/renderer/assets/{pieDiagram-IB7DONF6-C7Crt4gw.js → pieDiagram-IB7DONF6-hEnot0FH.js} +7 -7
  38. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-BMbHGD_6.js → quadrantDiagram-7GDLP6J5-3Xr8RuV3.js} +1 -1
  39. package/out/renderer/assets/{radar-MK3ICKWK-BIBBEO8S.js → radar-MK3ICKWK-CZU5BhvW.js} +4 -4
  40. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-BumPivJk.js → requirementDiagram-KVF5MWMF-epT_iBII.js} +2 -2
  41. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-D1LzUzj2.js → sankeyDiagram-QLVOVGJD-DGEieYSJ.js} +1 -1
  42. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-CwnYTtil.js → sequenceDiagram-X6HHIX6F-C-26csWS.js} +3 -3
  43. package/out/renderer/assets/{stateDiagram-DGXRK772-4yXBR_vP.js → stateDiagram-DGXRK772-CeyZGI_q.js} +7 -7
  44. package/out/renderer/assets/{stateDiagram-v2-YXO3MK2T-6p7BdIAB.js → stateDiagram-v2-YXO3MK2T-Bcz2S6_5.js} +3 -3
  45. package/out/renderer/assets/{timeline-definition-BDJGKUSR-CCdgMyc-.js → timeline-definition-BDJGKUSR-Db8O4iZL.js} +2 -2
  46. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-DD0agc1N.js → xychartDiagram-VJFVF3MP-Dw2GxLel.js} +1 -1
  47. package/out/renderer/index.html +1 -1
  48. package/package.json +11 -38
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-CtrEBFNz.js","./fonts-DqkQ6BY5.js","./fonts-CM-VN_uu.css","./index-B4xrtp2Z.js","./pug-By0kVCfm.js","./javascript-C3MnDRiU.js","./dagre-OKDRZEBW-DZOFGtWs.js","./graph-P5xyWsnt.js","./_baseUniq-CVF81xU9.js","./layout-Bep2Ed3s.js","./_basePickBy-D-mTy0T7.js","./clone-D4Ah0_EU.js","./c4Diagram-VJAJSXHY-B8ZTZ0n8.js","./chunk-D6G4REZN-_hQRwF7v.js","./flowDiagram-4HSFHLVR-tRJWBVYd.js","./chunk-RZ5BOZE2-Vl3-h4SG.js","./channel-BQBOXiqs.js","./erDiagram-Q7BY3M3F-CfYzgE98.js","./gitGraphDiagram-7IBYFJ6S-Cd11pFbi.js","./chunk-4BMEZGHF-BCTXK4C0.js","./chunk-XZIHB7SX-C61iNqnQ.js","./radar-MK3ICKWK-BIBBEO8S.js","./ganttDiagram-APWFNJXF-BWG5VLyZ.js","./infoDiagram-PH2N3AL5-KjJg15gx.js","./pieDiagram-IB7DONF6-C7Crt4gw.js","./arc-BcZxubla.js","./quadrantDiagram-7GDLP6J5-BMbHGD_6.js","./xychartDiagram-VJFVF3MP-DD0agc1N.js","./requirementDiagram-KVF5MWMF-BumPivJk.js","./sequenceDiagram-X6HHIX6F-CwnYTtil.js","./classDiagram-GIVACNV2-CNcNWb-o.js","./chunk-A2AXSNBT-Dt4gXQBd.js","./classDiagram-v2-COTLJTTW-CNcNWb-o.js","./stateDiagram-DGXRK772-4yXBR_vP.js","./chunk-AEK57VVT-CAAj-J2-.js","./stateDiagram-v2-YXO3MK2T-6p7BdIAB.js","./journeyDiagram-U35MCT3I-Dp2FVK6h.js","./timeline-definition-BDJGKUSR-CCdgMyc-.js","./mindmap-definition-ALO5MXBD-DiLxGufv.js","./cytoscape.esm-C0AOj4uS.js","./kanban-definition-NDS4AKOZ-cttuutf_.js","./sankeyDiagram-QLVOVGJD-D1LzUzj2.js","./diagram-VNBRO52H-DUz0a2Uz.js","./diagram-SSKATNLV-DGVbLzJc.js","./blockDiagram-JOT3LUYC-DIjqxpHX.js","./architectureDiagram-IEHRJDOE-0JBfW8n9.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-DNeKpvUS.js","./fonts-DqkQ6BY5.js","./fonts-CM-VN_uu.css","./index-DyaU6iOA.js","./pug-By0kVCfm.js","./javascript-C3MnDRiU.js","./dagre-OKDRZEBW-BThe-2D6.js","./graph-keTJV7XL.js","./_baseUniq-oNXXu8rx.js","./layout-BFWSU6s_.js","./_basePickBy-DBXIOr3H.js","./clone-CXK5mu5e.js","./c4Diagram-VJAJSXHY-BQMfKd4Q.js","./chunk-D6G4REZN-BBcVBD5t.js","./flowDiagram-4HSFHLVR-B3925mvz.js","./chunk-RZ5BOZE2-DoaOrKfk.js","./channel-L1pqeWuA.js","./erDiagram-Q7BY3M3F-IPUKaKH3.js","./gitGraphDiagram-7IBYFJ6S-OlXFREtF.js","./chunk-4BMEZGHF-tTF-v-04.js","./chunk-XZIHB7SX-CH_ugfxe.js","./radar-MK3ICKWK-CZU5BhvW.js","./ganttDiagram-APWFNJXF-CKJIfiAY.js","./infoDiagram-PH2N3AL5-DWMqI59j.js","./pieDiagram-IB7DONF6-hEnot0FH.js","./arc-dIUhH0vy.js","./quadrantDiagram-7GDLP6J5-3Xr8RuV3.js","./xychartDiagram-VJFVF3MP-Dw2GxLel.js","./requirementDiagram-KVF5MWMF-epT_iBII.js","./sequenceDiagram-X6HHIX6F-C-26csWS.js","./classDiagram-GIVACNV2-BuM30Dyp.js","./chunk-A2AXSNBT-BQYMyLBf.js","./classDiagram-v2-COTLJTTW-BuM30Dyp.js","./stateDiagram-DGXRK772-CeyZGI_q.js","./chunk-AEK57VVT-SRljeQZu.js","./stateDiagram-v2-YXO3MK2T-Bcz2S6_5.js","./journeyDiagram-U35MCT3I-BcJ33bp0.js","./timeline-definition-BDJGKUSR-Db8O4iZL.js","./mindmap-definition-ALO5MXBD-O9uBlpHL.js","./cytoscape.esm-C0AOj4uS.js","./kanban-definition-NDS4AKOZ-vzPmig7Y.js","./sankeyDiagram-QLVOVGJD-DGEieYSJ.js","./diagram-VNBRO52H-BXqgQ9w2.js","./diagram-SSKATNLV-YOJrQHY2.js","./blockDiagram-JOT3LUYC-D5O4-oIj.js","./architectureDiagram-IEHRJDOE-CcEvEu2C.js"])))=>i.map(i=>d[i]);
2
2
  import { i as createStyled, l as resolveProps, m as useTheme, n as useTheme$1, r as reactExports, o as React, p as useEnhancedEffect$1, q as clsx, t as useForkRef$1, v as extendSxProp, j as jsxRuntimeExports, w as handleBreakpoints, x as resolveBreakpointValues, y as createUnarySpacing, z as deepmerge, A as mergeBreakpointsInOrder, F as composeClasses$1, G as generateUtilityClass$1, I as createTheme$1, J as getValue$1, h as React$1, K as requireReactDom, g as getDefaultExportFromCjs, L as defaultTheme$2, M as THEME_ID, N as generateUtilityClasses$1, O as useDefaultProps, s as styled$1, P as capitalize$1, Q as memoTheme, _ as _inheritsLoose, S as _objectWithoutPropertiesLoose$k, U as TransitionGroupContext, V as _extends$w, W as duration, u as useTheme$2, X as useTimeout$1, Y as useId$1, Z as ButtonBase, b as alpha$1, $ as createSimplePaletteValueFilter, a0 as CircularProgress, a1 as Paper, a2 as darken$1, a3 as lighten$1, a4 as useEventCallback$1, a5 as useRtl, a6 as globalCss, a7 as formatMuiErrorMessage$1, a8 as rootShouldForwardProp, T as Typography, a9 as css$1, k as keyframes, aa as getPath$2, ab as isFocusVisible, ac as typographyClasses, ad as slotShouldForwardProp, ae as clamp$1, af as emphasize, ag as Timeout$1, c as createLucideIcon, a as Button, B as Box, ah as FontAwesomeIcon, ai as faExclamationTriangle, D as DEFAULT_THEME, aj as faChevronLeft, ak as faChevronRight, al as faRobot, am as faCheck, an as faTimes, ao as faEraser, ap as faPen, aq as faFileImport, ar as faUpload, as as GlobalStyles, at as requireReact, au as faComment, av as faSave, aw as faEdit, ax as faTrashAlt, ay as faInfoCircle, az as faGear, aA as faPlus, aB as faServer, aC as faStar, aD as faTag, aE as faIdCard, aF as faCalendarAlt, aG as faCodeBranch, aH as faShieldAlt, aI as faArrowLeft, aJ as faClock, C as Code, aK as faHome, aL as faDownload, aM as faFileAlt, aN as faDesktop, aO as faImage, aP as faMusic, aQ as faVideo, aR as faLaptop, aS as faUsers, aT as faDatabase, aU as faBoxOpen, aV as faBook, aW as faHdd, aX as faBox, aY as faArchive, aZ as faNetworkWired, a_ as faFolder, a$ as faFolderOpen, b0 as faFolderTree, b1 as faFile, b2 as faCode, b3 as faSliders, b4 as faTrash, b5 as faArrowDown, b6 as faPaperclip, b7 as faPaperPlane, b8 as faExclamationCircle, b9 as faChevronDown, ba as isDevelopmentMode, bb as faCommentSlash, bc as faArrowRight, bd as faBrain, be as faWandMagicSparkles, bf as faExternalLinkAlt, bg as faKey, bh as radientTheme, bi as faGlobe, bj as faSearch, bk as PropTypes, bl as shouldForwardProp, bm as TransitionGroup, bn as commonjsGlobal, bo as faLock, bp as faPuzzlePiece, H as HardDrive, bq as faSignOut, br as themes$1, bs as faMoon, bt as faSun, bu as faHexagonNodes, bv as faSkull, bw as faLeaf, bx as faMountain, by as faFire, bz as faIcicles, bA as faBolt, bB as faAdjust, bC as faWaveSquare, bD as faUser, bE as faEnvelope, bF as faHistory, bG as faListAlt, bH as faCreditCard, bI as faPlusCircle, bJ as faChartLine, bK as faShield, bL as library$1, bM as icons$1, f as CssBaseline, e as ThemeProvider$1, d as getTheme, R as ReactDOM$1, E as ErrorBoundary } from "./fonts-DqkQ6BY5.js";
3
3
  const styled = createStyled();
4
4
  function getThemeProps(params) {
@@ -40532,9 +40532,9 @@ const useMessageInput = ({
40532
40532
  resetCurrentHistoryIndex(conversationId);
40533
40533
  draftMessageRef.current = "";
40534
40534
  if (scrollToBottom) {
40535
- setTimeout(() => {
40535
+ requestAnimationFrame(() => {
40536
40536
  scrollToBottom();
40537
- }, 150);
40537
+ });
40538
40538
  }
40539
40539
  }, [
40540
40540
  inputValue,
@@ -42221,8 +42221,10 @@ const useScrollToBottom = (buttonThreshold = 50, externalContainerRef, contentKe
42221
42221
  const scrollToBottom = reactExports.useCallback(() => {
42222
42222
  const container = containerRef.current;
42223
42223
  if (!container) return;
42224
- container.scrollTo({ top: 0, behavior: "smooth" });
42225
- requestAnimationFrame(updateScrollPosition);
42224
+ requestAnimationFrame(() => {
42225
+ container.scrollTo({ top: 0, behavior: "smooth" });
42226
+ requestAnimationFrame(updateScrollPosition);
42227
+ });
42226
42228
  }, [containerRef, updateScrollPosition]);
42227
42229
  const handleScroll = reactExports.useCallback(() => {
42228
42230
  if (!containerRef.current || isHandlingScrollRef.current) return;
@@ -42547,6 +42549,22 @@ const useStreamingMessage = ({
42547
42549
  (record) => record.id === messageId
42548
42550
  );
42549
42551
  if (!messageData) {
42552
+ if (registryEntry?.messageData && registryEntry.isComplete) {
42553
+ completeStreamingMessage(messageId, registryEntry.messageData);
42554
+ if (conversationId) {
42555
+ const messageForStore = convertToMessage(
42556
+ registryEntry.messageData,
42557
+ conversationId
42558
+ );
42559
+ const updated = updateMessage(conversationId, messageForStore);
42560
+ if (!updated) {
42561
+ addMessage(conversationId, messageForStore);
42562
+ }
42563
+ }
42564
+ if (onComplete && mountedRef.current) {
42565
+ onComplete(registryEntry.messageData);
42566
+ }
42567
+ }
42550
42568
  return;
42551
42569
  }
42552
42570
  completeStreamingMessage(messageId, messageData);
@@ -42602,78 +42620,42 @@ const useStreamingMessage = ({
42602
42620
  ...registryEntry?.messageData,
42603
42621
  ...update
42604
42622
  };
42605
- if (update.is_complete) {
42623
+ const currentRegistryEntry = globalConnectionRegistry.get(messageId);
42624
+ const alreadyCompleted = currentRegistryEntry?.isComplete;
42625
+ if (update.is_complete && !alreadyCompleted) {
42606
42626
  completeStreamingMessage(messageId, messageData);
42607
- if (refetchOnComplete) {
42627
+ if (currentRegistryEntry) {
42628
+ currentRegistryEntry.isComplete = true;
42629
+ }
42630
+ if (conversationId && messageData.id) {
42631
+ const messageForStore = convertToMessage(messageData, conversationId);
42632
+ const updated = updateMessage(conversationId, messageForStore);
42633
+ if (!updated) {
42634
+ addMessage(conversationId, messageForStore);
42635
+ }
42636
+ }
42637
+ if (refetchOnComplete && !isRefetching) {
42608
42638
  setTimeout(() => {
42609
42639
  if (mountedRef.current) {
42610
- const doRefetch = async () => {
42611
- if (isRefetching) return;
42612
- try {
42613
- setIsRefetching(true);
42614
- const client2 = createLocalOperatorClient(baseUrl);
42615
- const entry = globalConnectionRegistry.get(messageId);
42616
- const agentId = entry?.conversationId || conversationId;
42617
- if (!agentId) return;
42618
- const response = await client2.agents.getAgentExecutionHistory(
42619
- agentId,
42620
- 1,
42621
- 20
42622
- );
42623
- if (response.status >= 400 || !response.result) {
42624
- throw new Error(
42625
- response.message || "Failed to fetch message data"
42626
- );
42627
- }
42628
- const msgData = response.result.history.find(
42629
- (record) => record.id === messageId
42630
- );
42631
- if (!msgData) return;
42632
- completeStreamingMessage(messageId, msgData);
42633
- if (entry) {
42634
- entry.messageData = msgData;
42635
- entry.isComplete = true;
42636
- entry.isStreamable = !!msgData.is_streamable;
42637
- }
42638
- if (conversationId) {
42639
- const msgForStore = convertToMessage(
42640
- msgData,
42641
- conversationId
42642
- );
42643
- const updated = updateMessage(conversationId, msgForStore);
42644
- if (!updated) {
42645
- addMessage(conversationId, msgForStore);
42646
- }
42647
- }
42648
- if (onComplete && mountedRef.current) {
42649
- onComplete(msgData);
42650
- }
42651
- } catch (error2) {
42652
- const errorMessage = error2 instanceof Error ? error2.message : String(error2);
42653
- console.error(
42654
- `Error auto-refetching message: ${errorMessage}`
42655
- );
42656
- } finally {
42657
- setIsRefetching(false);
42658
- }
42659
- };
42660
- doRefetch();
42640
+ refetchMessage().catch((error2) => {
42641
+ console.error("Error during refetch after completion:", error2);
42642
+ });
42661
42643
  }
42662
- }, 500);
42644
+ }, 150);
42663
42645
  }
42664
- } else {
42646
+ } else if (!update.is_complete) {
42665
42647
  updateStreamingMessage(messageId, messageData);
42666
- }
42667
- if (conversationId && messageData.id) {
42668
- const messageForStore = convertToMessage(messageData, conversationId);
42669
- if (!updateChatStoreTimeoutRef.current) {
42670
- updateChatStoreTimeoutRef.current = setTimeout(() => {
42671
- const updated = updateMessage(conversationId, messageForStore);
42672
- if (!updated) {
42673
- addMessage(conversationId, messageForStore);
42674
- }
42675
- updateChatStoreTimeoutRef.current = null;
42676
- }, 100);
42648
+ if (conversationId && messageData.id) {
42649
+ const messageForStore = convertToMessage(messageData, conversationId);
42650
+ if (!updateChatStoreTimeoutRef.current) {
42651
+ updateChatStoreTimeoutRef.current = setTimeout(() => {
42652
+ const updated = updateMessage(conversationId, messageForStore);
42653
+ if (!updated) {
42654
+ addMessage(conversationId, messageForStore);
42655
+ }
42656
+ updateChatStoreTimeoutRef.current = null;
42657
+ }, 50);
42658
+ }
42677
42659
  }
42678
42660
  }
42679
42661
  },
@@ -42681,14 +42663,13 @@ const useStreamingMessage = ({
42681
42663
  messageId,
42682
42664
  conversationId,
42683
42665
  onUpdate,
42684
- onComplete,
42685
42666
  refetchOnComplete,
42686
42667
  updateStreamingMessage,
42687
42668
  completeStreamingMessage,
42688
42669
  updateMessage,
42689
42670
  addMessage,
42690
- baseUrl,
42691
- isRefetching
42671
+ isRefetching,
42672
+ refetchMessage
42692
42673
  ]
42693
42674
  );
42694
42675
  const updateChatStoreTimeoutRef = reactExports.useRef(null);
@@ -42887,7 +42868,11 @@ const useStreamingMessage = ({
42887
42868
  isCompletePrevRef.current = true;
42888
42869
  completeStreamingMessage(messageId, message2);
42889
42870
  if (onComplete) {
42890
- onComplete(message2);
42871
+ setTimeout(() => {
42872
+ if (mountedRef.current) {
42873
+ onComplete(message2);
42874
+ }
42875
+ }, 50);
42891
42876
  }
42892
42877
  if (!keepAlive) {
42893
42878
  safeDisconnect();
@@ -42904,6 +42889,27 @@ const useStreamingMessage = ({
42904
42889
  messageId,
42905
42890
  completeStreamingMessage
42906
42891
  ]);
42892
+ reactExports.useEffect(() => {
42893
+ return () => {
42894
+ if (globalConnectionRegistry.has(messageId)) {
42895
+ const entry = globalConnectionRegistry.get(messageId);
42896
+ if (entry && entry.instanceCount > 0) {
42897
+ entry.instanceCount = Math.max(0, entry.instanceCount - 1);
42898
+ if (entry.instanceCount === 0 && !entry.keepAlive) {
42899
+ try {
42900
+ wsDisconnect();
42901
+ entry.connected = false;
42902
+ entry.connecting = false;
42903
+ entry.connectionPromise = null;
42904
+ entry.wsClient = null;
42905
+ } catch (error2) {
42906
+ console.warn("Error during cleanup:", error2);
42907
+ }
42908
+ }
42909
+ }
42910
+ }
42911
+ };
42912
+ }, [messageId, wsDisconnect]);
42907
42913
  return {
42908
42914
  message: message2,
42909
42915
  isComplete,
@@ -89889,7 +89895,7 @@ const languages = [
89889
89895
  name: "Go",
89890
89896
  extensions: ["go"],
89891
89897
  load() {
89892
- return __vitePreload(() => import("./index-CtrEBFNz.js"), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url).then((m2) => m2.go());
89898
+ return __vitePreload(() => import("./index-DNeKpvUS.js"), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url).then((m2) => m2.go());
89893
89899
  }
89894
89900
  }),
89895
89901
  /* @__PURE__ */ LanguageDescription.of({
@@ -90066,7 +90072,7 @@ const languages = [
90066
90072
  alias: ["yml"],
90067
90073
  extensions: ["yaml", "yml"],
90068
90074
  load() {
90069
- return __vitePreload(() => import("./index-B4xrtp2Z.js"), true ? __vite__mapDeps([3,1,2]) : void 0, import.meta.url).then((m2) => m2.yaml());
90075
+ return __vitePreload(() => import("./index-DyaU6iOA.js"), true ? __vite__mapDeps([3,1,2]) : void 0, import.meta.url).then((m2) => m2.yaml());
90070
90076
  }
90071
90077
  }),
90072
90078
  // Legacy modes ported from CodeMirror 5
@@ -273861,7 +273867,7 @@ var registerDefaultLayoutLoaders = /* @__PURE__ */ __name(() => {
273861
273867
  registerLayoutLoaders([
273862
273868
  {
273863
273869
  name: "dagre",
273864
- loader: /* @__PURE__ */ __name(async () => await __vitePreload(() => import("./dagre-OKDRZEBW-DZOFGtWs.js"), true ? __vite__mapDeps([6,7,8,9,10,11,1,2]) : void 0, import.meta.url), "loader")
273870
+ loader: /* @__PURE__ */ __name(async () => await __vitePreload(() => import("./dagre-OKDRZEBW-BThe-2D6.js"), true ? __vite__mapDeps([6,7,8,9,10,11,1,2]) : void 0, import.meta.url), "loader")
273865
273871
  }
273866
273872
  ]);
273867
273873
  }, "registerDefaultLayoutLoaders");
@@ -274451,7 +274457,7 @@ var detector = /* @__PURE__ */ __name((txt) => {
274451
274457
  }, "detector");
274452
274458
  var loader = /* @__PURE__ */ __name(async () => {
274453
274459
  const { diagram: diagram2 } = await __vitePreload(async () => {
274454
- const { diagram: diagram22 } = await import("./c4Diagram-VJAJSXHY-B8ZTZ0n8.js");
274460
+ const { diagram: diagram22 } = await import("./c4Diagram-VJAJSXHY-BQMfKd4Q.js");
274455
274461
  return { diagram: diagram22 };
274456
274462
  }, true ? __vite__mapDeps([12,13,1,2]) : void 0, import.meta.url);
274457
274463
  return { id, diagram: diagram2 };
@@ -274471,7 +274477,7 @@ var detector2 = /* @__PURE__ */ __name((txt, config2) => {
274471
274477
  }, "detector");
274472
274478
  var loader2 = /* @__PURE__ */ __name(async () => {
274473
274479
  const { diagram: diagram2 } = await __vitePreload(async () => {
274474
- const { diagram: diagram22 } = await import("./flowDiagram-4HSFHLVR-tRJWBVYd.js");
274480
+ const { diagram: diagram22 } = await import("./flowDiagram-4HSFHLVR-B3925mvz.js");
274475
274481
  return { diagram: diagram22 };
274476
274482
  }, true ? __vite__mapDeps([14,15,16,1,2]) : void 0, import.meta.url);
274477
274483
  return { id: id2, diagram: diagram2 };
@@ -274497,7 +274503,7 @@ var detector3 = /* @__PURE__ */ __name((txt, config2) => {
274497
274503
  }, "detector");
274498
274504
  var loader3 = /* @__PURE__ */ __name(async () => {
274499
274505
  const { diagram: diagram2 } = await __vitePreload(async () => {
274500
- const { diagram: diagram22 } = await import("./flowDiagram-4HSFHLVR-tRJWBVYd.js");
274506
+ const { diagram: diagram22 } = await import("./flowDiagram-4HSFHLVR-B3925mvz.js");
274501
274507
  return { diagram: diagram22 };
274502
274508
  }, true ? __vite__mapDeps([14,15,16,1,2]) : void 0, import.meta.url);
274503
274509
  return { id: id3, diagram: diagram2 };
@@ -274514,7 +274520,7 @@ var detector4 = /* @__PURE__ */ __name((txt) => {
274514
274520
  }, "detector");
274515
274521
  var loader4 = /* @__PURE__ */ __name(async () => {
274516
274522
  const { diagram: diagram2 } = await __vitePreload(async () => {
274517
- const { diagram: diagram22 } = await import("./erDiagram-Q7BY3M3F-CfYzgE98.js");
274523
+ const { diagram: diagram22 } = await import("./erDiagram-Q7BY3M3F-IPUKaKH3.js");
274518
274524
  return { diagram: diagram22 };
274519
274525
  }, true ? __vite__mapDeps([17,15,16,1,2]) : void 0, import.meta.url);
274520
274526
  return { id: id4, diagram: diagram2 };
@@ -274531,7 +274537,7 @@ var detector5 = /* @__PURE__ */ __name((txt) => {
274531
274537
  }, "detector");
274532
274538
  var loader5 = /* @__PURE__ */ __name(async () => {
274533
274539
  const { diagram: diagram2 } = await __vitePreload(async () => {
274534
- const { diagram: diagram22 } = await import("./gitGraphDiagram-7IBYFJ6S-Cd11pFbi.js");
274540
+ const { diagram: diagram22 } = await import("./gitGraphDiagram-7IBYFJ6S-OlXFREtF.js");
274535
274541
  return { diagram: diagram22 };
274536
274542
  }, true ? __vite__mapDeps([18,19,20,21,8,10,11,1,2]) : void 0, import.meta.url);
274537
274543
  return { id: id5, diagram: diagram2 };
@@ -274548,7 +274554,7 @@ var detector6 = /* @__PURE__ */ __name((txt) => {
274548
274554
  }, "detector");
274549
274555
  var loader6 = /* @__PURE__ */ __name(async () => {
274550
274556
  const { diagram: diagram2 } = await __vitePreload(async () => {
274551
- const { diagram: diagram22 } = await import("./ganttDiagram-APWFNJXF-BWG5VLyZ.js");
274557
+ const { diagram: diagram22 } = await import("./ganttDiagram-APWFNJXF-CKJIfiAY.js");
274552
274558
  return { diagram: diagram22 };
274553
274559
  }, true ? __vite__mapDeps([22,1,2]) : void 0, import.meta.url);
274554
274560
  return { id: id6, diagram: diagram2 };
@@ -274565,7 +274571,7 @@ var detector7 = /* @__PURE__ */ __name((txt) => {
274565
274571
  }, "detector");
274566
274572
  var loader7 = /* @__PURE__ */ __name(async () => {
274567
274573
  const { diagram: diagram2 } = await __vitePreload(async () => {
274568
- const { diagram: diagram22 } = await import("./infoDiagram-PH2N3AL5-KjJg15gx.js");
274574
+ const { diagram: diagram22 } = await import("./infoDiagram-PH2N3AL5-DWMqI59j.js");
274569
274575
  return { diagram: diagram22 };
274570
274576
  }, true ? __vite__mapDeps([23,21,8,10,11,1,2]) : void 0, import.meta.url);
274571
274577
  return { id: id7, diagram: diagram2 };
@@ -274581,7 +274587,7 @@ var detector8 = /* @__PURE__ */ __name((txt) => {
274581
274587
  }, "detector");
274582
274588
  var loader8 = /* @__PURE__ */ __name(async () => {
274583
274589
  const { diagram: diagram2 } = await __vitePreload(async () => {
274584
- const { diagram: diagram22 } = await import("./pieDiagram-IB7DONF6-C7Crt4gw.js");
274590
+ const { diagram: diagram22 } = await import("./pieDiagram-IB7DONF6-hEnot0FH.js");
274585
274591
  return { diagram: diagram22 };
274586
274592
  }, true ? __vite__mapDeps([24,19,21,8,10,11,25,1,2]) : void 0, import.meta.url);
274587
274593
  return { id: id8, diagram: diagram2 };
@@ -274597,7 +274603,7 @@ var detector9 = /* @__PURE__ */ __name((txt) => {
274597
274603
  }, "detector");
274598
274604
  var loader9 = /* @__PURE__ */ __name(async () => {
274599
274605
  const { diagram: diagram2 } = await __vitePreload(async () => {
274600
- const { diagram: diagram22 } = await import("./quadrantDiagram-7GDLP6J5-BMbHGD_6.js");
274606
+ const { diagram: diagram22 } = await import("./quadrantDiagram-7GDLP6J5-3Xr8RuV3.js");
274601
274607
  return { diagram: diagram22 };
274602
274608
  }, true ? __vite__mapDeps([26,1,2]) : void 0, import.meta.url);
274603
274609
  return { id: id9, diagram: diagram2 };
@@ -274614,7 +274620,7 @@ var detector10 = /* @__PURE__ */ __name((txt) => {
274614
274620
  }, "detector");
274615
274621
  var loader10 = /* @__PURE__ */ __name(async () => {
274616
274622
  const { diagram: diagram2 } = await __vitePreload(async () => {
274617
- const { diagram: diagram22 } = await import("./xychartDiagram-VJFVF3MP-DD0agc1N.js");
274623
+ const { diagram: diagram22 } = await import("./xychartDiagram-VJFVF3MP-Dw2GxLel.js");
274618
274624
  return { diagram: diagram22 };
274619
274625
  }, true ? __vite__mapDeps([27,1,2]) : void 0, import.meta.url);
274620
274626
  return { id: id10, diagram: diagram2 };
@@ -274631,7 +274637,7 @@ var detector11 = /* @__PURE__ */ __name((txt) => {
274631
274637
  }, "detector");
274632
274638
  var loader11 = /* @__PURE__ */ __name(async () => {
274633
274639
  const { diagram: diagram2 } = await __vitePreload(async () => {
274634
- const { diagram: diagram22 } = await import("./requirementDiagram-KVF5MWMF-BumPivJk.js");
274640
+ const { diagram: diagram22 } = await import("./requirementDiagram-KVF5MWMF-epT_iBII.js");
274635
274641
  return { diagram: diagram22 };
274636
274642
  }, true ? __vite__mapDeps([28,15,1,2]) : void 0, import.meta.url);
274637
274643
  return { id: id11, diagram: diagram2 };
@@ -274648,7 +274654,7 @@ var detector12 = /* @__PURE__ */ __name((txt) => {
274648
274654
  }, "detector");
274649
274655
  var loader12 = /* @__PURE__ */ __name(async () => {
274650
274656
  const { diagram: diagram2 } = await __vitePreload(async () => {
274651
- const { diagram: diagram22 } = await import("./sequenceDiagram-X6HHIX6F-CwnYTtil.js");
274657
+ const { diagram: diagram22 } = await import("./sequenceDiagram-X6HHIX6F-C-26csWS.js");
274652
274658
  return { diagram: diagram22 };
274653
274659
  }, true ? __vite__mapDeps([29,13,20,1,2]) : void 0, import.meta.url);
274654
274660
  return { id: id12, diagram: diagram2 };
@@ -274668,7 +274674,7 @@ var detector13 = /* @__PURE__ */ __name((txt, config2) => {
274668
274674
  }, "detector");
274669
274675
  var loader13 = /* @__PURE__ */ __name(async () => {
274670
274676
  const { diagram: diagram2 } = await __vitePreload(async () => {
274671
- const { diagram: diagram22 } = await import("./classDiagram-GIVACNV2-CNcNWb-o.js");
274677
+ const { diagram: diagram22 } = await import("./classDiagram-GIVACNV2-BuM30Dyp.js");
274672
274678
  return { diagram: diagram22 };
274673
274679
  }, true ? __vite__mapDeps([30,31,15,1,2]) : void 0, import.meta.url);
274674
274680
  return { id: id13, diagram: diagram2 };
@@ -274688,7 +274694,7 @@ var detector14 = /* @__PURE__ */ __name((txt, config2) => {
274688
274694
  }, "detector");
274689
274695
  var loader14 = /* @__PURE__ */ __name(async () => {
274690
274696
  const { diagram: diagram2 } = await __vitePreload(async () => {
274691
- const { diagram: diagram22 } = await import("./classDiagram-v2-COTLJTTW-CNcNWb-o.js");
274697
+ const { diagram: diagram22 } = await import("./classDiagram-v2-COTLJTTW-BuM30Dyp.js");
274692
274698
  return { diagram: diagram22 };
274693
274699
  }, true ? __vite__mapDeps([32,31,15,1,2]) : void 0, import.meta.url);
274694
274700
  return { id: id14, diagram: diagram2 };
@@ -274708,7 +274714,7 @@ var detector15 = /* @__PURE__ */ __name((txt, config2) => {
274708
274714
  }, "detector");
274709
274715
  var loader15 = /* @__PURE__ */ __name(async () => {
274710
274716
  const { diagram: diagram2 } = await __vitePreload(async () => {
274711
- const { diagram: diagram22 } = await import("./stateDiagram-DGXRK772-4yXBR_vP.js");
274717
+ const { diagram: diagram22 } = await import("./stateDiagram-DGXRK772-CeyZGI_q.js");
274712
274718
  return { diagram: diagram22 };
274713
274719
  }, true ? __vite__mapDeps([33,34,15,7,8,9,10,1,2]) : void 0, import.meta.url);
274714
274720
  return { id: id15, diagram: diagram2 };
@@ -274731,7 +274737,7 @@ var detector16 = /* @__PURE__ */ __name((txt, config2) => {
274731
274737
  }, "detector");
274732
274738
  var loader16 = /* @__PURE__ */ __name(async () => {
274733
274739
  const { diagram: diagram2 } = await __vitePreload(async () => {
274734
- const { diagram: diagram22 } = await import("./stateDiagram-v2-YXO3MK2T-6p7BdIAB.js");
274740
+ const { diagram: diagram22 } = await import("./stateDiagram-v2-YXO3MK2T-Bcz2S6_5.js");
274735
274741
  return { diagram: diagram22 };
274736
274742
  }, true ? __vite__mapDeps([35,34,15,1,2]) : void 0, import.meta.url);
274737
274743
  return { id: id16, diagram: diagram2 };
@@ -274748,7 +274754,7 @@ var detector17 = /* @__PURE__ */ __name((txt) => {
274748
274754
  }, "detector");
274749
274755
  var loader17 = /* @__PURE__ */ __name(async () => {
274750
274756
  const { diagram: diagram2 } = await __vitePreload(async () => {
274751
- const { diagram: diagram22 } = await import("./journeyDiagram-U35MCT3I-Dp2FVK6h.js");
274757
+ const { diagram: diagram22 } = await import("./journeyDiagram-U35MCT3I-BcJ33bp0.js");
274752
274758
  return { diagram: diagram22 };
274753
274759
  }, true ? __vite__mapDeps([36,13,25,1,2]) : void 0, import.meta.url);
274754
274760
  return { id: id17, diagram: diagram2 };
@@ -274818,7 +274824,7 @@ var detector18 = /* @__PURE__ */ __name((txt, config2 = {}) => {
274818
274824
  }, "detector");
274819
274825
  var loader18 = /* @__PURE__ */ __name(async () => {
274820
274826
  const { diagram: diagram2 } = await __vitePreload(async () => {
274821
- const { diagram: diagram22 } = await import("./flowDiagram-4HSFHLVR-tRJWBVYd.js");
274827
+ const { diagram: diagram22 } = await import("./flowDiagram-4HSFHLVR-B3925mvz.js");
274822
274828
  return { diagram: diagram22 };
274823
274829
  }, true ? __vite__mapDeps([14,15,16,1,2]) : void 0, import.meta.url);
274824
274830
  return { id: id18, diagram: diagram2 };
@@ -274835,7 +274841,7 @@ var detector19 = /* @__PURE__ */ __name((txt) => {
274835
274841
  }, "detector");
274836
274842
  var loader19 = /* @__PURE__ */ __name(async () => {
274837
274843
  const { diagram: diagram2 } = await __vitePreload(async () => {
274838
- const { diagram: diagram22 } = await import("./timeline-definition-BDJGKUSR-CCdgMyc-.js");
274844
+ const { diagram: diagram22 } = await import("./timeline-definition-BDJGKUSR-Db8O4iZL.js");
274839
274845
  return { diagram: diagram22 };
274840
274846
  }, true ? __vite__mapDeps([37,25,1,2]) : void 0, import.meta.url);
274841
274847
  return { id: id19, diagram: diagram2 };
@@ -274852,7 +274858,7 @@ var detector20 = /* @__PURE__ */ __name((txt) => {
274852
274858
  }, "detector");
274853
274859
  var loader20 = /* @__PURE__ */ __name(async () => {
274854
274860
  const { diagram: diagram2 } = await __vitePreload(async () => {
274855
- const { diagram: diagram22 } = await import("./mindmap-definition-ALO5MXBD-DiLxGufv.js");
274861
+ const { diagram: diagram22 } = await import("./mindmap-definition-ALO5MXBD-O9uBlpHL.js");
274856
274862
  return { diagram: diagram22 };
274857
274863
  }, true ? __vite__mapDeps([38,39,1,2]) : void 0, import.meta.url);
274858
274864
  return { id: id20, diagram: diagram2 };
@@ -274869,7 +274875,7 @@ var detector21 = /* @__PURE__ */ __name((txt) => {
274869
274875
  }, "detector");
274870
274876
  var loader21 = /* @__PURE__ */ __name(async () => {
274871
274877
  const { diagram: diagram2 } = await __vitePreload(async () => {
274872
- const { diagram: diagram22 } = await import("./kanban-definition-NDS4AKOZ-cttuutf_.js");
274878
+ const { diagram: diagram22 } = await import("./kanban-definition-NDS4AKOZ-vzPmig7Y.js");
274873
274879
  return { diagram: diagram22 };
274874
274880
  }, true ? __vite__mapDeps([40,1,2]) : void 0, import.meta.url);
274875
274881
  return { id: id21, diagram: diagram2 };
@@ -274886,7 +274892,7 @@ var detector22 = /* @__PURE__ */ __name((txt) => {
274886
274892
  }, "detector");
274887
274893
  var loader22 = /* @__PURE__ */ __name(async () => {
274888
274894
  const { diagram: diagram2 } = await __vitePreload(async () => {
274889
- const { diagram: diagram22 } = await import("./sankeyDiagram-QLVOVGJD-D1LzUzj2.js");
274895
+ const { diagram: diagram22 } = await import("./sankeyDiagram-QLVOVGJD-DGEieYSJ.js");
274890
274896
  return { diagram: diagram22 };
274891
274897
  }, true ? __vite__mapDeps([41,1,2]) : void 0, import.meta.url);
274892
274898
  return { id: id22, diagram: diagram2 };
@@ -274903,7 +274909,7 @@ var detector23 = /* @__PURE__ */ __name((txt) => {
274903
274909
  }, "detector");
274904
274910
  var loader23 = /* @__PURE__ */ __name(async () => {
274905
274911
  const { diagram: diagram2 } = await __vitePreload(async () => {
274906
- const { diagram: diagram22 } = await import("./diagram-VNBRO52H-DUz0a2Uz.js");
274912
+ const { diagram: diagram22 } = await import("./diagram-VNBRO52H-BXqgQ9w2.js");
274907
274913
  return { diagram: diagram22 };
274908
274914
  }, true ? __vite__mapDeps([42,19,21,8,10,11,1,2]) : void 0, import.meta.url);
274909
274915
  return { id: id23, diagram: diagram2 };
@@ -274919,7 +274925,7 @@ var detector24 = /* @__PURE__ */ __name((txt) => {
274919
274925
  }, "detector");
274920
274926
  var loader24 = /* @__PURE__ */ __name(async () => {
274921
274927
  const { diagram: diagram2 } = await __vitePreload(async () => {
274922
- const { diagram: diagram22 } = await import("./diagram-SSKATNLV-DGVbLzJc.js");
274928
+ const { diagram: diagram22 } = await import("./diagram-SSKATNLV-YOJrQHY2.js");
274923
274929
  return { diagram: diagram22 };
274924
274930
  }, true ? __vite__mapDeps([43,19,21,8,10,11,1,2]) : void 0, import.meta.url);
274925
274931
  return { id: id24, diagram: diagram2 };
@@ -274935,7 +274941,7 @@ var detector25 = /* @__PURE__ */ __name((txt) => {
274935
274941
  }, "detector");
274936
274942
  var loader25 = /* @__PURE__ */ __name(async () => {
274937
274943
  const { diagram: diagram2 } = await __vitePreload(async () => {
274938
- const { diagram: diagram22 } = await import("./blockDiagram-JOT3LUYC-DIjqxpHX.js");
274944
+ const { diagram: diagram22 } = await import("./blockDiagram-JOT3LUYC-D5O4-oIj.js");
274939
274945
  return { diagram: diagram22 };
274940
274946
  }, true ? __vite__mapDeps([44,11,8,7,16,1,2]) : void 0, import.meta.url);
274941
274947
  return { id: id25, diagram: diagram2 };
@@ -274952,7 +274958,7 @@ var detector26 = /* @__PURE__ */ __name((txt) => {
274952
274958
  }, "detector");
274953
274959
  var loader26 = /* @__PURE__ */ __name(async () => {
274954
274960
  const { diagram: diagram2 } = await __vitePreload(async () => {
274955
- const { diagram: diagram22 } = await import("./architectureDiagram-IEHRJDOE-0JBfW8n9.js");
274961
+ const { diagram: diagram22 } = await import("./architectureDiagram-IEHRJDOE-CcEvEu2C.js");
274956
274962
  return { diagram: diagram22 };
274957
274963
  }, true ? __vite__mapDeps([45,19,20,21,8,10,11,39,1,2]) : void 0, import.meta.url);
274958
274964
  return { id: id26, diagram: diagram2 };
@@ -315543,12 +315549,23 @@ const StreamingMessage = ({
315543
315549
  const isStoreMessageComplete = isMessageStreamingComplete(messageId);
315544
315550
  const handleComplete = reactExports.useCallback(
315545
315551
  (completedMessage) => {
315546
- if (onComplete) {
315547
- onComplete(completedMessage);
315548
- }
315552
+ setTimeout(() => {
315553
+ if (onComplete) {
315554
+ onComplete(completedMessage);
315555
+ }
315556
+ }, 50);
315549
315557
  },
315550
315558
  [onComplete]
315551
315559
  );
315560
+ reactExports.useEffect(() => {
315561
+ if (isStoreMessageComplete && storeMessage?.content && onComplete) {
315562
+ const timer2 = setTimeout(() => {
315563
+ onComplete(storeMessage.content);
315564
+ }, 50);
315565
+ return () => clearTimeout(timer2);
315566
+ }
315567
+ return void 0;
315568
+ }, [isStoreMessageComplete, storeMessage, onComplete]);
315552
315569
  const {
315553
315570
  message: wsMessage,
315554
315571
  isStreamable,
@@ -315621,18 +315638,46 @@ const StreamingMessage = ({
315621
315638
  () => status === "connected" && !isStoreMessageComplete,
315622
315639
  [status, isStoreMessageComplete]
315623
315640
  );
315641
+ const shouldShowStreaming = reactExports.useMemo(() => {
315642
+ return status === "connected" && !isStoreMessageComplete;
315643
+ }, [status, isStoreMessageComplete]);
315644
+ const hasCalledOnCompleteRef = reactExports.useRef(false);
315645
+ reactExports.useEffect(() => {
315646
+ if (!shouldShowStreaming && storeMessage?.content && onComplete && !hasCalledOnCompleteRef.current) {
315647
+ hasCalledOnCompleteRef.current = true;
315648
+ const timer2 = setTimeout(() => {
315649
+ onComplete(storeMessage.content);
315650
+ }, 50);
315651
+ return () => clearTimeout(timer2);
315652
+ }
315653
+ return void 0;
315654
+ }, [shouldShowStreaming, storeMessage, onComplete]);
315655
+ reactExports.useEffect(() => {
315656
+ hasCalledOnCompleteRef.current = false;
315657
+ }, []);
315658
+ reactExports.useEffect(() => {
315659
+ return () => {
315660
+ if (hasCalledOnCompleteRef.current) {
315661
+ hasCalledOnCompleteRef.current = false;
315662
+ }
315663
+ };
315664
+ }, []);
315624
315665
  const lastValidMessageRef = reactExports.useRef(null);
315625
315666
  const message2 = reactExports.useMemo(() => {
315626
- if (isActivelyStreaming && wsMessage) {
315667
+ if (wsMessage) {
315627
315668
  lastValidMessageRef.current = wsMessage;
315628
315669
  return wsMessage;
315629
315670
  }
315630
- const result = storeMessage?.content || wsMessage || lastValidMessageRef.current;
315631
- if (result) {
315632
- lastValidMessageRef.current = result;
315671
+ if (isStoreMessageComplete && storeMessage?.content) {
315672
+ lastValidMessageRef.current = storeMessage.content;
315673
+ return storeMessage.content;
315633
315674
  }
315634
- return result;
315635
- }, [isActivelyStreaming, wsMessage, storeMessage]);
315675
+ if (storeMessage?.content) {
315676
+ lastValidMessageRef.current = storeMessage.content;
315677
+ return storeMessage.content;
315678
+ }
315679
+ return lastValidMessageRef.current || null;
315680
+ }, [wsMessage, storeMessage, isStoreMessageComplete]);
315636
315681
  const connectionControls = reactExports.useMemo(
315637
315682
  () => ({
315638
315683
  connect,
@@ -315956,6 +316001,46 @@ const MessagePaper = React$1.memo(
315956
316001
  () => message2?.is_streamable === true && message2?.is_complete === false && !isUser,
315957
316002
  [message2?.is_streamable, message2?.is_complete, isUser]
315958
316003
  );
316004
+ const { isMessageStreamingComplete } = useStreamingMessagesStore();
316005
+ const isStreamingActuallyComplete = reactExports.useMemo(() => {
316006
+ if (!message2?.id) return true;
316007
+ return isMessageStreamingComplete(message2.id);
316008
+ }, [message2?.id, isMessageStreamingComplete]);
316009
+ const shouldShowStreaming = reactExports.useMemo(() => {
316010
+ if (!isStreamable) return false;
316011
+ if (isStreamingActuallyComplete) return false;
316012
+ if (isJobRunning) return true;
316013
+ if (message2?.is_complete === false) return true;
316014
+ return false;
316015
+ }, [
316016
+ isStreamable,
316017
+ isStreamingActuallyComplete,
316018
+ isJobRunning,
316019
+ message2?.is_complete
316020
+ ]);
316021
+ const hasHandledCompletionRef = reactExports.useRef(false);
316022
+ reactExports.useEffect(() => {
316023
+ if (!shouldShowStreaming && message2 && !hasHandledCompletionRef.current) {
316024
+ hasHandledCompletionRef.current = true;
316025
+ const timer2 = setTimeout(() => {
316026
+ if (onMessageComplete) {
316027
+ onMessageComplete();
316028
+ }
316029
+ }, 50);
316030
+ return () => clearTimeout(timer2);
316031
+ }
316032
+ return void 0;
316033
+ }, [shouldShowStreaming, message2, onMessageComplete]);
316034
+ reactExports.useEffect(() => {
316035
+ hasHandledCompletionRef.current = false;
316036
+ }, []);
316037
+ reactExports.useEffect(() => {
316038
+ return () => {
316039
+ if (hasHandledCompletionRef.current) {
316040
+ hasHandledCompletionRef.current = false;
316041
+ }
316042
+ };
316043
+ }, []);
315959
316044
  const messageStyles = reactExports.useMemo(
315960
316045
  () => ({
315961
316046
  borderRadius: 2,
@@ -315977,7 +316062,7 @@ const MessagePaper = React$1.memo(
315977
316062
  const isNearBottom = !isFarFromBottom;
315978
316063
  const shouldAutoScrollRef = reactExports.useRef(true);
315979
316064
  reactExports.useEffect(() => {
315980
- if (!isLastMessage || !isStreamable || !message2) return;
316065
+ if (!isLastMessage || !shouldShowStreaming || !message2) return;
315981
316066
  shouldAutoScrollRef.current = isNearBottom;
315982
316067
  const scrollInterval = setInterval(() => {
315983
316068
  if (shouldAutoScrollRef.current) {
@@ -315987,12 +316072,18 @@ const MessagePaper = React$1.memo(
315987
316072
  return () => {
315988
316073
  clearInterval(scrollInterval);
315989
316074
  };
315990
- }, [isStreamable, message2, scrollToBottom, isNearBottom, isLastMessage]);
316075
+ }, [
316076
+ shouldShowStreaming,
316077
+ message2,
316078
+ scrollToBottom,
316079
+ isNearBottom,
316080
+ isLastMessage
316081
+ ]);
315991
316082
  reactExports.useEffect(() => {
315992
316083
  shouldAutoScrollRef.current = isNearBottom;
315993
316084
  }, [isNearBottom]);
315994
316085
  const streamingMessageComponent = reactExports.useMemo(() => {
315995
- if (!isStreamable || !message2 || !isJobRunning) return null;
316086
+ if (!shouldShowStreaming || !message2) return null;
315996
316087
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
315997
316088
  StreamingMessage,
315998
316089
  {
@@ -316012,11 +316103,10 @@ const MessagePaper = React$1.memo(
316012
316103
  }
316013
316104
  );
316014
316105
  }, [
316015
- isStreamable,
316106
+ shouldShowStreaming,
316016
316107
  message2,
316017
316108
  messageStyles,
316018
316109
  onMessageComplete,
316019
- isJobRunning,
316020
316110
  markdownStyleProps
316021
316111
  ]);
316022
316112
  const [isThinkingExpanded, setIsThinkingExpanded] = reactExports.useState(false);
@@ -316029,7 +316119,7 @@ const MessagePaper = React$1.memo(
316029
316119
  setIsThinkingExpanded(false);
316030
316120
  }, []);
316031
316121
  const regularMessageComponents = reactExports.useMemo(() => {
316032
- if (isStreamable && isJobRunning || !message2) return null;
316122
+ if (shouldShowStreaming || !message2) return null;
316033
316123
  const childrenWithRemainingContent = React$1.Children.map(
316034
316124
  children2,
316035
316125
  (child) => {
@@ -316068,12 +316158,11 @@ const MessagePaper = React$1.memo(
316068
316158
  )
316069
316159
  ] });
316070
316160
  }, [
316071
- isStreamable,
316161
+ shouldShowStreaming,
316162
+ message2,
316072
316163
  messageStyles,
316073
316164
  children2,
316074
- message2,
316075
316165
  isUser,
316076
- isJobRunning,
316077
316166
  isThinkingExpanded,
316078
316167
  handleThinkingExpand,
316079
316168
  handleThinkingCollapse,
@@ -316081,7 +316170,7 @@ const MessagePaper = React$1.memo(
316081
316170
  replies,
316082
316171
  remainingContent,
316083
316172
  markdownStyleProps
316084
- ]);
316173
+ ]) || null;
316085
316174
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
316086
316175
  Box,
316087
316176
  {
@@ -316313,7 +316402,7 @@ const MessageItem = reactExports.memo(
316313
316402
  }
316314
316403
  }, []);
316315
316404
  const isMessageContentEmpty = !message2.message && (!message2.files || message2.files.length === 0) && !message2.code && !message2.stdout && !message2.stderr && !message2.logging;
316316
- const shouldHide = (message2.action === "DONE" || message2.action === "ASK") && message2.execution_type === "action" && message2.task_classification === "conversation" || isMessageContentEmpty && message2.is_complete || message2.is_streamable && !message2.is_complete && isMessageContentEmpty && !currentExecution;
316405
+ const shouldHide = (message2.action === "DONE" || message2.action === "ASK") && message2.execution_type === "action" && message2.task_classification === "conversation" || isMessageContentEmpty && message2.is_complete;
316317
316406
  if (shouldHide) {
316318
316407
  return null;
316319
316408
  }
@@ -316638,10 +316727,20 @@ const MessagesView = React$1.memo(
316638
316727
  const collapsed = messages.length === 0 && !isLoadingMessages && !isFetchingMore;
316639
316728
  const lastMessageIsStreaming = messages[messages.length - 1]?.is_streamable && !messages[messages.length - 1]?.is_complete;
316640
316729
  const handleMessageComplete = reactExports.useCallback(() => {
316641
- if (refetch) {
316642
- refetch();
316643
- }
316730
+ setTimeout(() => {
316731
+ if (refetch) {
316732
+ refetch();
316733
+ }
316734
+ }, 200);
316644
316735
  }, [refetch]);
316736
+ reactExports.useEffect(() => {
316737
+ if (messages.length > 0) {
316738
+ const lastMessage = messages[messages.length - 1];
316739
+ if (lastMessage?.is_complete && lastMessage?.is_streamable) {
316740
+ console.debug("Last message completed:", lastMessage.id);
316741
+ }
316742
+ }
316743
+ }, [messages]);
316645
316744
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(MessagesViewWrapper, { collapsed, children: [
316646
316745
  isFetchingMore && /* @__PURE__ */ jsxRuntimeExports.jsxs(LoadingMoreIndicator, { isSmallView, children: [
316647
316746
  /* @__PURE__ */ jsxRuntimeExports.jsx(CircularProgress, { size: 16, sx: { mr: 1 } }),
@@ -317720,7 +317819,9 @@ const ChatPage = () => {
317720
317819
  files: attachments.length > 0 ? attachments : void 0
317721
317820
  };
317722
317821
  addMessage(conversationId, userMessage);
317723
- scrollToBottom();
317822
+ requestAnimationFrame(() => {
317823
+ scrollToBottom();
317824
+ });
317724
317825
  setIsLoading(true);
317725
317826
  try {
317726
317827
  const options = {