@qredence/fleet 0.5.5 → 0.5.7

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 (183) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/web/client/assets/action-swap-roll-BB8DFMuf.js +1 -0
  3. package/dist/web/client/assets/agent-activity-CDcDNVC6.js +1 -0
  4. package/dist/web/client/assets/agent-disclosure-B8SnhQXL.js +1 -0
  5. package/dist/web/client/assets/analytics-stub-B8MIkiDB.js +1 -0
  6. package/dist/web/client/assets/artifacts-panel-CmHYXfoo.js +1 -0
  7. package/dist/web/client/assets/button-BV9NafmI.js +1 -0
  8. package/dist/web/client/assets/chat-command-palette-DiG-i3uJ.js +1 -0
  9. package/dist/web/client/assets/check-JjHKAZas.js +1 -0
  10. package/dist/web/client/assets/chevron-up-CnSvySGH.js +1 -0
  11. package/dist/web/client/assets/circle-alert-CONlFReH.js +1 -0
  12. package/dist/web/client/assets/circle-x-CkKCB__4.js +1 -0
  13. package/dist/web/client/assets/citations-CpTFUvx7.js +2 -0
  14. package/dist/web/client/assets/collapsible-BoXtZZWN.js +1 -0
  15. package/dist/web/client/assets/command-Cx-UYeQ9.js +1 -0
  16. package/dist/web/client/assets/createBaseUIEventDetails-DV0dQrBX.js +1 -0
  17. package/dist/web/client/assets/dialog-Dh7WpGIu.js +1 -0
  18. package/dist/web/client/assets/dist-BPaFisIZ.js +41 -0
  19. package/dist/web/client/assets/earth-DGZXAN5r.js +1 -0
  20. package/dist/web/client/assets/ease-u56MhKYS.js +1 -0
  21. package/dist/web/client/assets/file-text-T-NcAlZs.js +1 -0
  22. package/dist/web/client/assets/fleet-message-queue-B6zAK-hX.js +1 -0
  23. package/dist/web/client/assets/{fleet-pi-tool-renderer-B0Y7ou0U.js → fleet-pi-tool-renderer-Btq9mDUe.js} +28 -28
  24. package/dist/web/client/assets/fleet-reasoning-panel-MtbSdoCv.js +1 -0
  25. package/dist/web/client/assets/fleet-subagent-list-iszvrvy_.js +1 -0
  26. package/dist/web/client/assets/fleet-tool-timeline-COzPrwr8.js +1 -0
  27. package/dist/web/client/assets/{fork-picker-dialog-C2cVJUbf.js → fork-picker-dialog-CAhWx0G5.js} +1 -1
  28. package/dist/web/client/assets/gauge-DNpstbBn.js +1 -0
  29. package/dist/web/client/assets/generative-text-renderer-C1JrmYfx.js +6 -0
  30. package/dist/web/client/assets/globals-Bfr0jrPq.css +2 -0
  31. package/dist/web/client/assets/horizontal-resize-Bl3AyBJg.js +1 -0
  32. package/dist/web/client/assets/image-BbPmlw-n.js +1 -0
  33. package/dist/web/client/assets/index-QgUwd4m8.js +12 -0
  34. package/dist/web/client/assets/input-Bol3TP4v.js +1 -0
  35. package/dist/web/client/assets/input-group-D5gi9zBK.js +1 -0
  36. package/dist/web/client/assets/{markdown-DG7pUdsX.js → markdown-RD_ydkyD.js} +2 -2
  37. package/dist/web/client/assets/{markdown-code-BgMzpy7O.js → markdown-code-ETqXqY8E.js} +1 -1
  38. package/dist/web/client/assets/message-square-hbDao-A1.js +1 -0
  39. package/dist/web/client/assets/model-selector-list-CJY9pyt2.js +1 -0
  40. package/dist/web/client/assets/notify-DKTqXChG.js +1 -0
  41. package/dist/web/client/assets/{openui-renderer-CCfQqUfE.js → openui-renderer-BZMghkzQ.js} +7 -7
  42. package/dist/web/client/assets/prompt-suggestions-CXM6knMK.js +1 -0
  43. package/dist/web/client/assets/provider-catalog-CHKFGwHr.js +1 -0
  44. package/dist/web/client/assets/provider-label-KkqVX1CI.js +1 -0
  45. package/dist/web/client/assets/range-BWOHiLNe.js +1 -0
  46. package/dist/web/client/assets/refresh-cw-IThTJ3j-.js +1 -0
  47. package/dist/web/client/assets/{resource-helpers-ULlyU8qK.js → resource-helpers-Q2T0YCMO.js} +1 -1
  48. package/dist/web/client/assets/resources-panel-Bo8dfUdm.js +1 -0
  49. package/dist/web/client/assets/right-panel-context-B2VAZ2p4.js +1 -0
  50. package/dist/web/client/assets/right-panel-registry-C5fQcBKw.js +2 -0
  51. package/dist/web/client/assets/routes-C1hRkRkv.js +16 -0
  52. package/dist/web/client/assets/safe-external-url-D3PJJIcM.js +1 -0
  53. package/dist/web/client/assets/settings-dialog-CvvM6T0m.js +1 -0
  54. package/dist/web/client/assets/{sparkles-C5H3Jtgf.js → shield-check-CkA2viVW.js} +1 -1
  55. package/dist/web/client/assets/{skeleton-loaders-fStjEeRP.js → skeleton-loaders-DjGv9LLA.js} +1 -1
  56. package/dist/web/client/assets/sparkles-DuclzqlE.js +1 -0
  57. package/dist/web/client/assets/{subagent-chat-panel-D-qw4uWb.js → subagent-chat-panel-tGCg6gcn.js} +1 -1
  58. package/dist/web/client/assets/subagent-transcript-NO0PR8RU.js +1 -0
  59. package/dist/web/client/assets/subagent-utils-CQbaJ1g-.js +1 -0
  60. package/dist/web/client/assets/subagents-panel-BkFLsQQY.js +1 -0
  61. package/dist/web/client/assets/surfaces-cW-gp56p.js +1 -0
  62. package/dist/web/client/assets/switch-CcOFiQBK.js +1 -0
  63. package/dist/web/client/assets/terminal-DOS1s1gm.js +1 -0
  64. package/dist/web/client/assets/toast-ATq44uAL.js +1 -0
  65. package/dist/web/client/assets/tool-result-pklnrxSW.js +4 -0
  66. package/dist/web/client/assets/use-reduced-motion-eORd7fqW.js +9 -0
  67. package/dist/web/client/assets/useBaseUiId-CHqXB2UQ.js +1 -0
  68. package/dist/web/client/assets/useControlled-CJJ9BOQB.js +1 -0
  69. package/dist/web/client/assets/workspace-panel-BmMW7h7b.js +1 -0
  70. package/dist/web/client/assets/wrench-BJNNe07k.js +1 -0
  71. package/dist/web/client/assets/x-CsRC_tCI.js +1 -0
  72. package/dist/web/client/bundle-budget.json +10 -0
  73. package/dist/web/server/{_tanstack-start-manifest_v-DZc7dwm7-6ZQLGXB7.js → _tanstack-start-manifest_v-B4BnRTa_-DR7WQTT5.js} +35 -27
  74. package/dist/web/server/agent-activity-Dx6AlDhN-JXOL2EXK.js +514 -0
  75. package/dist/web/server/{artifacts-panel-Bt7YUzm4-NCBMXJ25.js → artifacts-panel-CloS3-ij-XWYXKL6A.js} +26 -18
  76. package/dist/web/server/{chat-command-palette-Co1L3rUY-RQLNME4T.js → chat-command-palette-Cc0uGvNm-GKENKTO7.js} +23 -18
  77. package/dist/web/server/{chunk-2V6B62OF.js → chunk-3B6M63AO.js} +12 -15
  78. package/dist/web/server/chunk-3D4Z32XA.js +22 -0
  79. package/dist/web/server/{chunk-SR65ARVS.js → chunk-3SSHBMDS.js} +16 -12
  80. package/dist/web/server/chunk-4PQ6OD6J.js +22 -0
  81. package/dist/web/server/chunk-56SEDI5N.js +19 -0
  82. package/dist/web/server/chunk-6QNW66XR.js +19 -0
  83. package/dist/web/server/chunk-744IIIDL.js +19 -0
  84. package/dist/web/server/{chunk-52SJQXO4.js → chunk-7PQTPSEE.js} +568 -568
  85. package/dist/web/server/{chunk-LSIHVSUT.js → chunk-7SR6WDM2.js} +2 -2
  86. package/dist/web/server/chunk-ANL4B775.js +60 -0
  87. package/dist/web/server/chunk-BNQWMQHD.js +35 -0
  88. package/dist/web/server/{chunk-BLVCDQ7E.js → chunk-C5X6G26O.js} +1 -19
  89. package/dist/web/server/chunk-C66BSNA6.js +42 -0
  90. package/dist/web/server/{chunk-XLCTCC4W.js → chunk-DEUBJJZN.js} +4 -59
  91. package/dist/web/server/chunk-E365EOXJ.js +35 -0
  92. package/dist/web/server/{chunk-5WZFFNFY.js → chunk-EFAGCVZ3.js} +2 -23
  93. package/dist/web/server/{chunk-56HSKUBD.js → chunk-EGQ6ZX4D.js} +23 -298
  94. package/dist/web/server/{chunk-TO3YPLNZ.js → chunk-EKBKGAWX.js} +12 -10
  95. package/dist/web/server/{chunk-5RQ6QAZX.js → chunk-F6MGAW3L.js} +2 -2
  96. package/dist/web/server/chunk-GABXCOY3.js +37 -0
  97. package/dist/web/server/chunk-GV7DJIHY.js +36 -0
  98. package/dist/web/server/{chunk-6D524OCJ.js → chunk-HSJMLO36.js} +6 -253
  99. package/dist/web/server/{chunk-46VQY7SG.js → chunk-HU4AIJV3.js} +4 -4
  100. package/dist/web/server/{chunk-PDRD2X5G.js → chunk-HZY3LBGP.js} +145 -1
  101. package/dist/web/server/{chunk-UKINNXJY.js → chunk-J6MRJXUH.js} +22 -15
  102. package/dist/web/server/{chunk-RX62LUDV.js → chunk-JOSTE7WK.js} +7 -5
  103. package/dist/web/server/{chunk-QJBEWT4E.js → chunk-K3BXQG3N.js} +27 -292
  104. package/dist/web/server/chunk-K4ESBQ3R.js +20 -0
  105. package/dist/web/server/{chunk-3HUI75QM.js → chunk-KZSM3BHO.js} +16 -107
  106. package/dist/web/server/chunk-L46H6IDX.js +13 -0
  107. package/dist/web/server/chunk-LNGWHEE6.js +206 -0
  108. package/dist/web/server/{chunk-WZNZQNI4.js → chunk-MOSVTKH5.js} +39 -36
  109. package/dist/web/server/{chunk-MDYA4NXK.js → chunk-NJRYX4A2.js} +4 -4
  110. package/dist/web/server/chunk-NNMZQN7Q.js +296 -0
  111. package/dist/web/server/{chunk-AWFOBHH4.js → chunk-NPPG2GTW.js} +7 -7
  112. package/dist/web/server/{chunk-Y4MHIA7B.js → chunk-PJNYH5SR.js} +7 -295
  113. package/dist/web/server/{chunk-7APYEQIO.js → chunk-QAE5SXDK.js} +1 -24
  114. package/dist/web/server/chunk-QTFCJGOY.js +189 -0
  115. package/dist/web/server/{chunk-AECEK3K7.js → chunk-RANJ6OJ3.js} +9 -9
  116. package/dist/web/server/chunk-RPBSDXJ4.js +62 -0
  117. package/dist/web/server/{chunk-VRLTWOVJ.js → chunk-RYHIJMFD.js} +57 -33
  118. package/dist/web/server/{chunk-NLIUTTKL.js → chunk-S3PQ6HKH.js} +1 -16
  119. package/dist/web/server/chunk-SG4W4SPQ.js +31 -0
  120. package/dist/web/server/{chunk-LESNF5O4.js → chunk-T23OO4SC.js} +2 -11
  121. package/dist/web/server/{chunk-BEMDNODD.js → chunk-UNZJQ7CY.js} +6 -4
  122. package/dist/web/server/chunk-V3S6BVXO.js +22 -0
  123. package/dist/web/server/{chunk-SZ65K4CO.js → chunk-W5GRNHV5.js} +6 -4
  124. package/dist/web/server/{chunk-FZRBAPUM.js → chunk-XKYEXPLQ.js} +2 -17
  125. package/dist/web/server/{chunk-6GMKRR3C.js → chunk-XNYQSCB2.js} +2 -2
  126. package/dist/web/server/chunk-YHXAXJ6I.js +22 -0
  127. package/dist/web/server/chunk-YLMXYMLG.js +86 -0
  128. package/dist/web/server/chunk-YNGDUWCF.js +56 -0
  129. package/dist/web/server/chunk-ZJFA4F5X.js +280 -0
  130. package/dist/web/server/fleet-message-queue-Bn0_3Efe-G4BZR2EU.js +74 -0
  131. package/dist/web/server/fleet-pi-tool-renderer-C52SZmPx-CIAH3IV7.js +51 -0
  132. package/dist/web/server/fleet-reasoning-panel-C_e7wzVm-SDHEWDQT.js +199 -0
  133. package/dist/web/server/fleet-subagent-list-CQltKswG-EKCMQHDI.js +18 -0
  134. package/dist/web/server/fleet-tool-timeline-KENErMKg-HTN7SW3D.js +16 -0
  135. package/dist/web/server/{fork-picker-dialog-DCzuGelH-TN2Q5OXI.js → fork-picker-dialog-DK9YGQuB-4QEFWRU4.js} +6 -5
  136. package/dist/web/server/{markdown-Boni3lHk-AZGKDNAR.js → markdown-QcSUaLyd-6DJUK5NC.js} +1 -1
  137. package/dist/web/server/{markdown-code-BrWukbg3-D2GN4Y77.js → markdown-code-Dyo1_13a-52ZQZSPE.js} +2 -2
  138. package/dist/web/server/model-selector-list-CEfWjRc--GBW2GUO6.js +289 -0
  139. package/dist/web/server/{openui-renderer-c36_GYes-HX46N4M5.js → openui-renderer-Dk0Ak9cW-MUJQHDAS.js} +16 -13
  140. package/dist/web/server/prompt-suggestions-BOmHi4-J-C563CHFU.js +30 -0
  141. package/dist/web/server/{resources-panel-CwKh4U9f-D3VDEMDW.js → resources-panel-B03M8bEp-SZG726N5.js} +7 -6
  142. package/dist/web/server/{router-_ZpegqiQ-QIE44PIB.js → router-BE9HcX2W-JMQ3JWE5.js} +39 -24
  143. package/dist/web/server/{routes-Ct81-8Tq-LHRMOS7R.js → routes-CJTRGB1Z-WJKXJFFT.js} +704 -1463
  144. package/dist/web/server/server.js +2 -2
  145. package/dist/web/server/{settings-dialog-B4uUS6f--AZ4I4ZOT.js → settings-dialog-yDibpbBH-TCLJ7NRJ.js} +42 -31
  146. package/dist/web/server/{subagent-chat-panel-C97S3WID-DLOAD5TG.js → subagent-chat-panel-B1YoZIKO-DFRUDQJ2.js} +39 -20
  147. package/dist/web/server/{subagents-panel-iHpvMIZy-LI6XK66M.js → subagents-panel-dJJwpsEL-FTWWCHND.js} +41 -22
  148. package/dist/web/server/{workspace-panel-CHPoiXEo-YB4WS3MK.js → workspace-panel-BC_H8Jri-5MHAEQQS.js} +22 -18
  149. package/package.json +1 -1
  150. package/dist/web/client/assets/action-swap-roll-DX5o_33Q.js +0 -1
  151. package/dist/web/client/assets/analytics-stub-Jh3lkb8P.js +0 -1
  152. package/dist/web/client/assets/artifacts-panel-C3yewUBP.js +0 -1
  153. package/dist/web/client/assets/button-0At5xSyU.js +0 -1
  154. package/dist/web/client/assets/chat-command-palette-D0xDK1j4.js +0 -1
  155. package/dist/web/client/assets/command-CQzrtjyj.js +0 -2
  156. package/dist/web/client/assets/dialog-DZ44tBtH.js +0 -1
  157. package/dist/web/client/assets/dist-MNgIFxqY.js +0 -41
  158. package/dist/web/client/assets/ease-vFBiNFNK.js +0 -9
  159. package/dist/web/client/assets/file-text-BhQ0ZnoU.js +0 -1
  160. package/dist/web/client/assets/generative-text-renderer-SS9c1kNX.js +0 -6
  161. package/dist/web/client/assets/globals-D_Hy9bT1.css +0 -2
  162. package/dist/web/client/assets/horizontal-resize-C1TpRLNC.js +0 -1
  163. package/dist/web/client/assets/index-C9FloFgj.js +0 -12
  164. package/dist/web/client/assets/input-CqC82Agz.js +0 -1
  165. package/dist/web/client/assets/input-group-H0TG-mkU.js +0 -1
  166. package/dist/web/client/assets/notify-Duj26eeZ.js +0 -1
  167. package/dist/web/client/assets/provider-catalog-BZhZuKSz.js +0 -1
  168. package/dist/web/client/assets/provider-label-jKm8v18u.js +0 -1
  169. package/dist/web/client/assets/range-65lubOFp.js +0 -2
  170. package/dist/web/client/assets/resources-panel-DSU7VGX2.js +0 -1
  171. package/dist/web/client/assets/routes-DSTyx_J0.js +0 -16
  172. package/dist/web/client/assets/safe-external-url-Bl_78dpZ.js +0 -1
  173. package/dist/web/client/assets/settings-dialog-CkfpTKfM.js +0 -1
  174. package/dist/web/client/assets/subagent-transcript-C7oRwEEP.js +0 -1
  175. package/dist/web/client/assets/subagents-panel-aSMWZP9p.js +0 -1
  176. package/dist/web/client/assets/switch-BFEBpUEU.js +0 -1
  177. package/dist/web/client/assets/toast-C4s7FYYa.js +0 -1
  178. package/dist/web/client/assets/tool-result-C2NvnN32.js +0 -4
  179. package/dist/web/client/assets/useBaseUiId-B9f7fokB.js +0 -1
  180. package/dist/web/client/assets/useControlled-CoY1jSuL.js +0 -1
  181. package/dist/web/client/assets/workspace-panel-CjdXlEvd.js +0 -1
  182. package/dist/web/client/assets/x-BgciQ7_C.js +0 -1
  183. package/dist/web/server/fleet-pi-tool-renderer-CE45vM6T-2UQN6RJM.js +0 -37
