@parhelia/core 0.1.12556 → 0.1.12560

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 (579) hide show
  1. package/dist/agents-view/AgentCard.d.ts +6 -4
  2. package/dist/agents-view/AgentCard.js +143 -24
  3. package/dist/agents-view/AgentCard.js.map +1 -1
  4. package/dist/agents-view/AgentsInbox.d.ts +1 -1
  5. package/dist/agents-view/AgentsInbox.js +7 -92
  6. package/dist/agents-view/AgentsInbox.js.map +1 -1
  7. package/dist/agents-view/AgentsTitlebar.js +3 -2
  8. package/dist/agents-view/AgentsTitlebar.js.map +1 -1
  9. package/dist/agents-view/AgentsView.d.ts +6 -7
  10. package/dist/agents-view/AgentsView.js +187 -98
  11. package/dist/agents-view/AgentsView.js.map +1 -1
  12. package/dist/agents-view/AgentsWorkspaceView.d.ts +2 -6
  13. package/dist/agents-view/AgentsWorkspaceView.js +266 -113
  14. package/dist/agents-view/AgentsWorkspaceView.js.map +1 -1
  15. package/dist/agents-view/ProfileAgentsGroup.d.ts +2 -1
  16. package/dist/agents-view/ProfileAgentsGroup.js +4 -3
  17. package/dist/agents-view/ProfileAgentsGroup.js.map +1 -1
  18. package/dist/components/ActionButton.d.ts +1 -1
  19. package/dist/components/ActionButton.js.map +1 -1
  20. package/dist/components/FilterInput.d.ts +1 -1
  21. package/dist/components/FilterInput.js +1 -1
  22. package/dist/components/FilterInput.js.map +1 -1
  23. package/dist/components/ui/LanguageSelector.js +2 -4
  24. package/dist/components/ui/LanguageSelector.js.map +1 -1
  25. package/dist/components/ui/PlaceholderInput.js +3 -3
  26. package/dist/components/ui/PlaceholderInput.js.map +1 -1
  27. package/dist/components/ui/PlaceholderInputTypes.js +1 -1
  28. package/dist/components/ui/PlaceholderInputTypes.js.map +1 -1
  29. package/dist/components/ui/alert-dialog.d.ts +1 -1
  30. package/dist/components/ui/alert-dialog.js +6 -10
  31. package/dist/components/ui/alert-dialog.js.map +1 -1
  32. package/dist/components/ui/button.d.ts +4 -4
  33. package/dist/components/ui/button.js +4 -1
  34. package/dist/components/ui/button.js.map +1 -1
  35. package/dist/components/ui/context-menu.d.ts +1 -1
  36. package/dist/components/ui/context-menu.js +12 -4
  37. package/dist/components/ui/context-menu.js.map +1 -1
  38. package/dist/components/ui/copy-button.d.ts +2 -1
  39. package/dist/components/ui/copy-button.js +2 -2
  40. package/dist/components/ui/copy-button.js.map +1 -1
  41. package/dist/components/ui/dialog.d.ts +1 -1
  42. package/dist/components/ui/dialog.js +21 -126
  43. package/dist/components/ui/dialog.js.map +1 -1
  44. package/dist/components/ui/input.d.ts +1 -1
  45. package/dist/components/ui/input.js +5 -3
  46. package/dist/components/ui/input.js.map +1 -1
  47. package/dist/components/ui/paste-button.d.ts +2 -1
  48. package/dist/components/ui/paste-button.js +2 -2
  49. package/dist/components/ui/paste-button.js.map +1 -1
  50. package/dist/components/ui/popover.js +1 -9
  51. package/dist/components/ui/popover.js.map +1 -1
  52. package/dist/components/ui/select.js +1 -1
  53. package/dist/components/ui/select.js.map +1 -1
  54. package/dist/components/ui/styled-dialog-title.js +1 -1
  55. package/dist/components/ui/styled-dialog-title.js.map +1 -1
  56. package/dist/components/ui/tabs.d.ts +1 -1
  57. package/dist/components/ui/tabs.js +4 -11
  58. package/dist/components/ui/tabs.js.map +1 -1
  59. package/dist/config/config.d.ts +4 -2
  60. package/dist/config/config.js +250 -70
  61. package/dist/config/config.js.map +1 -1
  62. package/dist/config/notificationRoutes.js +14 -0
  63. package/dist/config/notificationRoutes.js.map +1 -1
  64. package/dist/config/types/workspace.d.ts +6 -0
  65. package/dist/config/types.d.ts +63 -12
  66. package/dist/config/types.js.map +1 -1
  67. package/dist/editor/ConfirmationDialog.js +20 -4
  68. package/dist/editor/ConfirmationDialog.js.map +1 -1
  69. package/dist/editor/ContentTree.d.ts +2 -1
  70. package/dist/editor/ContentTree.js +93 -32
  71. package/dist/editor/ContentTree.js.map +1 -1
  72. package/dist/editor/Editor.js +87 -22
  73. package/dist/editor/Editor.js.map +1 -1
  74. package/dist/editor/FieldHistory.js +84 -36
  75. package/dist/editor/FieldHistory.js.map +1 -1
  76. package/dist/editor/FieldListField.js +21 -9
  77. package/dist/editor/FieldListField.js.map +1 -1
  78. package/dist/editor/FieldListFieldWithFallbacks.js +23 -2
  79. package/dist/editor/FieldListFieldWithFallbacks.js.map +1 -1
  80. package/dist/editor/GlobalMenuBar.js +29 -2
  81. package/dist/editor/GlobalMenuBar.js.map +1 -1
  82. package/dist/editor/ImageEditor.js +5 -2
  83. package/dist/editor/ImageEditor.js.map +1 -1
  84. package/dist/editor/ItemInfo.js +36 -1
  85. package/dist/editor/ItemInfo.js.map +1 -1
  86. package/dist/editor/LinkEditorDialog.js +3 -0
  87. package/dist/editor/LinkEditorDialog.js.map +1 -1
  88. package/dist/editor/MainLayout.d.ts +0 -2
  89. package/dist/editor/MainLayout.js +65 -8
  90. package/dist/editor/MainLayout.js.map +1 -1
  91. package/dist/editor/MigrationsView.js +29 -5
  92. package/dist/editor/MigrationsView.js.map +1 -1
  93. package/dist/editor/MobileLayout.js +37 -12
  94. package/dist/editor/MobileLayout.js.map +1 -1
  95. package/dist/editor/PictureCropper.js +54 -45
  96. package/dist/editor/PictureCropper.js.map +1 -1
  97. package/dist/editor/PictureEditor.js +17 -15
  98. package/dist/editor/PictureEditor.js.map +1 -1
  99. package/dist/editor/QuickItemSwitcher.js +21 -21
  100. package/dist/editor/QuickItemSwitcher.js.map +1 -1
  101. package/dist/editor/SetupWizard.js +52 -12
  102. package/dist/editor/SetupWizard.js.map +1 -1
  103. package/dist/editor/Titlebar.js +7 -2
  104. package/dist/editor/Titlebar.js.map +1 -1
  105. package/dist/editor/ai/AgentCostDisplay.d.ts +1 -0
  106. package/dist/editor/ai/AgentCostDisplay.js +1 -1
  107. package/dist/editor/ai/AgentCostDisplay.js.map +1 -1
  108. package/dist/editor/ai/AgentDocumentList.js +32 -14
  109. package/dist/editor/ai/AgentDocumentList.js.map +1 -1
  110. package/dist/editor/ai/AgentGreeting.js +3 -2
  111. package/dist/editor/ai/AgentGreeting.js.map +1 -1
  112. package/dist/editor/ai/AgentProfileSelector.js +2 -1
  113. package/dist/editor/ai/AgentProfileSelector.js.map +1 -1
  114. package/dist/editor/ai/AgentStatusBadge.d.ts +0 -5
  115. package/dist/editor/ai/AgentStatusBadge.js +67 -65
  116. package/dist/editor/ai/AgentStatusBadge.js.map +1 -1
  117. package/dist/editor/ai/AgentTerminal.d.ts +14 -2
  118. package/dist/editor/ai/AgentTerminal.js +2377 -483
  119. package/dist/editor/ai/AgentTerminal.js.map +1 -1
  120. package/dist/editor/ai/AgentTerminalStatusBar.d.ts +8 -3
  121. package/dist/editor/ai/AgentTerminalStatusBar.js +460 -56
  122. package/dist/editor/ai/AgentTerminalStatusBar.js.map +1 -1
  123. package/dist/editor/ai/Agents.js +150 -113
  124. package/dist/editor/ai/Agents.js.map +1 -1
  125. package/dist/editor/ai/AiResponseMessage.d.ts +10 -1
  126. package/dist/editor/ai/AiResponseMessage.js +238 -23
  127. package/dist/editor/ai/AiResponseMessage.js.map +1 -1
  128. package/dist/editor/ai/ContextInfoBar.d.ts +2 -3
  129. package/dist/editor/ai/ContextInfoBar.js +64 -7
  130. package/dist/editor/ai/ContextInfoBar.js.map +1 -1
  131. package/dist/editor/ai/GuidanceOverlay.js +17 -11
  132. package/dist/editor/ai/GuidanceOverlay.js.map +1 -1
  133. package/dist/editor/ai/InlineAiDialog.d.ts +1 -1
  134. package/dist/editor/ai/InlineAiDialog.js +514 -192
  135. package/dist/editor/ai/InlineAiDialog.js.map +1 -1
  136. package/dist/editor/ai/InlineAiTrigger.js +115 -12
  137. package/dist/editor/ai/InlineAiTrigger.js.map +1 -1
  138. package/dist/editor/ai/MediaImage.js +40 -8
  139. package/dist/editor/ai/MediaImage.js.map +1 -1
  140. package/dist/editor/ai/SpawnedAgentsPanel.js +10 -12
  141. package/dist/editor/ai/SpawnedAgentsPanel.js.map +1 -1
  142. package/dist/editor/ai/ToolCallDisplay.d.ts +22 -2
  143. package/dist/editor/ai/ToolCallDisplay.js +518 -147
  144. package/dist/editor/ai/ToolCallDisplay.js.map +1 -1
  145. package/dist/editor/ai/dialogs/AgentDialogHandler.d.ts +1 -8
  146. package/dist/editor/ai/dialogs/AgentDialogHandler.js +379 -42
  147. package/dist/editor/ai/dialogs/AgentDialogHandler.js.map +1 -1
  148. package/dist/editor/ai/dialogs/QuestionnaireInline.d.ts +5 -1
  149. package/dist/editor/ai/dialogs/QuestionnaireInline.js +628 -60
  150. package/dist/editor/ai/dialogs/QuestionnaireInline.js.map +1 -1
  151. package/dist/editor/ai/dialogs/agentDialogTypes.d.ts +115 -0
  152. package/dist/editor/ai/dialogs/agentDialogTypes.js +2 -0
  153. package/dist/editor/ai/dialogs/agentDialogTypes.js.map +1 -1
  154. package/dist/editor/ai/types.d.ts +3 -1
  155. package/dist/editor/ai/useAgentStatus.d.ts +2 -1
  156. package/dist/editor/ai/useAgentStatus.js +86 -99
  157. package/dist/editor/ai/useAgentStatus.js.map +1 -1
  158. package/dist/editor/ai/useInlineAiPosition.js +45 -5
  159. package/dist/editor/ai/useInlineAiPosition.js.map +1 -1
  160. package/dist/editor/client/AboutDialog.js +4 -2
  161. package/dist/editor/client/AboutDialog.js.map +1 -1
  162. package/dist/editor/client/EditorShell.d.ts +4 -1
  163. package/dist/editor/client/EditorShell.js +770 -237
  164. package/dist/editor/client/EditorShell.js.map +1 -1
  165. package/dist/editor/client/editContext.d.ts +33 -19
  166. package/dist/editor/client/editContext.js.map +1 -1
  167. package/dist/editor/client/helpers.js +6 -0
  168. package/dist/editor/client/helpers.js.map +1 -1
  169. package/dist/editor/client/hooks/useEditorUrlSync.js +1 -2
  170. package/dist/editor/client/hooks/useEditorUrlSync.js.map +1 -1
  171. package/dist/editor/client/hooks/useEditorWebSocket.d.ts +10 -0
  172. package/dist/editor/client/hooks/useEditorWebSocket.js +209 -14
  173. package/dist/editor/client/hooks/useEditorWebSocket.js.map +1 -1
  174. package/dist/editor/client/hooks/useQuota.d.ts +8 -0
  175. package/dist/editor/client/hooks/useQuota.js.map +1 -1
  176. package/dist/editor/client/hooks/useSocketMessageHandler.js +68 -7
  177. package/dist/editor/client/hooks/useSocketMessageHandler.js.map +1 -1
  178. package/dist/editor/client/itemsRepository.js +10 -6
  179. package/dist/editor/client/itemsRepository.js.map +1 -1
  180. package/dist/editor/client/navigation.js +35 -3
  181. package/dist/editor/client/navigation.js.map +1 -1
  182. package/dist/editor/client/operations.d.ts +6 -3
  183. package/dist/editor/client/operations.js +208 -30
  184. package/dist/editor/client/operations.js.map +1 -1
  185. package/dist/editor/client/pageModelBuilder.js +4 -31
  186. package/dist/editor/client/pageModelBuilder.js.map +1 -1
  187. package/dist/editor/client/ui/DevModeIndicator.js +2 -2
  188. package/dist/editor/client/ui/DevModeIndicator.js.map +1 -1
  189. package/dist/editor/client/ui/EditorChrome.d.ts +0 -6
  190. package/dist/editor/client/ui/EditorChrome.js +55 -72
  191. package/dist/editor/client/ui/EditorChrome.js.map +1 -1
  192. package/dist/editor/client/ui/FullscreenControls.js +5 -3
  193. package/dist/editor/client/ui/FullscreenControls.js.map +1 -1
  194. package/dist/editor/commands/commands.d.ts +11 -1
  195. package/dist/editor/commands/commands.js +12 -1
  196. package/dist/editor/commands/commands.js.map +1 -1
  197. package/dist/editor/commands/componentCommands.js +109 -55
  198. package/dist/editor/commands/componentCommands.js.map +1 -1
  199. package/dist/editor/commands/customCommandConverter.d.ts +8 -1
  200. package/dist/editor/commands/customCommandConverter.js +35 -5
  201. package/dist/editor/commands/customCommandConverter.js.map +1 -1
  202. package/dist/editor/commands/handlers/agentHandler.js +2 -1
  203. package/dist/editor/commands/handlers/agentHandler.js.map +1 -1
  204. package/dist/editor/commands/itemCommands.d.ts +3 -0
  205. package/dist/editor/commands/itemCommands.js +93 -10
  206. package/dist/editor/commands/itemCommands.js.map +1 -1
  207. package/dist/editor/commands/undo.d.ts +9 -15
  208. package/dist/editor/commands/undo.js +24 -0
  209. package/dist/editor/commands/undo.js.map +1 -1
  210. package/dist/editor/context-menu/InsertMenu.js +83 -39
  211. package/dist/editor/context-menu/InsertMenu.js.map +1 -1
  212. package/dist/editor/field-types/MultiLineText.js +1 -1
  213. package/dist/editor/field-types/MultiLineText.js.map +1 -1
  214. package/dist/editor/field-types/RawEditor.js +1 -1
  215. package/dist/editor/field-types/RichTextEditor.js +13 -5
  216. package/dist/editor/field-types/RichTextEditor.js.map +1 -1
  217. package/dist/editor/field-types/RichTextEditorComponent.js +37 -3
  218. package/dist/editor/field-types/RichTextEditorComponent.js.map +1 -1
  219. package/dist/editor/field-types/SingleLineText.js +1 -1
  220. package/dist/editor/field-types/TreeListEditor.js +3 -2
  221. package/dist/editor/field-types/TreeListEditor.js.map +1 -1
  222. package/dist/editor/field-types/richtext/components/ReactSlate.css +23 -5
  223. package/dist/editor/field-types/richtext/components/ReactSlate.d.ts +2 -0
  224. package/dist/editor/field-types/richtext/components/ReactSlate.js +28 -4
  225. package/dist/editor/field-types/richtext/components/ReactSlate.js.map +1 -1
  226. package/dist/editor/field-types/richtext/components/ToolbarButton.js +4 -2
  227. package/dist/editor/field-types/richtext/components/ToolbarButton.js.map +1 -1
  228. package/dist/editor/field-types/richtext/contextMenuFactory.d.ts +13 -0
  229. package/dist/editor/field-types/richtext/contextMenuFactory.js +181 -24
  230. package/dist/editor/field-types/richtext/contextMenuFactory.js.map +1 -1
  231. package/dist/editor/field-types/richtext/types.d.ts +2 -0
  232. package/dist/editor/field-types/richtext/types.js.map +1 -1
  233. package/dist/editor/field-types/richtext/utils/plugins.js +4 -0
  234. package/dist/editor/field-types/richtext/utils/plugins.js.map +1 -1
  235. package/dist/editor/field-types/textContextMenuFactory.js +3 -2
  236. package/dist/editor/field-types/textContextMenuFactory.js.map +1 -1
  237. package/dist/editor/media-selector/AiImageSearchPrompt.js +4 -2
  238. package/dist/editor/media-selector/AiImageSearchPrompt.js.map +1 -1
  239. package/dist/editor/media-selector/MediaFolderBrowser.js +1 -1
  240. package/dist/editor/media-selector/MediaFolderBrowser.js.map +1 -1
  241. package/dist/editor/media-selector/MediaSelector.js +7 -1
  242. package/dist/editor/media-selector/MediaSelector.js.map +1 -1
  243. package/dist/editor/media-selector/TreeSelector.js +40 -35
  244. package/dist/editor/media-selector/TreeSelector.js.map +1 -1
  245. package/dist/editor/menubar/ActiveUsers.js +1 -1
  246. package/dist/editor/menubar/ActiveUsers.js.map +1 -1
  247. package/dist/editor/menubar/GenericToolbar.js +4 -2
  248. package/dist/editor/menubar/GenericToolbar.js.map +1 -1
  249. package/dist/editor/menubar/ItemLanguageVersion.js +2 -2
  250. package/dist/editor/menubar/ItemLanguageVersion.js.map +1 -1
  251. package/dist/editor/menubar/PageSelector.js +26 -147
  252. package/dist/editor/menubar/PageSelector.js.map +1 -1
  253. package/dist/editor/menubar/Separator.js +1 -1
  254. package/dist/editor/menubar/VersionSelector.js +2 -4
  255. package/dist/editor/menubar/VersionSelector.js.map +1 -1
  256. package/dist/editor/menubar/WorkflowButton.js +39 -12
  257. package/dist/editor/menubar/WorkflowButton.js.map +1 -1
  258. package/dist/editor/menubar/toolbar-sections/CustomCommandsToolbar.js +16 -38
  259. package/dist/editor/menubar/toolbar-sections/CustomCommandsToolbar.js.map +1 -1
  260. package/dist/editor/menubar/toolbar-sections/EditControls.js +3 -3
  261. package/dist/editor/menubar/toolbar-sections/EditControls.js.map +1 -1
  262. package/dist/editor/menubar/toolbar-sections/HelpButton.js +1 -0
  263. package/dist/editor/menubar/toolbar-sections/HelpButton.js.map +1 -1
  264. package/dist/editor/menubar/toolbar-sections/ManualBrowser.d.ts +6 -10
  265. package/dist/editor/menubar/toolbar-sections/ManualBrowser.js +597 -220
  266. package/dist/editor/menubar/toolbar-sections/ManualBrowser.js.map +1 -1
  267. package/dist/editor/menubar/toolbar-sections/UtilityControls.js +13 -2
  268. package/dist/editor/menubar/toolbar-sections/UtilityControls.js.map +1 -1
  269. package/dist/editor/page-editor-chrome/CommentHighlighting.js +42 -1
  270. package/dist/editor/page-editor-chrome/CommentHighlighting.js.map +1 -1
  271. package/dist/editor/page-editor-chrome/FrameMenu.js +1 -1
  272. package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
  273. package/dist/editor/page-editor-chrome/InlineEditor.js +97 -48
  274. package/dist/editor/page-editor-chrome/InlineEditor.js.map +1 -1
  275. package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +38 -17
  276. package/dist/editor/page-editor-chrome/PlaceholderDropZone.js.map +1 -1
  277. package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +17 -11
  278. package/dist/editor/page-editor-chrome/PlaceholderDropZones.js.map +1 -1
  279. package/dist/editor/page-editor-chrome/useInlineAICompletion.js +301 -301
  280. package/dist/editor/page-editor-chrome/useInlineAICompletion.js.map +1 -1
  281. package/dist/editor/page-viewer/DeviceToolbar.js +1 -1
  282. package/dist/editor/page-viewer/DeviceToolbar.js.map +1 -1
  283. package/dist/editor/page-viewer/EditorForm.js +69 -11
  284. package/dist/editor/page-viewer/EditorForm.js.map +1 -1
  285. package/dist/editor/page-viewer/MiniMap.d.ts +2 -4
  286. package/dist/editor/page-viewer/MiniMap.js +91 -28
  287. package/dist/editor/page-viewer/MiniMap.js.map +1 -1
  288. package/dist/editor/page-viewer/PageViewer.d.ts +3 -1
  289. package/dist/editor/page-viewer/PageViewer.js +92 -19
  290. package/dist/editor/page-viewer/PageViewer.js.map +1 -1
  291. package/dist/editor/page-viewer/PageViewerFrame.d.ts +2 -1
  292. package/dist/editor/page-viewer/PageViewerFrame.js +348 -115
  293. package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
  294. package/dist/editor/page-viewer/pageModelSkeletonBuilder.js +114 -49
  295. package/dist/editor/page-viewer/pageModelSkeletonBuilder.js.map +1 -1
  296. package/dist/editor/page-viewer/pageViewContext.d.ts +1 -0
  297. package/dist/editor/page-viewer/pageViewContext.js +51 -14
  298. package/dist/editor/page-viewer/pageViewContext.js.map +1 -1
  299. package/dist/editor/pageModel.d.ts +14 -1
  300. package/dist/editor/reviews/Comment.js +26 -12
  301. package/dist/editor/reviews/Comment.js.map +1 -1
  302. package/dist/editor/reviews/CommentDisplayPopover.js +7 -5
  303. package/dist/editor/reviews/CommentDisplayPopover.js.map +1 -1
  304. package/dist/editor/reviews/CommentView.js +19 -4
  305. package/dist/editor/reviews/CommentView.js.map +1 -1
  306. package/dist/editor/reviews/Comments.js +89 -72
  307. package/dist/editor/reviews/Comments.js.map +1 -1
  308. package/dist/editor/reviews/CreateReviewDialog.js +281 -177
  309. package/dist/editor/reviews/CreateReviewDialog.js.map +1 -1
  310. package/dist/editor/reviews/DecisionsMatrix.js +96 -25
  311. package/dist/editor/reviews/DecisionsMatrix.js.map +1 -1
  312. package/dist/editor/reviews/DiffView.js +7 -14
  313. package/dist/editor/reviews/DiffView.js.map +1 -1
  314. package/dist/editor/reviews/EditReviewSettingsDialog.js +6 -4
  315. package/dist/editor/reviews/EditReviewSettingsDialog.js.map +1 -1
  316. package/dist/editor/reviews/MultiReviewManager.js +25 -3
  317. package/dist/editor/reviews/MultiReviewManager.js.map +1 -1
  318. package/dist/editor/reviews/PagesPanel.js +31 -15
  319. package/dist/editor/reviews/PagesPanel.js.map +1 -1
  320. package/dist/editor/reviews/PreviewInfo.js +1 -4
  321. package/dist/editor/reviews/PreviewInfo.js.map +1 -1
  322. package/dist/editor/reviews/ReviewCard.js +13 -7
  323. package/dist/editor/reviews/ReviewCard.js.map +1 -1
  324. package/dist/editor/reviews/ReviewDetail.js +3 -2
  325. package/dist/editor/reviews/ReviewDetail.js.map +1 -1
  326. package/dist/editor/reviews/ReviewsList.js +7 -3
  327. package/dist/editor/reviews/ReviewsList.js.map +1 -1
  328. package/dist/editor/reviews/SuggestedEdit.js +34 -3
  329. package/dist/editor/reviews/SuggestedEdit.js.map +1 -1
  330. package/dist/editor/reviews/SuggestionDisplayPopover.js +31 -5
  331. package/dist/editor/reviews/SuggestionDisplayPopover.js.map +1 -1
  332. package/dist/editor/reviews/commentAi.js +25 -6
  333. package/dist/editor/reviews/commentAi.js.map +1 -1
  334. package/dist/editor/reviews/reviewCommands.js +4 -1
  335. package/dist/editor/reviews/reviewCommands.js.map +1 -1
  336. package/dist/editor/reviews/useMultiReview.js +2 -2
  337. package/dist/editor/reviews/useMultiReview.js.map +1 -1
  338. package/dist/editor/reviews/useReviews.d.ts +2 -2
  339. package/dist/editor/reviews/useReviews.js +12 -30
  340. package/dist/editor/reviews/useReviews.js.map +1 -1
  341. package/dist/editor/services/agentService.d.ts +229 -5
  342. package/dist/editor/services/agentService.js +292 -39
  343. package/dist/editor/services/agentService.js.map +1 -1
  344. package/dist/editor/services/aiService.d.ts +57 -1
  345. package/dist/editor/services/aiService.js +79 -6
  346. package/dist/editor/services/aiService.js.map +1 -1
  347. package/dist/editor/services/contentService.d.ts +6 -3
  348. package/dist/editor/services/contentService.js +13 -12
  349. package/dist/editor/services/contentService.js.map +1 -1
  350. package/dist/editor/services/editService.d.ts +52 -1
  351. package/dist/editor/services/editService.js +94 -2
  352. package/dist/editor/services/editService.js.map +1 -1
  353. package/dist/editor/services/indexService.js +1 -1
  354. package/dist/editor/services/indexService.js.map +1 -1
  355. package/dist/editor/services/reviewsService.d.ts +3 -6
  356. package/dist/editor/services/reviewsService.js +2 -11
  357. package/dist/editor/services/reviewsService.js.map +1 -1
  358. package/dist/editor/services/serviceHelper.d.ts +2 -1
  359. package/dist/editor/services/serviceHelper.js +112 -20
  360. package/dist/editor/services/serviceHelper.js.map +1 -1
  361. package/dist/editor/services/systemService.d.ts +2 -1
  362. package/dist/editor/services/systemService.js +3 -0
  363. package/dist/editor/services/systemService.js.map +1 -1
  364. package/dist/editor/services-server/api.d.ts +1 -2
  365. package/dist/editor/services-server/api.js +11 -6
  366. package/dist/editor/services-server/api.js.map +1 -1
  367. package/dist/editor/settings/About.js +317 -3
  368. package/dist/editor/settings/About.js.map +1 -1
  369. package/dist/editor/settings/QuotaInfo.js +210 -4
  370. package/dist/editor/settings/QuotaInfo.js.map +1 -1
  371. package/dist/editor/settings/SettingsView.js +25 -23
  372. package/dist/editor/settings/SettingsView.js.map +1 -1
  373. package/dist/editor/settings/Status.js +7 -6
  374. package/dist/editor/settings/Status.js.map +1 -1
  375. package/dist/editor/settings/index/useIndexStatus.js +20 -22
  376. package/dist/editor/settings/index/useIndexStatus.js.map +1 -1
  377. package/dist/editor/settings/panels/AgentsPanel.d.ts +0 -4
  378. package/dist/editor/settings/panels/AgentsPanel.js +95 -121
  379. package/dist/editor/settings/panels/AgentsPanel.js.map +1 -1
  380. package/dist/editor/settings/panels/ModelsPanel.js +329 -108
  381. package/dist/editor/settings/panels/ModelsPanel.js.map +1 -1
  382. package/dist/editor/settings/panels/ProvidersPanel.d.ts +1 -1
  383. package/dist/editor/settings/panels/ProvidersPanel.js +86 -59
  384. package/dist/editor/settings/panels/ProvidersPanel.js.map +1 -1
  385. package/dist/editor/settings/panels/SearchConfigPanel.js +4 -4
  386. package/dist/editor/settings/panels/SearchConfigPanel.js.map +1 -1
  387. package/dist/editor/settings/panels/index.d.ts +3 -2
  388. package/dist/editor/settings/panels/index.js +3 -2
  389. package/dist/editor/settings/panels/index.js.map +1 -1
  390. package/dist/editor/settings/status/coreStatusChecks.js +124 -19
  391. package/dist/editor/settings/status/coreStatusChecks.js.map +1 -1
  392. package/dist/editor/settings/status/useStartupChecks.d.ts +3 -1
  393. package/dist/editor/settings/status/useStartupChecks.js +9 -5
  394. package/dist/editor/settings/status/useStartupChecks.js.map +1 -1
  395. package/dist/editor/setup-wizard/steps/CompleteStep.d.ts +2 -1
  396. package/dist/editor/setup-wizard/steps/CompleteStep.js +2 -1
  397. package/dist/editor/setup-wizard/steps/CompleteStep.js.map +1 -1
  398. package/dist/editor/sidebar/ComponentPalette.js +2 -1
  399. package/dist/editor/sidebar/ComponentPalette.js.map +1 -1
  400. package/dist/editor/sidebar/ComponentTree.d.ts +8 -1
  401. package/dist/editor/sidebar/ComponentTree.js +216 -69
  402. package/dist/editor/sidebar/ComponentTree.js.map +1 -1
  403. package/dist/editor/sidebar/EditHistory.js +22 -46
  404. package/dist/editor/sidebar/EditHistory.js.map +1 -1
  405. package/dist/editor/sidebar/Favorites.js +4 -8
  406. package/dist/editor/sidebar/Favorites.js.map +1 -1
  407. package/dist/editor/sidebar/MainContentTree.js +4 -3
  408. package/dist/editor/sidebar/MainContentTree.js.map +1 -1
  409. package/dist/editor/sidebar/OperationItem.js +21 -7
  410. package/dist/editor/sidebar/OperationItem.js.map +1 -1
  411. package/dist/editor/sidebar/SidebarPanel.d.ts +3 -1
  412. package/dist/editor/sidebar/SidebarPanel.js +44 -12
  413. package/dist/editor/sidebar/SidebarPanel.js.map +1 -1
  414. package/dist/editor/sidebar/SidebarStack.d.ts +2 -1
  415. package/dist/editor/sidebar/SidebarStack.js +4 -3
  416. package/dist/editor/sidebar/SidebarStack.js.map +1 -1
  417. package/dist/editor/sidebar/Validation.js +22 -12
  418. package/dist/editor/sidebar/Validation.js.map +1 -1
  419. package/dist/editor/sidebar/Workbox.js +53 -3
  420. package/dist/editor/sidebar/Workbox.js.map +1 -1
  421. package/dist/editor/sidebar/WorkspaceRail.d.ts +0 -1
  422. package/dist/editor/sidebar/WorkspaceRail.js +56 -167
  423. package/dist/editor/sidebar/WorkspaceRail.js.map +1 -1
  424. package/dist/editor/tree-indicators/GutterColumns.d.ts +3 -1
  425. package/dist/editor/tree-indicators/GutterColumns.js +26 -5
  426. package/dist/editor/tree-indicators/GutterColumns.js.map +1 -1
  427. package/dist/editor/tree-indicators/GutterContext.d.ts +4 -0
  428. package/dist/editor/tree-indicators/GutterContext.js +23 -0
  429. package/dist/editor/tree-indicators/GutterContext.js.map +1 -1
  430. package/dist/editor/tree-indicators/index.d.ts +0 -1
  431. package/dist/editor/tree-indicators/index.js +0 -1
  432. package/dist/editor/tree-indicators/index.js.map +1 -1
  433. package/dist/editor/tree-indicators/types.d.ts +12 -1
  434. package/dist/editor/ui/CopyMoveTargetSelectorDialog.js +1 -1
  435. package/dist/editor/ui/CopyMoveTargetSelectorDialog.js.map +1 -1
  436. package/dist/editor/ui/Icons.js +1 -1
  437. package/dist/editor/ui/Icons.js.map +1 -1
  438. package/dist/editor/ui/ItemNameDialogNew.d.ts +2 -0
  439. package/dist/editor/ui/ItemNameDialogNew.js +33 -17
  440. package/dist/editor/ui/ItemNameDialogNew.js.map +1 -1
  441. package/dist/editor/ui/ItemSearch.js +7 -11
  442. package/dist/editor/ui/ItemSearch.js.map +1 -1
  443. package/dist/editor/ui/SimpleIconButton.js +1 -1
  444. package/dist/editor/ui/SimpleIconButton.js.map +1 -1
  445. package/dist/editor/ui/SimpleTabs.d.ts +1 -0
  446. package/dist/editor/ui/SimpleTabs.js +45 -25
  447. package/dist/editor/ui/SimpleTabs.js.map +1 -1
  448. package/dist/editor/ui/Splitter.d.ts +1 -0
  449. package/dist/editor/ui/Splitter.js +102 -86
  450. package/dist/editor/ui/Splitter.js.map +1 -1
  451. package/dist/editor/ui/TemplateSelectorDialog.js +4 -4
  452. package/dist/editor/ui/TemplateSelectorDialog.js.map +1 -1
  453. package/dist/editor/ui/TreeListSelector.d.ts +6 -1
  454. package/dist/editor/ui/TreeListSelector.js +2 -2
  455. package/dist/editor/ui/TreeListSelector.js.map +1 -1
  456. package/dist/editor/utils/keyboardNavigation.d.ts +6 -20
  457. package/dist/editor/utils/keyboardNavigation.js +48 -140
  458. package/dist/editor/utils/keyboardNavigation.js.map +1 -1
  459. package/dist/editor/utils.js +19 -9
  460. package/dist/editor/utils.js.map +1 -1
  461. package/dist/editor/views/CompareView.d.ts +3 -1
  462. package/dist/editor/views/CompareView.js +7 -5
  463. package/dist/editor/views/CompareView.js.map +1 -1
  464. package/dist/editor/views/EditView.js +1 -1
  465. package/dist/editor/views/EditView.js.map +1 -1
  466. package/dist/editor/views/EditorSlot.js +27 -34
  467. package/dist/editor/views/EditorSlot.js.map +1 -1
  468. package/dist/editor/views/ItemEditor.js +7 -3
  469. package/dist/editor/views/ItemEditor.js.map +1 -1
  470. package/dist/editor/views/MediaFolderEditView.js +1 -1
  471. package/dist/editor/views/MediaFolderEditView.js.map +1 -1
  472. package/dist/editor/views/ParheliaView.js +5 -6
  473. package/dist/editor/views/ParheliaView.js.map +1 -1
  474. package/dist/editor/views/SingleEditView.d.ts +2 -1
  475. package/dist/editor/views/SingleEditView.js +10 -8
  476. package/dist/editor/views/SingleEditView.js.map +1 -1
  477. package/dist/editor/views/editorSlotContext.js +35 -6
  478. package/dist/editor/views/editorSlotContext.js.map +1 -1
  479. package/dist/index.d.ts +16 -2
  480. package/dist/index.js +11 -0
  481. package/dist/index.js.map +1 -1
  482. package/dist/revision.d.ts +2 -2
  483. package/dist/revision.js +2 -2
  484. package/dist/setup/services/setupWizardService.d.ts +40 -13
  485. package/dist/setup/services/setupWizardService.js +32 -17
  486. package/dist/setup/services/setupWizardService.js.map +1 -1
  487. package/dist/setup/wizard/steps/AddModelDialog.js +12 -3
  488. package/dist/setup/wizard/steps/AddModelDialog.js.map +1 -1
  489. package/dist/setup/wizard/steps/ImportModelDialog.js +39 -22
  490. package/dist/setup/wizard/steps/ImportModelDialog.js.map +1 -1
  491. package/dist/splash-screen/ModernSplashScreen.js +112 -32
  492. package/dist/splash-screen/ModernSplashScreen.js.map +1 -1
  493. package/dist/splash-screen/NewPage.js +33 -50
  494. package/dist/splash-screen/NewPage.js.map +1 -1
  495. package/dist/splash-screen/OpenPage.js +2 -6
  496. package/dist/splash-screen/OpenPage.js.map +1 -1
  497. package/dist/splash-screen/ParheliaAssistantChat.js +12 -29
  498. package/dist/splash-screen/ParheliaAssistantChat.js.map +1 -1
  499. package/dist/splash-screen/ParheliaLogo.js +87 -37
  500. package/dist/splash-screen/ParheliaLogo.js.map +1 -1
  501. package/dist/splash-screen/RecentPages.js +3 -3
  502. package/dist/splash-screen/RecentPages.js.map +1 -1
  503. package/dist/tour/Tour.d.ts +2 -1
  504. package/dist/tour/Tour.js +256 -75
  505. package/dist/tour/Tour.js.map +1 -1
  506. package/dist/tour/default-tour.js +222 -96
  507. package/dist/tour/default-tour.js.map +1 -1
  508. package/dist/types.d.ts +63 -29
  509. package/package.json +19 -15
  510. package/styles.css +14 -10
  511. package/dist/editor/ComponentInfo.d.ts +0 -4
  512. package/dist/editor/ComponentInfo.js +0 -41
  513. package/dist/editor/ComponentInfo.js.map +0 -1
  514. package/dist/editor/ai/HelpTerminal.d.ts +0 -5
  515. package/dist/editor/ai/HelpTerminal.js +0 -166
  516. package/dist/editor/ai/HelpTerminal.js.map +0 -1
  517. package/dist/editor/field-types/ReactQuill.d.ts +0 -125
  518. package/dist/editor/field-types/ReactQuill.js +0 -385
  519. package/dist/editor/field-types/ReactQuill.js.map +0 -1
  520. package/dist/editor/services-server/graphQL.d.ts +0 -29
  521. package/dist/editor/services-server/graphQL.js +0 -53
  522. package/dist/editor/services-server/graphQL.js.map +0 -1
  523. package/dist/editor/settings/AllAgentsPanel.d.ts +0 -5
  524. package/dist/editor/settings/AllAgentsPanel.js +0 -139
  525. package/dist/editor/settings/AllAgentsPanel.js.map +0 -1
  526. package/dist/editor/settings/LatestFeedback.d.ts +0 -1
  527. package/dist/editor/settings/LatestFeedback.js +0 -136
  528. package/dist/editor/settings/LatestFeedback.js.map +0 -1
  529. package/dist/editor/settings/Setup.d.ts +0 -1
  530. package/dist/editor/settings/Setup.js +0 -211
  531. package/dist/editor/settings/Setup.js.map +0 -1
  532. package/dist/editor/settings/panels/DatabasePanel.d.ts +0 -6
  533. package/dist/editor/settings/panels/DatabasePanel.js +0 -50
  534. package/dist/editor/settings/panels/DatabasePanel.js.map +0 -1
  535. package/dist/editor/settings/setup-steps/AiSetupStep/EmbeddingsModelSection.d.ts +0 -2
  536. package/dist/editor/settings/setup-steps/AiSetupStep/EmbeddingsModelSection.js +0 -195
  537. package/dist/editor/settings/setup-steps/AiSetupStep/EmbeddingsModelSection.js.map +0 -1
  538. package/dist/editor/settings/setup-steps/AiSetupStep/index.d.ts +0 -2
  539. package/dist/editor/settings/setup-steps/AiSetupStep/index.js +0 -21
  540. package/dist/editor/settings/setup-steps/AiSetupStep/index.js.map +0 -1
  541. package/dist/editor/settings/setup-steps/AiSetupStep/provider/ProviderSection.d.ts +0 -1
  542. package/dist/editor/settings/setup-steps/AiSetupStep/provider/ProviderSection.js +0 -233
  543. package/dist/editor/settings/setup-steps/AiSetupStep/provider/ProviderSection.js.map +0 -1
  544. package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersList.d.ts +0 -15
  545. package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersList.js +0 -14
  546. package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersList.js.map +0 -1
  547. package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersSection.d.ts +0 -1
  548. package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersSection.js +0 -94
  549. package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersSection.js.map +0 -1
  550. package/dist/editor/settings/setup-steps/AiSetupStep/types.d.ts +0 -1
  551. package/dist/editor/settings/setup-steps/AiSetupStep/types.js +0 -2
  552. package/dist/editor/settings/setup-steps/AiSetupStep/types.js.map +0 -1
  553. package/dist/editor/settings/setup-steps/AiSetupStep/utils.d.ts +0 -5
  554. package/dist/editor/settings/setup-steps/AiSetupStep/utils.js +0 -44
  555. package/dist/editor/settings/setup-steps/AiSetupStep/utils.js.map +0 -1
  556. package/dist/editor/settings/setup-steps/IndexSetupStep.d.ts +0 -2
  557. package/dist/editor/settings/setup-steps/IndexSetupStep.js +0 -36
  558. package/dist/editor/settings/setup-steps/IndexSetupStep.js.map +0 -1
  559. package/dist/editor/settings/setup-steps/SettingsSetupStep.d.ts +0 -2
  560. package/dist/editor/settings/setup-steps/SettingsSetupStep.js +0 -111
  561. package/dist/editor/settings/setup-steps/SettingsSetupStep.js.map +0 -1
  562. package/dist/editor/settings/setup-steps/SetupOverview.d.ts +0 -14
  563. package/dist/editor/settings/setup-steps/SetupOverview.js +0 -38
  564. package/dist/editor/settings/setup-steps/SetupOverview.js.map +0 -1
  565. package/dist/editor/sidebar/Debug.d.ts +0 -1
  566. package/dist/editor/sidebar/Debug.js +0 -70
  567. package/dist/editor/sidebar/Debug.js.map +0 -1
  568. package/dist/editor/sidebar/GraphQL.d.ts +0 -2
  569. package/dist/editor/sidebar/GraphQL.js +0 -234
  570. package/dist/editor/sidebar/GraphQL.js.map +0 -1
  571. package/dist/editor/sidebar/LeftToolbar.d.ts +0 -1
  572. package/dist/editor/sidebar/LeftToolbar.js +0 -12
  573. package/dist/editor/sidebar/LeftToolbar.js.map +0 -1
  574. package/dist/editor/sidebar/NavigationSidebar.d.ts +0 -4
  575. package/dist/editor/sidebar/NavigationSidebar.js +0 -254
  576. package/dist/editor/sidebar/NavigationSidebar.js.map +0 -1
  577. package/dist/editor/tree-indicators/GutterSelector.d.ts +0 -5
  578. package/dist/editor/tree-indicators/GutterSelector.js +0 -91
  579. package/dist/editor/tree-indicators/GutterSelector.js.map +0 -1
@@ -5,7 +5,8 @@ import "react-json-view-lite/dist/index.css";
5
5
  import { Spinner } from "../ui/Spinner";
6
6
  import { Button } from "../../components/ui/button";
7
7
  import { CopyButton } from "../../components/ui/copy-button";
8
- import { approveToolCall, rejectToolCall, updateAgentSettings } from "../services/agentService";
8
+ import { approveToolCall, createOperationAllowance, rejectToolCall, updateAgentSettings, } from "../services/agentService";
9
+ import { formatTime } from "../utils";
9
10
  // Custom dark theme styles for JSON view
10
11
  const darkJsonStyles = {
11
12
  ...defaultStyles,
@@ -68,6 +69,45 @@ const getToolIcon = (toolName) => {
68
69
  };
69
70
  return iconMap[toolName] || iconMap.default;
70
71
  };
72
+ const formatToolDuration = (durationMs) => {
73
+ if (typeof durationMs !== "number" ||
74
+ !Number.isFinite(durationMs) ||
75
+ durationMs < 0) {
76
+ return null;
77
+ }
78
+ if (durationMs < 1000) {
79
+ return `${Math.round(durationMs)}ms`;
80
+ }
81
+ if (durationMs < 10_000) {
82
+ return `${(durationMs / 1000).toFixed(1)}s`;
83
+ }
84
+ if (durationMs < 60_000) {
85
+ return `${Math.round(durationMs / 1000)}s`;
86
+ }
87
+ const totalSeconds = Math.round(durationMs / 1000);
88
+ const minutes = Math.floor(totalSeconds / 60);
89
+ const seconds = totalSeconds % 60;
90
+ if (minutes < 60) {
91
+ return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`;
92
+ }
93
+ const hours = Math.floor(minutes / 60);
94
+ const remainingMinutes = minutes % 60;
95
+ return remainingMinutes > 0 ? `${hours}h ${remainingMinutes}m` : `${hours}h`;
96
+ };
97
+ const formatToolCallMeta = (createdDate, durationMs) => {
98
+ const parts = [];
99
+ if (createdDate) {
100
+ const parsed = new Date(createdDate);
101
+ if (!Number.isNaN(parsed.getTime())) {
102
+ parts.push(formatTime(parsed));
103
+ }
104
+ }
105
+ const duration = formatToolDuration(durationMs);
106
+ if (duration) {
107
+ parts.push(duration);
108
+ }
109
+ return parts.length > 0 ? parts.join(" • ") : null;
110
+ };
71
111
  // Helper function to normalize tool calls to a common format
72
112
  const normalizeToolCall = (toolCall) => {
73
113
  if ("functionName" in toolCall) {
@@ -78,10 +118,14 @@ const normalizeToolCall = (toolCall) => {
78
118
  function: {
79
119
  name: toolCall.functionName,
80
120
  arguments: toolCall.functionArguments,
81
- result: toolCall.functionResult,
121
+ result: toolCall.functionResultRichContent || toolCall.functionResult,
82
122
  error: toolCall.functionError,
83
123
  },
84
124
  requiresApproval: toolCall.requiresApproval,
125
+ isPruned: toolCall.isPruned,
126
+ prunedAt: toolCall.prunedAt,
127
+ responseTimeMs: toolCall.responseTimeMs,
128
+ createdDate: toolCall.createdDate,
85
129
  };
86
130
  }
87
131
  // Already in base format
@@ -133,6 +177,125 @@ const parseJsonString = (json) => {
133
177
  }
134
178
  }
135
179
  };
180
+ const isImageDataUrl = (value) => {
181
+ return typeof value === "string" && /^data:image\//i.test(value.trim());
182
+ };
183
+ const getInlineImageSource = (value) => {
184
+ if (isImageDataUrl(value)) {
185
+ return value.trim();
186
+ }
187
+ if (!value || typeof value !== "object") {
188
+ return null;
189
+ }
190
+ const candidate = value;
191
+ if (isImageDataUrl(candidate.dataUrl)) {
192
+ return candidate.dataUrl.trim();
193
+ }
194
+ if (isImageDataUrl(candidate.url)) {
195
+ return candidate.url.trim();
196
+ }
197
+ if (isImageDataUrl(candidate.src)) {
198
+ return candidate.src.trim();
199
+ }
200
+ const imageUrlCandidate = candidate.imageUrl ?? candidate.image_url;
201
+ if (imageUrlCandidate && typeof imageUrlCandidate === "object") {
202
+ const imageUrlRecord = imageUrlCandidate;
203
+ if (isImageDataUrl(imageUrlRecord.url)) {
204
+ return imageUrlRecord.url.trim();
205
+ }
206
+ }
207
+ return null;
208
+ };
209
+ const extractInlineToolResultImage = (value) => {
210
+ const directSource = getInlineImageSource(value);
211
+ if (directSource) {
212
+ return {
213
+ src: directSource,
214
+ alt: "Tool result image",
215
+ };
216
+ }
217
+ if (Array.isArray(value)) {
218
+ for (const entry of value) {
219
+ const preview = extractInlineToolResultImage(entry);
220
+ if (preview) {
221
+ return preview;
222
+ }
223
+ }
224
+ return null;
225
+ }
226
+ if (!value || typeof value !== "object") {
227
+ return null;
228
+ }
229
+ const candidate = value;
230
+ const nestedImage = candidate.image && typeof candidate.image === "object"
231
+ ? candidate.image
232
+ : undefined;
233
+ const richImageSource = getInlineImageSource(candidate.imageUrl ??
234
+ candidate.image_url);
235
+ const src = isImageDataUrl(nestedImage?.dataUrl)
236
+ ? nestedImage?.dataUrl.trim()
237
+ : isImageDataUrl(candidate.dataUrl)
238
+ ? candidate.dataUrl.trim()
239
+ : richImageSource
240
+ ? richImageSource
241
+ : null;
242
+ if (!src) {
243
+ return null;
244
+ }
245
+ const width = typeof candidate.imageWidth === "number" && Number.isFinite(candidate.imageWidth)
246
+ ? candidate.imageWidth
247
+ : typeof nestedImage?.width === "number" && Number.isFinite(nestedImage.width)
248
+ ? nestedImage.width
249
+ : undefined;
250
+ const height = typeof candidate.imageHeight === "number" &&
251
+ Number.isFinite(candidate.imageHeight)
252
+ ? candidate.imageHeight
253
+ : typeof nestedImage?.height === "number" &&
254
+ Number.isFinite(nestedImage.height)
255
+ ? nestedImage.height
256
+ : undefined;
257
+ return {
258
+ src,
259
+ alt: candidate.scope
260
+ ? `Screenshot result (${candidate.scope})`
261
+ : "Tool result image",
262
+ fileName: nestedImage?.fileName || candidate.fileName,
263
+ dimensions: width && height ? `${Math.round(width)} x ${Math.round(height)}` : undefined,
264
+ };
265
+ };
266
+ const sanitizeInlineImageDataForDisplay = (value) => {
267
+ if (isImageDataUrl(value)) {
268
+ return "[image data URL omitted from preview]";
269
+ }
270
+ if (Array.isArray(value)) {
271
+ let hasChanges = false;
272
+ const sanitizedItems = value.map((entry) => {
273
+ const sanitizedEntry = sanitizeInlineImageDataForDisplay(entry);
274
+ if (sanitizedEntry !== entry) {
275
+ hasChanges = true;
276
+ }
277
+ return sanitizedEntry;
278
+ });
279
+ return hasChanges ? sanitizedItems : value;
280
+ }
281
+ if (!value || typeof value !== "object") {
282
+ return value;
283
+ }
284
+ const candidate = value;
285
+ let hasChanges = false;
286
+ const clone = {};
287
+ Object.entries(candidate).forEach(([key, entryValue]) => {
288
+ const sanitizedValue = sanitizeInlineImageDataForDisplay(entryValue);
289
+ clone[key] = sanitizedValue;
290
+ if (sanitizedValue !== entryValue) {
291
+ hasChanges = true;
292
+ }
293
+ });
294
+ return hasChanges ? clone : value;
295
+ };
296
+ const InlineToolResultPreview = ({ preview, }) => {
297
+ return (_jsxs("a", { href: preview.src, target: "_blank", rel: "noopener noreferrer", className: "mb-2 block overflow-hidden rounded border border-gray-200 bg-white transition-colors hover:border-gray-300", children: [_jsx("img", { src: preview.src, alt: preview.alt, loading: "lazy", className: "max-h-40 w-auto max-w-full bg-gray-100 object-contain" }), (preview.fileName || preview.dimensions) && (_jsxs("div", { className: "flex items-center justify-between gap-3 border-t border-gray-100 px-2 py-1 text-[10px] text-gray-500", children: [_jsx("span", { className: "truncate", children: preview.fileName || "Screenshot" }), preview.dimensions && (_jsx("span", { className: "shrink-0", children: preview.dimensions }))] }))] }));
298
+ };
136
299
  // Helper function to render JSON or text
137
300
  const renderJsonOrText = (json) => {
138
301
  const parsed = parseJsonString(json);
@@ -141,7 +304,7 @@ const renderJsonOrText = (json) => {
141
304
  }
142
305
  // If parsing failed, display as plain text
143
306
  const jsonString = typeof json === "string" ? json : String(json);
144
- return (_jsx("div", { className: "font-mono text-xs break-words whitespace-pre-wrap text-gray-700", children: jsonString }));
307
+ return (_jsx("div", { className: "font-mono text-xs wrap-break-word whitespace-pre-wrap text-gray-700", children: jsonString }));
145
308
  };
146
309
  // Expandable panel component
147
310
  const ExpandablePanel = ({ title, children, defaultExpanded = false, actionButton, }) => {
@@ -150,8 +313,14 @@ const ExpandablePanel = ({ title, children, defaultExpanded = false, actionButto
150
313
  };
151
314
  // Helper function to create expandable tool call details
152
315
  const ToolCallDetails = memo(({ toolCall, result }) => {
153
- const hasError = toolCall.function?.error;
154
- const hasOutput = result || hasError;
316
+ const isPruned = !!toolCall.isPruned;
317
+ const hasError = !!toolCall.function?.error && !isPruned;
318
+ const hasOutput = !!result || hasError || isPruned;
319
+ const prunedOutput = useMemo(() => {
320
+ if (!isPruned)
321
+ return "";
322
+ return result || toolCall.function?.error || "";
323
+ }, [isPruned, result, toolCall.function?.error]);
155
324
  // Memoize parsed input data to prevent re-parsing on every render
156
325
  const parsedInput = useMemo(() => {
157
326
  return parseJsonString(toolCall.function?.arguments || "");
@@ -160,6 +329,31 @@ const ToolCallDetails = memo(({ toolCall, result }) => {
160
329
  const parsedOutput = useMemo(() => {
161
330
  return parseJsonString(result || "");
162
331
  }, [result]);
332
+ const parsedPrunedOutput = useMemo(() => {
333
+ return parseJsonString(prunedOutput);
334
+ }, [prunedOutput]);
335
+ const outputPreview = useMemo(() => {
336
+ if (isPruned) {
337
+ return extractInlineToolResultImage(parsedPrunedOutput ?? prunedOutput);
338
+ }
339
+ if (hasError) {
340
+ return null;
341
+ }
342
+ return extractInlineToolResultImage(parsedOutput ?? (result || ""));
343
+ }, [
344
+ hasError,
345
+ isPruned,
346
+ parsedOutput,
347
+ parsedPrunedOutput,
348
+ prunedOutput,
349
+ result,
350
+ ]);
351
+ const displayPrunedOutput = useMemo(() => {
352
+ return sanitizeInlineImageDataForDisplay(parsedPrunedOutput ?? prunedOutput);
353
+ }, [parsedPrunedOutput, prunedOutput]);
354
+ const displayOutput = useMemo(() => {
355
+ return sanitizeInlineImageDataForDisplay(parsedOutput ?? (result || ""));
356
+ }, [parsedOutput, result]);
163
357
  // Get text to copy for input
164
358
  const inputTextToCopy = useMemo(() => {
165
359
  const args = toolCall.function?.arguments || "";
@@ -170,63 +364,190 @@ const ToolCallDetails = memo(({ toolCall, result }) => {
170
364
  }, [toolCall.function?.arguments, parsedInput]);
171
365
  // Get text to copy for output
172
366
  const outputTextToCopy = useMemo(() => {
367
+ if (isPruned) {
368
+ if (parsedPrunedOutput !== null) {
369
+ return JSON.stringify(parsedPrunedOutput, null, 2);
370
+ }
371
+ return typeof prunedOutput === "object"
372
+ ? JSON.stringify(prunedOutput, null, 2)
373
+ : prunedOutput;
374
+ }
173
375
  if (hasError) {
174
376
  return toolCall.function?.error || "";
175
377
  }
176
378
  if (parsedOutput !== null) {
177
379
  return JSON.stringify(parsedOutput, null, 2);
178
380
  }
381
+ if (typeof result === "object") {
382
+ return JSON.stringify(result, null, 2);
383
+ }
179
384
  return result || "";
180
- }, [hasError, toolCall.function?.error, parsedOutput, result]);
181
- return (_jsxs("div", { className: "mt-1 ml-5 overflow-hidden rounded border border-gray-200/60 bg-gray-50/40", children: [_jsx(ExpandablePanel, { title: "Input", defaultExpanded: !hasOutput, actionButton: _jsx(CopyButton, { textToCopy: inputTextToCopy, iconOnly: true, className: "cursor-pointer text-gray-400 hover:text-gray-600" }), children: _jsx("div", { className: "rounded bg-white p-2 text-xs", children: parsedInput !== null ? (_jsx(MemoizedJsonView, { data: parsedInput })) : (_jsx("div", { className: "font-mono text-xs break-words whitespace-pre-wrap text-gray-700", children: toolCall.function?.arguments || "" })) }) }), hasOutput && (_jsx(ExpandablePanel, { title: hasError ? "Error" : "Output", defaultExpanded: true, actionButton: _jsx(CopyButton, { textToCopy: outputTextToCopy, iconOnly: true, className: "cursor-pointer text-gray-400 hover:text-gray-600" }), children: hasError ? (_jsxs("div", { className: "rounded border-l-2 border-red-400 bg-red-50/60 p-2 text-xs text-red-700", children: [_jsx("div", { className: "mb-1 text-[10px] font-medium text-red-600", children: "Error" }), _jsx("div", { className: "text-red-600", children: toolCall.function?.error })] })) : (_jsx("div", { className: "rounded bg-white p-2 text-xs", children: parsedOutput !== null ? (_jsx(MemoizedJsonView, { data: parsedOutput })) : (_jsx("div", { className: "font-mono text-xs break-words whitespace-pre-wrap text-gray-700", children: result || "" })) })) }))] }));
385
+ }, [
386
+ hasError,
387
+ isPruned,
388
+ toolCall.function?.error,
389
+ parsedOutput,
390
+ parsedPrunedOutput,
391
+ prunedOutput,
392
+ result,
393
+ ]);
394
+ return (_jsxs("div", { className: "mt-1 ml-5 overflow-hidden rounded border border-gray-200/60 bg-gray-50/40", children: [_jsx(ExpandablePanel, { title: "Input", defaultExpanded: !hasOutput, actionButton: _jsx(CopyButton, { textToCopy: inputTextToCopy, iconOnly: true, className: "cursor-pointer text-gray-400 hover:text-gray-600" }), children: _jsx("div", { className: "rounded bg-white p-2 text-xs", children: parsedInput !== null ? (_jsx(MemoizedJsonView, { data: parsedInput })) : (_jsx("div", { className: "font-mono text-xs wrap-break-word whitespace-pre-wrap text-gray-700", children: toolCall.function?.arguments || "" })) }) }), hasOutput && (_jsx(ExpandablePanel, { title: isPruned ? "Pruned" : hasError ? "Error" : "Output", defaultExpanded: true, actionButton: _jsx(CopyButton, { textToCopy: outputTextToCopy, iconOnly: true, className: "cursor-pointer text-gray-400 hover:text-gray-600" }), children: isPruned ? (_jsxs("div", { className: "rounded border-l-2 border-slate-400 bg-slate-50/70 p-2 text-xs text-slate-700", children: [_jsx("div", { className: "mb-1 text-[10px] font-medium text-slate-600", children: "Pruned from AI context" }), _jsx("div", { className: "mb-2 text-slate-600", children: "This tool call completed, but its output was pruned from future agent context to save tokens." }), prunedOutput ? (_jsxs("div", { className: "rounded bg-white p-2 text-xs", children: [outputPreview && (_jsx(InlineToolResultPreview, { preview: outputPreview })), displayPrunedOutput !== null &&
395
+ typeof displayPrunedOutput === "object" ? (_jsx(MemoizedJsonView, { data: displayPrunedOutput })) : (_jsx("div", { className: "font-mono text-xs wrap-break-word whitespace-pre-wrap text-gray-700", children: String(displayPrunedOutput ?? prunedOutput) }))] })) : null] })) : hasError ? (_jsxs("div", { className: "rounded border-l-2 border-red-400 bg-red-50/60 p-2 text-xs text-red-700", children: [_jsx("div", { className: "mb-1 text-[10px] font-medium text-red-600", children: "Error" }), _jsx("div", { className: "text-red-600", children: toolCall.function?.error })] })) : (_jsxs("div", { className: "rounded bg-white p-2 text-xs", children: [outputPreview && (_jsx(InlineToolResultPreview, { preview: outputPreview })), displayOutput !== null && typeof displayOutput === "object" ? (_jsx(MemoizedJsonView, { data: displayOutput })) : (_jsx("div", { className: "font-mono text-xs wrap-break-word whitespace-pre-wrap text-gray-700", children: String(displayOutput ?? (result || "")) }))] })) }))] }));
182
396
  }, (prevProps, nextProps) => {
183
397
  // Only re-render if the data actually changed
184
398
  return (prevProps.toolCall.id === nextProps.toolCall.id &&
185
399
  prevProps.toolCall.function?.arguments ===
186
400
  nextProps.toolCall.function?.arguments &&
187
401
  prevProps.result === nextProps.result &&
188
- prevProps.toolCall.function?.error === nextProps.toolCall.function?.error);
402
+ prevProps.toolCall.function?.error === nextProps.toolCall.function?.error &&
403
+ prevProps.toolCall.isPruned === nextProps.toolCall.isPruned);
189
404
  });
190
405
  ToolCallDetails.displayName = "ToolCallDetails";
191
- export function ToolCallDisplay({ toolCalls, finished, openPopovers, setOpenPopovers, messageId, agentId, allPendingApprovals = [], onSwitchToAutonomous, seenApprovalDialogs, onApprovalDialogShown, }) {
192
- const [isApprovingAll, setIsApprovingAll] = useState(false);
406
+ export function ToolCallDisplay({ toolCalls, finished, openPopovers, setOpenPopovers, messageId, agentId, allPendingApprovals = [], onSwitchToAutonomous, seenApprovalDialogs, onApprovalDialogShown, browserCaptureInlinePrompt, }) {
407
+ const [batchRiskAction, setBatchRiskAction] = useState(null);
193
408
  const [isSwitchingMode, setIsSwitchingMode] = useState(false);
409
+ const [isGroupExpanded, setIsGroupExpanded] = useState(() => {
410
+ if (toolCalls && toolCalls.length >= 2 && finished) {
411
+ const allDone = toolCalls.every((tc) => {
412
+ if ("isCompleted" in tc)
413
+ return tc.isCompleted;
414
+ const n = normalizeToolCall(tc);
415
+ return !!(n.function?.result || n.function?.error);
416
+ });
417
+ const hasPending = toolCalls.some((tc) => {
418
+ if (!tc.requiresApproval)
419
+ return false;
420
+ const fn = ("functionName" in tc
421
+ ? tc.functionName
422
+ : normalizeToolCall(tc).function?.name) || "";
423
+ return !fn.includes("(approved)") && !fn.includes("(rejected)");
424
+ });
425
+ if (allDone && !hasPending)
426
+ return false;
427
+ }
428
+ return true;
429
+ });
430
+ const [userToggled, setUserToggled] = useState(false);
431
+ const allToolCallsCompleted = useMemo(() => {
432
+ if (!toolCalls)
433
+ return false;
434
+ return toolCalls.every((tc) => {
435
+ if ("isCompleted" in tc)
436
+ return tc.isCompleted;
437
+ const normalized = normalizeToolCall(tc);
438
+ return !!(normalized.function?.result || normalized.function?.error);
439
+ });
440
+ }, [toolCalls]);
441
+ const hasPendingApprovalsInGroup = useMemo(() => {
442
+ if (!toolCalls)
443
+ return false;
444
+ return toolCalls.some((tc) => {
445
+ if (!tc.requiresApproval)
446
+ return false;
447
+ const funcName = ("functionName" in tc
448
+ ? tc.functionName
449
+ : normalizeToolCall(tc).function?.name) || "";
450
+ return (!funcName.includes("(approved)") && !funcName.includes("(rejected)"));
451
+ });
452
+ }, [toolCalls]);
453
+ useEffect(() => {
454
+ if (!userToggled &&
455
+ (toolCalls?.length ?? 0) >= 2 &&
456
+ finished &&
457
+ allToolCallsCompleted &&
458
+ !hasPendingApprovalsInGroup) {
459
+ setIsGroupExpanded(false);
460
+ }
461
+ }, [
462
+ userToggled,
463
+ toolCalls?.length,
464
+ finished,
465
+ allToolCallsCompleted,
466
+ hasPendingApprovalsInGroup,
467
+ ]);
468
+ const groupSummary = useMemo(() => {
469
+ if (!toolCalls || toolCalls.length < 2)
470
+ return null;
471
+ const uniqueNames = [
472
+ ...new Set(toolCalls
473
+ .map((tc) => {
474
+ const normalized = normalizeToolCall(tc);
475
+ return ((("functionName" in tc
476
+ ? tc.functionName
477
+ : normalized.function?.name) || "")
478
+ .replace(/ \(approved\)/g, "")
479
+ .replace(/ \(rejected\)/g, "")
480
+ .replace(/ \(pending approval\)/g, "")
481
+ .trim());
482
+ })
483
+ .filter(Boolean)),
484
+ ];
485
+ const errorCount = toolCalls.filter((tc) => {
486
+ const normalized = normalizeToolCall(tc);
487
+ return !!normalized.function?.error && !normalized.isPruned;
488
+ }).length;
489
+ return { uniqueNames, errorCount };
490
+ }, [toolCalls]);
194
491
  if (!toolCalls || toolCalls.length === 0) {
195
492
  return null;
196
493
  }
494
+ const resolvePendingToolCalls = async (pendingToolCalls, approved) => {
495
+ if (!agentId || pendingToolCalls.length === 0)
496
+ return;
497
+ const actionLabel = approved ? "approve" : "reject";
498
+ await Promise.all(pendingToolCalls.map(async (pending) => {
499
+ try {
500
+ const params = {
501
+ agentId,
502
+ messageId: pending.dbMessageId || pending.messageId,
503
+ toolCallId: pending.toolCallId,
504
+ };
505
+ if (approved) {
506
+ await approveToolCall(params);
507
+ }
508
+ else {
509
+ await rejectToolCall(params);
510
+ }
511
+ window.dispatchEvent(new CustomEvent("agent:toolApprovalResolved", {
512
+ detail: {
513
+ messageId: pending.dbMessageId || pending.messageId,
514
+ toolCallId: pending.toolCallId,
515
+ approved,
516
+ },
517
+ }));
518
+ }
519
+ catch (error) {
520
+ console.error(`Failed to ${actionLabel} tool call ${pending.toolCallId}:`, error);
521
+ }
522
+ }));
523
+ };
197
524
  // Helper to approve all pending tool calls with a specific risk level
198
525
  const handleApproveAllByRisk = async (riskLevel) => {
199
- if (!agentId || isApprovingAll)
526
+ if (!agentId || batchRiskAction)
200
527
  return;
201
528
  const matchingPending = allPendingApprovals.filter((p) => (p.riskLevel || undefined) === riskLevel);
202
529
  if (matchingPending.length === 0)
203
530
  return;
204
- setIsApprovingAll(true);
531
+ setBatchRiskAction("approve");
205
532
  try {
206
- // Approve all matching tool calls in parallel
207
- await Promise.all(matchingPending.map(async (pending) => {
208
- try {
209
- await approveToolCall({
210
- agentId,
211
- messageId: pending.dbMessageId || pending.messageId,
212
- toolCallId: pending.toolCallId,
213
- });
214
- // Dispatch event to update UI
215
- window.dispatchEvent(new CustomEvent("agent:toolApprovalResolved", {
216
- detail: {
217
- messageId: pending.dbMessageId || pending.messageId,
218
- toolCallId: pending.toolCallId,
219
- approved: true,
220
- },
221
- }));
222
- }
223
- catch (error) {
224
- console.error(`Failed to approve tool call ${pending.toolCallId}:`, error);
225
- }
226
- }));
533
+ await resolvePendingToolCalls(matchingPending, true);
534
+ }
535
+ finally {
536
+ setBatchRiskAction(null);
537
+ }
538
+ };
539
+ const handleRejectAllByRisk = async (riskLevel) => {
540
+ if (!agentId || batchRiskAction)
541
+ return;
542
+ const matchingPending = allPendingApprovals.filter((p) => (p.riskLevel || undefined) === riskLevel);
543
+ if (matchingPending.length === 0)
544
+ return;
545
+ setBatchRiskAction("reject");
546
+ try {
547
+ await resolvePendingToolCalls(matchingPending, false);
227
548
  }
228
549
  finally {
229
- setIsApprovingAll(false);
550
+ setBatchRiskAction(null);
230
551
  }
231
552
  };
232
553
  // Helper to switch to autonomous mode
@@ -235,29 +556,14 @@ export function ToolCallDisplay({ toolCalls, finished, openPopovers, setOpenPopo
235
556
  return;
236
557
  setIsSwitchingMode(true);
237
558
  try {
238
- await updateAgentSettings(agentId, { mode: "autonomous" });
559
+ const result = await updateAgentSettings(agentId, { mode: "autonomous" });
560
+ if (result.success === false || result.updates?.mode === false) {
561
+ throw new Error("Mode change was not applied");
562
+ }
239
563
  onSwitchToAutonomous?.();
240
564
  // After switching to autonomous, approve all remaining pending tool calls
241
565
  if (allPendingApprovals.length > 0) {
242
- await Promise.all(allPendingApprovals.map(async (pending) => {
243
- try {
244
- await approveToolCall({
245
- agentId,
246
- messageId: pending.dbMessageId || pending.messageId,
247
- toolCallId: pending.toolCallId,
248
- });
249
- window.dispatchEvent(new CustomEvent("agent:toolApprovalResolved", {
250
- detail: {
251
- messageId: pending.dbMessageId || pending.messageId,
252
- toolCallId: pending.toolCallId,
253
- approved: true,
254
- },
255
- }));
256
- }
257
- catch (error) {
258
- console.error(`Failed to approve tool call ${pending.toolCallId}:`, error);
259
- }
260
- }));
566
+ await resolvePendingToolCalls(allPendingApprovals, true);
261
567
  }
262
568
  }
263
569
  catch (error) {
@@ -268,56 +574,89 @@ export function ToolCallDisplay({ toolCalls, finished, openPopovers, setOpenPopo
268
574
  setIsSwitchingMode(false);
269
575
  }
270
576
  };
271
- return (_jsx("div", { className: "flex flex-col", children: toolCalls.map((originalToolCall, toolIndex) => {
272
- const toolCall = normalizeToolCall(originalToolCall);
273
- const toolResult = toolCall.function?.result;
274
- const popoverKey = `${messageId}-${toolIndex}`;
275
- const isAgentToolCall = "isCompleted" in originalToolCall;
276
- // Get approval information to check if tool call is pending approval
277
- const approvalInfo = originalToolCall.requiresApproval || toolCall.requiresApproval;
278
- const isCompleted = isAgentToolCall
279
- ? originalToolCall.isCompleted
280
- : !!(toolResult || toolCall.function?.error) && !approvalInfo;
281
- // Check if tool call is currently streaming (arguments still being generated)
282
- const isStreaming = isAgentToolCall && "isStreaming" in originalToolCall && originalToolCall.isStreaming === true;
283
- // Use the approval info from the backend
284
- const finalApprovalInfo = approvalInfo;
285
- // Check if this tool call's approval dialog has already been shown (for deduplication)
286
- const toolCallIdForApproval = "toolCallId" in originalToolCall ? originalToolCall.toolCallId : toolCall.id;
287
- const approvalAlreadyShown = seenApprovalDialogs?.has(toolCallIdForApproval) ?? false;
288
- // Check if this tool call has been approved/rejected (look for status indicators in function name)
289
- // The AgentTerminal adds " (approved)" or " (rejected)" or " (pending approval)" to the functionName field
290
- const originalFunctionName = ("functionName" in originalToolCall
291
- ? originalToolCall.functionName
292
- : toolCall?.function?.name) || "";
293
- const isApproved = originalFunctionName.includes("(approved)");
294
- const isRejected = originalFunctionName.includes("(rejected)");
295
- const isPending = originalFunctionName.includes("(pending approval)");
296
- // Treat only approved/rejected as final; pending should still show buttons
297
- const hasApprovalStatus = isApproved || isRejected;
298
- // Debug logging removed for performance
299
- const isExpanded = openPopovers[popoverKey] || false;
300
- return (_jsxs("div", { children: [_jsxs("div", { className: "group flex cursor-pointer items-center gap-1.5 rounded-md px-1 py-1 text-xs text-gray-600 transition-all hover:bg-gray-100/60 hover:text-gray-800", onClick: () => {
301
- setOpenPopovers((prev) => ({
302
- ...prev,
303
- [popoverKey]: !prev[popoverKey],
304
- }));
305
- }, children: [_jsx("div", { className: "flex items-center transition-transform group-hover:scale-110", children: isExpanded ? (_jsx(ChevronDown, { size: 14, strokeWidth: 1.5, className: "text-gray-500" })) : (_jsx(ChevronRight, { size: 14, strokeWidth: 1.5, className: "text-gray-500" })) }), isCompleted ? (_jsx("div", { className: `flex items-center transition-all ${toolCall.function?.error ? "text-red-500" : "text-green-600"}`, children: getToolIcon(toolCall?.function?.name || "") })) : finalApprovalInfo && !hasApprovalStatus ? (_jsx("div", { className: "flex items-center text-amber-600 transition-all", children: getToolIcon(toolCall?.function?.name || "") })) : isStreaming || !finished ? (
306
- // Show spinner when tool call arguments are still being streamed or tool is executing
307
- _jsx(Spinner, { size: "xs" })) : (
308
- // Turn finished but tool call not completed - show static icon
309
- _jsx("div", { className: "flex items-center text-gray-400 transition-all", children: getToolIcon(toolCall?.function?.name || "") })), _jsx("div", { className: "inline-flex flex-1 items-center gap-2", children: _jsxs("span", { className: `font-medium transition-colors ${toolCall.function?.error ? "text-red-600" : ""}`, children: [(originalFunctionName ||
310
- toolCall?.function?.name ||
311
- toolCall?.displayName ||
312
- "(function name missing)")
313
- .replace(" (approved)", "")
314
- .replace(" (rejected)", "")
315
- .replace(" (pending approval)", ""), toolCall.function?.error && !isRejected && (_jsx("span", { className: "ml-1 text-red-500", children: "(error)" })), finalApprovalInfo && isApproved && (_jsxs("span", { className: "ml-2 inline-flex items-center gap-1 rounded-full bg-green-100 px-2 py-0.5 text-[10px] font-semibold text-green-700", children: [_jsx("span", { children: "\u2713" }), " Approved"] })), finalApprovalInfo && isRejected && (_jsxs("span", { className: "ml-2 inline-flex items-center gap-1 rounded-full bg-red-100 px-2 py-0.5 text-[10px] font-semibold text-red-700", children: [_jsx("span", { children: "\u2717" }), " Rejected"] })), finalApprovalInfo && isPending && (_jsxs("span", { className: "ml-2 inline-flex items-center gap-1 rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-semibold text-amber-700", children: [_jsx("span", { children: "\u23F8" }), " Pending approval"] }))] }) })] }), isExpanded && (_jsx(ToolCallDetails, { toolCall: toolCall, result: toolResult })), !isCompleted && finalApprovalInfo && !hasApprovalStatus && (_jsx(ApprovalDialog, { toolCallId: toolCallIdForApproval, onApprovalDialogShown: onApprovalDialogShown, finalApprovalInfo: finalApprovalInfo, isAgentToolCall: isAgentToolCall, originalToolCall: originalToolCall, toolCall: toolCall, messageId: messageId, agentId: agentId, allPendingApprovals: allPendingApprovals, onSwitchToAutonomous: onSwitchToAutonomous, isSwitchingMode: isSwitchingMode, setIsSwitchingMode: setIsSwitchingMode, isApprovingAll: isApprovingAll, setIsApprovingAll: setIsApprovingAll, handleApproveAllByRisk: handleApproveAllByRisk, handleSwitchToAutonomous: handleSwitchToAutonomous }))] }, toolIndex));
316
- }) }));
577
+ const showCollapsibleGroup = toolCalls.length >= 2;
578
+ return (_jsxs("div", { className: "flex flex-col", children: [showCollapsibleGroup && (_jsxs("div", { className: "group flex cursor-pointer items-center gap-1.5 rounded-md px-1 py-1 text-xs text-gray-500 transition-all hover:bg-gray-100/60 hover:text-gray-700", onClick: () => {
579
+ setIsGroupExpanded((prev) => !prev);
580
+ setUserToggled(true);
581
+ }, children: [_jsx("div", { className: "flex items-center transition-transform group-hover:scale-110", children: isGroupExpanded ? (_jsx(ChevronDown, { size: 14, strokeWidth: 1.5, className: "text-gray-500" })) : (_jsx(ChevronRight, { size: 14, strokeWidth: 1.5, className: "text-gray-500" })) }), _jsx("div", { className: "flex items-center text-gray-500", children: _jsx(Wrench, { strokeWidth: 1, size: 14 }) }), _jsxs("span", { className: "font-medium", children: [toolCalls.length, " tool call", toolCalls.length !== 1 ? "s" : ""] }), !isGroupExpanded && groupSummary && (_jsx("span", { className: "ml-1 min-w-0 flex-1 truncate text-[10px] text-gray-400", children: groupSummary.uniqueNames.length <= 3
582
+ ? groupSummary.uniqueNames.join(", ")
583
+ : `${groupSummary.uniqueNames.slice(0, 2).join(", ")} +${groupSummary.uniqueNames.length - 2} more` })), groupSummary && groupSummary.errorCount > 0 && (_jsxs("span", { className: "ml-1 shrink-0 text-[10px] text-red-500", children: ["(", groupSummary.errorCount, " error", groupSummary.errorCount !== 1 ? "s" : "", ")"] }))] })), (isGroupExpanded || !showCollapsibleGroup) &&
584
+ toolCalls.map((originalToolCall, toolIndex) => {
585
+ const toolCall = normalizeToolCall(originalToolCall);
586
+ const toolResult = toolCall.function?.result;
587
+ const popoverKey = `${messageId}-${toolIndex}`;
588
+ const isAgentToolCall = "isCompleted" in originalToolCall;
589
+ const isPruned = !!toolCall.isPruned;
590
+ const toolCallMeta = formatToolCallMeta(toolCall.createdDate, toolCall.responseTimeMs);
591
+ // Get approval information to check if tool call is pending approval
592
+ const approvalInfo = originalToolCall.requiresApproval || toolCall.requiresApproval;
593
+ const isCompleted = isAgentToolCall
594
+ ? originalToolCall.isCompleted
595
+ : !!(toolResult || toolCall.function?.error) && !approvalInfo;
596
+ // Check if tool call is currently streaming (arguments still being generated)
597
+ const isStreaming = isAgentToolCall && "isStreaming" in originalToolCall && originalToolCall.isStreaming === true;
598
+ // Use the approval info from the backend
599
+ const finalApprovalInfo = approvalInfo;
600
+ // Check if this tool call's approval dialog has already been shown (for deduplication)
601
+ const toolCallIdForApproval = "toolCallId" in originalToolCall ? originalToolCall.toolCallId : toolCall.id;
602
+ const approvalAlreadyShown = seenApprovalDialogs?.has(toolCallIdForApproval) ?? false;
603
+ // Check if this tool call has been approved/rejected (look for status indicators in function name)
604
+ // The AgentTerminal adds " (approved)" or " (rejected)" or " (pending approval)" to the functionName field
605
+ const originalFunctionName = ("functionName" in originalToolCall
606
+ ? originalToolCall.functionName
607
+ : toolCall?.function?.name) || "";
608
+ const baseFunctionName = originalFunctionName
609
+ .replace(" (approved)", "")
610
+ .replace(" (rejected)", "")
611
+ .replace(" (pending approval)", "")
612
+ .trim()
613
+ .toLowerCase();
614
+ const hideAutonomousSwitch = baseFunctionName === "delete-item" ||
615
+ baseFunctionName === "delete-items";
616
+ const isApproved = originalFunctionName.includes("(approved)");
617
+ const isRejected = originalFunctionName.includes("(rejected)");
618
+ const isPending = originalFunctionName.includes("(pending approval)");
619
+ // Treat only approved/rejected as final; pending should still show buttons
620
+ const hasApprovalStatus = isApproved || isRejected;
621
+ // Debug logging removed for performance
622
+ const isExpanded = openPopovers[popoverKey] || false;
623
+ const shouldShowBrowserCaptureInlinePrompt = !!browserCaptureInlinePrompt &&
624
+ browserCaptureInlinePrompt.toolNames.includes(baseFunctionName) &&
625
+ !isCompleted &&
626
+ !toolCall.function?.error;
627
+ return (_jsxs("div", { children: [_jsxs("div", { className: "group flex cursor-pointer items-center gap-1.5 rounded-md px-1 py-1 text-xs text-gray-600 transition-all hover:bg-gray-100/60 hover:text-gray-800", onClick: () => {
628
+ setOpenPopovers((prev) => ({
629
+ ...prev,
630
+ [popoverKey]: !prev[popoverKey],
631
+ }));
632
+ }, children: [_jsx("div", { className: "flex items-center transition-transform group-hover:scale-110", children: isExpanded ? (_jsx(ChevronDown, { size: 14, strokeWidth: 1.5, className: "text-gray-500" })) : (_jsx(ChevronRight, { size: 14, strokeWidth: 1.5, className: "text-gray-500" })) }), isCompleted ? (_jsx("div", { className: `flex items-center transition-all ${toolCall.function?.error && !isPruned
633
+ ? "text-red-500"
634
+ : isPruned
635
+ ? "text-slate-500"
636
+ : "text-green-600"}`, children: getToolIcon(toolCall?.function?.name || "") })) : finalApprovalInfo && !hasApprovalStatus ? (_jsx("div", { className: "flex items-center text-amber-600 transition-all", children: getToolIcon(toolCall?.function?.name || "") })) : isStreaming || !finished ? (
637
+ // Show spinner when tool call arguments are still being streamed or tool is executing
638
+ _jsx(Spinner, { size: "xs" })) : (
639
+ // Turn finished but tool call not completed - show static icon
640
+ _jsx("div", { className: "flex items-center text-gray-400 transition-all", children: getToolIcon(toolCall?.function?.name || "") })), _jsxs("div", { className: "inline-flex flex-1 items-center gap-2", children: [_jsxs("span", { className: `font-medium transition-colors ${toolCall.function?.error && !isPruned
641
+ ? "text-red-600"
642
+ : isPruned
643
+ ? "text-slate-600"
644
+ : ""}`, children: [(originalFunctionName ||
645
+ toolCall?.function?.name ||
646
+ toolCall?.displayName ||
647
+ "(function name missing)")
648
+ .replace(" (approved)", "")
649
+ .replace(" (rejected)", "")
650
+ .replace(" (pending approval)", ""), toolCall.function?.error && !isRejected && !isPruned && (_jsx("span", { className: "ml-1 text-red-500", children: "(error)" })), isPruned && (_jsxs("span", { className: "ml-2 inline-flex items-center gap-1 rounded-full bg-slate-100 px-2 py-0.5 text-[10px] font-semibold text-slate-700", children: [_jsx("span", { children: "\u2702" }), " Pruned"] })), finalApprovalInfo && isApproved && (_jsxs("span", { className: "ml-2 inline-flex items-center gap-1 rounded-full bg-green-100 px-2 py-0.5 text-[10px] font-semibold text-green-700", children: [_jsx("span", { children: "\u2713" }), " Approved"] })), finalApprovalInfo && isRejected && (_jsxs("span", { className: "ml-2 inline-flex items-center gap-1 rounded-full bg-red-100 px-2 py-0.5 text-[10px] font-semibold text-red-700", children: [_jsx("span", { children: "\u2717" }), " Rejected"] })), finalApprovalInfo && isPending && (_jsxs("span", { className: "ml-2 inline-flex items-center gap-1 rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-semibold text-amber-700", children: [_jsx("span", { children: "\u23F8" }), " Pending approval"] }))] }), toolCallMeta && (_jsx("span", { className: "ml-auto shrink-0 text-[10px] text-gray-400", children: toolCallMeta }))] })] }), isExpanded && (_jsx(ToolCallDetails, { toolCall: toolCall, result: toolResult })), shouldShowBrowserCaptureInlinePrompt && browserCaptureInlinePrompt && (_jsx("div", { className: "mt-2 ml-5 rounded-lg border border-blue-200 bg-blue-50 p-3 text-[11px] text-blue-900", children: _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "font-semibold", children: browserCaptureInlinePrompt.label }), _jsx("div", { className: "mt-1 text-blue-800", children: browserCaptureInlinePrompt.description })] }), _jsx("div", { className: "flex shrink-0 items-center gap-2", children: _jsx("button", { type: "button", className: "rounded border border-blue-300 bg-white px-2 py-1 text-[11px] font-medium text-blue-900 disabled:cursor-not-allowed disabled:opacity-60", disabled: browserCaptureInlinePrompt.isPending, onClick: (event) => {
651
+ event.stopPropagation();
652
+ browserCaptureInlinePrompt.onAction();
653
+ }, children: browserCaptureInlinePrompt.actionLabel }) })] }) })), !isCompleted && finalApprovalInfo && !hasApprovalStatus && (_jsx(ApprovalDialog, { toolCallId: toolCallIdForApproval, onApprovalDialogShown: onApprovalDialogShown, finalApprovalInfo: finalApprovalInfo, isAgentToolCall: isAgentToolCall, originalToolCall: originalToolCall, toolCall: toolCall, messageId: messageId, agentId: agentId, allPendingApprovals: allPendingApprovals, onSwitchToAutonomous: onSwitchToAutonomous, hideAutonomousSwitch: hideAutonomousSwitch, isSwitchingMode: isSwitchingMode, setIsSwitchingMode: setIsSwitchingMode, batchRiskAction: batchRiskAction, handleApproveAllByRisk: handleApproveAllByRisk, handleRejectAllByRisk: handleRejectAllByRisk, handleSwitchToAutonomous: handleSwitchToAutonomous }))] }, toolIndex));
654
+ })] }));
317
655
  }
318
656
  // Separate component for approval dialog to properly handle useEffect
319
- function ApprovalDialog({ toolCallId, onApprovalDialogShown, finalApprovalInfo, isAgentToolCall, originalToolCall, toolCall, messageId, agentId, allPendingApprovals, onSwitchToAutonomous, isSwitchingMode, setIsSwitchingMode, isApprovingAll, setIsApprovingAll, handleApproveAllByRisk, handleSwitchToAutonomous, }) {
657
+ function ApprovalDialog({ toolCallId, onApprovalDialogShown, finalApprovalInfo, isAgentToolCall, originalToolCall, toolCall, messageId, agentId, allPendingApprovals, onSwitchToAutonomous, hideAutonomousSwitch, isSwitchingMode, setIsSwitchingMode, batchRiskAction, handleApproveAllByRisk, handleRejectAllByRisk, handleSwitchToAutonomous, }) {
320
658
  const hasMarkedAsShown = useRef(false);
659
+ const [isCreatingAllowance, setIsCreatingAllowance] = useState(false);
321
660
  // Mark dialog as shown on mount to prevent duplicate dialogs
322
661
  // The dialog stays visible until hasApprovalStatus becomes true (after approve/reject)
323
662
  useEffect(() => {
@@ -340,7 +679,44 @@ function ApprovalDialog({ toolCallId, onApprovalDialogShown, finalApprovalInfo,
340
679
  hasMarkedAsShown.current = true;
341
680
  }
342
681
  };
343
- return (_jsxs("div", { className: "mt-2 overflow-hidden rounded-lg border border-amber-200 bg-gradient-to-br from-amber-50 to-amber-50/30 shadow-sm", children: [_jsx("div", { className: "border-b border-amber-200/60 bg-amber-50/80 p-3", children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: `mt-1 h-2.5 w-2.5 rounded-full shadow-sm ${finalApprovalInfo.riskLevel === "high"
682
+ const getActualMessageId = () => {
683
+ return isAgentToolCall
684
+ ? originalToolCall.dbMessageId || originalToolCall.messageId
685
+ : messageId;
686
+ };
687
+ const dispatchApprovalResolved = (actualMessageId, approved) => {
688
+ const ev = new CustomEvent("agent:toolApprovalResolved", {
689
+ detail: {
690
+ messageId: actualMessageId,
691
+ toolCallId: toolCall.id,
692
+ approved,
693
+ },
694
+ });
695
+ window.dispatchEvent(ev);
696
+ };
697
+ const approveCurrentToolCall = async () => {
698
+ const actualMessageId = getActualMessageId();
699
+ if (!agentId) {
700
+ console.error("Cannot approve tool call: agentId is missing");
701
+ return;
702
+ }
703
+ if (!actualMessageId) {
704
+ console.error("Cannot approve tool call: messageId is missing");
705
+ return;
706
+ }
707
+ await approveToolCall({
708
+ agentId,
709
+ messageId: actualMessageId,
710
+ toolCallId: toolCall.id,
711
+ });
712
+ dispatchApprovalResolved(actualMessageId, true);
713
+ };
714
+ const allowableScope = finalApprovalInfo.allowableScope;
715
+ const showAllowInScopeButton = !!agentId &&
716
+ allowableScope?.operationType === "delete" &&
717
+ !!allowableScope.parentItemId &&
718
+ !!allowableScope.parentItemPath;
719
+ return (_jsxs("div", { className: "mt-2 overflow-hidden rounded-lg border border-amber-200 bg-linear-to-br from-amber-50 to-amber-50/30 shadow-sm", children: [_jsx("div", { className: "border-b border-amber-200/60 bg-amber-50/80 p-3", children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: `mt-1 h-2.5 w-2.5 rounded-full shadow-sm ${finalApprovalInfo.riskLevel === "high"
344
720
  ? "bg-red-500 ring-2 ring-red-200"
345
721
  : finalApprovalInfo.riskLevel === "medium"
346
722
  ? "bg-amber-500 ring-2 ring-amber-200"
@@ -348,13 +724,32 @@ function ApprovalDialog({ toolCallId, onApprovalDialogShown, finalApprovalInfo,
348
724
  ? "bg-red-100 text-red-700"
349
725
  : finalApprovalInfo.riskLevel === "medium"
350
726
  ? "bg-amber-100 text-amber-700"
351
- : "bg-green-100 text-green-700"}`, children: [_jsx("span", { className: "font-normal", children: "Risk:" }), _jsx("span", { className: "uppercase", children: finalApprovalInfo.riskLevel })] }))] })] }) }), _jsxs("div", { className: "flex flex-col gap-2 bg-white/60 p-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [_jsx(Button, { size: "sm", variant: "secondary", "data-testid": "agent-reject-button", onClick: async () => {
727
+ : "bg-green-100 text-green-700"}`, children: [_jsx("span", { className: "font-normal", children: "Risk:" }), _jsx("span", { className: "uppercase", children: finalApprovalInfo.riskLevel })] }))] })] }) }), _jsxs("div", { className: "flex flex-col gap-2 bg-white/60 p-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [showAllowInScopeButton && (_jsx(Button, { size: "sm", variant: "outline", disabled: isCreatingAllowance, onClick: async () => {
728
+ markAsShown();
729
+ if (!agentId || !allowableScope?.parentItemId)
730
+ return;
731
+ setIsCreatingAllowance(true);
732
+ try {
733
+ await createOperationAllowance({
734
+ agentId,
735
+ itemId: allowableScope.parentItemId,
736
+ operationType: "delete",
737
+ scopeType: "itemSubtree",
738
+ });
739
+ await approveCurrentToolCall();
740
+ }
741
+ catch (error) {
742
+ console.error("Failed to create operation allowance:", error);
743
+ alert(`Failed to allow deletes in scope: ${error?.message || "Unknown error"}`);
744
+ }
745
+ finally {
746
+ setIsCreatingAllowance(false);
747
+ }
748
+ }, children: isCreatingAllowance
749
+ ? "Allowing..."
750
+ : `Allow deletes in ${allowableScope?.parentItemPath}` })), _jsx(Button, { size: "sm", variant: "secondary", "data-testid": "agent-reject-button", onClick: async () => {
352
751
  markAsShown(); // Mark as shown when user interacts
353
- // Use the dbMessageId from AgentToolCall if available, otherwise fall back to messageId or prop
354
- const actualMessageId = isAgentToolCall
355
- ? originalToolCall.dbMessageId ||
356
- originalToolCall.messageId
357
- : messageId;
752
+ const actualMessageId = getActualMessageId();
358
753
  if (!agentId) {
359
754
  console.error("❌ Cannot reject tool call: agentId is missing");
360
755
  return;
@@ -375,53 +770,21 @@ function ApprovalDialog({ toolCallId, onApprovalDialogShown, finalApprovalInfo,
375
770
  toolCallId: toolCall.id,
376
771
  });
377
772
  console.log("✅ Reject successful:", result);
378
- const ev = new CustomEvent("agent:toolApprovalResolved", {
379
- detail: {
380
- messageId: actualMessageId,
381
- toolCallId: toolCall.id,
382
- approved: false,
383
- },
384
- });
385
- window.dispatchEvent(ev);
773
+ dispatchApprovalResolved(actualMessageId, false);
386
774
  }
387
775
  catch (error) {
388
776
  console.error("❌ Reject failed:", error);
389
777
  }
390
778
  }, children: "Reject" }), _jsx(Button, { size: "sm", "data-testid": "agent-approve-button", onClick: async () => {
391
779
  markAsShown(); // Mark as shown when user interacts
392
- // Use the dbMessageId from AgentToolCall if available, otherwise fall back to messageId or prop
393
- const actualMessageId = isAgentToolCall
394
- ? originalToolCall.dbMessageId ||
395
- originalToolCall.messageId
396
- : messageId;
397
- if (!agentId) {
398
- console.error("❌ Cannot approve tool call: agentId is missing");
399
- return;
400
- }
401
- if (!actualMessageId) {
402
- console.error("❌ Cannot approve tool call: messageId is missing");
403
- return;
404
- }
405
780
  console.log("✅ Approving tool call:", {
406
781
  agentId,
407
- messageId: actualMessageId,
782
+ messageId: getActualMessageId(),
408
783
  toolCallId: toolCall.id,
409
784
  });
410
785
  try {
411
- const result = await approveToolCall({
412
- agentId,
413
- messageId: actualMessageId,
414
- toolCallId: toolCall.id,
415
- });
416
- console.log("✅ Approve successful:", result);
417
- const ev = new CustomEvent("agent:toolApprovalResolved", {
418
- detail: {
419
- messageId: actualMessageId,
420
- toolCallId: toolCall.id,
421
- approved: true,
422
- },
423
- });
424
- window.dispatchEvent(ev);
786
+ await approveCurrentToolCall();
787
+ console.log("✅ Approve successful");
425
788
  }
426
789
  catch (error) {
427
790
  console.error("❌ Approve failed:", error);
@@ -431,15 +794,23 @@ function ApprovalDialog({ toolCallId, onApprovalDialogShown, finalApprovalInfo,
431
794
  const currentRiskLevel = finalApprovalInfo?.riskLevel;
432
795
  const sameRiskCount = allPendingApprovals.filter((p) => (p.riskLevel || undefined) === currentRiskLevel).length;
433
796
  const totalPendingCount = allPendingApprovals.length;
797
+ const showSwitchToAutonomous = !hideAutonomousSwitch;
798
+ const showResolveAllByRisk = sameRiskCount > 1;
434
799
  // Only show batch actions if there's more than 1 pending approval
435
800
  if (totalPendingCount <= 1)
436
801
  return null;
802
+ if (!showSwitchToAutonomous && !showResolveAllByRisk)
803
+ return null;
437
804
  const riskLabel = currentRiskLevel
438
805
  ? currentRiskLevel.charAt(0).toUpperCase() + currentRiskLevel.slice(1)
439
806
  : "Same";
440
- return (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 border-t border-amber-200/60 pt-2", children: [_jsx(Button, { size: "sm", variant: "outline", disabled: isSwitchingMode, onClick: handleSwitchToAutonomous, className: "text-xs", children: isSwitchingMode ? "Switching..." : "Switch to Autonomous" }), sameRiskCount > 1 && (_jsx(Button, { size: "sm", variant: "outline", disabled: isApprovingAll, onClick: () => handleApproveAllByRisk(currentRiskLevel), className: "text-xs", children: isApprovingAll
441
- ? "Approving..."
442
- : `Approve All ${riskLabel} (${sameRiskCount})` }))] }));
807
+ return (_jsxs("div", { className: `flex flex-wrap items-center gap-2 border-t border-amber-200/60 pt-2 ${showSwitchToAutonomous && showResolveAllByRisk
808
+ ? "justify-between"
809
+ : "justify-end"}`, children: [showSwitchToAutonomous && (_jsx(Button, { size: "sm", variant: "outline", disabled: isSwitchingMode, onClick: handleSwitchToAutonomous, className: "text-xs", children: isSwitchingMode ? "Switching..." : "Switch to Autonomous" })), showResolveAllByRisk && (_jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [_jsx(Button, { size: "sm", variant: "outline", "data-testid": "agent-reject-all-button", disabled: batchRiskAction !== null, onClick: () => handleRejectAllByRisk(currentRiskLevel), className: "text-xs", children: batchRiskAction === "reject"
810
+ ? "Rejecting..."
811
+ : `Reject All ${riskLabel} (${sameRiskCount})` }), _jsx(Button, { size: "sm", variant: "outline", "data-testid": "agent-approve-all-button", disabled: batchRiskAction !== null, onClick: () => handleApproveAllByRisk(currentRiskLevel), className: "text-xs", children: batchRiskAction === "approve"
812
+ ? "Approving..."
813
+ : `Approve All ${riskLabel} (${sameRiskCount})` })] }))] }));
443
814
  })()] })] }));
444
815
  }
445
816
  //# sourceMappingURL=ToolCallDisplay.js.map