@@ -21,14 +21,47 @@ import {
21
21
  useMutation,
22
22
  useQuery,
23
23
  useQueryClient
24
- } from "./chunk-PDRD2X5G.js";
24
+ } from "./chunk-HZY3LBGP.js";
25
+ import {
26
+ Library,
27
+ RIGHT_PANEL_LAUNCHER_DEFINITIONS,
28
+ Square,
29
+ getRightPanelDefinition
30
+ } from "./chunk-NNMZQN7Q.js";
31
+ import {
32
+ AlertDialog,
33
+ AlertDialogAction,
34
+ AlertDialogCancel,
35
+ AlertDialogContent,
36
+ AlertDialogDescription,
37
+ AlertDialogFooter,
38
+ AlertDialogTitle,
39
+ ArrowLeft,
40
+ CHAT_HEADER_LAYER_CLASS,
41
+ CHROME_PILL_ACTIVE_CLASS,
42
+ CHROME_PILL_CLASS,
43
+ CHROME_PILL_INACTIVE_CLASS,
44
+ PANEL_OVERLAY_CLASS,
45
+ ProviderBrandIcon,
46
+ Settings,
47
+ Spinner,
48
+ Trash2,
49
+ formatProviderLabel,
50
+ safePolygon,
51
+ useHoverFloatingInteraction,
52
+ useHoverReferenceInteraction,
53
+ usePopupHandleStore
54
+ } from "./chunk-3B6M63AO.js";
55
+ import {
56
+ Plus,
57
+ RightPanelProvider,
58
+ useChatPanelDataContext,
59
+ useWorkspaceTreeContext
60
+ } from "./chunk-RPBSDXJ4.js";
25
61
  import {
26
62
  ChevronLeft,
27
63
  FileAttachment,
28
64
  FleetGenerativeTextRenderer,
29
- FleetSubagentList,
30
- FleetToolTimeline,
31
- Image,
32
65
  Message,
33
66
  MessageBubble,
34
67
  MessageBubbleContent,
@@ -37,28 +70,45 @@ import {
37
70
  UserMessage,
38
71
  buildAssistantElements,
39
72
  groupMessages,
40
- normalizeAssistantToolParts,
41
- orderedRlmChildren
42
- } from "./chunk-56HSKUBD.js";
73
+ normalizeAssistantToolParts
74
+ } from "./chunk-EGQ6ZX4D.js";
75
+ import "./chunk-GV7DJIHY.js";
76
+ import {
77
+ RefreshCw
78
+ } from "./chunk-XKYEXPLQ.js";
79
+ import {
80
+ notify
81
+ } from "./chunk-K4ESBQ3R.js";
82
+ import {
83
+ TriangleAlert
84
+ } from "./chunk-W5GRNHV5.js";
85
+ import {
86
+ Bot
87
+ } from "./chunk-74QOI457.js";
43
88
  import {
44
89
  BookOpenText,
45
90
  CitationList,
46
91
  CitationStack,
47
- Earth,
48
92
  ListTodo,
49
93
  LogOut,
50
94
  MessageCircleQuestionMark,
51
95
  PI_TOOL_RENDERERS,
52
- ShimmerLabel,
53
- SwapLabel,
54
- collapsePanel,
96
+ useHoverCapable
97
+ } from "./chunk-KZSM3BHO.js";
98
+ import "./chunk-E365EOXJ.js";
99
+ import {
55
100
  field,
56
101
  floating,
57
102
  mono,
58
- paper,
59
- take,
60
- useHoverCapable
61
- } from "./chunk-3HUI75QM.js";
103
+ paper
104
+ } from "./chunk-ANL4B775.js";
105
+ import "./chunk-EFAGCVZ3.js";
106
+ import {
107
+ Sparkles
108
+ } from "./chunk-BNQWMQHD.js";
109
+ import {
110
+ orderedRlmChildren
111
+ } from "./chunk-YNGDUWCF.js";
62
112
  import {
63
113
  DESKTOP_PANEL_ONLY,
64
114
  File,
@@ -75,70 +125,17 @@ import {
75
125
  thinkingLevelLabel,
76
126
  toModelOption,
77
127
  toModelSelection
78
- } from "./chunk-BEMDNODD.js";
128
+ } from "./chunk-UNZJQ7CY.js";
79
129
  import "./chunk-QK4CHLVV.js";
80
- import {
81
- resolveWorkspacePanelTarget
82
- } from "./chunk-P66QQWUM.js";
83
- import {
84
- Command,
85
- CommandEmpty,
86
- CommandGroup,
87
- CommandInput,
88
- CommandItem,
89
- CommandList,
90
- Library,
91
- RIGHT_PANEL_LAUNCHER_DEFINITIONS,
92
- Square,
93
- getRightPanelDefinition
94
- } from "./chunk-Y4MHIA7B.js";
95
130
  import {
96
131
  Folder
97
132
  } from "./chunk-OLG5DQ7V.js";
98
133
  import {
99
- AlertDialog,
100
- AlertDialogAction,
101
- AlertDialogCancel,
102
- AlertDialogContent,
103
- AlertDialogDescription,
104
- AlertDialogFooter,
105
- AlertDialogTitle,
106
- ArrowLeft,
107
- CHAT_HEADER_LAYER_CLASS,
108
- CHROME_PILL_ACTIVE_CLASS,
109
- CHROME_PILL_CLASS,
110
- CHROME_PILL_INACTIVE_CLASS,
111
- MessageSquare,
112
- PANEL_OVERLAY_CLASS,
113
- ProviderBrandIcon,
114
- Settings,
115
- Spinner,
116
- Trash2,
117
- formatProviderLabel,
118
- safePolygon,
119
- useHoverFloatingInteraction,
120
- useHoverReferenceInteraction,
121
- usePopupHandleStore
122
- } from "./chunk-2V6B62OF.js";
123
- import {
124
- RefreshCw,
125
- notify
126
- } from "./chunk-FZRBAPUM.js";
127
- import {
128
- TriangleAlert
129
- } from "./chunk-SZ65K4CO.js";
130
- import {
131
- Sparkles
132
- } from "./chunk-5WZFFNFY.js";
133
- import {
134
- Plus,
135
- RightPanelProvider,
136
- useChatPanelDataContext,
137
- useWorkspaceTreeContext
138
- } from "./chunk-XLCTCC4W.js";
134
+ resolveWorkspacePanelTarget
135
+ } from "./chunk-P66QQWUM.js";
139
136
  import {
140
- Bot
141
- } from "./chunk-74QOI457.js";
137
+ Gauge
138
+ } from "./chunk-3D4Z32XA.js";
142
139
  import {
143
140
  Search
144
141
  } from "./chunk-2H6A6Z7F.js";
@@ -150,32 +147,40 @@ import {
150
147
  } from "./chunk-4UBOIY2S.js";
151
148
  import {
152
149
  ActionSwapRollText,
153
- AgentDisclosure,
154
- Collapsible,
155
- CollapsibleContent,
156
- CollapsibleTrigger,
157
150
  Copy,
158
- FileCodeCorner,
159
- Wrench
160
- } from "./chunk-6D524OCJ.js";
151
+ FileCodeCorner
152
+ } from "./chunk-LNGWHEE6.js";
153
+ import {
154
+ AgentDisclosure
155
+ } from "./chunk-C66BSNA6.js";
156
+ import {
157
+ RotateCcw
158
+ } from "./chunk-6RJYXDSD.js";
159
+ import "./chunk-SG4W4SPQ.js";
160
+ import {
161
+ LoaderCircle
162
+ } from "./chunk-PKCTG7EW.js";
161
163
  import {
162
164
  AnimatePresence,
165
+ useReducedMotion
166
+ } from "./chunk-ZJFA4F5X.js";
167
+ import {
168
+ ChevronRight
169
+ } from "./chunk-7QCDOBZ3.js";
170
+ import {
163
171
  EASE_DRAWER,
164
172
  EASE_IN_OUT,
165
173
  EASE_OUT,
166
174
  MotionConfigContext,
167
- SPRING_GLIDE,
168
175
  SPRING_LAYOUT,
169
176
  SPRING_MOUSE,
170
177
  SPRING_PANEL,
171
178
  SPRING_PRESS,
172
179
  SPRING_SWAP,
173
180
  m,
174
- motion,
175
181
  useConstant,
176
- useIsomorphicLayoutEffect,
177
- useReducedMotion
178
- } from "./chunk-QJBEWT4E.js";
182
+ useIsomorphicLayoutEffect
183
+ } from "./chunk-K3BXQG3N.js";
179
184
  import {
180
185
  HTMLVisualElement,
181
186
  JSAnimation,
@@ -210,15 +215,6 @@ import {
210
215
  visualElementStore,
211
216
  warning
212
217
  } from "./chunk-FAGDMGLK.js";
213
- import {
214
- RotateCcw
215
- } from "./chunk-6RJYXDSD.js";
216
- import {
217
- LoaderCircle
218
- } from "./chunk-PKCTG7EW.js";
219
- import {
220
- ChevronRight
221
- } from "./chunk-7QCDOBZ3.js";
222
218
  import {
223
219
  UiErrorBoundary,
224
220
  decodeOpenPanelActionMessage
@@ -247,12 +243,6 @@ import {
247
243
  WorkspaceRelativePathSchema,
248
244
  external_exports
249
245
  } from "./chunk-XFVL5ITL.js";
250
- import "./chunk-NFRJDPB3.js";
251
- import {
252
- ChevronUp,
253
- isSafeExternalUrl
254
- } from "./chunk-LESNF5O4.js";
255
- import "./chunk-52SJQXO4.js";
256
246
  import {
257
247
  CompositeList,
258
248
  Select,
@@ -266,18 +256,19 @@ import {
266
256
  useOpenMethodTriggerProps,
267
257
  usePositioner,
268
258
  useToolbarRootContext
269
- } from "./chunk-TO3YPLNZ.js";
259
+ } from "./chunk-EKBKGAWX.js";
270
260
  import "./chunk-RJOANOT4.js";
261
+ import "./chunk-NFRJDPB3.js";
262
+ import {
263
+ ChevronUp
264
+ } from "./chunk-T23OO4SC.js";
265
+ import "./chunk-L46H6IDX.js";
271
266
  import {
272
267
  ChevronDown
273
268
  } from "./chunk-QLY3L4A2.js";
274
269
  import {
275
270
  Input
276
- } from "./chunk-AWFOBHH4.js";
277
- import {
278
- Check,
279
- useControlled
280
- } from "./chunk-NLIUTTKL.js";
271
+ } from "./chunk-NPPG2GTW.js";
281
272
  import {
282
273
  ARROW_DOWN,
283
274
  ARROW_LEFT,
@@ -320,7 +311,7 @@ import {
320
311
  usePopupRootSync,
321
312
  useSurface,
322
313
  useTriggerDataForwarding
323
- } from "./chunk-RX62LUDV.js";
314
+ } from "./chunk-JOSTE7WK.js";
324
315
  import {
325
316
  Button,
326
317
  CLICK_TRIGGER_IDENTIFIER,
@@ -344,15 +335,23 @@ import {
344
335
  isListIndexDisabled,
345
336
  isOutsideEvent,
346
337
  ownerDocument
347
- } from "./chunk-5RQ6QAZX.js";
338
+ } from "./chunk-F6MGAW3L.js";
339
+ import {
340
+ Check
341
+ } from "./chunk-6QNW66XR.js";
342
+ import {
343
+ useControlled
344
+ } from "./chunk-S3PQ6HKH.js";
348
345
  import {
349
346
  useBaseUiId
350
- } from "./chunk-LSIHVSUT.js";
347
+ } from "./chunk-7SR6WDM2.js";
348
+ import {
349
+ X
350
+ } from "./chunk-YHXAXJ6I.js";
351
351
  import {
352
352
  CompositeRootContext,
353
353
  EMPTY_ARRAY,
354
354
  EMPTY_OBJECT,
355
- X,
356
355
  createChangeEventDetails,
357
356
  disabled,
358
357
  focusOut,
@@ -371,22 +370,22 @@ import {
371
370
  useOpenChangeComplete,
372
371
  useRenderElement,
373
372
  useStableCallback
374
- } from "./chunk-BLVCDQ7E.js";
373
+ } from "./chunk-C5X6G26O.js";
375
374
  import {
376
375
  getResourceGroups
377
- } from "./chunk-46VQY7SG.js";
378
- import {
379
- CircleAlert,
380
- FileText
381
- } from "./chunk-7APYEQIO.js";
376
+ } from "./chunk-HU4AIJV3.js";
382
377
  import "./chunk-BSFYTSN6.js";
383
378
  import "./chunk-EAJTWMK5.js";
379
+ import {
380
+ FileText
381
+ } from "./chunk-QAE5SXDK.js";
382
+ import {
383
+ CircleAlert
384
+ } from "./chunk-GABXCOY3.js";
384
385
  import {
385
386
  Package
386
387
  } from "./chunk-ZGFQ7HIX.js";
387
- import {
388
- SquareTerminal
389
- } from "./chunk-G5BCQQ5N.js";
388
+ import "./chunk-G5BCQQ5N.js";
390
389
  import "./chunk-BYXBJQAS.js";
391
390
  import {
392
391
  createLucideIcon
@@ -401,7 +400,7 @@ import "./chunk-JDCCC7A7.js";
401
400
  import "./chunk-L547YHC4.js";
402
401
  import "./chunk-MLKGABMK.js";
403
402
 
404
- // web/app/dist/server/assets/routes-Ct81-8Tq.js
403
+ // web/app/dist/server/assets/routes-CJTRGB1Z.js
405
404
  import * as React$1 from "react";
406
405
  import { Suspense, cloneElement, createContext as createContext2, createElement, forwardRef as forwardRef2, isValidElement, lazy, memo, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect2, useEffectEvent, useId, useInsertionEffect, useLayoutEffect, useMemo as useMemo2, useReducer, useRef as useRef2, useState as useState2, useSyncExternalStore } from "react";
407
406
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -461,12 +460,6 @@ var CircleStop = createLucideIcon("circle-stop", [["circle", {
461
460
  rx: "1",
462
461
  key: "1ssd4o"
463
462
  }]]);
464
- var Circle = createLucideIcon("circle", [["circle", {
465
- cx: "12",
466
- cy: "12",
467
- r: "10",
468
- key: "1mglay"
469
- }]]);
470
463
  var Clock3 = createLucideIcon("clock-3", [["circle", {
471
464
  cx: "12",
472
465
  cy: "12",
@@ -476,7 +469,7 @@ var Clock3 = createLucideIcon("clock-3", [["circle", {
476
469
  d: "M12 6v6h4",
477
470
  key: "135r8i"
478
471
  }]]);
479
- var Command2 = createLucideIcon("command", [["path", {
472
+ var Command = createLucideIcon("command", [["path", {
480
473
  d: "M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",
481
474
  key: "11bfej"
482
475
  }]]);
@@ -550,13 +543,6 @@ var FolderTree = createLucideIcon("folder-tree", [
550
543
  key: "k8epm1"
551
544
  }]
552
545
  ]);
553
- var Gauge = createLucideIcon("gauge", [["path", {
554
- d: "m12 14 4-4",
555
- key: "9kzdfg"
556
- }], ["path", {
557
- d: "M3.34 19a10 10 0 1 1 17.32 0",
558
- key: "19p75a"
559
- }]]);
560
546
  var ListRestart = createLucideIcon("list-restart", [
561
547
  ["path", {
562
548
  d: "M21 5H3",
@@ -622,20 +608,6 @@ var PanelRight = createLucideIcon("panel-right", [["rect", {
622
608
  d: "M15 3v18",
623
609
  key: "14nvp0"
624
610
  }]]);
625
- var PencilLine = createLucideIcon("pencil-line", [
626
- ["path", {
627
- d: "M13 21h8",
628
- key: "1jsn5i"
629
- }],
630
- ["path", {
631
- d: "m15 5 4 4",
632
- key: "1mk7zo"
633
- }],
634
- ["path", {
635
- d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
636
- key: "1a8usu"
637
- }]
638
- ]);
639
611
  var Pencil = createLucideIcon("pencil", [["path", {
640
612
  d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
641
613
  key: "1a8usu"
@@ -7450,551 +7422,109 @@ function StreamingResponse({ children, status = "streaming", copyText, onCopy, o
7450
7422
  })]
7451
7423
  });
7452
7424
  }
7453
- var TEXT_SHIMMER_KEYFRAMES = "@keyframes beui-text-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion: reduce){.beui-text-shimmer{animation:none !important}}";
7454
- var TEXT_SHIMMER_CLASS_NAME = "beui-text-shimmer bg-[length:200%_100%] bg-clip-text text-transparent bg-[linear-gradient(110deg,var(--muted-foreground)_30%,var(--foreground)_50%,var(--muted-foreground)_70%)]";
7455
- function textShimmerStyle(duration) {
7456
- return { animation: `beui-text-shimmer ${duration}s linear infinite` };
7457
- }
7458
- function TextShimmer({ children, as: Comp = "span", duration = 2.5, className }) {
7459
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("style", { children: TEXT_SHIMMER_KEYFRAMES }), /* @__PURE__ */ jsx(Comp, {
7460
- style: textShimmerStyle(duration),
7461
- className: cn("inline-block", TEXT_SHIMMER_CLASS_NAME, className),
7462
- children
7463
- })] });
7464
- }
7465
- function ThinkingShimmer({ children = "Thinking\u2026", duration = 1.8, className }) {
7466
- return /* @__PURE__ */ jsx(TextShimmer, {
7467
- as: "span",
7468
- duration,
7469
- className: cn("font-medium", className),
7470
- children
7471
- });
7425
+ var GRID_CELLS = [
7426
+ {
7427
+ id: "top-left",
7428
+ delay: 0
7429
+ },
7430
+ {
7431
+ id: "top-center",
7432
+ delay: 0.14
7433
+ },
7434
+ {
7435
+ id: "top-right",
7436
+ delay: 0.28
7437
+ },
7438
+ {
7439
+ id: "middle-left",
7440
+ delay: 0.42
7441
+ },
7442
+ {
7443
+ id: "middle-center",
7444
+ delay: 0.56
7445
+ },
7446
+ {
7447
+ id: "middle-right",
7448
+ delay: 0.7
7449
+ },
7450
+ {
7451
+ id: "bottom-left",
7452
+ delay: 0.84
7453
+ },
7454
+ {
7455
+ id: "bottom-center",
7456
+ delay: 0.98
7457
+ },
7458
+ {
7459
+ id: "bottom-right",
7460
+ delay: 1.12
7461
+ }
7462
+ ];
7463
+ function formatElapsed(totalSeconds) {
7464
+ const safeSeconds = Math.max(0, totalSeconds);
7465
+ const minutes = Math.floor(safeSeconds / 60);
7466
+ const seconds = (safeSeconds % 60).toFixed(1);
7467
+ return minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`;
7472
7468
  }
7473
- function StepRow({ item }) {
7474
- const state = item.status ?? "complete";
7475
- return /* @__PURE__ */ jsxs("div", {
7476
- className: "flex min-h-7 items-start gap-2.5 rounded-md px-1.5 py-1",
7469
+ function AgentProgress({ label = "Churning", elapsedSeconds, initialSeconds = 0, running = true, className }) {
7470
+ const reduce = useReducedMotion() ?? false;
7471
+ const [internalSeconds, setInternalSeconds] = useState2(initialSeconds);
7472
+ useEffect2(() => {
7473
+ if (elapsedSeconds !== void 0 || !running) return;
7474
+ const startedAt = performance.now() - initialSeconds * 1e3;
7475
+ const timer = window.setInterval(() => {
7476
+ setInternalSeconds((performance.now() - startedAt) / 1e3);
7477
+ }, 100);
7478
+ return () => window.clearInterval(timer);
7479
+ }, [
7480
+ elapsedSeconds,
7481
+ initialSeconds,
7482
+ running
7483
+ ]);
7484
+ const elapsed = elapsedSeconds ?? internalSeconds;
7485
+ return /* @__PURE__ */ jsxs("span", {
7486
+ role: "status",
7487
+ "aria-label": `${label}, in progress`,
7488
+ className: cn("inline-flex items-center gap-3 font-mono text-sm text-muted-foreground", className),
7477
7489
  children: [
7478
7490
  /* @__PURE__ */ jsx("span", {
7479
7491
  "aria-hidden": "true",
7480
- className: "mt-0.5 grid size-4 shrink-0 place-items-center text-muted-foreground/70",
7481
- children: state === "complete" ? /* @__PURE__ */ jsx(Check, {
7482
- className: "size-4",
7483
- strokeWidth: 1.8
7484
- }) : state === "active" ? /* @__PURE__ */ jsxs("span", {
7485
- className: "relative grid size-3 place-items-center",
7486
- children: [/* @__PURE__ */ jsx(motion.span, {
7487
- className: "absolute inset-0 rounded-full bg-foreground/10",
7488
- animate: { opacity: [
7489
- 0.35,
7490
- 0.8,
7491
- 0.35
7492
- ] },
7493
- transition: {
7494
- duration: 1.5,
7495
- repeat: Number.POSITIVE_INFINITY
7496
- }
7497
- }), /* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-foreground/60" })]
7498
- }) : /* @__PURE__ */ jsx(Circle, {
7499
- className: "size-3",
7500
- strokeWidth: 1.5
7501
- })
7492
+ className: "grid size-5 shrink-0 grid-cols-3 gap-[2px]",
7493
+ children: GRID_CELLS.map(({ id, delay }) => /* @__PURE__ */ jsx(m.span, {
7494
+ className: "rounded-[1px] bg-current",
7495
+ animate: reduce ? { opacity: [
7496
+ 0.35,
7497
+ 0.8,
7498
+ 0.35
7499
+ ] } : {
7500
+ opacity: [
7501
+ 0.28,
7502
+ 1,
7503
+ 0.28
7504
+ ],
7505
+ scale: [
7506
+ 0.72,
7507
+ 1,
7508
+ 0.72
7509
+ ]
7510
+ },
7511
+ transition: {
7512
+ duration: 1.55,
7513
+ ease: EASE_IN_OUT,
7514
+ repeat: Infinity,
7515
+ delay
7516
+ }
7517
+ }, id))
7502
7518
  }),
7503
7519
  /* @__PURE__ */ jsx("span", {
7504
- className: cn("min-w-0 flex-1 leading-5", state === "pending" ? "text-muted-foreground/55" : "text-foreground/90"),
7505
- children: item.label
7520
+ className: "font-sans font-medium",
7521
+ children: label
7506
7522
  }),
7507
- item.meta ? /* @__PURE__ */ jsx("span", {
7508
- className: "shrink-0 leading-5 text-muted-foreground/55",
7509
- children: item.meta
7510
- }) : null
7511
- ]
7512
- });
7513
- }
7514
- function TextRow({ item }) {
7515
- return /* @__PURE__ */ jsx("div", {
7516
- className: "rounded-md px-1.5 py-1 leading-5 text-muted-foreground",
7517
- children: item.content
7518
- });
7519
- }
7520
- function SearchResultRow({ result }) {
7521
- const safeUrl = result.url && isSafeExternalUrl(result.url) ? result.url : void 0;
7522
- const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
7523
- /* @__PURE__ */ jsx("span", {
7524
- "aria-hidden": "true",
7525
- className: "grid size-5 shrink-0 place-items-center text-muted-foreground",
7526
- children: result.icon ?? /* @__PURE__ */ jsx(Earth, {
7527
- className: "size-3",
7528
- strokeWidth: 2
7529
- })
7530
- }),
7531
- /* @__PURE__ */ jsx("span", {
7532
- className: "min-w-0 truncate font-medium text-foreground/90",
7533
- children: result.title
7534
- }),
7535
- result.domain ? /* @__PURE__ */ jsx("span", {
7536
- className: "min-w-0 truncate text-muted-foreground/55",
7537
- children: result.domain
7538
- }) : null
7539
- ] });
7540
- const className = cn("flex min-h-7 items-center gap-2 rounded-md px-1.5 py-1 text-left outline-none transition-colors", safeUrl && "focus-visible:ring-2 focus-visible:ring-ring");
7541
- return safeUrl ? /* @__PURE__ */ jsx("a", {
7542
- href: safeUrl,
7543
- className,
7544
- children: content
7545
- }) : /* @__PURE__ */ jsx("div", {
7546
- className,
7547
- children: content
7548
- });
7549
- }
7550
- function SearchRow({ item }) {
7551
- const reduce = useReducedMotion() ?? false;
7552
- const enter = reduce ? { opacity: 1 } : {
7553
- opacity: 0,
7554
- y: 6
7555
- };
7556
- const visible = {
7557
- opacity: 1,
7558
- y: 0
7559
- };
7560
- const exit = reduce ? { opacity: 0 } : {
7561
- opacity: 0,
7562
- y: -3
7563
- };
7564
- const transition = reduce ? { duration: 0 } : {
7565
- opacity: {
7566
- duration: 0.18,
7567
- ease: EASE_OUT
7568
- },
7569
- y: SPRING_LAYOUT,
7570
- layout: SPRING_LAYOUT
7571
- };
7572
- return /* @__PURE__ */ jsxs("div", {
7573
- className: "space-y-0.5",
7574
- children: [
7575
- /* @__PURE__ */ jsxs("div", {
7576
- className: "flex min-h-7 items-center gap-2.5 rounded-md px-1.5 py-1 text-muted-foreground",
7577
- children: [/* @__PURE__ */ jsx(Search, {
7578
- "aria-hidden": "true",
7579
- className: "size-4 shrink-0",
7580
- strokeWidth: 1.7
7581
- }), /* @__PURE__ */ jsx("span", {
7582
- className: "min-w-0 truncate",
7583
- children: item.query
7584
- })]
7585
- }),
7586
- item.results?.length ? /* @__PURE__ */ jsx("div", {
7587
- className: "space-y-0.5 pl-4",
7588
- children: /* @__PURE__ */ jsx(AnimatePresence, {
7589
- initial: true,
7590
- mode: "popLayout",
7591
- children: item.results.map((result) => /* @__PURE__ */ jsx(motion.div, {
7592
- layout: "position",
7593
- initial: enter,
7594
- animate: visible,
7595
- exit,
7596
- transition,
7597
- children: /* @__PURE__ */ jsx(SearchResultRow, { result })
7598
- }, result.id))
7599
- })
7600
- }) : null,
7601
- /* @__PURE__ */ jsx(AnimatePresence, {
7602
- initial: true,
7603
- children: item.moreCount ? /* @__PURE__ */ jsxs(motion.div, {
7604
- initial: enter,
7605
- animate: visible,
7606
- exit,
7607
- transition,
7608
- className: "px-1.5 py-1 pl-8 text-muted-foreground/55",
7609
- children: [
7610
- "+",
7611
- item.moreCount,
7612
- " more"
7613
- ]
7614
- }, "more-results") : null
7615
- })
7616
- ]
7617
- });
7618
- }
7619
- function ActionIcon({ action }) {
7620
- if (action === "read") return /* @__PURE__ */ jsx(FileText, { className: "size-4" });
7621
- if (action === "edit" || action === "write") return /* @__PURE__ */ jsx(PencilLine, { className: "size-4" });
7622
- if (action === "run") return /* @__PURE__ */ jsx(SquareTerminal, { className: "size-4" });
7623
- return /* @__PURE__ */ jsx(Wrench, { className: "size-4" });
7624
- }
7625
- function ActivityAction({ action }) {
7626
- return /* @__PURE__ */ jsx("button", {
7627
- type: "button",
7628
- "aria-label": action.ariaLabel ?? action.label,
7629
- onClick: action.onClick,
7630
- className: "shrink-0 rounded-md px-1.5 py-1 text-[10px] font-medium text-primary outline-none hover:bg-primary/10 focus-visible:ring-2 focus-visible:ring-ring",
7631
- children: action.label
7632
- });
7633
- }
7634
- function ToolRow({ item }) {
7635
- const action = item.action.charAt(0).toUpperCase() + item.action.slice(1);
7636
- const hasChanges = typeof item.additions === "number" || typeof item.deletions === "number";
7637
- return /* @__PURE__ */ jsxs("div", {
7638
- className: "grid min-h-8 min-w-0 grid-cols-[1rem_auto_minmax(0,1fr)_auto] items-center gap-2.5 rounded-md px-1.5 py-0.5 leading-5",
7639
- children: [
7640
- /* @__PURE__ */ jsx("span", {
7641
- "aria-hidden": "true",
7642
- className: "grid size-4 shrink-0 place-items-center text-muted-foreground/70",
7643
- children: /* @__PURE__ */ jsx(ActionIcon, { action: item.action })
7644
- }),
7645
- /* @__PURE__ */ jsx("span", {
7646
- className: "shrink-0 font-medium text-foreground/90",
7647
- children: action
7648
- }),
7649
- /* @__PURE__ */ jsx("span", {
7650
- className: "min-w-0 flex-1 truncate rounded-lg bg-muted/80 px-2.5 py-1 font-mono text-xs text-muted-foreground/70",
7651
- children: item.target
7652
- }),
7653
- hasChanges || item.openAction ? /* @__PURE__ */ jsxs("div", {
7654
- className: "flex shrink-0 items-center gap-2",
7655
- children: [hasChanges ? /* @__PURE__ */ jsxs("span", {
7656
- className: "flex items-center gap-2 font-mono tabular-nums",
7657
- children: [typeof item.additions === "number" ? /* @__PURE__ */ jsxs("span", {
7658
- className: "text-emerald-500",
7659
- children: ["+", item.additions]
7660
- }) : null, typeof item.deletions === "number" ? /* @__PURE__ */ jsxs("span", {
7661
- className: "text-rose-500",
7662
- children: ["\u2212", item.deletions]
7663
- }) : null]
7664
- }) : null, item.openAction ? /* @__PURE__ */ jsx(ActivityAction, { action: item.openAction }) : null]
7665
- }) : null
7666
- ]
7667
- });
7668
- }
7669
- function TraceIcon({ kind }) {
7670
- if (kind === "thinking") return /* @__PURE__ */ jsx(Sparkles, { className: "size-4" });
7671
- if (kind === "message") return /* @__PURE__ */ jsx(MessageSquare, { className: "size-4" });
7672
- if (kind === "write") return /* @__PURE__ */ jsx(PencilLine, { className: "size-4" });
7673
- if (kind === "run") return /* @__PURE__ */ jsx(SquareTerminal, { className: "size-4" });
7674
- if (kind === "read") return /* @__PURE__ */ jsx(Image, { className: "size-4" });
7675
- return /* @__PURE__ */ jsx(Wrench, { className: "size-4" });
7676
- }
7677
- function TraceRow({ item }) {
7678
- const thinking = item.kind === "thinking";
7679
- return /* @__PURE__ */ jsxs("div", {
7680
- className: cn("grid min-h-8 grid-cols-[1rem_auto_minmax(0,1fr)_auto] gap-2.5 rounded-md px-1.5 py-0.5", thinking ? "items-start" : "items-center"),
7681
- children: [
7682
- /* @__PURE__ */ jsx("span", {
7683
- "aria-hidden": "true",
7684
- className: "grid size-4 place-items-center text-muted-foreground/70",
7685
- children: item.icon ?? /* @__PURE__ */ jsx(TraceIcon, { kind: item.kind })
7686
- }),
7687
- /* @__PURE__ */ jsx("span", {
7688
- className: "min-w-0 truncate font-medium text-foreground/90",
7689
- children: item.label
7690
- }),
7691
- item.detail ? /* @__PURE__ */ jsx("span", {
7692
- className: cn("min-w-0 rounded-lg bg-muted/80 px-2.5 py-1 font-mono text-xs text-muted-foreground/70", thinking ? "max-h-40 overflow-y-auto whitespace-pre-wrap break-words" : "truncate"),
7693
- children: item.detail
7694
- }) : /* @__PURE__ */ jsx("span", {}),
7695
- item.action ? /* @__PURE__ */ jsx(ActivityAction, { action: item.action }) : null
7696
- ]
7697
- });
7698
- }
7699
- function ActivityRow({ item }) {
7700
- if (item.type === "text") return /* @__PURE__ */ jsx(TextRow, { item });
7701
- if (item.type === "search") return /* @__PURE__ */ jsx(SearchRow, { item });
7702
- if (item.type === "tool") return /* @__PURE__ */ jsx(ToolRow, { item });
7703
- if (item.type === "trace") return /* @__PURE__ */ jsx(TraceRow, { item });
7704
- return /* @__PURE__ */ jsx(StepRow, { item });
7705
- }
7706
- function formatDuration(duration) {
7707
- const seconds = Math.max(0, Math.round(duration));
7708
- if (seconds < 60) return `${seconds}s`;
7709
- const minutes = Math.floor(seconds / 60);
7710
- const remainder = seconds % 60;
7711
- return remainder === 0 ? `${minutes}m` : `${minutes}m ${remainder}s`;
7712
- }
7713
- function useControllableOpen({ open, defaultOpen, onOpenChange }) {
7714
- const [internalOpen, setInternalOpen] = useState2(defaultOpen);
7715
- const controlled = open !== void 0;
7716
- return [open ?? internalOpen, useCallback2((next) => {
7717
- if (!controlled) setInternalOpen(next);
7718
- onOpenChange?.(next);
7719
- }, [controlled, onOpenChange])];
7720
- }
7721
- function getContentType(items) {
7722
- const first = items[0]?.type;
7723
- return first && items.every((item) => item.type === first) ? first : "mixed";
7724
- }
7725
- function getActiveLabel(type) {
7726
- if (type === "search") return "Searching the web\u2026";
7727
- if (type === "tool") return "Running tools\u2026";
7728
- if (type === "trace") return "Working through the run\u2026";
7729
- if (type === "mixed") return "Working through it\u2026";
7730
- return "Thinking\u2026";
7731
- }
7732
- function getSummary(type, items, duration) {
7733
- if (type === "step" || type === "text") return /* @__PURE__ */ jsxs(Fragment$1, { children: ["Thought for ", /* @__PURE__ */ jsx("span", {
7734
- className: "tabular-nums",
7735
- children: formatDuration(duration)
7736
- })] });
7737
- if (type === "search") return "Searched the web";
7738
- if (type === "tool") return `Ran ${items.length} ${items.length === 1 ? "tool" : "tools"}`;
7739
- if (type === "trace") {
7740
- const messages = items.filter((item) => item.type === "trace" && (item.kind === "thinking" || item.kind === "message")).length;
7741
- const tools = items.length - messages;
7742
- return `${tools} ${tools === 1 ? "tool call" : "tool calls"}, ${messages} ${messages === 1 ? "message" : "messages"}`;
7743
- }
7744
- return `Completed ${items.length} ${items.length === 1 ? "step" : "steps"}`;
7745
- }
7746
- function AgentActivity({ items, contentType: initialContentType, status = "working", duration = 0, open, defaultOpen = false, onOpenChange, collapseOnComplete = true, activeLabel, summary, renderWorkingStatus, renderCompletedStatus, maxHeight = 208, className, contentClassName }) {
7747
- const reduce = useReducedMotion() ?? false;
7748
- const baseId = useId();
7749
- const triggerId = `${baseId}-trigger`;
7750
- const contentId = `${baseId}-content`;
7751
- const contentRef = useRef2(null);
7752
- const viewportRef = useRef2(null);
7753
- const previousStatus = useRef2(status);
7754
- const [contentHeight, setContentHeight] = useState2(0);
7755
- const [currentOpen, setOpen] = useControllableOpen({
7756
- open,
7757
- defaultOpen,
7758
- onOpenChange
7759
- });
7760
- const working = status === "working";
7761
- const expanded = working || currentOpen;
7762
- const contentType = items.length ? getContentType(items) : initialContentType ?? "mixed";
7763
- const viewportHeight = working ? Math.max(0, maxHeight) : Math.min(contentHeight, Math.max(0, maxHeight));
7764
- const capped = contentHeight > maxHeight;
7765
- const streamOffset = working ? Math.min(0, viewportHeight - contentHeight) : 0;
7766
- useLayoutEffect(() => {
7767
- const node = contentRef.current;
7768
- if (!node) return;
7769
- const measure = () => setContentHeight(node.offsetHeight);
7770
- measure();
7771
- if (typeof ResizeObserver === "undefined") return;
7772
- const observer = new ResizeObserver(measure);
7773
- observer.observe(node);
7774
- return () => observer.disconnect();
7775
- }, []);
7776
- useEffect2(() => {
7777
- if (previousStatus.current === "working" && status === "complete") setOpen(!collapseOnComplete);
7778
- previousStatus.current = status;
7779
- }, [
7780
- collapseOnComplete,
7781
- setOpen,
7782
- status
7783
- ]);
7784
- const toggle = () => {
7785
- const next = !currentOpen;
7786
- setOpen(next);
7787
- if (next) requestAnimationFrame(() => viewportRef.current?.scrollTo({ top: 0 }));
7788
- };
7789
- const liveLabel = activeLabel ?? getActiveLabel(contentType);
7790
- const completedSummary = summary ?? getSummary(contentType, items, duration);
7791
- const maskImage = capped ? working ? "linear-gradient(to bottom, transparent, black 12px)" : "linear-gradient(to bottom, transparent, black 12px, black calc(100% - 12px), transparent)" : void 0;
7792
- return /* @__PURE__ */ jsxs("div", {
7793
- "data-state": working ? "working" : expanded ? "open" : "closed",
7794
- "data-content": contentType,
7795
- "aria-busy": working,
7796
- className: cn("w-full text-sm", className),
7797
- children: [working ? /* @__PURE__ */ jsx("div", {
7798
- id: triggerId,
7799
- role: "status",
7800
- className: "flex h-7 min-w-0 items-center text-muted-foreground",
7801
- children: renderWorkingStatus ? renderWorkingStatus({
7802
- label: liveLabel,
7803
- duration
7804
- }) : /* @__PURE__ */ jsx(ThinkingShimmer, { children: liveLabel })
7805
- }) : /* @__PURE__ */ jsxs("button", {
7806
- id: triggerId,
7807
- type: "button",
7808
- "aria-expanded": expanded,
7809
- "aria-controls": contentId,
7810
- onClick: toggle,
7811
- className: "group flex h-7 min-w-0 items-center gap-1.5 rounded-md text-left font-medium text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
7812
- children: [/* @__PURE__ */ jsx("span", {
7813
- className: "truncate",
7814
- children: renderCompletedStatus ? renderCompletedStatus({
7815
- summary: completedSummary,
7816
- duration
7817
- }) : completedSummary
7818
- }), /* @__PURE__ */ jsx(motion.span, {
7819
- "aria-hidden": "true",
7820
- animate: { rotate: expanded ? 180 : 0 },
7821
- transition: reduce ? { duration: 0 } : SPRING_SWAP,
7822
- className: "inline-flex shrink-0 text-muted-foreground/70 group-hover:text-foreground",
7823
- children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-3.5" })
7824
- })]
7825
- }), /* @__PURE__ */ jsx(AgentDisclosure, {
7826
- id: contentId,
7827
- role: "region",
7828
- "aria-labelledby": triggerId,
7829
- open: expanded,
7830
- openHeight: viewportHeight,
7831
- children: /* @__PURE__ */ jsx("div", {
7832
- ref: viewportRef,
7833
- className: cn("scrollbar-hide pr-1", capped && expanded && !working ? "overflow-y-auto" : "overflow-y-hidden"),
7834
- style: {
7835
- height: viewportHeight,
7836
- maskImage,
7837
- WebkitMaskImage: maskImage
7838
- },
7839
- children: /* @__PURE__ */ jsx(motion.div, {
7840
- ref: contentRef,
7841
- role: "list",
7842
- initial: false,
7843
- animate: { y: streamOffset },
7844
- transition: reduce ? { duration: 0 } : SPRING_LAYOUT,
7845
- className: cn("space-y-0.5 py-2", contentClassName),
7846
- children: /* @__PURE__ */ jsx(AnimatePresence, {
7847
- mode: "popLayout",
7848
- children: items.map((item) => /* @__PURE__ */ jsx(motion.div, {
7849
- layout: "position",
7850
- role: "listitem",
7851
- initial: reduce ? { opacity: 1 } : {
7852
- opacity: 0,
7853
- y: 6
7854
- },
7855
- animate: {
7856
- opacity: 1,
7857
- y: 0
7858
- },
7859
- exit: reduce ? { opacity: 0 } : {
7860
- opacity: 0,
7861
- y: -3
7862
- },
7863
- transition: reduce ? { duration: 0 } : {
7864
- opacity: {
7865
- duration: 0.18,
7866
- ease: EASE_OUT
7867
- },
7868
- y: SPRING_LAYOUT,
7869
- layout: SPRING_LAYOUT
7870
- },
7871
- children: /* @__PURE__ */ jsx(ActivityRow, { item })
7872
- }, item.id))
7873
- })
7874
- })
7875
- })
7876
- })]
7877
- });
7878
- }
7879
- function PromptSuggestions({ suggestions, selectedSuggestion, cycle, onSuggestion, variant = "pills", className, ...props }) {
7880
- const list = variant === "list";
7881
- return /* @__PURE__ */ jsx("div", {
7882
- "data-slot": "suggestions",
7883
- className: cn(list ? "flex w-full max-w-sm flex-col gap-2" : "flex w-full max-w-xl flex-wrap justify-center gap-1", className),
7884
- ...props,
7885
- children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsx("button", {
7886
- type: "button",
7887
- "aria-pressed": selectedSuggestion === suggestion,
7888
- onClick: () => onSuggestion(suggestion),
7889
- className: cn(paper, "fade-in slide-in-from-bottom-2 animate-in fill-mode-both flex cursor-pointer items-center text-[13px] text-foreground/80 transition-[color,transform] duration-300 hover:-translate-y-px hover:text-foreground focus-visible:text-foreground active:scale-[0.96] motion-reduce:animate-none", list ? "w-full rounded-2xl px-4 py-2.5 text-start" : "rounded-full px-4 py-2", selectedSuggestion === suggestion && "!bg-foreground !text-background hover:!text-background focus-visible:!text-background"),
7890
- style: { animationDelay: `${index * 70}ms` },
7891
- children: suggestion
7892
- }, suggestion))
7893
- }, cycle);
7894
- }
7895
- var GRID_CELLS = [
7896
- {
7897
- id: "top-left",
7898
- delay: 0
7899
- },
7900
- {
7901
- id: "top-center",
7902
- delay: 0.14
7903
- },
7904
- {
7905
- id: "top-right",
7906
- delay: 0.28
7907
- },
7908
- {
7909
- id: "middle-left",
7910
- delay: 0.42
7911
- },
7912
- {
7913
- id: "middle-center",
7914
- delay: 0.56
7915
- },
7916
- {
7917
- id: "middle-right",
7918
- delay: 0.7
7919
- },
7920
- {
7921
- id: "bottom-left",
7922
- delay: 0.84
7923
- },
7924
- {
7925
- id: "bottom-center",
7926
- delay: 0.98
7927
- },
7928
- {
7929
- id: "bottom-right",
7930
- delay: 1.12
7931
- }
7932
- ];
7933
- function formatElapsed$1(totalSeconds) {
7934
- const safeSeconds = Math.max(0, totalSeconds);
7935
- const minutes = Math.floor(safeSeconds / 60);
7936
- const seconds = (safeSeconds % 60).toFixed(1);
7937
- return minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`;
7938
- }
7939
- function AgentProgress({ label = "Churning", elapsedSeconds, initialSeconds = 0, running = true, className }) {
7940
- const reduce = useReducedMotion() ?? false;
7941
- const [internalSeconds, setInternalSeconds] = useState2(initialSeconds);
7942
- useEffect2(() => {
7943
- if (elapsedSeconds !== void 0 || !running) return;
7944
- const startedAt = performance.now() - initialSeconds * 1e3;
7945
- const timer = window.setInterval(() => {
7946
- setInternalSeconds((performance.now() - startedAt) / 1e3);
7947
- }, 100);
7948
- return () => window.clearInterval(timer);
7949
- }, [
7950
- elapsedSeconds,
7951
- initialSeconds,
7952
- running
7953
- ]);
7954
- const elapsed = elapsedSeconds ?? internalSeconds;
7955
- return /* @__PURE__ */ jsxs("span", {
7956
- role: "status",
7957
- "aria-label": `${label}, in progress`,
7958
- className: cn("inline-flex items-center gap-3 font-mono text-sm text-muted-foreground", className),
7959
- children: [
7960
- /* @__PURE__ */ jsx("span", {
7961
- "aria-hidden": "true",
7962
- className: "grid size-5 shrink-0 grid-cols-3 gap-[2px]",
7963
- children: GRID_CELLS.map(({ id, delay }) => /* @__PURE__ */ jsx(m.span, {
7964
- className: "rounded-[1px] bg-current",
7965
- animate: reduce ? { opacity: [
7966
- 0.35,
7967
- 0.8,
7968
- 0.35
7969
- ] } : {
7970
- opacity: [
7971
- 0.28,
7972
- 1,
7973
- 0.28
7974
- ],
7975
- scale: [
7976
- 0.72,
7977
- 1,
7978
- 0.72
7979
- ]
7980
- },
7981
- transition: {
7982
- duration: 1.55,
7983
- ease: EASE_IN_OUT,
7984
- repeat: Infinity,
7985
- delay
7986
- }
7987
- }, id))
7988
- }),
7989
- /* @__PURE__ */ jsx("span", {
7990
- className: "font-sans font-medium",
7991
- children: label
7992
- }),
7993
- /* @__PURE__ */ jsx("span", {
7994
- "aria-hidden": "true",
7995
- className: "tabular-nums text-muted-foreground/70",
7996
- children: formatElapsed$1(elapsed)
7997
- })
7523
+ /* @__PURE__ */ jsx("span", {
7524
+ "aria-hidden": "true",
7525
+ className: "tabular-nums text-muted-foreground/70",
7526
+ children: formatElapsed(elapsed)
7527
+ })
7998
7528
  ]
7999
7529
  });
8000
7530
  }
@@ -8077,6 +7607,70 @@ function iconFor(kind) {
8077
7607
  return Clock3;
8078
7608
  }
8079
7609
  }
7610
+ function activityLabelFor(items) {
7611
+ if (items.length === 1) {
7612
+ const item = items[0];
7613
+ if (item?.type === "search") return "Checking a source\u2026";
7614
+ if (item?.type === "tool") return `Working with ${item.action}\u2026`;
7615
+ }
7616
+ if (items.length > 1) return `Coordinating ${items.length} active actions\u2026`;
7617
+ return "Working through the run\u2026";
7618
+ }
7619
+ function activitySummary(items) {
7620
+ return items.length === 1 ? "Completed 1 tracked action" : `Completed ${items.length} tracked actions`;
7621
+ }
7622
+ var WELCOME_TASKS = [
7623
+ {
7624
+ id: "welcome-explore-codebase",
7625
+ label: "Explore codebase",
7626
+ value: "Explore this codebase and explain its architecture, important modules, and main entry points."
7627
+ },
7628
+ {
7629
+ id: "welcome-review-changes",
7630
+ label: "Review changes",
7631
+ value: "Review my current changes for bugs, regressions, architecture issues, and code quality problems."
7632
+ },
7633
+ {
7634
+ id: "welcome-fix-issue",
7635
+ label: "Fix an issue",
7636
+ value: "Help me investigate and fix an issue in this project."
7637
+ },
7638
+ {
7639
+ id: "welcome-plan-feature",
7640
+ label: "Plan a feature",
7641
+ value: "Explore the relevant code and create an implementation plan for a new feature before making changes."
7642
+ }
7643
+ ];
7644
+ function ChatWelcome({ disabled: disabled2, onSelect, composer }) {
7645
+ return /* @__PURE__ */ jsxs("section", {
7646
+ "aria-labelledby": "fleet-welcome-title",
7647
+ className: "flex w-full max-w-an flex-col items-center text-center",
7648
+ children: [
7649
+ /* @__PURE__ */ jsx("h1", {
7650
+ id: "fleet-welcome-title",
7651
+ className: "text-2xl font-normal tracking-tight text-foreground sm:text-3xl",
7652
+ children: "What should Fleet Prime Agent work on?"
7653
+ }),
7654
+ /* @__PURE__ */ jsx("div", {
7655
+ className: "mt-6 w-full",
7656
+ children: composer
7657
+ }),
7658
+ /* @__PURE__ */ jsx("div", {
7659
+ "aria-label": "Suggested prompts",
7660
+ className: "mt-4 flex w-full flex-wrap justify-center gap-2",
7661
+ children: WELCOME_TASKS.map((item) => /* @__PURE__ */ jsx(Button, {
7662
+ type: "button",
7663
+ variant: "outline",
7664
+ size: "sm",
7665
+ disabled: disabled2 || item.disabled,
7666
+ onClick: () => onSelect(item),
7667
+ className: "min-h-8 rounded-full border-border/70 bg-background/70 px-4 py-1.5 text-center text-sm font-normal text-foreground/80 shadow-sm hover:border-primary/40 hover:bg-primary/5 hover:text-foreground motion-reduce:transition-none",
7668
+ children: item.label
7669
+ }, item.id))
7670
+ })
7671
+ ]
7672
+ });
7673
+ }
8080
7674
  var VARIANT_CLASS = {
8081
7675
  primary: "bg-primary text-primary-foreground hover:bg-primary/90",
8082
7676
  secondary: "border border-border bg-card text-foreground hover:border-border",
@@ -9708,7 +9302,7 @@ function defaultIcon(kind, item) {
9708
9302
  "aria-hidden": "true",
9709
9303
  className: "size-4"
9710
9304
  });
9711
- return /* @__PURE__ */ jsx(Command2, {
9305
+ return /* @__PURE__ */ jsx(Command, {
9712
9306
  "aria-hidden": "true",
9713
9307
  className: "size-4"
9714
9308
  });
@@ -9826,163 +9420,17 @@ var ComposerTriggerPopover = memo(function ComposerTriggerPopover2({ open, kind,
9826
9420
  })]
9827
9421
  }) : null;
9828
9422
  });
9829
- function clamp(value, min, max) {
9830
- return Math.min(max, Math.max(min, value));
9831
- }
9832
- function Slider({ value, onChange, min = 0, max = 100, step = 1, label, formatValue = String, disabled: disabled2 = false, className, ...props }) {
9833
- const inputId = useId();
9834
- const [focused, setFocused] = useState2(false);
9835
- const [hovered, setHovered] = useState2(false);
9836
- const safeMax = Math.max(min, max);
9837
- const safeStep = Math.max(Number.EPSILON, step);
9838
- const clampedValue = clamp(value, min, safeMax);
9839
- const normalized = safeMax === min ? 0 : (clampedValue - min) / (safeMax - min);
9840
- const percent = normalized * 100;
9841
- const zeroOffset = normalized === 0 ? 8 : 0;
9842
- const fillWidth = `calc(${percent}% + ${20 - 20 * normalized - zeroOffset * 2.5}px)`;
9843
- const handleLeft = `calc(${percent}% + ${11 - 24 * normalized}px)`;
9844
- const pipMaskOffset = 20 - 20 * normalized - zeroOffset * 2.5;
9845
- const pipMask = `linear-gradient(to right, transparent calc(${percent}% + ${pipMaskOffset}px), black calc(${percent}% + ${pipMaskOffset + 2}px))`;
9846
- const pipValues = useMemo2(() => {
9847
- const count = Math.floor((safeMax - min) / safeStep);
9848
- const values = Array.from({ length: count + 1 }, (_, index) => min + index * safeStep);
9849
- if (values.at(-1) !== safeMax) values.push(safeMax);
9850
- return values;
9851
- }, [
9852
- min,
9853
- safeMax,
9854
- safeStep
9855
- ]);
9856
- const valueText = formatValue(clampedValue);
9857
- const maxValueText = formatValue(safeMax);
9858
- const valueFromPointer = (clientX, element) => {
9859
- const bounds = element.getBoundingClientRect();
9860
- if (bounds.width <= 0 || safeMax === min) return min;
9861
- const nextValue = min + clamp((clientX - bounds.left) / bounds.width, 0, 1) * (safeMax - min);
9862
- return clamp(min + Math.round((nextValue - min) / safeStep) * safeStep, min, safeMax);
9863
- };
9864
- const handleKeyDown = (event) => {
9865
- let handled = true;
9866
- const direction = event.key === "ArrowRight" || event.key === "ArrowUp" ? 1 : event.key === "ArrowLeft" || event.key === "ArrowDown" ? -1 : 0;
9867
- if (direction !== 0) {
9868
- event.preventDefault();
9869
- onChange(clamp(clampedValue + direction * safeStep, min, safeMax));
9870
- } else if (event.key === "Home") {
9871
- event.preventDefault();
9872
- onChange(min);
9873
- } else if (event.key === "End") {
9874
- event.preventDefault();
9875
- onChange(safeMax);
9876
- } else handled = false;
9877
- if (handled) event.stopPropagation();
9878
- };
9879
- return /* @__PURE__ */ jsx("div", {
9880
- className: cn("relative w-full touch-none", disabled2 && "opacity-50", className),
9881
- ...props,
9882
- children: /* @__PURE__ */ jsxs("div", {
9883
- className: cn("relative h-8 w-full select-none touch-none overflow-hidden rounded-md border border-border bg-background outline-offset-2 transition-colors duration-150", hovered && !disabled2 && "border-foreground/25", focused && "border-foreground/40 ring-2 ring-ring/60 ring-offset-1 ring-offset-background"),
9884
- onPointerEnter: () => setHovered(true),
9885
- onPointerLeave: () => setHovered(false),
9886
- onPointerDown: (event) => {
9887
- if (!disabled2) onChange(valueFromPointer(event.clientX, event.currentTarget));
9888
- },
9889
- children: [
9890
- /* @__PURE__ */ jsx("div", {
9891
- "aria-hidden": "true",
9892
- className: "absolute inset-0 z-[1] flex items-center justify-between px-3 pointer-events-none",
9893
- style: {
9894
- WebkitMaskImage: pipMask,
9895
- maskImage: pipMask
9896
- },
9897
- children: pipValues.map((pipValue) => /* @__PURE__ */ jsx(m.span, {
9898
- className: "relative flex size-[5px] items-center justify-center rounded-full",
9899
- animate: {
9900
- backgroundColor: pipValue === clampedValue ? "var(--foreground)" : "var(--muted-foreground)",
9901
- opacity: pipValue === clampedValue ? 1 : 0.3
9902
- },
9903
- transition: SPRING_GLIDE
9904
- }, pipValue))
9905
- }),
9906
- /* @__PURE__ */ jsx(m.div, {
9907
- "aria-hidden": "true",
9908
- className: "absolute inset-y-0 left-0 z-[3] pointer-events-none bg-foreground/[0.08]",
9909
- layout: "size",
9910
- style: { width: fillWidth },
9911
- transition: SPRING_GLIDE
9912
- }),
9913
- /* @__PURE__ */ jsx(m.div, {
9914
- "aria-hidden": "true",
9915
- className: cn("absolute z-[3] w-0.5 rounded-full pointer-events-none"),
9916
- layout: true,
9917
- style: {
9918
- left: handleLeft,
9919
- top: hovered || focused ? 7 : 8,
9920
- bottom: hovered || focused ? 7 : 8
9921
- },
9922
- animate: { backgroundColor: focused ? "var(--foreground)" : hovered ? "color-mix(in srgb, var(--foreground) 50%, transparent)" : "color-mix(in srgb, var(--foreground) 25%, transparent)" },
9923
- transition: SPRING_GLIDE
9924
- }),
9925
- /* @__PURE__ */ jsxs("div", {
9926
- "aria-hidden": "true",
9927
- className: "pointer-events-none absolute inset-0 z-[2] flex items-center px-2",
9928
- children: [label ? /* @__PURE__ */ jsx("span", {
9929
- className: "px-2 text-[13px] text-transparent select-none",
9930
- "aria-hidden": "true",
9931
- children: label
9932
- }) : null, /* @__PURE__ */ jsx("span", {
9933
- className: "ml-auto px-2 text-[13px] text-transparent tabular-nums select-none",
9934
- style: { minWidth: `${maxValueText.length}ch` },
9935
- "aria-hidden": "true",
9936
- children: maxValueText
9937
- })]
9938
- }),
9939
- /* @__PURE__ */ jsxs("div", {
9940
- className: "pointer-events-none absolute inset-0 z-[4] flex items-center px-2 text-[13px]",
9941
- children: [label ? /* @__PURE__ */ jsx(m.span, {
9942
- className: "px-2",
9943
- animate: { color: hovered || focused ? "var(--foreground)" : "var(--muted-foreground)" },
9944
- transition: SPRING_GLIDE,
9945
- children: label
9946
- }) : null, /* @__PURE__ */ jsx(m.span, {
9947
- className: "ml-auto px-2 tabular-nums",
9948
- style: {
9949
- minWidth: `${maxValueText.length}ch`,
9950
- textAlign: "right"
9951
- },
9952
- animate: { color: hovered || focused ? "var(--foreground)" : "var(--muted-foreground)" },
9953
- transition: SPRING_GLIDE,
9954
- children: valueText
9955
- })]
9956
- }),
9957
- /* @__PURE__ */ jsx("input", {
9958
- id: inputId,
9959
- type: "range",
9960
- min,
9961
- max: safeMax,
9962
- step: safeStep,
9963
- value: clampedValue,
9964
- disabled: disabled2,
9965
- "aria-label": label ?? "Slider",
9966
- "aria-valuetext": valueText,
9967
- onChange: (event) => onChange(Number(event.currentTarget.value)),
9968
- onFocus: () => setFocused(true),
9969
- onBlur: () => setFocused(false),
9970
- onKeyDown: handleKeyDown,
9971
- className: "absolute inset-0 z-20 m-0 h-full w-full cursor-ew-resize opacity-0 disabled:cursor-not-allowed"
9972
- })
9973
- ]
9974
- })
9423
+ var LazyModelSelectorList = lazy(() => import("./model-selector-list-CEfWjRc--GBW2GUO6.js").then(({ ModelSelectorList: ModelSelectorList2 }) => ({ default: ModelSelectorList2 })));
9424
+ function ModelSelectorList(props) {
9425
+ return /* @__PURE__ */ jsx(Suspense, {
9426
+ fallback: /* @__PURE__ */ jsx("div", {
9427
+ className: "h-24 animate-pulse rounded-md bg-muted/40 p-1.5",
9428
+ "aria-label": "Loading models",
9429
+ role: "status"
9430
+ }),
9431
+ children: /* @__PURE__ */ jsx(LazyModelSelectorList, { ...props })
9975
9432
  });
9976
9433
  }
9977
- function groupModels(models) {
9978
- const groups = /* @__PURE__ */ new Map();
9979
- for (const model of models) {
9980
- const group = groups.get(model.provider) ?? [];
9981
- group.push(model);
9982
- groups.set(model.provider, group);
9983
- }
9984
- return [...groups.entries()];
9985
- }
9986
9434
  var ModelSelector = memo(function ModelSelector2({ models, value, effort, open: controlledOpen, onOpenChange, onModelChange, onEffortChange, placeholder = "Model", effortLabel = "Reasoning effort", className, contentClassName }) {
9987
9435
  const [internalOpen, setInternalOpen] = useState2(false);
9988
9436
  const popupId = useId();
@@ -9992,7 +9440,6 @@ var ModelSelector = memo(function ModelSelector2({ models, value, effort, open:
9992
9440
  onOpenChange?.(next);
9993
9441
  };
9994
9442
  const selectedModel = models.find((model) => model.id === value) ?? models[0];
9995
- const groups = useMemo2(() => groupModels(models), [models]);
9996
9443
  const selectedEffort = selectedModel?.efforts?.find((option) => option.id === effort) ?? selectedModel?.efforts?.[0];
9997
9444
  const trigger = /* @__PURE__ */ jsxs("button", {
9998
9445
  type: "button",
@@ -10029,91 +9476,13 @@ var ModelSelector = memo(function ModelSelector2({ models, value, effort, open:
10029
9476
  align: "start",
10030
9477
  className: cn("w-[min(24rem,calc(100vw-2rem))] max-h-[min(55vh,28rem)] overflow-hidden p-0", contentClassName),
10031
9478
  trigger,
10032
- children: /* @__PURE__ */ jsxs(Command, {
10033
- className: "min-h-0 max-h-[min(55vh,28rem)] bg-transparent",
10034
- shouldFilter: true,
10035
- children: [
10036
- /* @__PURE__ */ jsx(CommandInput, {
10037
- placeholder: "Search models\u2026",
10038
- "aria-label": "Search models"
10039
- }),
10040
- /* @__PURE__ */ jsxs(CommandList, {
10041
- className: "min-h-0 flex-1 p-1.5",
10042
- children: [/* @__PURE__ */ jsx(CommandEmpty, { children: "No matching models" }), groups.map(([provider, providerModels]) => /* @__PURE__ */ jsx(CommandGroup, {
10043
- heading: providerModels[0]?.providerLabel ?? provider,
10044
- children: providerModels.map((model) => {
10045
- const searchValue = [
10046
- model.id,
10047
- model.name,
10048
- model.provider,
10049
- model.providerLabel,
10050
- model.modelId,
10051
- ...model.keywords ?? []
10052
- ].filter(Boolean).join(" ");
10053
- const selected = model.id === selectedModel?.id;
10054
- return /* @__PURE__ */ jsxs(CommandItem, {
10055
- value: searchValue,
10056
- disabled: model.disabled,
10057
- onSelect: () => {
10058
- if (model.disabled) return;
10059
- onModelChange?.(model.id);
10060
- },
10061
- className: "items-start gap-2 rounded-lg px-2.5 py-2",
10062
- children: [
10063
- /* @__PURE__ */ jsx("span", {
10064
- className: "mt-0.5 shrink-0 text-muted-foreground",
10065
- children: model.icon ?? /* @__PURE__ */ jsx(Gauge, {
10066
- "aria-hidden": "true",
10067
- className: "size-4"
10068
- })
10069
- }),
10070
- /* @__PURE__ */ jsxs("span", {
10071
- className: "min-w-0 flex-1",
10072
- children: [
10073
- /* @__PURE__ */ jsxs("span", {
10074
- className: "flex items-center gap-2",
10075
- children: [/* @__PURE__ */ jsx("span", {
10076
- className: "truncate text-sm font-medium",
10077
- children: model.name
10078
- }), model.disabled ? /* @__PURE__ */ jsx("span", {
10079
- className: "shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",
10080
- children: "Unavailable"
10081
- }) : null]
10082
- }),
10083
- /* @__PURE__ */ jsxs("span", {
10084
- className: "mt-0.5 block truncate text-xs text-muted-foreground",
10085
- children: [model.modelId ?? model.id, model.reasoning ? " \xB7 reasoning" : ""]
10086
- }),
10087
- model.description ? /* @__PURE__ */ jsx("span", {
10088
- className: "mt-0.5 block truncate text-xs text-muted-foreground/80",
10089
- children: model.description
10090
- }) : null
10091
- ]
10092
- }),
10093
- selected ? /* @__PURE__ */ jsx(Check, {
10094
- "aria-hidden": "true",
10095
- className: "mt-1 size-4 shrink-0"
10096
- }) : null
10097
- ]
10098
- }, model.id);
10099
- })
10100
- }, provider))]
10101
- }),
10102
- selectedModel?.reasoning && selectedModel.efforts?.length ? /* @__PURE__ */ jsx("div", {
10103
- className: "shrink-0 border-t border-border/70 p-2",
10104
- children: /* @__PURE__ */ jsx(Slider, {
10105
- label: effortLabel,
10106
- value: Math.max(0, selectedModel.efforts.findIndex((option) => option.id === selectedEffort?.id)),
10107
- onChange: (nextValue) => {
10108
- const option = selectedModel.efforts?.[Math.round(nextValue)];
10109
- if (option && !option.disabled) onEffortChange?.(option.id);
10110
- },
10111
- min: 0,
10112
- max: Math.max(0, selectedModel.efforts.length - 1),
10113
- formatValue: (nextValue) => selectedModel.efforts?.[Math.round(nextValue)]?.name ?? ""
10114
- })
10115
- }) : null
10116
- ]
9479
+ children: /* @__PURE__ */ jsx(ModelSelectorList, {
9480
+ models,
9481
+ selectedModel,
9482
+ selectedEffort,
9483
+ effortLabel,
9484
+ onModelChange,
9485
+ onEffortChange
10117
9486
  })
10118
9487
  });
10119
9488
  });
@@ -10496,6 +9865,9 @@ function FleetPiInputBarContent({ modelKey, models, status, infoDescription, cha
10496
9865
  children: [/* @__PURE__ */ jsx("img", {
10497
9866
  src: image.url,
10498
9867
  alt: image.filename,
9868
+ width: 64,
9869
+ height: 64,
9870
+ loading: "lazy",
10499
9871
  className: "size-16 rounded-lg border object-cover"
10500
9872
  }), /* @__PURE__ */ jsx(Button, {
10501
9873
  type: "button",
@@ -10585,233 +9957,15 @@ function FleetPiInputBarContent({ modelKey, models, status, infoDescription, cha
10585
9957
  }
10586
9958
  function getChatErrorPresentation(error) {
10587
9959
  if (error.code === "NETWORK_DISCONNECTED" || /Cannot send daemon command/i.test(error.message) || /Prime Agent daemon is not connected/i.test(error.message) || /not connected to the Prime Agent runtime/i.test(error.message)) return {
10588
- title: "Agent unavailable",
10589
- message: NETWORK_DISCONNECTED_MESSAGE
10590
- };
10591
- return {
10592
- title: "Request failed",
10593
- message: error.message.replace(/\s+(?:Socket|Daemon log):\s*[^\n]*(?:\s+(?:Socket|Daemon log):\s*[^\n]*)*/gi, "")
10594
- };
10595
- }
10596
- var CELL_SHAPES = {
10597
- dots: "rounded-full",
10598
- squares: "rounded-[1px]",
10599
- rounded: "rounded-[3px]"
10600
- };
10601
- function GenerationLoader({ label, tick, variant = "dots", className, ...props }) {
10602
- const pixelOffset = Math.floor(tick / 3);
10603
- return /* @__PURE__ */ jsxs("div", {
10604
- "data-slot": "generation-loader",
10605
- className: cn("flex flex-col items-center gap-4", className),
10606
- ...props,
10607
- children: [/* @__PURE__ */ jsx("div", {
10608
- "aria-hidden": true,
10609
- className: "grid grid-cols-3 gap-1",
10610
- children: Array.from({ length: 9 }, (_, index) => {
10611
- const active = (index * 2 + pixelOffset) % 9 < 3;
10612
- return /* @__PURE__ */ jsx("span", { className: cn("bg-foreground size-2 transition-opacity duration-300 motion-reduce:transition-none", CELL_SHAPES[variant], active ? "opacity-90" : "opacity-15") }, index);
10613
- })
10614
- }), /* @__PURE__ */ jsx(ShimmerLabel, {
10615
- className: "text-foreground/55 relative inline-block text-sm",
10616
- children: label
10617
- })]
10618
- });
10619
- }
10620
- function ThinkingIndicator({ label, elapsed, className, ...props }) {
10621
- return /* @__PURE__ */ jsxs("div", {
10622
- "data-slot": "thinking-indicator",
10623
- className: cn("text-foreground/55 flex items-center gap-2.5 text-sm", className),
10624
- ...props,
10625
- children: [
10626
- /* @__PURE__ */ jsx("span", {
10627
- "aria-hidden": true,
10628
- className: "size-1.5 shrink-0 animate-pulse rounded-full bg-blue-500 motion-reduce:animate-none dark:bg-blue-400"
10629
- }),
10630
- /* @__PURE__ */ jsx(ShimmerLabel, {
10631
- className: "fade-in slide-in-from-bottom-1 animate-in relative inline-block leading-none duration-300",
10632
- children: label
10633
- }, label),
10634
- elapsed !== void 0 && /* @__PURE__ */ jsx("span", {
10635
- className: cn("font-mono text-[11px] tracking-tight", "text-foreground/30 tabular-nums"),
10636
- children: elapsed
10637
- })
10638
- ]
10639
- });
10640
- }
10641
- function ReasoningPanel({ steps, visibleSteps, streaming, streamingLabel = "Thinking", open, onOpenChange, restingLabel, elapsed, className }) {
10642
- const shown = take(steps, visibleSteps);
10643
- return /* @__PURE__ */ jsxs(Collapsible, {
10644
- "data-slot": "reasoning-panel",
10645
- open,
10646
- onOpenChange,
10647
- className: cn("w-full max-w-sm", className),
10648
- children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
10649
- className: "group/trigger text-foreground/55 hover:text-foreground/90 flex items-center gap-1.5 py-1 text-[13.5px] transition-[color,scale] outline-none active:scale-[0.98]",
10650
- children: [/* @__PURE__ */ jsxs(SwapLabel, {
10651
- active: streaming ? 0 : 1,
10652
- className: "text-start",
10653
- children: [/* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ShimmerLabel, {
10654
- active: streaming,
10655
- className: "relative inline-block leading-none",
10656
- children: streamingLabel
10657
- }), elapsed !== void 0 && /* @__PURE__ */ jsx("span", {
10658
- className: cn("font-mono text-[11px] tracking-tight", "text-foreground/30 tabular-nums"),
10659
- children: elapsed
10660
- })] }), /* @__PURE__ */ jsx(Fragment$1, { children: restingLabel })]
10661
- }), /* @__PURE__ */ jsx(ChevronDown, { className: "size-3.5 shrink-0 opacity-60 transition-transform duration-200 ease-[cubic-bezier(0.32,0.72,0,1)] group-data-open/trigger:rotate-180 group-data-panel-open/trigger:rotate-180 motion-reduce:transition-none" })]
10662
- }), /* @__PURE__ */ jsx(CollapsibleContent, {
10663
- className: cn(collapsePanel, "outline-none"),
10664
- children: /* @__PURE__ */ jsx("ol", {
10665
- className: "flex flex-col gap-4 pt-3 pb-1",
10666
- children: shown.map((step, i) => {
10667
- const active = streaming && i === shown.length - 1;
10668
- return /* @__PURE__ */ jsxs("li", {
10669
- className: "fade-in slide-in-from-bottom-1 animate-in fill-mode-both flex gap-3 duration-300",
10670
- children: [/* @__PURE__ */ jsx("span", {
10671
- "aria-hidden": true,
10672
- className: cn("mt-[7px] size-[5px] shrink-0 rounded-full transition-colors duration-300", active ? "animate-pulse bg-blue-500 dark:bg-blue-400" : "bg-foreground/20")
10673
- }), /* @__PURE__ */ jsxs("span", {
10674
- className: "flex min-w-0 flex-1 flex-col",
10675
- children: [/* @__PURE__ */ jsx("p", {
10676
- className: "text-foreground/90 text-[13.5px] font-medium",
10677
- children: step.title
10678
- }), /* @__PURE__ */ jsx("p", {
10679
- className: "text-foreground/50 mt-0.5 text-[13px] leading-relaxed break-words",
10680
- children: step.body
10681
- })]
10682
- })]
10683
- }, step.id ?? `${step.title}-${i}`);
10684
- })
10685
- })
10686
- })]
10687
- });
10688
- }
10689
- function FleetReasoningPanel({ presentation, className, streamingOverride }) {
10690
- const [userOpen, setUserOpen] = useState2(void 0);
10691
- const streaming = streamingOverride ?? presentation.streaming;
10692
- const open = userOpen ?? streaming;
10693
- const steps = useMemo2(() => presentation.steps.map((step) => ({
10694
- id: step.id,
10695
- title: step.title,
10696
- body: step.body
10697
- })), [presentation.steps]);
10698
- if (!streaming && steps.length === 0) return null;
10699
- const visibleSteps = Math.min(Math.max(0, presentation.visibleSteps), steps.length);
10700
- const activeStep = steps.at(visibleSteps - 1);
10701
- const activeLabel = activeStep?.title ?? phaseLabel(presentation.phase);
10702
- const elapsed = formatElapsed(presentation.elapsedMs);
10703
- return /* @__PURE__ */ jsxs("section", {
10704
- "data-slot": "fleet-reasoning-presentation",
10705
- "aria-label": "Safe reasoning progress",
10706
- className: cn("w-full max-w-xl rounded-xl border border-border/60 bg-muted/30 px-3 py-2.5 shadow-sm shadow-black/[0.02] dark:shadow-black/15", className),
10707
- children: [streaming ? /* @__PURE__ */ jsx("div", {
10708
- className: "mb-1.5 flex flex-col gap-1.5 border-b border-border/45 pb-2.5",
10709
- children: activeStep?.body ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ThinkingIndicator, {
10710
- label: activeLabel,
10711
- elapsed,
10712
- className: "text-[13px]"
10713
- }), /* @__PURE__ */ jsx("p", {
10714
- className: "pl-4 text-xs font-normal text-muted-foreground",
10715
- children: activeStep.body
10716
- })] }) : /* @__PURE__ */ jsx(GenerationLoader, {
10717
- label: activeLabel,
10718
- tick: Math.floor((presentation.elapsedMs ?? 0) / 250),
10719
- variant: "dots",
10720
- className: "items-start gap-2 px-1 py-1 text-left"
10721
- })
10722
- }) : null, /* @__PURE__ */ jsx(ReasoningPanel, {
10723
- steps,
10724
- visibleSteps,
10725
- streaming,
10726
- streamingLabel: "Preparing response",
10727
- open,
10728
- onOpenChange: setUserOpen,
10729
- restingLabel: presentation.restingLabel,
10730
- elapsed,
10731
- className: "max-w-none"
10732
- })]
10733
- });
10734
- }
10735
- function phaseLabel(phase) {
10736
- switch (phase) {
10737
- case "waiting":
10738
- return "Preparing run";
10739
- case "context":
10740
- return "Reviewing workspace context";
10741
- case "planning":
10742
- return "Organising the response";
10743
- case "executing":
10744
- return "Completing requested work";
10745
- case "responding":
10746
- return "Writing the response";
10747
- case "recovering":
10748
- return "Recovering the run";
10749
- case "error":
10750
- return "Run needs attention";
10751
- case "complete":
10752
- return "Completed";
10753
- default:
10754
- return "Working";
10755
- }
10756
- }
10757
- function formatElapsed(elapsedMs) {
10758
- if (elapsedMs === void 0) return void 0;
10759
- const seconds = Math.max(0, Math.round(elapsedMs / 1e3));
10760
- if (seconds < 60) return String(seconds) + "s";
10761
- return String(Math.floor(seconds / 60)) + "m " + String(seconds % 60) + "s";
10762
- }
10763
- var LANES = [{
10764
- key: "steering",
10765
- label: "Next"
10766
- }, {
10767
- key: "followUp",
10768
- label: "After run"
10769
- }];
10770
- function FleetMessageQueue({ queue, onDelete, className }) {
10771
- const count = queue.steering.length + queue.followUp.length;
10772
- if (count === 0) return null;
10773
- const handleDelete = async (lane, index, text) => {
10774
- try {
10775
- if (await onDelete?.(lane, index, text) === false) notify.error("Unable to remove queued message");
10776
- } catch {
10777
- notify.error("Unable to remove queued message");
10778
- }
10779
- };
10780
- return /* @__PURE__ */ jsx("section", {
10781
- "aria-label": "Queued messages",
10782
- className: cn("mx-auto mb-2 w-full max-w-an px-3", className),
10783
- children: /* @__PURE__ */ jsxs("div", {
10784
- className: "rounded-xl border border-border/60 bg-muted/30 p-2",
10785
- children: [/* @__PURE__ */ jsxs("div", {
10786
- className: "mb-1 flex items-baseline justify-between px-1 text-xs text-muted-foreground",
10787
- children: [/* @__PURE__ */ jsxs("span", { children: [count, " queued"] }), /* @__PURE__ */ jsx("span", { children: "Sent when the run reaches its lane" })]
10788
- }), /* @__PURE__ */ jsx("div", {
10789
- className: "space-y-1",
10790
- children: LANES.flatMap(({ key, label }) => queue[key].map((text, index) => /* @__PURE__ */ jsxs("div", {
10791
- className: "flex min-w-0 items-center gap-2 rounded-lg bg-background/80 px-2 py-1.5 text-sm",
10792
- children: [
10793
- /* @__PURE__ */ jsx("span", {
10794
- className: "shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",
10795
- children: label
10796
- }),
10797
- /* @__PURE__ */ jsx("span", {
10798
- className: "min-w-0 flex-1 truncate text-foreground/80",
10799
- children: text
10800
- }),
10801
- onDelete ? /* @__PURE__ */ jsx("button", {
10802
- type: "button",
10803
- "aria-label": `Remove queued message: ${text}`,
10804
- onClick: () => void handleDelete(key, index, text),
10805
- className: "grid size-6 shrink-0 place-items-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
10806
- children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
10807
- }) : null
10808
- ]
10809
- }, `${key}:${index}:${text}`)))
10810
- })]
10811
- })
10812
- });
9960
+ title: "Agent unavailable",
9961
+ message: NETWORK_DISCONNECTED_MESSAGE
9962
+ };
9963
+ return {
9964
+ title: "Request failed",
9965
+ message: error.message.replace(/\s+(?:Socket|Daemon log):\s*[^\n]*(?:\s+(?:Socket|Daemon log):\s*[^\n]*)*/gi, "")
9966
+ };
10813
9967
  }
10814
- var LazyFleetPiToolRenderer = lazy(() => import("./fleet-pi-tool-renderer-CE45vM6T-2UQN6RJM.js").then((n) => n.n).then(({ FleetPiToolRenderer: FleetPiToolRenderer2 }) => ({ default: FleetPiToolRenderer2 })));
9968
+ var LazyFleetPiToolRenderer = lazy(() => import("./fleet-pi-tool-renderer-C52SZmPx-CIAH3IV7.js").then((n) => n.n).then(({ FleetPiToolRenderer: FleetPiToolRenderer2 }) => ({ default: FleetPiToolRenderer2 })));
10815
9969
  function FleetPiToolRenderer(props) {
10816
9970
  return /* @__PURE__ */ jsx(Suspense, {
10817
9971
  fallback: /* @__PURE__ */ jsx("div", {
@@ -10821,6 +9975,63 @@ function FleetPiToolRenderer(props) {
10821
9975
  children: /* @__PURE__ */ jsx(LazyFleetPiToolRenderer, { ...props })
10822
9976
  });
10823
9977
  }
9978
+ var LazyAgentActivity = lazy(() => import("./agent-activity-Dx6AlDhN-JXOL2EXK.js").then(({ AgentActivity: AgentActivity2 }) => ({ default: AgentActivity2 })));
9979
+ function AgentActivity(props) {
9980
+ return /* @__PURE__ */ jsx(Suspense, {
9981
+ fallback: /* @__PURE__ */ jsx("div", {
9982
+ className: "mt-2 h-8 animate-pulse rounded-md bg-muted/40",
9983
+ "aria-label": "Loading activity"
9984
+ }),
9985
+ children: /* @__PURE__ */ jsx(LazyAgentActivity, { ...props })
9986
+ });
9987
+ }
9988
+ var LazyFleetReasoningPanel = lazy(() => import("./fleet-reasoning-panel-C_e7wzVm-SDHEWDQT.js").then(({ FleetReasoningPanel: FleetReasoningPanel2 }) => ({ default: FleetReasoningPanel2 })));
9989
+ function FleetReasoningPanel(props) {
9990
+ return /* @__PURE__ */ jsx(Suspense, {
9991
+ fallback: /* @__PURE__ */ jsx("div", {
9992
+ className: "mb-2 h-6 animate-pulse rounded-md bg-muted/40",
9993
+ "aria-label": "Loading reasoning"
9994
+ }),
9995
+ children: /* @__PURE__ */ jsx(LazyFleetReasoningPanel, { ...props })
9996
+ });
9997
+ }
9998
+ var LazyFleetToolTimeline = lazy(() => import("./fleet-tool-timeline-KENErMKg-HTN7SW3D.js").then((n) => n.n).then(({ FleetToolTimeline: FleetToolTimeline2 }) => ({ default: FleetToolTimeline2 })));
9999
+ function FleetToolTimeline(props) {
10000
+ return /* @__PURE__ */ jsx(Suspense, {
10001
+ fallback: /* @__PURE__ */ jsx("div", {
10002
+ className: "h-6 animate-pulse rounded-md bg-muted/40",
10003
+ "aria-label": "Loading timeline"
10004
+ }),
10005
+ children: /* @__PURE__ */ jsx(LazyFleetToolTimeline, { ...props })
10006
+ });
10007
+ }
10008
+ var LazyFleetSubagentList = lazy(() => import("./fleet-subagent-list-CQltKswG-EKCMQHDI.js").then((n) => n.n).then(({ FleetSubagentList: FleetSubagentList2 }) => ({ default: FleetSubagentList2 })));
10009
+ function FleetSubagentList(props) {
10010
+ return /* @__PURE__ */ jsx(Suspense, {
10011
+ fallback: /* @__PURE__ */ jsx("div", {
10012
+ className: "h-6 animate-pulse rounded-md bg-muted/40",
10013
+ "aria-label": "Loading subagents"
10014
+ }),
10015
+ children: /* @__PURE__ */ jsx(LazyFleetSubagentList, { ...props })
10016
+ });
10017
+ }
10018
+ var LazyPromptSuggestions = lazy(() => import("./prompt-suggestions-BOmHi4-J-C563CHFU.js").then(({ PromptSuggestions: PromptSuggestions2 }) => ({ default: PromptSuggestions2 })));
10019
+ function PromptSuggestions(props) {
10020
+ return /* @__PURE__ */ jsx(Suspense, {
10021
+ fallback: /* @__PURE__ */ jsx("div", {
10022
+ className: "h-8 animate-pulse rounded-full bg-muted/40",
10023
+ "aria-label": "Loading suggestions"
10024
+ }),
10025
+ children: /* @__PURE__ */ jsx(LazyPromptSuggestions, { ...props })
10026
+ });
10027
+ }
10028
+ var LazyFleetMessageQueue = lazy(() => import("./fleet-message-queue-Bn0_3Efe-G4BZR2EU.js").then(({ FleetMessageQueue: FleetMessageQueue2 }) => ({ default: FleetMessageQueue2 })));
10029
+ function FleetMessageQueue(props) {
10030
+ return /* @__PURE__ */ jsx(Suspense, {
10031
+ fallback: null,
10032
+ children: /* @__PURE__ */ jsx(LazyFleetMessageQueue, { ...props })
10033
+ });
10034
+ }
10824
10035
  function textFromMessage(message) {
10825
10036
  return (message.parts ?? []).flatMap((part) => {
10826
10037
  if (typeof part === "object" && part !== null && "type" in part && part.type === "text" && "text" in part && typeof part.text === "string") return [part.text];
@@ -11036,6 +10247,10 @@ function sameMessages(previous, next) {
11036
10247
  var ConversationTurnView = memo(function ConversationTurnView2({ turn, state, rendering, activity }) {
11037
10248
  return /* @__PURE__ */ jsxs("div", {
11038
10249
  className: "flex flex-col gap-3",
10250
+ style: {
10251
+ contentVisibility: "auto",
10252
+ containIntrinsicSize: "auto 400px"
10253
+ },
11039
10254
  children: [turn.user ? /* @__PURE__ */ jsx(Message, {
11040
10255
  from: "user",
11041
10256
  animateIn: !state.isStreaming,
@@ -11059,76 +10274,33 @@ function isLifecycleNotice(label) {
11059
10274
  if (!label) return false;
11060
10275
  return /queued|steered|retry|compact|reset|recover|sign in/i.test(label);
11061
10276
  }
11062
- function activityLabelFor(items) {
11063
- if (items.length === 1) {
11064
- const item = items[0];
11065
- if (item?.type === "search") return "Checking a source\u2026";
11066
- if (item?.type === "tool") return "Working with " + item.action + "\u2026";
11067
- }
11068
- if (items.length > 1) return "Coordinating " + items.length + " active actions\u2026";
11069
- return "Working through the run\u2026";
11070
- }
11071
- function activitySummary(items) {
11072
- const count = items.length;
11073
- if (count === 1) return "Completed 1 tracked action";
11074
- return "Completed " + count + " tracked actions";
11075
- }
11076
10277
  function resolveSuggestions(suggestions) {
11077
10278
  if (Array.isArray(suggestions)) return suggestions;
11078
10279
  return suggestions?.items ?? [];
11079
10280
  }
11080
- var WELCOME_TASKS = [
11081
- {
11082
- id: "welcome-explore-codebase",
11083
- label: "Explore codebase",
11084
- value: "Explore this codebase and explain its architecture, important modules, and main entry points."
11085
- },
11086
- {
11087
- id: "welcome-review-changes",
11088
- label: "Review changes",
11089
- value: "Review my current changes for bugs, regressions, architecture issues, and code quality problems."
11090
- },
11091
- {
11092
- id: "welcome-fix-issue",
11093
- label: "Fix an issue",
11094
- value: "Help me investigate and fix an issue in this project."
11095
- },
11096
- {
11097
- id: "welcome-plan-feature",
11098
- label: "Plan a feature",
11099
- value: "Explore the relevant code and create an implementation plan for a new feature before making changes."
11100
- }
11101
- ];
11102
- function WelcomeState({ disabled: disabled2, onSelect, composer }) {
11103
- return /* @__PURE__ */ jsxs("section", {
11104
- "aria-labelledby": "fleet-welcome-title",
11105
- className: "flex w-full max-w-an flex-col items-center text-center",
11106
- children: [
11107
- /* @__PURE__ */ jsx("h1", {
11108
- id: "fleet-welcome-title",
11109
- className: "text-2xl font-normal tracking-tight text-foreground sm:text-3xl",
11110
- children: "What should Fleet Prime Agent work on?"
11111
- }),
11112
- /* @__PURE__ */ jsx("div", {
11113
- className: "mt-6 w-full",
11114
- children: composer
11115
- }),
11116
- /* @__PURE__ */ jsx("div", {
11117
- "aria-label": "Suggested prompts",
11118
- className: "mt-4 flex w-full flex-wrap justify-center gap-2",
11119
- children: WELCOME_TASKS.map((item) => /* @__PURE__ */ jsx("button", {
11120
- type: "button",
11121
- disabled: disabled2 || item.disabled,
11122
- onClick: () => onSelect(item),
11123
- className: "inline-flex min-h-8 items-center rounded-full border border-border/70 bg-background/70 px-4 py-1.5 text-center text-sm text-foreground/80 shadow-sm transition-colors hover:border-primary/40 hover:bg-primary/5 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 motion-reduce:transition-none",
11124
- children: item.label
11125
- }, item.id))
11126
- })
11127
- ]
10281
+ function ChatComposerHost({ inputBar, status, suggestions, onSend, onStop, isEmpty, draftSetterRef }) {
10282
+ const [draft, setDraft] = useState2("");
10283
+ useEffect2(() => {
10284
+ draftSetterRef.current = setDraft;
10285
+ }, [draftSetterRef]);
10286
+ return /* @__PURE__ */ jsx(FleetPiInputBar, {
10287
+ ...inputBar,
10288
+ className: cn(inputBar.className, isEmpty && "px-0 pb-0"),
10289
+ placeholder: isEmpty ? "Ask Prime to build, investigate, or change something\u2026" : inputBar.placeholder,
10290
+ controlled: {
10291
+ value: draft,
10292
+ onChange: setDraft
10293
+ },
10294
+ status,
10295
+ suggestions,
10296
+ onSend,
10297
+ onStop
11128
10298
  });
11129
10299
  }
10300
+ var MemoChatComposerHost = memo(ChatComposerHost);
11130
10301
  function FleetPiAgentChat({ toolRenderers = PI_TOOL_RENDERERS, suggestions, status, onStop, onSend, inputBar, className, messages, error, suppressQuestionTool = false, onOpenUIAction, activityLabel, presentation, artifactRuns, onOpenArtifact, onOpenUIArtifactReady, queue, onDeleteQueuedMessage }) {
11131
- const [draft, setDraft] = useState2("");
10302
+ const draftSetterRef = useRef2(null);
10303
+ const setDraft = useCallback2((value) => draftSetterRef.current?.(value), []);
11132
10304
  const turns = useMemo2(() => groupMessages(messages), [messages]);
11133
10305
  const suggestionItems2 = resolveSuggestions(suggestions);
11134
10306
  const suggestionTexts = useMemo2(() => suggestionItems2.flatMap((item) => item.disabled ? [] : [item.value ?? item.label]), [suggestionItems2]);
@@ -11177,18 +10349,14 @@ function FleetPiAgentChat({ toolRenderers = PI_TOOL_RENDERERS, suggestions, stat
11177
10349
  }), []);
11178
10350
  const isEmpty = turns.length === 0 && !error;
11179
10351
  const errorPresentation = error ? getChatErrorPresentation(error) : null;
11180
- const inputBarNode = /* @__PURE__ */ jsx(FleetPiInputBar, {
11181
- ...inputBar,
11182
- className: cn(inputBar.className, isEmpty && "px-0 pb-0"),
11183
- placeholder: isEmpty ? "Ask Prime to build, investigate, or change something\u2026" : inputBar.placeholder,
11184
- controlled: {
11185
- value: draft,
11186
- onChange: setDraft
11187
- },
10352
+ const composerNode = /* @__PURE__ */ jsx(MemoChatComposerHost, {
10353
+ inputBar,
11188
10354
  status,
11189
10355
  suggestions,
11190
10356
  onSend,
11191
- onStop
10357
+ onStop,
10358
+ isEmpty,
10359
+ draftSetterRef
11192
10360
  });
11193
10361
  return /* @__PURE__ */ jsxs("div", {
11194
10362
  className: cn("fleet-pi-agent-chat flex h-full min-h-0 flex-col bg-background", className),
@@ -11197,13 +10365,13 @@ function FleetPiAgentChat({ toolRenderers = PI_TOOL_RENDERERS, suggestions, stat
11197
10365
  className: "flex-1",
11198
10366
  busy: isStreaming,
11199
10367
  followOutput: true,
11200
- smooth: isStreaming,
10368
+ smooth: !isStreaming,
11201
10369
  contentClassName: cn("mx-auto flex w-full max-w-an flex-col gap-5 px-4", isEmpty ? "min-h-full items-center justify-center py-8" : "py-6"),
11202
10370
  children: [
11203
- isEmpty ? /* @__PURE__ */ jsx(WelcomeState, {
10371
+ isEmpty ? /* @__PURE__ */ jsx(ChatWelcome, {
11204
10372
  disabled: isStreaming,
11205
10373
  onSelect: (item) => setDraft(item.value ?? item.label),
11206
- composer: inputBarNode
10374
+ composer: composerNode
11207
10375
  }) : null,
11208
10376
  turns.map((turn, turnIndex) => {
11209
10377
  const key = turn.user?.id ?? `assistant-turn-${turnIndex}`;
@@ -11238,7 +10406,7 @@ function FleetPiAgentChat({ toolRenderers = PI_TOOL_RENDERERS, suggestions, stat
11238
10406
  }) : null
11239
10407
  ]
11240
10408
  }),
11241
- !isEmpty ? inputBarNode : null,
10409
+ !isEmpty ? composerNode : null,
11242
10410
  /* @__PURE__ */ jsx(FleetMessageQueue, {
11243
10411
  queue: queue ?? {
11244
10412
  steering: [],
@@ -11352,9 +10520,9 @@ function buildChatInputBarProps(composer, activeSessionId) {
11352
10520
  onEffortPickerOpenChange: composer.setEffortPickerOpen
11353
10521
  };
11354
10522
  }
11355
- var LazyChatCommandPalette = lazy(() => import("./chat-command-palette-Co1L3rUY-RQLNME4T.js").then(({ ChatCommandPalette }) => ({ default: ChatCommandPalette })));
11356
- var LazySettingsDialog = lazy(() => import("./settings-dialog-B4uUS6f--AZ4I4ZOT.js").then(({ SettingsDialog }) => ({ default: SettingsDialog })));
11357
- var LazyForkPickerDialog = lazy(() => import("./fork-picker-dialog-DCzuGelH-TN2Q5OXI.js").then(({ ForkPickerDialog }) => ({ default: ForkPickerDialog })));
10523
+ var LazyChatCommandPalette = lazy(() => import("./chat-command-palette-Cc0uGvNm-GKENKTO7.js").then(({ ChatCommandPalette }) => ({ default: ChatCommandPalette })));
10524
+ var LazySettingsDialog = lazy(() => import("./settings-dialog-yDibpbBH-TCLJ7NRJ.js").then(({ SettingsDialog }) => ({ default: SettingsDialog })));
10525
+ var LazyForkPickerDialog = lazy(() => import("./fork-picker-dialog-DK9YGQuB-4QEFWRU4.js").then(({ ForkPickerDialog }) => ({ default: ForkPickerDialog })));
11358
10526
  function ChatCommandPaletteOverlay({ chrome, conversation, dialogs, panels, session }) {
11359
10527
  return /* @__PURE__ */ jsx(Fragment$1, { children: dialogs.commandPaletteOpen ? /* @__PURE__ */ jsx(Suspense, {
11360
10528
  fallback: null,
@@ -12472,6 +11640,40 @@ function buildSlashCommands(resources, enabled, commandsData) {
12472
11640
  }
12473
11641
  return Array.from(byId.values());
12474
11642
  }
11643
+ var INITIAL_AGENT_TAB_SCOPE_STATE = {
11644
+ dismissedChildIds: /* @__PURE__ */ new Set(),
11645
+ scopeKey: "",
11646
+ selectedTabId: "main"
11647
+ };
11648
+ function stateForScope(state, scopeKey) {
11649
+ return state.scopeKey === scopeKey ? state : {
11650
+ dismissedChildIds: /* @__PURE__ */ new Set(),
11651
+ scopeKey,
11652
+ selectedTabId: "main"
11653
+ };
11654
+ }
11655
+ function visibleAgentTabScope(state, scopeKey) {
11656
+ return stateForScope(state, scopeKey);
11657
+ }
11658
+ function reduceAgentTabScope(state, action) {
11659
+ if (action.type === "scope") return stateForScope(state, action.scopeKey);
11660
+ const current = stateForScope(state, action.scopeKey);
11661
+ if (action.type === "select") return {
11662
+ ...current,
11663
+ selectedTabId: action.tabId
11664
+ };
11665
+ if (action.type === "dismiss") return {
11666
+ ...current,
11667
+ dismissedChildIds: new Set(current.dismissedChildIds).add(action.tabId),
11668
+ selectedTabId: current.selectedTabId === action.tabId ? "main" : current.selectedTabId
11669
+ };
11670
+ const dismissedChildIds = new Set(current.dismissedChildIds);
11671
+ dismissedChildIds.delete(action.tabId);
11672
+ return {
11673
+ ...current,
11674
+ dismissedChildIds
11675
+ };
11676
+ }
12475
11677
  function createTextMessage(role, text, id = crypto.randomUUID()) {
12476
11678
  return {
12477
11679
  id,
@@ -13135,17 +12337,16 @@ function childLabel(child) {
13135
12337
  return normalizeSessionLabel(child.sessionName?.trim() || child.label) || "Subagent";
13136
12338
  }
13137
12339
  function useAgentTabs({ activeProjectId, loadSubagentSession, presentation, rootSessionId, client = chatClient }) {
13138
- const [selectedTabId, setSelectedTabId] = useState2("main");
13139
- const [dismissedChildIds, setDismissedChildIds] = useState2(/* @__PURE__ */ new Set());
13140
- const scopeKeyRef = useRef2(`${activeProjectId ?? ""}:${rootSessionId ?? ""}`);
13141
- const orderedChildren = useMemo2(() => orderedRlmChildren(presentation.rlmChildren, presentation.rlmTree), [presentation.rlmChildren, presentation.rlmTree]);
12340
+ const scopeKey = `${activeProjectId ?? ""}:${rootSessionId ?? ""}`;
12341
+ const [tabScope, dispatchTabScope] = useReducer(reduceAgentTabScope, INITIAL_AGENT_TAB_SCOPE_STATE);
13142
12342
  useEffect2(() => {
13143
- const nextScopeKey = `${activeProjectId ?? ""}:${rootSessionId ?? ""}`;
13144
- if (scopeKeyRef.current === nextScopeKey) return;
13145
- scopeKeyRef.current = nextScopeKey;
13146
- setSelectedTabId("main");
13147
- setDismissedChildIds(/* @__PURE__ */ new Set());
13148
- }, [activeProjectId, rootSessionId]);
12343
+ dispatchTabScope({
12344
+ type: "scope",
12345
+ scopeKey
12346
+ });
12347
+ }, [scopeKey]);
12348
+ const { dismissedChildIds, selectedTabId } = visibleAgentTabScope(tabScope, scopeKey);
12349
+ const orderedChildren = useMemo2(() => orderedRlmChildren(presentation.rlmChildren, presentation.rlmTree), [presentation.rlmChildren, presentation.rlmTree]);
13149
12350
  const tabs = useMemo2(() => [{
13150
12351
  id: "main",
13151
12352
  label: "Main agent",
@@ -13160,19 +12361,25 @@ function useAgentTabs({ activeProjectId, loadSubagentSession, presentation, root
13160
12361
  const selectedChild = orderedChildren.find((child) => child.id === activeTabId);
13161
12362
  const selectTab = useCallback2((tabId) => {
13162
12363
  if (tabId !== "main" && !orderedChildren.some((child) => child.id === tabId)) return;
13163
- if (tabId !== "main") setDismissedChildIds((current) => {
13164
- if (!current.has(tabId)) return current;
13165
- const next = new Set(current);
13166
- next.delete(tabId);
13167
- return next;
12364
+ if (tabId !== "main") dispatchTabScope({
12365
+ type: "restore",
12366
+ scopeKey,
12367
+ tabId
12368
+ });
12369
+ dispatchTabScope({
12370
+ type: "select",
12371
+ scopeKey,
12372
+ tabId
13168
12373
  });
13169
- setSelectedTabId(tabId);
13170
- }, [orderedChildren]);
12374
+ }, [orderedChildren, scopeKey]);
13171
12375
  const closeTab = useCallback2((tabId) => {
13172
12376
  if (tabId === "main" || !orderedChildren.some((child) => child.id === tabId)) return;
13173
- setDismissedChildIds((current) => new Set(current).add(tabId));
13174
- setSelectedTabId((current) => current === tabId ? "main" : current);
13175
- }, [orderedChildren]);
12377
+ dispatchTabScope({
12378
+ type: "dismiss",
12379
+ scopeKey,
12380
+ tabId
12381
+ });
12382
+ }, [orderedChildren, scopeKey]);
13176
12383
  const openChildTab = useCallback2((childId) => selectTab(childId), [selectTab]);
13177
12384
  return {
13178
12385
  activeTabId,
@@ -14417,47 +13624,233 @@ function planPresentationForToolCall(messages, toolCallId) {
14417
13624
  todos: candidate.todos.map((todo) => ({ ...todo }))
14418
13625
  }
14419
13626
  };
14420
- }
14421
- }
14422
- async function runForbiddenSessionRecovery(deps) {
14423
- deps.setSessionMetadataSynced({});
14424
- deps.setMessagesSynced([]);
14425
- deps.setQueueSynced(EMPTY_QUEUE_STATE);
14426
- deps.setActivityLabelSynced(void 0);
14427
- deps.setPlanLabelSynced(void 0);
14428
- deps.setPresentationSynced({
14429
- revision: 0,
14430
- userBash: [],
14431
- rlmChildren: [],
14432
- refinements: [],
14433
- artifactRuns: []
14434
- });
14435
- deps.setError(null);
14436
- deps.setStatus("ready");
14437
- const result = await deps.client.createSession(deps.projectId);
14438
- deps.setSessionMetadataSynced(result.session);
14439
- deps.setMessagesSynced(result.messages);
14440
- deps.setPresentationSynced(result.presentation);
14441
- deps.setActivityLabelSynced(result.sessionReset ? "Started a fresh Pi session" : void 0);
14442
- await deps.refreshSessions();
14443
- }
14444
- async function tryRecoverMatchingSessionError(error, matches2, recover, deps) {
14445
- if (!matches2(error)) return false;
14446
- try {
14447
- await recover();
14448
- } catch (recoveryError) {
14449
- const nextError = recoveryError instanceof Error ? recoveryError : new Error(String(recoveryError));
14450
- deps.setError(nextError);
14451
- deps.setStatus("error");
14452
- notifyChatError(nextError);
14453
- }
14454
- return true;
14455
- }
14456
- async function tryRecoverForbiddenSession(error, recover, deps) {
14457
- return tryRecoverMatchingSessionError(error, isForbiddenSessionError, recover, deps);
14458
- }
14459
- async function tryRecoverUnknownSession(error, recover, deps) {
14460
- return tryRecoverMatchingSessionError(error, isUnknownSessionError, recover, deps);
13627
+ }
13628
+ }
13629
+ async function runForbiddenSessionRecovery(deps) {
13630
+ deps.setSessionMetadataSynced({});
13631
+ deps.setMessagesSynced([]);
13632
+ deps.setQueueSynced(EMPTY_QUEUE_STATE);
13633
+ deps.setActivityLabelSynced(void 0);
13634
+ deps.setPlanLabelSynced(void 0);
13635
+ deps.setPresentationSynced({
13636
+ revision: 0,
13637
+ userBash: [],
13638
+ rlmChildren: [],
13639
+ refinements: [],
13640
+ artifactRuns: []
13641
+ });
13642
+ deps.setError(null);
13643
+ deps.setStatus("ready");
13644
+ const result = await deps.client.createSession(deps.projectId);
13645
+ deps.setSessionMetadataSynced(result.session);
13646
+ deps.setMessagesSynced(result.messages);
13647
+ deps.setPresentationSynced(result.presentation);
13648
+ deps.setActivityLabelSynced(result.sessionReset ? "Started a fresh Pi session" : void 0);
13649
+ await deps.refreshSessions();
13650
+ }
13651
+ async function tryRecoverMatchingSessionError(error, matches2, recover, deps) {
13652
+ if (!matches2(error)) return false;
13653
+ try {
13654
+ await recover();
13655
+ } catch (recoveryError) {
13656
+ const nextError = recoveryError instanceof Error ? recoveryError : new Error(String(recoveryError));
13657
+ deps.setError(nextError);
13658
+ deps.setStatus("error");
13659
+ notifyChatError(nextError);
13660
+ }
13661
+ return true;
13662
+ }
13663
+ async function tryRecoverForbiddenSession(error, recover, deps) {
13664
+ return tryRecoverMatchingSessionError(error, isForbiddenSessionError, recover, deps);
13665
+ }
13666
+ async function tryRecoverUnknownSession(error, recover, deps) {
13667
+ return tryRecoverMatchingSessionError(error, isUnknownSessionError, recover, deps);
13668
+ }
13669
+ function usePiChatBootstrap({ client, initialSessionMetadataRef, initializedRef, recoverFromForbiddenSession, refreshSessions, setActivityLabelSynced, setError, setMessagesSynced, setPlanLabelSynced, setPresentationSynced, setQueueSynced, setSessionMetadataSynced, setStatus }) {
13670
+ useEffect2(() => {
13671
+ if (initializedRef.current) return;
13672
+ initializedRef.current = true;
13673
+ const controller = new AbortController();
13674
+ let completed = false;
13675
+ setStatus("ready");
13676
+ setError(null);
13677
+ setQueueSynced(EMPTY_QUEUE_STATE);
13678
+ setActivityLabelSynced(void 0);
13679
+ setPlanLabelSynced(void 0);
13680
+ setMessagesSynced([]);
13681
+ const storedSession = initialSessionMetadataRef.current;
13682
+ refreshSessions().then((availableSessions) => {
13683
+ if (controller.signal.aborted) return void 0;
13684
+ const selected = storedSession.sessionId ? availableSessions.find((candidate) => candidate.sessionId === storedSession.sessionId) : void 0;
13685
+ const fallback = selected ?? (storedSession.projectId ? availableSessions.find((candidate) => candidate.projectId === storedSession.projectId) : availableSessions[0]);
13686
+ if (!fallback) {
13687
+ setSessionMetadataSynced(storedSession.projectId ? { projectId: storedSession.projectId } : {});
13688
+ return;
13689
+ }
13690
+ const metadata = selected ? storedSession : {
13691
+ sessionId: fallback.sessionId,
13692
+ projectId: fallback.projectId
13693
+ };
13694
+ return client.loadSession(metadata);
13695
+ }).then((result) => {
13696
+ if (!result || controller.signal.aborted) return;
13697
+ setSessionMetadataSynced(result.session);
13698
+ setMessagesSynced(hydratePlanPresentationMessages(result.messages, result.planPresentations));
13699
+ setPresentationSynced(result.presentation);
13700
+ setActivityLabelSynced(result.sessionReset ? "Started a fresh Pi session" : void 0);
13701
+ }).catch(async (err) => {
13702
+ if (controller.signal.aborted) return;
13703
+ const recoveryDeps = {
13704
+ setError,
13705
+ setStatus
13706
+ };
13707
+ if (await tryRecoverForbiddenSession(err, recoverFromForbiddenSession, recoveryDeps) || await tryRecoverUnknownSession(err, recoverFromForbiddenSession, recoveryDeps) || controller.signal.aborted) return;
13708
+ const nextError = err instanceof Error ? err : new Error(String(err));
13709
+ setError(nextError);
13710
+ setStatus("error");
13711
+ notifyChatError(nextError);
13712
+ }).finally(() => {
13713
+ completed = true;
13714
+ });
13715
+ return () => {
13716
+ controller.abort();
13717
+ if (!completed) initializedRef.current = false;
13718
+ };
13719
+ }, [
13720
+ client,
13721
+ initialSessionMetadataRef,
13722
+ initializedRef,
13723
+ recoverFromForbiddenSession,
13724
+ refreshSessions,
13725
+ setActivityLabelSynced,
13726
+ setError,
13727
+ setMessagesSynced,
13728
+ setPlanLabelSynced,
13729
+ setPresentationSynced,
13730
+ setQueueSynced,
13731
+ setSessionMetadataSynced,
13732
+ setStatus
13733
+ ]);
13734
+ }
13735
+ function usePiChatSessionEvents({ client, presentationRef, sessionId, sessionMetadataRef, setActivityLabelSynced, setAdapterCapabilities, setMessagesSynced, setPresentationSynced, setQueueSynced, setSessionMetadataSynced, statusRef }) {
13736
+ useEffect2(() => {
13737
+ if (!sessionId || typeof window === "undefined") return;
13738
+ const lastEventIdKey = `pi:sse:last-event-id:${sessionId}`;
13739
+ const sseCapabilitiesRef = { current: void 0 };
13740
+ let lastEventId = Number.parseInt(window.sessionStorage.getItem(lastEventIdKey) ?? "0", 10);
13741
+ if (Number.isNaN(lastEventId)) lastEventId = 0;
13742
+ let source = null;
13743
+ let reconnectTimer = null;
13744
+ let closedByEffect = false;
13745
+ const handleEvent = (raw) => {
13746
+ let frame2;
13747
+ try {
13748
+ frame2 = JSON.parse(raw.data);
13749
+ } catch {
13750
+ return;
13751
+ }
13752
+ if (frame2.type === "presentation") {
13753
+ if (frame2.presentation.revision > (presentationRef.current?.revision ?? -1)) setPresentationSynced(frame2.presentation);
13754
+ return;
13755
+ }
13756
+ if (frame2.type === "rlm") {
13757
+ const current = presentationRef.current;
13758
+ const existing = current.rlmChildren.find((child) => child.id === frame2.child.id);
13759
+ if (existing && existing.timestamp > frame2.child.timestamp) return;
13760
+ setPresentationSynced({
13761
+ ...current,
13762
+ rlmChildren: [...current.rlmChildren.filter((child) => child.id !== frame2.child.id), frame2.child],
13763
+ ...frame2.tree ? { rlmTree: frame2.tree } : {}
13764
+ });
13765
+ return;
13766
+ }
13767
+ if (statusRef.current === "streaming" || statusRef.current === "submitted") return;
13768
+ const connected = frame2;
13769
+ if (connected.type === "connected") {
13770
+ sseCapabilitiesRef.current = connected.adapterCapabilities;
13771
+ setAdapterCapabilities(connected.adapterCapabilities);
13772
+ return;
13773
+ }
13774
+ if (frame2.type === "reasoning") {
13775
+ const messageId = frame2.messageId;
13776
+ if (!sseCapabilitiesRef.current?.features.includes("reasoning-summary-v1") || !messageId) return;
13777
+ setMessagesSynced((current) => upsertAssistantReasoningPresentation(current, messageId, frame2.presentation));
13778
+ return;
13779
+ }
13780
+ if (frame2.type === "tool" && frame2.part?.type === "tool-Question") {
13781
+ setMessagesSynced((current) => {
13782
+ const toolCallId = frame2.part.toolCallId ?? "";
13783
+ if (current.some((message) => message.parts.some((part) => part.type !== "text" && part.type !== "error" && "toolCallId" in part && part.toolCallId === toolCallId))) return current;
13784
+ const questionPart = {
13785
+ ...frame2.part,
13786
+ type: "tool-Question"
13787
+ };
13788
+ return [...current, {
13789
+ id: crypto.randomUUID(),
13790
+ role: "assistant",
13791
+ parts: [questionPart],
13792
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
13793
+ }];
13794
+ });
13795
+ return;
13796
+ }
13797
+ if (frame2.type === "state") {
13798
+ setActivityLabelSynced(typeof frame2.state?.message === "string" ? frame2.state.message : void 0);
13799
+ if (frame2.state?.name === "agent_settled") client.loadSession({ sessionId }).then((result) => {
13800
+ if (closedByEffect || sessionMetadataRef.current.sessionId !== sessionId) return;
13801
+ setMessagesSynced(hydratePlanPresentationMessages(result.messages, result.planPresentations));
13802
+ setPresentationSynced(result.presentation);
13803
+ setSessionMetadataSynced(result.session);
13804
+ setQueueSynced(EMPTY_QUEUE_STATE);
13805
+ }).catch(() => void 0);
13806
+ return;
13807
+ }
13808
+ if (frame2.type === "queue") setQueueSynced({
13809
+ steering: frame2.steering,
13810
+ followUp: frame2.followUp
13811
+ });
13812
+ };
13813
+ const connect = () => {
13814
+ const params = new URLSearchParams({ sessionId });
13815
+ if (lastEventId > 0) params.set("lastEventId", String(lastEventId));
13816
+ source?.close();
13817
+ const nextSource = new EventSource(resolveChatApiUrl(`/api/chat/events?${params}`));
13818
+ source = nextSource;
13819
+ nextSource.onmessage = (event) => {
13820
+ if (closedByEffect || source !== nextSource) return;
13821
+ const seq = Number.parseInt(event.lastEventId ?? "", 10);
13822
+ if (!Number.isNaN(seq) && seq > 0) {
13823
+ lastEventId = seq;
13824
+ window.sessionStorage.setItem(lastEventIdKey, String(seq));
13825
+ }
13826
+ handleEvent(event);
13827
+ };
13828
+ nextSource.onerror = () => {
13829
+ if (closedByEffect || source !== nextSource) return;
13830
+ nextSource.close();
13831
+ if (reconnectTimer) clearTimeout(reconnectTimer);
13832
+ reconnectTimer = setTimeout(connect, 2e3);
13833
+ };
13834
+ };
13835
+ connect();
13836
+ return () => {
13837
+ closedByEffect = true;
13838
+ source?.close();
13839
+ if (reconnectTimer) clearTimeout(reconnectTimer);
13840
+ };
13841
+ }, [
13842
+ client,
13843
+ presentationRef,
13844
+ sessionId,
13845
+ sessionMetadataRef,
13846
+ setActivityLabelSynced,
13847
+ setAdapterCapabilities,
13848
+ setMessagesSynced,
13849
+ setPresentationSynced,
13850
+ setQueueSynced,
13851
+ setSessionMetadataSynced,
13852
+ statusRef
13853
+ ]);
14461
13854
  }
14462
13855
  function createStreamAdmission() {
14463
13856
  let resolvePromise;
@@ -15103,62 +14496,21 @@ function usePiChat(model, options) {
15103
14496
  cancelled = true;
15104
14497
  };
15105
14498
  }, [refreshSessions]);
15106
- useEffect2(() => {
15107
- if (initializedRef.current) return;
15108
- initializedRef.current = true;
15109
- const controller = new AbortController();
15110
- setStatus("ready");
15111
- setError(null);
15112
- setQueueSynced(EMPTY_QUEUE_STATE);
15113
- setActivityLabelSynced(void 0);
15114
- setPlanLabelSynced(void 0);
15115
- setMessagesSynced([]);
15116
- const storedSession = initialSessionMetadataRef.current;
15117
- refreshSessions().then((availableSessions) => {
15118
- if (controller.signal.aborted) return void 0;
15119
- const selected = storedSession.sessionId ? availableSessions.find((candidate) => candidate.sessionId === storedSession.sessionId) : void 0;
15120
- const fallback = selected ?? (storedSession.projectId ? availableSessions.find((candidate) => candidate.projectId === storedSession.projectId) : availableSessions[0]);
15121
- if (!fallback) {
15122
- setSessionMetadataSynced(storedSession.projectId ? { projectId: storedSession.projectId } : {});
15123
- return;
15124
- }
15125
- const metadata = selected ? storedSession : {
15126
- sessionId: fallback.sessionId,
15127
- projectId: fallback.projectId
15128
- };
15129
- return client.loadSession(metadata);
15130
- }).then((result) => {
15131
- if (!result || controller.signal.aborted) return;
15132
- setSessionMetadataSynced(result.session);
15133
- setMessagesSynced(hydratePlanPresentationMessages(result.messages, result.planPresentations));
15134
- setPresentationSynced(result.presentation);
15135
- setActivityLabelSynced(result.sessionReset ? "Started a fresh Pi session" : void 0);
15136
- }).catch(async (err) => {
15137
- if (controller.signal.aborted) return;
15138
- const recoveryDeps = {
15139
- setError,
15140
- setStatus
15141
- };
15142
- if (await tryRecoverForbiddenSession(err, recoverFromForbiddenSession, recoveryDeps) || await tryRecoverUnknownSession(err, recoverFromForbiddenSession, recoveryDeps) || controller.signal.aborted) return;
15143
- const nextError = err instanceof Error ? err : new Error(String(err));
15144
- setError(nextError);
15145
- setStatus("error");
15146
- notifyChatError(nextError);
15147
- });
15148
- return () => {
15149
- controller.abort();
15150
- };
15151
- }, [
14499
+ usePiChatBootstrap({
15152
14500
  client,
14501
+ initialSessionMetadataRef,
14502
+ initializedRef,
14503
+ recoverFromForbiddenSession,
14504
+ refreshSessions,
15153
14505
  setActivityLabelSynced,
14506
+ setError,
15154
14507
  setMessagesSynced,
15155
14508
  setPlanLabelSynced,
15156
14509
  setPresentationSynced,
15157
14510
  setQueueSynced,
15158
14511
  setSessionMetadataSynced,
15159
- refreshSessions,
15160
- recoverFromForbiddenSession
15161
- ]);
14512
+ setStatus
14513
+ });
15162
14514
  const { resetStreamAdmission, sendMessage, setAdapterCapabilities } = usePiChatMessaging({
15163
14515
  activityLabelRef,
15164
14516
  client,
@@ -15348,130 +14700,19 @@ function usePiChat(model, options) {
15348
14700
  useEffect2(() => {
15349
14701
  sendMessageRef.current = sendMessage;
15350
14702
  }, [sendMessage]);
15351
- useEffect2(() => {
15352
- const sessionId = sessionMetadata.sessionId;
15353
- if (!sessionId || typeof window === "undefined") return;
15354
- const lastEventIdKey = `pi:sse:last-event-id:${sessionId}`;
15355
- const sseCapabilitiesRef = { current: void 0 };
15356
- let lastEventId = Number.parseInt(window.sessionStorage.getItem(lastEventIdKey) ?? "0", 10);
15357
- if (Number.isNaN(lastEventId)) lastEventId = 0;
15358
- let source = null;
15359
- let reconnectTimer = null;
15360
- let closedByEffect = false;
15361
- const handleEvent = (raw) => {
15362
- let frame2;
15363
- try {
15364
- frame2 = JSON.parse(raw.data);
15365
- } catch {
15366
- return;
15367
- }
15368
- if (frame2.type === "presentation") {
15369
- if (frame2.presentation.revision > (presentationRef.current?.revision ?? -1)) setPresentationSynced(frame2.presentation);
15370
- return;
15371
- }
15372
- if (frame2.type === "rlm") {
15373
- const current = presentationRef.current;
15374
- const existing = current.rlmChildren.find((child) => child.id === frame2.child.id);
15375
- if (existing && existing.timestamp > frame2.child.timestamp) return;
15376
- setPresentationSynced({
15377
- ...current,
15378
- rlmChildren: [...current.rlmChildren.filter((child) => child.id !== frame2.child.id), frame2.child],
15379
- ...frame2.tree ? { rlmTree: frame2.tree } : {}
15380
- });
15381
- return;
15382
- }
15383
- const currentStatus = statusRef.current;
15384
- if (currentStatus === "streaming" || currentStatus === "submitted") return;
15385
- const connected = frame2;
15386
- if (connected.type === "connected") {
15387
- const caps = connected.adapterCapabilities;
15388
- sseCapabilitiesRef.current = caps;
15389
- setAdapterCapabilities(caps);
15390
- return;
15391
- }
15392
- if (frame2.type === "reasoning") {
15393
- const capabilities = sseCapabilitiesRef.current;
15394
- const messageId = frame2.messageId;
15395
- if (!capabilities?.features.includes("reasoning-summary-v1") || !messageId) return;
15396
- setMessagesSynced((current) => upsertAssistantReasoningPresentation(current, messageId, frame2.presentation));
15397
- return;
15398
- }
15399
- if (frame2.type === "tool" && frame2.part?.type === "tool-Question") {
15400
- setMessagesSynced((current) => {
15401
- const toolCallId = frame2.part.toolCallId ?? "";
15402
- if (current.findIndex((message) => message.parts.some((p) => p.type !== "text" && p.type !== "error" && "toolCallId" in p && p.toolCallId === toolCallId)) !== -1) return current;
15403
- const questionPart = {
15404
- ...frame2.part,
15405
- type: "tool-Question"
15406
- };
15407
- return [...current, {
15408
- id: crypto.randomUUID(),
15409
- role: "assistant",
15410
- parts: [questionPart],
15411
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
15412
- }];
15413
- });
15414
- return;
15415
- }
15416
- if (frame2.type === "state") {
15417
- setActivityLabelSynced(typeof frame2.state?.message === "string" ? frame2.state.message : void 0);
15418
- if (frame2.state?.name === "agent_settled") {
15419
- const settledSessionId = sessionId;
15420
- client.loadSession({ sessionId: settledSessionId }).then((result) => {
15421
- if (sessionMetadataRef.current.sessionId !== settledSessionId) return;
15422
- setMessagesSynced(hydratePlanPresentationMessages(result.messages, result.planPresentations));
15423
- setPresentationSynced(result.presentation);
15424
- setSessionMetadataSynced(result.session);
15425
- setQueueSynced(EMPTY_QUEUE_STATE);
15426
- }).catch(() => void 0);
15427
- }
15428
- return;
15429
- }
15430
- if (frame2.type === "queue") {
15431
- setQueueSynced({
15432
- steering: frame2.steering,
15433
- followUp: frame2.followUp
15434
- });
15435
- return;
15436
- }
15437
- };
15438
- const connect = () => {
15439
- const params = new URLSearchParams({ sessionId });
15440
- if (lastEventId > 0) params.set("lastEventId", String(lastEventId));
15441
- const url = resolveChatApiUrl(`/api/chat/events?${params}`);
15442
- source?.close();
15443
- source = new EventSource(url);
15444
- source.onmessage = (event) => {
15445
- const seq = Number.parseInt(event.lastEventId ?? "", 10);
15446
- if (!Number.isNaN(seq) && seq > 0) {
15447
- lastEventId = seq;
15448
- window.sessionStorage.setItem(lastEventIdKey, String(seq));
15449
- }
15450
- handleEvent(event);
15451
- };
15452
- source.onerror = () => {
15453
- source?.close();
15454
- if (closedByEffect) return;
15455
- if (reconnectTimer) clearTimeout(reconnectTimer);
15456
- reconnectTimer = setTimeout(connect, 2e3);
15457
- };
15458
- };
15459
- connect();
15460
- return () => {
15461
- closedByEffect = true;
15462
- source?.close();
15463
- if (reconnectTimer) clearTimeout(reconnectTimer);
15464
- };
15465
- }, [
14703
+ usePiChatSessionEvents({
15466
14704
  client,
15467
- sessionMetadata.sessionId,
14705
+ presentationRef,
14706
+ sessionId: sessionMetadata.sessionId,
14707
+ sessionMetadataRef,
15468
14708
  setActivityLabelSynced,
14709
+ setAdapterCapabilities,
15469
14710
  setMessagesSynced,
15470
- setQueueSynced,
15471
14711
  setPresentationSynced,
14712
+ setQueueSynced,
15472
14713
  setSessionMetadataSynced,
15473
- setAdapterCapabilities
15474
- ]);
14714
+ statusRef
14715
+ });
15475
14716
  const enhancedMessages = useMemo2(() => enhanceMessages(messages), [messages, enhanceMessages]);
15476
14717
  const renameSession = useCallback2(async (sessionId, title) => {
15477
14718
  await client.renameSession(sessionId, title);
@@ -16167,7 +15408,7 @@ function useChatWorkspaceData() {
16167
15408
  }
16168
15409
  };
16169
15410
  }
16170
- var LazySubagentChatPanel = lazy(() => import("./subagent-chat-panel-C97S3WID-DLOAD5TG.js").then(({ SubagentChatPanel }) => ({ default: SubagentChatPanel })));
15411
+ var LazySubagentChatPanel = lazy(() => import("./subagent-chat-panel-B1YoZIKO-DFRUDQJ2.js").then(({ SubagentChatPanel }) => ({ default: SubagentChatPanel })));
16171
15412
  function ChatWorkspaceShell() {
16172
15413
  const { session, conversation, composer, panels, dialogs, chrome, agentTabs } = useChatWorkspaceData();
16173
15414
  const toggleCommandPalette = useCallback2(() => {