@fluidgrids/fe-sdk 0.0.0-stage → 2026.1203.8

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 (323) hide show
  1. package/README.md +564 -2
  2. package/dist/ActivityOptionsFields-C2u-hY2U.js +142 -0
  3. package/dist/AiStudioPage-B_hNTj-_.js +1137 -0
  4. package/dist/ApprovalInboxPage-ClITra3n.js +1312 -0
  5. package/dist/ChoiceSelect-LkK-uS9J.js +65 -0
  6. package/dist/ConfirmActionDialog-DHWTDRbp.js +31 -0
  7. package/dist/ConnectionFormDialog-C0kDgcrZ.js +153 -0
  8. package/dist/CreateFluidgridsTagDocument-Dtp9KPLJ.js +1055 -0
  9. package/dist/DataSinkDashboardPage-b4ezeqa6.js +278 -0
  10. package/dist/DataTablesPage-C1d9YGHz.js +5575 -0
  11. package/dist/DateTimeField-B1qR4ruo.js +51 -0
  12. package/dist/Disclosure-BNKij7-v.js +45 -0
  13. package/dist/ElementLibraryPage-8jNO6YmE.js +2256 -0
  14. package/dist/ElementLibrarySequenceDocument-B-W8SPzn.js +3979 -0
  15. package/dist/EnsureThemeProvider-BvlNjAd0.js +24 -0
  16. package/dist/EntityTagBadge-1OlP6p0c.js +25 -0
  17. package/dist/EntityTagPicker-BBrU5cE0.js +137 -0
  18. package/dist/ExecuteStepDocument-B4j1mdRT.js +189 -0
  19. package/dist/ExecutionDetailDocument-D6QuM-kp.js +875 -0
  20. package/dist/ExecutionDetailPage-D4CBtFdo.js +12217 -0
  21. package/dist/ExecutionDetailPage-DvQ667OE.d.ts +10 -0
  22. package/dist/ExecutionStatusBadge-BsDVor9t.js +221 -0
  23. package/dist/ExecutionsListDocument-Dan7ZiqB.js +459 -0
  24. package/dist/ExecutionsListPage-B3XT8ITL.js +4307 -0
  25. package/dist/FailureTriagePanel-DOJMaJ0n.js +1285 -0
  26. package/dist/FileDownloadUrlDocument-CVOYKcL5.js +92 -0
  27. package/dist/FluidGridsDocsLink-bX0Hnhxr.js +66 -0
  28. package/dist/FluidGridsMark-CE2blT7K.js +74 -0
  29. package/dist/HeldLoadRegion-BtTxbvOW.js +34 -0
  30. package/dist/HistoryPage-BLoRpJ1R.d.ts +6 -0
  31. package/dist/HistoryPage-BSBISXoj.js +2835 -0
  32. package/dist/Icon-BtQ0HXLh.js +160 -0
  33. package/dist/InsightsPage-D7ybj8N9.js +11245 -0
  34. package/dist/IsolationSetting-vy911E8b.js +1153 -0
  35. package/dist/LibraryParts-DOeNgR8A.js +413 -0
  36. package/dist/ManagedAiPolicyAuthority-BxwJ3ptd.js +40 -0
  37. package/dist/ManagedAiPolicyAuthority-DM3t3wNr.d.ts +18 -0
  38. package/dist/ManagedAiPolicyAuthorityContext-CNkxIOZ1.js +10 -0
  39. package/dist/McpTriggerServers-BCPCAOWB.js +459 -0
  40. package/dist/MissingNodesInstallModal-rO_SEDrC.js +224 -0
  41. package/dist/NavigationV2Provider-DCDt35eG.js +17 -0
  42. package/dist/NodeSchemaIntrospectionDocument-C1vAIcHd.js +95 -0
  43. package/dist/NodesPage-DEbnz9iU.d.ts +6 -0
  44. package/dist/NodesPage-O7KeeKtd.js +653 -0
  45. package/dist/OfflineIcon-TwMKYWjA.js +207 -0
  46. package/dist/OpenTemplateAsCodeButton-BhWJWIF3.js +94 -0
  47. package/dist/PaidTemplateConfirm-_G3ag6S4.js +28 -0
  48. package/dist/PublishCustomNodeAction-CIySbK4c.js +134 -0
  49. package/dist/RecordTaskDialog-BkpCDvhR.js +2078 -0
  50. package/dist/RunActionsMenu-DodOgIQm.js +59 -0
  51. package/dist/RunnerStatusPill-C1v967iq.js +24 -0
  52. package/dist/RunnersPage-dB0RSdY_.js +1929 -0
  53. package/dist/SandboxRuntimeExhaustedNotice-BFOIF93C.js +120 -0
  54. package/dist/SchedulesPage-DPWr1yvf.js +1607 -0
  55. package/dist/SearchBox-BGtYjvfs.js +49 -0
  56. package/dist/SequenceEditor-CFiHeHkR.js +497 -0
  57. package/dist/SettingsPage-0CQBNPZV.js +8695 -0
  58. package/dist/StewardPages-DAJhepen.js +47 -0
  59. package/dist/StewardRunImportPanel-Kva2DO0u.js +2844 -0
  60. package/dist/StoreTemplateCardCompact-CHn5kP7A.js +2166 -0
  61. package/dist/TagFilterSelect-CyA8QrS7.js +42 -0
  62. package/dist/TaskQueuesPage-DdnDCyat.js +3571 -0
  63. package/dist/TechnicalDetails-B0Oi4aZw.js +19 -0
  64. package/dist/TemplateConfigurationModal-CdvCYJLM.js +332 -0
  65. package/dist/TemplateDetailPanel-CbiKciuB.js +222 -0
  66. package/dist/TemplatePreview-cx7-NOeG.js +868 -0
  67. package/dist/TemplatesPage-BG3H-6v6.d.ts +10 -0
  68. package/dist/TemplatesPage-BVQpGYIV.js +3251 -0
  69. package/dist/TerminateExecutionDocument-B_HKNVrN.js +581 -0
  70. package/dist/TranslationBridge-Bd4aJKMs.d.ts +11 -0
  71. package/dist/TranslationBridge-Da-TPgQm.js +68 -0
  72. package/dist/TriggerWorkflowDocument-D9Km2Vv2.js +460 -0
  73. package/dist/UiSequencePickerSequenceDocument-BSYnSDV7.js +607 -0
  74. package/dist/UiStepScreenshot-Qh4QMyUp.js +146 -0
  75. package/dist/UsageTimeSeriesDocument-DcInx9-z.js +177 -0
  76. package/dist/VariablesPage-ChfGuW22.js +2243 -0
  77. package/dist/VersionDiffDialog-Bd2AeUwf.js +1702 -0
  78. package/dist/VersionLifecycleBar-BBeWVtz-.js +143 -0
  79. package/dist/WebhookDeliveriesPage-D66bua0j.js +1563 -0
  80. package/dist/WorkflowBuilder-B6wQD1TK.js +539 -0
  81. package/dist/WorkflowBuilder-DR4ku8Tr.js +1611 -0
  82. package/dist/WorkflowDefinitionDocument-DZLbTPUZ.js +321 -0
  83. package/dist/WorkflowEmbed-BXfFGy0i.js +708 -0
  84. package/dist/WorkflowEmbed-Cbqe1s1z.d.ts +6 -0
  85. package/dist/WorkflowPinnedDataDocument-BODT5omd.js +782 -0
  86. package/dist/WorkflowProposalCard-BruukdeF.js +96 -0
  87. package/dist/WorkflowProposalDocument-BdUbsrd0.js +620 -0
  88. package/dist/WorkflowSearchRedirect-C7zJ2MKH.js +40 -0
  89. package/dist/WorkflowSettingsDrawer-MVU1BKfY.d.ts +18 -0
  90. package/dist/WorkflowSettingsDrawer-gazs97WR.js +196 -0
  91. package/dist/WorkflowShareDialog-e8jJtLjU.js +469 -0
  92. package/dist/WorkflowVersionsDocument-DRVOp8Uj.js +3213 -0
  93. package/dist/WorkflowsList--hR2_8gf.js +4593 -0
  94. package/dist/WorkflowsList-CcNDQge5.d.ts +6 -0
  95. package/dist/WorkflowsListPageDocument-CnzcQm_o.js +934 -0
  96. package/dist/addonCatalog-CbZS4deh.js +58 -0
  97. package/dist/addonCatalog-sjlonAmR.d.ts +15 -0
  98. package/dist/addons.d.ts +3 -0
  99. package/dist/addons.js +4 -0
  100. package/dist/agent-form-Bfvm32j1.js +83 -0
  101. package/dist/agent-tools.d.ts +3 -0
  102. package/dist/agent-tools.js +5 -0
  103. package/dist/agentTools-CyL7DLOF.js +320 -0
  104. package/dist/ai-usage-BrxDgvdR.js +240 -0
  105. package/dist/aiCreditsBridge-BuE92tKo.js +49 -0
  106. package/dist/api-BKq-nIOZ.js +2286 -0
  107. package/dist/api-Ol7I8NxE.js +8289 -0
  108. package/dist/apollo-type-policies.d.ts +11 -0
  109. package/dist/apollo-type-policies.js +64 -0
  110. package/dist/askAboutBridge-ByYsQams.js +106 -0
  111. package/dist/askQuestions-Cmx7VnMm.js +742 -0
  112. package/dist/assert-rules-lfYEMc99.js +318 -0
  113. package/dist/assistant.d.ts +94 -0
  114. package/dist/assistant.js +99 -0
  115. package/dist/attach-node-helpers-HDKQOtrD.js +32 -0
  116. package/dist/badge-CXfPhoMH.js +26 -0
  117. package/dist/basil.generated-BK-EHbwN.js +10 -0
  118. package/dist/browser-steps-DMpS5TyB.js +533 -0
  119. package/dist/builderTimings-pvGnK1m-.js +510 -0
  120. package/dist/button-DG7y_FVJ.js +48 -0
  121. package/dist/canvasNoteTools-BxuP_AYO.js +137 -0
  122. package/dist/card-Bomy_1UG.js +44 -0
  123. package/dist/catalogGrid-BOrfMgi-.js +41 -0
  124. package/dist/channel-CPyQ1NR1.js +212 -0
  125. package/dist/chips-CvNrYJZa.js +27 -0
  126. package/dist/client-holder-C0M5Cfwl.js +68 -0
  127. package/dist/cn-QqidFIgr.js +10 -0
  128. package/dist/code-editor-diagnostics-Zr0cIcx1.js +46 -0
  129. package/dist/code-editor-field-x_JrY8KR.js +113 -0
  130. package/dist/codec-client-DPuD6mw7.js +515 -0
  131. package/dist/conditionBuilder-DwfEF0Q-.js +1144 -0
  132. package/dist/config-DO68jw5k.js +322 -0
  133. package/dist/constants-DgbVc24O.d.ts +296 -0
  134. package/dist/constants-DlRnHBfQ.js +217 -0
  135. package/dist/convert-browser-action-pfecelF7.js +347 -0
  136. package/dist/convert-dialog-B_o22NiJ.js +382 -0
  137. package/dist/create-workflow-first-Azg3JUdX.js +120 -0
  138. package/dist/definition-canvas-Bsda-rDT.js +31 -0
  139. package/dist/dialog-BVd152GS.js +94 -0
  140. package/dist/durable-nodes-BXyYCLxT.js +91 -0
  141. package/dist/duration-CDb7-mT_.js +33 -0
  142. package/dist/edge-mapper-wEAdGVU2.js +4477 -0
  143. package/dist/element-library-DkSlg_VE.js +727 -0
  144. package/dist/entities-I_0kio3q.js +38 -0
  145. package/dist/error-advice-QLr5NCm7.js +65 -0
  146. package/dist/errors-ClKb5sEt.js +188 -0
  147. package/dist/executions.d.ts +3 -0
  148. package/dist/executions.js +5 -0
  149. package/dist/feature-flags-B2qetXKd.js +385 -0
  150. package/dist/field-label-DPZRmE_B.js +153 -0
  151. package/dist/firstWorkflow-C_h0KMB2.js +133 -0
  152. package/dist/flags.d.ts +3 -0
  153. package/dist/flags.js +4 -0
  154. package/dist/flow-builder-DIvLOhz0.js +28038 -0
  155. package/dist/flow-store-holder-CUN7Terz.js +52 -0
  156. package/dist/fluent.generated-CA_e6-4l.js +14 -0
  157. package/dist/fluidgridsEvents-bbEQbwU6.js +175 -0
  158. package/dist/fluidgridsTheme-DUhvOgoy.js +297 -0
  159. package/dist/global-client-BQPuFrFa.js +433 -0
  160. package/dist/global-operations-BG6YgxrM.js +136 -0
  161. package/dist/graphql-types-UTYtujY9.js +21358 -0
  162. package/dist/history.d.ts +3 -0
  163. package/dist/history.js +4 -0
  164. package/dist/index-AoJAa5vU.d.ts +164958 -0
  165. package/dist/index-DEMT3iAM.d.ts +120 -0
  166. package/dist/index-ROZzNGyY.d.ts +76 -0
  167. package/dist/index.d.ts +20 -0
  168. package/dist/index.js +8123 -0
  169. package/dist/ion.generated-mbajjcAg.js +10 -0
  170. package/dist/label-Lzb8ZXf_.js +29 -0
  171. package/dist/labels-rXd9gYQz.js +1236 -0
  172. package/dist/liveCanvas-D5ytXDp8.js +103 -0
  173. package/dist/logos.generated-X6_0kjVR.js +21 -0
  174. package/dist/logs-panel-Cw0DkG0l.js +468 -0
  175. package/dist/lucide.generated-B6NVd3GT.js +29 -0
  176. package/dist/marksStore-a9oIMMot.js +175 -0
  177. package/dist/mcp-trigger-D0nRdvq5.js +307 -0
  178. package/dist/mdi.generated-D1BV74d6.js +292 -0
  179. package/dist/menus-CU3hDGYl.js +160 -0
  180. package/dist/mynaui.generated-DMWr5cXz.js +66 -0
  181. package/dist/navigation-v2.d.ts +3 -0
  182. package/dist/navigation-v2.js +5 -0
  183. package/dist/node-detail-view-Cgm5H1P-.js +1372 -0
  184. package/dist/node-editor-tab-body-CZ0fVuVP.js +187 -0
  185. package/dist/node-operation-selection-CdV3KI_V.js +3534 -0
  186. package/dist/node-registry-refresh-s3okf83X.js +27 -0
  187. package/dist/node-role-TMbnkmeP.js +132 -0
  188. package/dist/node-type-icon-BZa8n4iG.js +33 -0
  189. package/dist/nodes.d.ts +3 -0
  190. package/dist/nodes.js +4 -0
  191. package/dist/notesKey-5EaREBGA.js +12 -0
  192. package/dist/observability.d.ts +3 -0
  193. package/dist/observability.js +5 -0
  194. package/dist/offset-pages-zghoClB3.js +55 -0
  195. package/dist/operations-BBmT9ToP.js +663 -0
  196. package/dist/operations-WxRJWeqO.js +3133 -0
  197. package/dist/output-files-Ba8bu5lv.js +196 -0
  198. package/dist/page-operation-DrWuhd6Y.js +129 -0
  199. package/dist/page-twins.d.ts +13 -0
  200. package/dist/page-twins.js +186 -0
  201. package/dist/pageControlSpecs-DZJ9K37m.js +134 -0
  202. package/dist/pageControlsBridge-0pX9s-3k.js +54 -0
  203. package/dist/pageControlsBridge-DAuT3w7L.d.ts +36 -0
  204. package/dist/panels-PfBBAToE.js +346 -0
  205. package/dist/parts-B7fBcw-B.js +346 -0
  206. package/dist/popover-Dms9Vz3j.js +3389 -0
  207. package/dist/preloadable-lazy-Pp47mqQ9.js +65 -0
  208. package/dist/proactive.d.ts +66 -0
  209. package/dist/proactive.js +237 -0
  210. package/dist/quick-config-panel-DFd77xho.js +451 -0
  211. package/dist/quota-DeA_CJ2e.js +175 -0
  212. package/dist/quota.d.ts +3 -0
  213. package/dist/quota.js +4 -0
  214. package/dist/read-only-context-Dt9N9SIG.js +18 -0
  215. package/dist/relative-time-Dxt8ZIIu.js +55 -0
  216. package/dist/results-CwK_yDxK.js +325 -0
  217. package/dist/rolldown-runtime-hDbaFkMy.js +18 -0
  218. package/dist/route-data.d.ts +12 -0
  219. package/dist/route-data.js +69 -0
  220. package/dist/route-match-C-0_EnAt.d.ts +5 -0
  221. package/dist/route-match-DMkUICYV.js +41 -0
  222. package/dist/route-preload-C4DlGoCd.js +120 -0
  223. package/dist/run-display-UjLAoYqQ.js +81 -0
  224. package/dist/run-history-arGiHzGU.js +285 -0
  225. package/dist/run-list-links-DJn4Mf1T.js +98 -0
  226. package/dist/run-mode-USmM0-Uo.js +82 -0
  227. package/dist/run-parity-CWXqEJqM.js +144 -0
  228. package/dist/runsQuota-B6SyTbne.js +100 -0
  229. package/dist/runsQuota-DsniKiSg.d.ts +20 -0
  230. package/dist/safe-expression-Cw7-SCsm.js +1251 -0
  231. package/dist/save-status-store-C7nEYpfb.js +631 -0
  232. package/dist/schedule-panel-B4GYXzXQ.js +13774 -0
  233. package/dist/schedule-rules-ggVKRkBH.js +358 -0
  234. package/dist/secrets-Re_wSiE3.js +153 -0
  235. package/dist/settings.d.ts +4 -0
  236. package/dist/settings.js +6 -0
  237. package/dist/shared-DAWGGMSM.js +177 -0
  238. package/dist/sidebar-node-editor-6eSSgCzc.js +178 -0
  239. package/dist/solar.generated-CGYuUQAC.js +10 -0
  240. package/dist/stableTabbedDialog-BBhrfXGe.js +20 -0
  241. package/dist/start-url-CT6Yz96K.js +24 -0
  242. package/dist/status-CessxGpm.js +55 -0
  243. package/dist/store-icon-OctYp5zP.js +155 -0
  244. package/dist/styles-WGmTnZ2n.js +26 -0
  245. package/dist/styles.css +139 -0
  246. package/dist/svg-spinners.generated-CIPT7IhM.js +10 -0
  247. package/dist/template-code-CzN6JWNV.js +191 -0
  248. package/dist/template-graph-DLF9dygU.js +20 -0
  249. package/dist/template-preview-DcIIKOOL.js +32 -0
  250. package/dist/template-price-CdUHZRMF.js +40 -0
  251. package/dist/templates.d.ts +3 -0
  252. package/dist/templates.js +5 -0
  253. package/dist/theme-provider-CntfC4_i.js +23 -0
  254. package/dist/transient-DgZfhDfN.js +57 -0
  255. package/dist/typed-calls-C5tO03wq.js +26 -0
  256. package/dist/ui-script-By74Guk3.js +1094 -0
  257. package/dist/ui-script-editor-CqPu2bCN.js +2447 -0
  258. package/dist/ui-step-fix-8uM2_Hft.js +67 -0
  259. package/dist/ui-step-fix-store-CcO1FdRx.js +19 -0
  260. package/dist/ui-step-run-context-o7bLE6KP.js +46 -0
  261. package/dist/ui-target-editor-D2JhB_lD.js +673 -0
  262. package/dist/uiMarkTools-CSznnO1i.js +1054 -0
  263. package/dist/upgradePrompt-BAFBKKW5.js +72 -0
  264. package/dist/use-bare-node-registry-O6mKJO_n.js +11498 -0
  265. package/dist/use-browser-available-hj8wc3Kb.js +241 -0
  266. package/dist/use-edge-mapper-schemas-Bonofxow.js +496 -0
  267. package/dist/use-extension-bridge-B9ZreOkQ.js +608 -0
  268. package/dist/use-mobile-BTqCUjzS.js +27 -0
  269. package/dist/use-sdk-query-C697xZVv.js +116 -0
  270. package/dist/use-workflow-code-editor-CFoRFrZ5.js +753 -0
  271. package/dist/useActionParam-B2tU2BlY.js +85 -0
  272. package/dist/useAgentTokenStream-Bko_J0d0.js +4217 -0
  273. package/dist/useBrowserClients-3v95-gSh.js +103 -0
  274. package/dist/useCodeWorkflowInsights-w0tz9Ap_.js +600 -0
  275. package/dist/useConnections-DsgEJs05.js +439 -0
  276. package/dist/useDebouncedValue-BFekcv6n.js +18 -0
  277. package/dist/useDurableParity-8fnMZmBc.js +1787 -0
  278. package/dist/useEntityTags-D0spL6Ut.js +460 -0
  279. package/dist/useExecutions-2u5nGJJk.js +681 -0
  280. package/dist/useFluidGridsAnalytics-VM8lAi2x.js +238 -0
  281. package/dist/useGlobalStoreClient-BTdhkA2I.js +24 -0
  282. package/dist/useHumanRequests-zlYDp3l1.js +221 -0
  283. package/dist/useNavigationV2-C2WeqN7d.js +29 -0
  284. package/dist/useNavigationV2-DANUmg12.d.ts +9 -0
  285. package/dist/useObservability-BRlQ0tOA.js +285 -0
  286. package/dist/useRequestedProposal-B7uPXfZB.js +51 -0
  287. package/dist/useRunHistory-CXCMUPyf.js +2759 -0
  288. package/dist/useRunLive-D0JvVZT2.js +1060 -0
  289. package/dist/useRunnerList-Dbi59i1K.js +446 -0
  290. package/dist/useRunners-URUc5quU.js +173 -0
  291. package/dist/useRunsPage-DG656UCK.js +2709 -0
  292. package/dist/useVariables-BIelxcWr.js +463 -0
  293. package/dist/useVersionHistoryData-CTjqVw7l.js +292 -0
  294. package/dist/useWorkflowCodeExport-pqxyLHD1.js +522 -0
  295. package/dist/useWorkflowListExport-hcZNvTaB.js +232 -0
  296. package/dist/useWorkflowOrganization-CpBbOrs7.js +1772 -0
  297. package/dist/useWorkflowProposal-BH0VdNMA.js +3280 -0
  298. package/dist/useWorkflows-Cvg-Z_IE.js +1606 -0
  299. package/dist/utils-fvBb5qOD.js +89 -0
  300. package/dist/webhook-deliveries-AvQujaZy.js +99 -0
  301. package/dist/workflow-builder-CJygVkVv.d.ts +2 -0
  302. package/dist/workflow-builder.d.ts +3 -0
  303. package/dist/workflow-builder.js +8 -0
  304. package/dist/workflow-code-transfer-Bsy0JKAZ.js +323 -0
  305. package/dist/workflow-embed.d.ts +3 -0
  306. package/dist/workflow-embed.js +4 -0
  307. package/dist/workflow-git-sync--K9ZsPDC.js +263 -0
  308. package/dist/workflow-host.d.ts +6 -0
  309. package/dist/workflow-host.js +11 -0
  310. package/dist/workflow-pages-D-7ByLTB.d.ts +68 -0
  311. package/dist/workflow-pages.d.ts +3 -0
  312. package/dist/workflow-pages.js +115 -0
  313. package/dist/workflow-preview-canvas-CO8yzdE3.js +848 -0
  314. package/dist/workflow-preview.d.ts +65 -0
  315. package/dist/workflow-preview.js +4 -0
  316. package/dist/workflow-route.d.ts +33 -0
  317. package/dist/workflow-route.js +4 -0
  318. package/dist/workflow-save-state-D0l-DkLf.js +767 -0
  319. package/dist/workflow-transfer-CQnQC-ke.js +104 -0
  320. package/dist/workflowRouteData-BkfVOc-O.js +169 -0
  321. package/dist/workflows-list.d.ts +10 -0
  322. package/dist/workflows-list.js +5 -0
  323. package/package.json +320 -4
@@ -0,0 +1,1312 @@
1
+ "use client";
2
+ import { t as __exportAll } from "./rolldown-runtime-hDbaFkMy.js";
3
+ import { t as Icon } from "./Icon-BtQ0HXLh.js";
4
+ import { r as useTr } from "./TranslationBridge-Da-TPgQm.js";
5
+ import { n as useNavigationV2 } from "./useNavigationV2-C2WeqN7d.js";
6
+ import { r as isForbiddenError, s as throwIfResultError, t as describeOperationError } from "./errors-ClKb5sEt.js";
7
+ import { a as useRecipientLabel, i as notAnswerableText, n as ApprovalApprovers, r as answeredToastText, t as channelLabel } from "./channel-CPyQ1NR1.js";
8
+ import { n as useRespondToHumanRequest, t as usePendingHumanRequests } from "./useHumanRequests-zlYDp3l1.js";
9
+ import { t as TechnicalDetails } from "./TechnicalDetails-B0Oi4aZw.js";
10
+ import { t as FluidGridsDocsLink } from "./FluidGridsDocsLink-bX0Hnhxr.js";
11
+ import { i as PageIntro, t as ApprovalsListSkeleton } from "./parts-B7fBcw-B.js";
12
+ import { n as getFluidGridsClient } from "./client-holder-C0M5Cfwl.js";
13
+ import { r as nodeDisplayTitle, t as buildNodeDisplayMap } from "./run-display-UjLAoYqQ.js";
14
+ import { i as SdkPermissionButton, s as useFluidGridsPermission, t as FLUIDGRIDS_PERMISSIONS } from "./constants-DlRnHBfQ.js";
15
+ import { useCallback, useEffect, useState } from "react";
16
+ import { Link, useNavigate } from "react-router";
17
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
18
+ import { toast } from "sonner";
19
+ import { Badge, Card, CardContent, CardHeader, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, EmptyState, Input, Label, LoadRegion, Textarea, ThemedSelect, useLoadingSystem } from "@burdenoff/fe-libs/ui";
20
+ import { gql } from "@apollo/client";
21
+ import { Button as Button$1 } from "@burdenoff/fe-libs/button";
22
+
23
+ // src/modules/human-response/utils/approval-labels.ts
24
+ /**
25
+ * The raw ids every Approvals card keeps one click away (Navigation v2,
26
+ * BOFF-11848): the workflow key, the run id and the step (node) id.
27
+ */
28
+ function approvalTechnicalRows(ids, tr) {
29
+ return [
30
+ {
31
+ label: tr("fluidgrids.approvals.technicalWorkflowKey", "Workflow key"),
32
+ value: ids.workflowKey
33
+ },
34
+ {
35
+ label: tr("fluidgrids.approvals.technicalRunId", "Run ID"),
36
+ value: ids.runId
37
+ },
38
+ {
39
+ label: tr("fluidgrids.approvals.technicalStepId", "Step ID"),
40
+ value: ids.nodeId
41
+ }
42
+ ];
43
+ }
44
+ /**
45
+ * Where an Approvals card comes from, in words (Navigation v2): "Step: Sort
46
+ * the ticket in Support desk", or "In Support desk" when the step's name is
47
+ * not known.
48
+ */
49
+ function approvalSourceText(workflow, step, tr) {
50
+ return step ? tr("fluidgrids.approvals.stepInWorkflow", "Step: {{step}} in {{workflow}}", {
51
+ step,
52
+ workflow
53
+ }) : tr("fluidgrids.approvals.inWorkflow", "In {{workflow}}", { workflow });
54
+ }
55
+
56
+ // src/modules/human-response/components/ApprovalSource.tsx
57
+ /** "Open run": the run this card belongs to, on the Runs page. */
58
+ function OpenRunLink({ runId }) {
59
+ const tr = useTr();
60
+ return /* @__PURE__ */ jsx(Link, {
61
+ to: `../runs/${encodeURIComponent(runId)}`,
62
+ "data-testid": "approval-open-run",
63
+ className: "font-medium text-text-link underline-offset-2 hover:text-text-linkHover hover:underline",
64
+ children: tr("fluidgrids.approvals.openRun", "Open run")
65
+ });
66
+ }
67
+ /** "Step: {step} in {workflow} · Open run" under an ask's title. */
68
+ function ApprovalSource({ workflow, step, runId }) {
69
+ const tr = useTr();
70
+ return /* @__PURE__ */ jsxs("p", {
71
+ className: "flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs text-text-secondary",
72
+ "data-testid": "approval-source",
73
+ children: [/* @__PURE__ */ jsx("span", {
74
+ className: "min-w-0 break-words",
75
+ children: approvalSourceText(workflow, step, tr)
76
+ }), /* @__PURE__ */ jsx(OpenRunLink, { runId })]
77
+ });
78
+ }
79
+ /** The raw ids of a card, one click away under "Show technical details". */
80
+ function ApprovalTechnicalDetails({ rows, children }) {
81
+ return /* @__PURE__ */ jsxs(TechnicalDetails, {
82
+ "data-testid": "approval-technical-details",
83
+ children: [/* @__PURE__ */ jsx("dl", {
84
+ className: "space-y-1 text-xs",
85
+ children: rows.map((row) => /* @__PURE__ */ jsxs("div", {
86
+ className: "flex flex-wrap gap-x-2",
87
+ children: [/* @__PURE__ */ jsx("dt", {
88
+ className: "font-medium text-text-secondary",
89
+ children: row.label
90
+ }), /* @__PURE__ */ jsx("dd", {
91
+ className: "break-all font-mono text-text-primary",
92
+ children: row.value
93
+ })]
94
+ }, row.label))
95
+ }), children]
96
+ });
97
+ }
98
+
99
+ // src/modules/human-response/components/HumanRequestCard.tsx
100
+ /**
101
+ * One "Send and Wait for Response" ask in the in-app inbox (BOFF-7651): what was asked, of whom,
102
+ * through which channel and until when — and, when the caller may answer it in-app, the controls
103
+ * to do so (Approve / Decline, a text box, or the custom form). An approval with several approvers
104
+ * (BOFF-9956) also shows where its quorum stands and takes an optional comment with the answer.
105
+ *
106
+ * Navigation v2 (BOFF-11848, FluidGrids only): the card names its workflow (and step) with an
107
+ * "Open run" link instead of the raw workflow-key badge, which moves under "Show technical
108
+ * details" with the run and step ids; a required field says "(required)" instead of " *".
109
+ */
110
+ const CHANNEL_ICON = {
111
+ EMAIL: "mdi:email-outline",
112
+ SLACK: "mdi:slack",
113
+ IN_APP: "mdi:bell-outline"
114
+ };
115
+ function inputType(field) {
116
+ const type = (field.type || "text").toLowerCase();
117
+ return [
118
+ "email",
119
+ "number",
120
+ "date",
121
+ "tel",
122
+ "url"
123
+ ].includes(type) ? type : "text";
124
+ }
125
+ function FormControls({ requestId, fields, values, onChange }) {
126
+ const tr = useTr();
127
+ const v2 = useNavigationV2();
128
+ const marker = v2 ? ` ${tr("fluidgrids.humanResponse.requiredMarker", "(required)")}` : " *";
129
+ return /* @__PURE__ */ jsx("div", {
130
+ className: "space-y-3",
131
+ children: fields.map((field) => {
132
+ const id = `human-field-${requestId}-${field.name}`;
133
+ const required = field.required || void 0;
134
+ const type = (field.type || "text").toLowerCase();
135
+ return /* @__PURE__ */ jsxs("div", {
136
+ className: "space-y-1.5",
137
+ children: [/* @__PURE__ */ jsxs(Label, {
138
+ htmlFor: id,
139
+ children: [field.label || field.name, field.required && /* @__PURE__ */ jsx("span", {
140
+ "aria-hidden": "true",
141
+ className: v2 ? "text-text-secondary" : void 0,
142
+ children: marker
143
+ })]
144
+ }), type === "textarea" ? /* @__PURE__ */ jsx(Textarea, {
145
+ id,
146
+ "aria-required": required,
147
+ value: values[field.name] ?? "",
148
+ placeholder: field.placeholder ?? void 0,
149
+ onChange: (event) => onChange(field.name, event.target.value)
150
+ }) : type === "dropdown" || type === "select" ? /* @__PURE__ */ jsxs(ThemedSelect, {
151
+ id,
152
+ "aria-required": required,
153
+ className: "w-full rounded-md border border-border-default bg-surface-canvas px-3 py-2 text-sm text-text-primary",
154
+ value: values[field.name] ?? "",
155
+ onChange: (event) => onChange(field.name, event.target.value),
156
+ children: [/* @__PURE__ */ jsx("option", {
157
+ value: "",
158
+ children: "—"
159
+ }), (field.options ?? []).map((option) => /* @__PURE__ */ jsx("option", {
160
+ value: option,
161
+ children: option
162
+ }, option))]
163
+ }) : /* @__PURE__ */ jsx(Input, {
164
+ id,
165
+ "aria-required": required,
166
+ type: inputType(field),
167
+ value: values[field.name] ?? "",
168
+ placeholder: field.placeholder ?? void 0,
169
+ onChange: (event) => onChange(field.name, event.target.value)
170
+ })]
171
+ }, field.name);
172
+ })
173
+ });
174
+ }
175
+ /** Approve / Decline, with an optional comment that is recorded with the answer (BOFF-9956). */
176
+ function ApprovalControls({ request, loading, onAnswer }) {
177
+ const tr = useTr();
178
+ const [comment, setComment] = useState("");
179
+ const note = comment.trim() ? { comment: comment.trim() } : {};
180
+ const commentId = `human-comment-${request.id}`;
181
+ return /* @__PURE__ */ jsxs("div", {
182
+ className: "space-y-2 pt-1",
183
+ children: [/* @__PURE__ */ jsxs("div", {
184
+ className: "space-y-1.5",
185
+ children: [/* @__PURE__ */ jsx(Label, {
186
+ htmlFor: commentId,
187
+ children: tr("fluidgrids.humanResponse.commentLabel", "Comment (optional)")
188
+ }), /* @__PURE__ */ jsx(Textarea, {
189
+ id: commentId,
190
+ value: comment,
191
+ maxLength: 2e3,
192
+ placeholder: tr("fluidgrids.humanResponse.commentPlaceholder", "Why you approve or decline. It is saved with your answer on the run."),
193
+ onChange: (event) => setComment(event.target.value),
194
+ "data-testid": "human-request-comment"
195
+ })]
196
+ }), /* @__PURE__ */ jsxs("div", {
197
+ className: "flex flex-wrap items-center gap-2",
198
+ children: [/* @__PURE__ */ jsxs(Button$1, {
199
+ "data-agent": "confirm",
200
+ size: "sm",
201
+ disabled: loading,
202
+ onClick: () => onAnswer({
203
+ action: "approve",
204
+ ...note
205
+ }),
206
+ "data-testid": "human-request-approve",
207
+ children: [/* @__PURE__ */ jsx(Icon, {
208
+ icon: "mdi:check",
209
+ className: "mr-1.5",
210
+ width: 16
211
+ }), request.approveLabel]
212
+ }), request.approvalType === "double" && /* @__PURE__ */ jsxs(Button$1, {
213
+ "data-agent": "confirm",
214
+ size: "sm",
215
+ variant: "destructive",
216
+ disabled: loading,
217
+ onClick: () => onAnswer({
218
+ action: "decline",
219
+ ...note
220
+ }),
221
+ "data-testid": "human-request-decline",
222
+ children: [/* @__PURE__ */ jsx(Icon, {
223
+ icon: "mdi:close",
224
+ className: "mr-1.5",
225
+ width: 16
226
+ }), request.declineLabel]
227
+ })]
228
+ })]
229
+ });
230
+ }
231
+ /** How the caller answers in-app: Approve/Decline, a text box, or the custom form. */
232
+ function AnswerArea({ request, loading, onAnswer }) {
233
+ const tr = useTr();
234
+ const [text, setText] = useState("");
235
+ const [values, setValues] = useState({});
236
+ if (request.responseType === "APPROVAL") return /* @__PURE__ */ jsx(ApprovalControls, {
237
+ request,
238
+ loading,
239
+ onAnswer
240
+ });
241
+ const missingRequired = request.responseType === "CUSTOM_FORM" && request.fields.some((field) => field.required && !(values[field.name] ?? "").trim());
242
+ const emptyText = request.responseType === "FREE_TEXT" && !text.trim();
243
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
244
+ request.responseType === "FREE_TEXT" && /* @__PURE__ */ jsxs("div", {
245
+ className: "space-y-1.5",
246
+ children: [/* @__PURE__ */ jsx(Label, {
247
+ htmlFor: `human-text-${request.id}`,
248
+ children: tr("fluidgrids.humanResponse.yourResponse", "Your response")
249
+ }), /* @__PURE__ */ jsx(Textarea, {
250
+ id: `human-text-${request.id}`,
251
+ value: text,
252
+ onChange: (event) => setText(event.target.value)
253
+ })]
254
+ }),
255
+ request.responseType === "CUSTOM_FORM" && /* @__PURE__ */ jsx(FormControls, {
256
+ requestId: request.id,
257
+ fields: request.fields,
258
+ values,
259
+ onChange: (name, value) => setValues((current) => ({
260
+ ...current,
261
+ [name]: value
262
+ }))
263
+ }),
264
+ /* @__PURE__ */ jsx("div", {
265
+ className: "flex flex-wrap items-center gap-2 pt-1",
266
+ children: /* @__PURE__ */ jsxs(Button$1, {
267
+ "data-agent": "confirm",
268
+ size: "sm",
269
+ disabled: loading || missingRequired || emptyText,
270
+ onClick: () => onAnswer(request.responseType === "FREE_TEXT" ? { text } : { values }),
271
+ "data-testid": "human-request-submit",
272
+ children: [/* @__PURE__ */ jsx(Icon, {
273
+ icon: "mdi:send",
274
+ className: "mr-1.5",
275
+ width: 16
276
+ }), request.submitLabel]
277
+ })
278
+ })
279
+ ] });
280
+ }
281
+ function HumanRequestCard({ request, onAnswered, workflowName, stepName }) {
282
+ const tr = useTr();
283
+ const v2 = useNavigationV2();
284
+ const { respond, loading } = useRespondToHumanRequest();
285
+ const submit = async (answer) => {
286
+ try {
287
+ const decision = await respond(request.id, answer);
288
+ toast.success(answeredToastText(decision, tr));
289
+ onAnswered();
290
+ } catch (err) {
291
+ const failed = tr("fluidgrids.humanResponse.failed", "Your response could not be recorded");
292
+ toast.error(failed, { description: describeOperationError(err, failed) });
293
+ }
294
+ };
295
+ const recipient = useRecipientLabel(request, request.channel === "IN_APP" ? tr("fluidgrids.humanResponse.anyMember", "any workspace member") : "");
296
+ return /* @__PURE__ */ jsxs(Card, {
297
+ className: "border border-border-default bg-surface",
298
+ "data-testid": "human-request-card",
299
+ "data-request-id": request.id,
300
+ children: [/* @__PURE__ */ jsxs(CardHeader, {
301
+ className: "pb-3",
302
+ children: [
303
+ /* @__PURE__ */ jsxs("div", {
304
+ className: "flex flex-wrap items-center justify-between gap-2",
305
+ children: [/* @__PURE__ */ jsxs("div", {
306
+ className: "flex min-w-0 items-center gap-2",
307
+ children: [/* @__PURE__ */ jsx(Icon, {
308
+ icon: CHANNEL_ICON[request.channel] ?? "mdi:account-question",
309
+ width: 18,
310
+ className: "shrink-0 text-text-secondary"
311
+ }), /* @__PURE__ */ jsx("span", {
312
+ className: "truncate text-sm font-semibold text-text-primary",
313
+ children: request.title
314
+ })]
315
+ }), !v2 && /* @__PURE__ */ jsx(Badge, {
316
+ variant: "outline",
317
+ className: "font-mono text-[10px]",
318
+ children: request.workflowKey
319
+ })]
320
+ }),
321
+ v2 && /* @__PURE__ */ jsx(ApprovalSource, {
322
+ workflow: workflowName ?? request.workflowKey,
323
+ step: stepName,
324
+ runId: request.runId
325
+ }),
326
+ /* @__PURE__ */ jsxs("p", {
327
+ className: "text-xs text-text-secondary",
328
+ children: [tr("fluidgrids.humanResponse.askedVia", "Asked {{recipient}} via {{channel}}", {
329
+ recipient,
330
+ channel: channelLabel(request.channel, tr)
331
+ }), request.expiresAt && ` · ${tr("fluidgrids.humanResponse.until", "until {{time}}", { time: new Date(request.expiresAt).toLocaleString() })}`]
332
+ })
333
+ ]
334
+ }), /* @__PURE__ */ jsxs(CardContent, {
335
+ className: "space-y-3",
336
+ children: [
337
+ request.message && /* @__PURE__ */ jsx("p", {
338
+ className: "whitespace-pre-wrap break-words text-sm text-text-primary",
339
+ children: request.message
340
+ }),
341
+ /* @__PURE__ */ jsx(ApprovalApprovers, { request }),
342
+ !request.canRespond && /* @__PURE__ */ jsx("p", {
343
+ className: "text-xs text-text-secondary",
344
+ children: notAnswerableText(request, channelLabel(request.channel, tr), tr)
345
+ }),
346
+ request.canRespond && /* @__PURE__ */ jsx(AnswerArea, {
347
+ request,
348
+ loading,
349
+ onAnswer: submit
350
+ }),
351
+ v2 && /* @__PURE__ */ jsx(ApprovalTechnicalDetails, { rows: approvalTechnicalRows(request, tr) })
352
+ ]
353
+ })]
354
+ });
355
+ }
356
+
357
+ // src/modules/tool-approval/hooks/useToolApprovals.ts
358
+ /**
359
+ * Custom hooks for the AI Agent tool-approval inbox (BOFF-7521).
360
+ * Queries/mutates wspace-workflow-svc via the federated GraphQL gateway —
361
+ * mirrors the variables module's hook pattern
362
+ * (`modules/variables/hooks/useVariables.ts`).
363
+ */
364
+ const TOOL_APPROVAL_FIELDS = gql`
365
+ fragment ToolApprovalRequestFields on ToolApprovalRequest {
366
+ id
367
+ runId
368
+ nodeId
369
+ workflowId
370
+ workflowKey
371
+ status
372
+ toolCalls {
373
+ callId
374
+ name
375
+ argsJson
376
+ }
377
+ decisions {
378
+ callId
379
+ decision
380
+ reason
381
+ }
382
+ timeoutAt
383
+ timeoutAction
384
+ requestedAt
385
+ decidedAt
386
+ decidedBy
387
+ }
388
+ `;
389
+ const GET_PENDING_TOOL_APPROVALS = gql`
390
+ ${TOOL_APPROVAL_FIELDS}
391
+ query GetPendingToolApprovals($limit: Int, $offset: Int) {
392
+ pendingToolApprovals(limit: $limit, offset: $offset) {
393
+ totalCount
394
+ items {
395
+ ...ToolApprovalRequestFields
396
+ }
397
+ }
398
+ }
399
+ `;
400
+ const DECIDE_TOOL_APPROVAL = gql`
401
+ ${TOOL_APPROVAL_FIELDS}
402
+ mutation DecideToolApproval(
403
+ $id: ID!
404
+ $decisions: [ToolApprovalDecisionInput!]!
405
+ ) {
406
+ decideToolApproval(id: $id, decisions: $decisions) {
407
+ success
408
+ error
409
+ resumedFromNodeId
410
+ request {
411
+ ...ToolApprovalRequestFields
412
+ }
413
+ }
414
+ }
415
+ `;
416
+ /**
417
+ * Polls the pending tool-approval inbox. Short polling interval (not a
418
+ * subscription) — approvals are rare/low-volume and the caller wants a
419
+ * near-real-time inbox without standing up a dedicated subscription channel
420
+ * for a v1 feature.
421
+ *
422
+ * Pass `enabled: false` when the caller lacks `tool-approval-request:read`:
423
+ * the query is then never sent, so the gateway's FORBIDDEN never reaches the
424
+ * shell's global error toast (BOFF-10104). If the gateway still denies the
425
+ * query, `forbidden` turns true and polling stops.
426
+ */
427
+ function usePendingToolApprovals(options) {
428
+ const limit = options?.limit ?? 50;
429
+ const offset = options?.offset ?? 0;
430
+ const pollIntervalMs = options?.pollIntervalMs ?? 15e3;
431
+ const enabled = options?.enabled ?? true;
432
+ const [items, setItems] = useState([]);
433
+ const [totalCount, setTotalCount] = useState(0);
434
+ const [loading, setLoading] = useState(enabled);
435
+ const [error, setError] = useState(null);
436
+ const [forbidden, setForbidden] = useState(false);
437
+ const fetchData = useCallback(async () => {
438
+ if (!enabled) return;
439
+ setError(null);
440
+ try {
441
+ const client = getFluidGridsClient();
442
+ const result = throwIfResultError(await client.query({
443
+ query: GET_PENDING_TOOL_APPROVALS,
444
+ variables: {
445
+ limit,
446
+ offset
447
+ },
448
+ fetchPolicy: "network-only"
449
+ }));
450
+ setItems(result.data?.pendingToolApprovals?.items ?? []);
451
+ setTotalCount(result.data?.pendingToolApprovals?.totalCount ?? 0);
452
+ } catch (err) {
453
+ if (isForbiddenError(err)) {
454
+ setForbidden(true);
455
+ setItems([]);
456
+ setTotalCount(0);
457
+ } else setError(err);
458
+ } finally {
459
+ setLoading(false);
460
+ }
461
+ }, [
462
+ enabled,
463
+ limit,
464
+ offset
465
+ ]);
466
+ useEffect(() => {
467
+ setForbidden(false);
468
+ if (!enabled) {
469
+ setItems([]);
470
+ setTotalCount(0);
471
+ setError(null);
472
+ }
473
+ }, [enabled]);
474
+ useEffect(() => {
475
+ if (!enabled || forbidden) {
476
+ setLoading(false);
477
+ return;
478
+ }
479
+ setLoading(true);
480
+ fetchData();
481
+ if (pollIntervalMs <= 0) return;
482
+ const interval = setInterval(fetchData, pollIntervalMs);
483
+ return () => clearInterval(interval);
484
+ }, [
485
+ enabled,
486
+ fetchData,
487
+ forbidden,
488
+ pollIntervalMs
489
+ ]);
490
+ return {
491
+ items,
492
+ totalCount,
493
+ loading,
494
+ error,
495
+ forbidden: forbidden || !enabled,
496
+ refetch: fetchData
497
+ };
498
+ }
499
+ function useDecideToolApproval() {
500
+ const [loading, setLoading] = useState(false);
501
+ const [error, setError] = useState(null);
502
+ const decide = useCallback(async (id, decisions) => {
503
+ setLoading(true);
504
+ setError(null);
505
+ try {
506
+ const client = getFluidGridsClient();
507
+ const response = throwIfResultError(await client.mutate({
508
+ mutation: DECIDE_TOOL_APPROVAL,
509
+ variables: {
510
+ id,
511
+ decisions
512
+ }
513
+ })).data?.decideToolApproval;
514
+ if (!response?.success) throw new Error(response?.error ?? "Failed to record the decision");
515
+ return response;
516
+ } catch (err) {
517
+ setError(err);
518
+ throw err;
519
+ } finally {
520
+ setLoading(false);
521
+ }
522
+ }, []);
523
+ return {
524
+ decide,
525
+ decideAll: useCallback(async (request, decision, reason) => {
526
+ return decide(request.id, request.toolCalls.map((call) => ({
527
+ callId: call.callId,
528
+ decision,
529
+ reason
530
+ })));
531
+ }, [decide]),
532
+ loading,
533
+ error
534
+ };
535
+ }
536
+
537
+ // src/modules/tool-approval/hooks/useApprovalWorkflows.ts
538
+ /**
539
+ * Names for the Approvals cards (Navigation v2, BOFF-11848): which workflow
540
+ * each ask or AI action belongs to, and the name of the step that asked.
541
+ *
542
+ * Neither `ToolApprovalRequest` nor `WorkflowHumanRequest` carries a name,
543
+ * only the workflow key (and, for AI actions, the definition id), so the page
544
+ * looks each workflow up once. A failed lookup (a deleted workflow, no access)
545
+ * leaves the card on the key; nothing is shown as an error.
546
+ */
547
+ const GET_APPROVAL_WORKFLOW = gql`
548
+ query GetApprovalWorkflow($id: ID, $workflowKey: String) {
549
+ workflowDefinition(id: $id, workflowKey: $workflowKey) {
550
+ id
551
+ workflowKey
552
+ name
553
+ definitionJson
554
+ }
555
+ }
556
+ `;
557
+ /** At most this many workflows are looked up for one page of cards. */
558
+ const MAX_WORKFLOW_LOOKUPS = 20;
559
+ /** The lookup key of a ref: the definition id when known, else the key. */
560
+ function approvalWorkflowRefKey(ref) {
561
+ return ref.workflowId ? `id:${ref.workflowId}` : `key:${ref.workflowKey}`;
562
+ }
563
+ /**
564
+ * The unique lookup keys of the cards, in first-seen order, capped at
565
+ * MAX_WORKFLOW_LOOKUPS, joined into one string: a poll that returns the same
566
+ * cards gives the same string, so nothing is looked up again.
567
+ */
568
+ function workflowLookupSignature(refs) {
569
+ const keys = /* @__PURE__ */ new Set();
570
+ for (const ref of refs) {
571
+ keys.add(approvalWorkflowRefKey(ref));
572
+ if (keys.size >= 20) break;
573
+ }
574
+ return [...keys].join("\n");
575
+ }
576
+ /** The query variables for one lookup key ("id:…" or "key:…"). */
577
+ function lookupVariables(key) {
578
+ return key.startsWith("id:") ? { id: key.slice(3) } : { workflowKey: key.slice(4) };
579
+ }
580
+ async function lookUp(key) {
581
+ try {
582
+ const definition = throwIfResultError(await getFluidGridsClient().query({
583
+ query: GET_APPROVAL_WORKFLOW,
584
+ variables: lookupVariables(key),
585
+ fetchPolicy: "cache-first"
586
+ })).data?.workflowDefinition;
587
+ if (!definition?.name) return null;
588
+ return {
589
+ name: definition.name,
590
+ steps: buildNodeDisplayMap(definition.definitionJson)
591
+ };
592
+ } catch {
593
+ return null;
594
+ }
595
+ }
596
+ /**
597
+ * Looks up the workflows behind the cards while `enabled` (Navigation v2,
598
+ * and the caller may read workflows). Returns what is known so far, keyed by
599
+ * `approvalWorkflowRefKey`.
600
+ */
601
+ function useApprovalWorkflows(refs, enabled) {
602
+ const signature = workflowLookupSignature(refs);
603
+ const [known, setKnown] = useState(() => /* @__PURE__ */ new Map());
604
+ useEffect(() => {
605
+ if (!enabled || !signature) return;
606
+ let active = true;
607
+ Promise.all(signature.split("\n").map(async (key) => [key, await lookUp(key)])).then((results) => {
608
+ if (!active) return;
609
+ setKnown((current) => {
610
+ const next = new Map(current);
611
+ for (const [key, info] of results) if (info) next.set(key, info);
612
+ return next;
613
+ });
614
+ });
615
+ return () => {
616
+ active = false;
617
+ };
618
+ }, [enabled, signature]);
619
+ return known;
620
+ }
621
+ /** "Step: Sort the ticket in Support desk" parts for a card, or the key. */
622
+ function approvalLabels(info, workflowKey, nodeId) {
623
+ const display = info?.steps[nodeId];
624
+ return {
625
+ workflow: info?.name ?? workflowKey,
626
+ step: display ? nodeDisplayTitle(display, nodeId) : null
627
+ };
628
+ }
629
+
630
+ // src/modules/tool-approval/utils/paging.ts
631
+ /**
632
+ * Paging for the Approvals inbox (BOFF-11848). Both lists (asks waiting for a
633
+ * person, and the AI assistant's actions waiting for an OK) load 50 at a time.
634
+ */
635
+ /** Items per page in each Approvals list. */
636
+ const APPROVALS_PAGE_SIZE = 50;
637
+ /**
638
+ * The offset to show for a requested one: answering the last item on a later
639
+ * page empties it, so step back to the last page that still has items.
640
+ * Derived while rendering, so it never needs an effect to correct itself.
641
+ */
642
+ function clampPageOffset(offset, total, pageSize = 50) {
643
+ if (offset <= 0 || offset < total) return Math.max(0, offset);
644
+ return Math.max(0, Math.ceil(total / pageSize) - 1) * pageSize;
645
+ }
646
+
647
+ // src/modules/tool-approval/components/InboxPager.tsx
648
+ /**
649
+ * "{from}–{to} of {total}" with Previous / Next, under each Approvals list
650
+ * (BOFF-7651 for asks; BOFF-11848 adds it to the AI assistant's actions, which
651
+ * had no pager, so anything past the first 50 could not be reached).
652
+ * Renders nothing while everything fits on one page.
653
+ */
654
+ function InboxPager({ offset, shown, total, onOffsetChange, "data-testid": testId }) {
655
+ const tr = useTr();
656
+ if (total <= 50) return null;
657
+ return /* @__PURE__ */ jsxs("div", {
658
+ className: "mt-4 flex items-center gap-3",
659
+ "data-testid": testId,
660
+ children: [
661
+ /* @__PURE__ */ jsx("span", {
662
+ className: "text-xs text-text-secondary",
663
+ children: tr("fluidgrids.humanResponse.pageRange", "{{from}}–{{to}} of {{total}}", {
664
+ from: offset + 1,
665
+ to: offset + shown,
666
+ total
667
+ })
668
+ }),
669
+ /* @__PURE__ */ jsx(Button$1, {
670
+ variant: "outline",
671
+ size: "sm",
672
+ disabled: offset === 0,
673
+ onClick: () => onOffsetChange(Math.max(0, offset - 50)),
674
+ children: tr("fluidgrids.humanResponse.previousPage", "Previous")
675
+ }),
676
+ /* @__PURE__ */ jsx(Button$1, {
677
+ variant: "outline",
678
+ size: "sm",
679
+ disabled: offset + 50 >= total,
680
+ onClick: () => onOffsetChange(offset + 50),
681
+ children: tr("fluidgrids.humanResponse.nextPage", "Next")
682
+ })
683
+ ]
684
+ });
685
+ }
686
+
687
+ // src/modules/tool-approval/utils/timeout.ts
688
+ /**
689
+ * Classifies timeout metadata without changing server-owned request status.
690
+ * The timeout sweep remains authoritative for auto-resolving WAITING runs.
691
+ */
692
+ function getToolApprovalTimeoutState(timeoutAt, nowMs = Date.now()) {
693
+ if (!timeoutAt) return "NONE";
694
+ const timeoutMs = Date.parse(timeoutAt);
695
+ if (!Number.isFinite(timeoutMs)) return "NONE";
696
+ return timeoutMs <= nowMs ? "DUE" : "ACTIVE";
697
+ }
698
+
699
+ // src/modules/tool-approval/utils/tool-summary.ts
700
+ /**
701
+ * Plain-language view of an AI assistant's proposed action on the Approvals
702
+ * inbox (Navigation v2, BOFF-11848): "The AI assistant wants to: Send email"
703
+ * with a short key/value summary of its arguments. The raw tool name and JSON
704
+ * stay available under "Show technical details".
705
+ */
706
+ /** How many arguments the summary lists before "and N more". */
707
+ const SUMMARY_MAX_ENTRIES = 6;
708
+ /** Longest value the summary shows before cutting it with "…". */
709
+ const SUMMARY_MAX_VALUE_LENGTH = 120;
710
+ /**
711
+ * Split an identifier into lower-case words: snake_case, kebab-case,
712
+ * dotted/namespaced (`github.search_issues`, `slack__post`) and camelCase
713
+ * (`searchIssues`, `HTTPRequest`).
714
+ */
715
+ function words(identifier) {
716
+ return identifier.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s_\-.:/]+/).map((word) => word.trim().toLowerCase()).filter(Boolean);
717
+ }
718
+ function sentenceCase(parts) {
719
+ const text = parts.join(" ");
720
+ return text.charAt(0).toUpperCase() + text.slice(1);
721
+ }
722
+ /**
723
+ * "send_email" → "Send email", "github.searchIssues" → "Github search issues".
724
+ * An empty or symbol-only name is returned as it is.
725
+ */
726
+ function friendlyToolName(name) {
727
+ const parts = words(name);
728
+ return parts.length > 0 ? sentenceCase(parts) : name;
729
+ }
730
+ /** "recipient_email" → "Recipient email". */
731
+ function friendlyArgumentName(key) {
732
+ return friendlyToolName(key);
733
+ }
734
+ function shorten(text) {
735
+ return text.length > 120 ? `${text.slice(0, 119)}…` : text;
736
+ }
737
+ function valueText(value) {
738
+ if (value === null || value === void 0) return "—";
739
+ if (typeof value === "string") return shorten(value);
740
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
741
+ if (Array.isArray(value) && value.every((item) => typeof item === "string")) return shorten(value.join(", "));
742
+ return shorten(JSON.stringify(value));
743
+ }
744
+ /**
745
+ * The top-level arguments of a tool call as label/value rows. Arguments that
746
+ * are not a JSON object (a list, a bare value, malformed JSON) give no rows:
747
+ * the raw JSON under the technical details says it all.
748
+ */
749
+ function summarizeToolArguments(argsJson) {
750
+ let parsed;
751
+ try {
752
+ parsed = JSON.parse(argsJson);
753
+ } catch {
754
+ return {
755
+ rows: [],
756
+ hidden: 0
757
+ };
758
+ }
759
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {
760
+ rows: [],
761
+ hidden: 0
762
+ };
763
+ const entries = Object.entries(parsed);
764
+ return {
765
+ rows: entries.slice(0, 6).map(([key, value]) => ({
766
+ key,
767
+ label: friendlyArgumentName(key),
768
+ value: valueText(value)
769
+ })),
770
+ hidden: Math.max(0, entries.length - 6)
771
+ };
772
+ }
773
+ /** Pretty-printed raw arguments for the technical details. */
774
+ function formatToolArguments(argsJson) {
775
+ try {
776
+ return JSON.stringify(JSON.parse(argsJson), null, 2);
777
+ } catch {
778
+ return argsJson;
779
+ }
780
+ }
781
+
782
+ // src/modules/tool-approval/components/ToolApprovalCard.tsx
783
+ /**
784
+ * One AI assistant action waiting for a decision on the Approvals inbox
785
+ * (BOFF-7521), with the Reject dialog.
786
+ *
787
+ * Navigation v2 (BOFF-11848, FluidGrids only): the card reads "Step: {step}
788
+ * in {workflow}" with an "Open run" link, each proposed call reads "The AI
789
+ * assistant wants to: {action}" with a short summary of its arguments, a
790
+ * time limit says whether it will be approved or rejected automatically, and
791
+ * a request with several calls says the decision covers all of them. The
792
+ * node id, workflow key, run id and raw JSON move under "Show technical
793
+ * details". With the switch off the card is exactly as before.
794
+ */
795
+ function timeAgo(iso, tr) {
796
+ const then = new Date(iso).getTime();
797
+ const diffMs = Date.now() - then;
798
+ const minutes = Math.floor(diffMs / 6e4);
799
+ if (minutes < 1) return tr("fluidgrids.toolApproval.justNow", "just now");
800
+ if (minutes < 60) return tr("fluidgrids.toolApproval.minutesAgo", "{{minutes}}m ago", { minutes });
801
+ const hours = Math.floor(minutes / 60);
802
+ if (hours < 24) return tr("fluidgrids.toolApproval.hoursAgo", "{{hours}}h ago", { hours });
803
+ return tr("fluidgrids.toolApproval.daysAgo", "{{days}}d ago", { days: Math.floor(hours / 24) });
804
+ }
805
+ /** What the time limit does: today's words, or (v2) approve vs reject. */
806
+ function timeoutText(request, tr, plain) {
807
+ const time = new Date(request.timeoutAt ?? "").toLocaleString();
808
+ if (!plain) return tr("fluidgrids.toolApproval.autoResolvesAt", "auto-resolves at {{time}}", { time });
809
+ return request.timeoutAction === "AUTO_APPROVE" ? tr("fluidgrids.toolApproval.autoApprovesAt", "If nobody decides by {{time}}, it will be approved automatically", { time }) : tr("fluidgrids.toolApproval.autoRejectsAt", "If nobody decides by {{time}}, it will be rejected automatically", { time });
810
+ }
811
+ function RejectDialog({ open, onOpenChange, onConfirm, submitting }) {
812
+ const tr = useTr();
813
+ const v2 = useNavigationV2();
814
+ return /* @__PURE__ */ jsx(Dialog, {
815
+ open,
816
+ onOpenChange,
817
+ children: /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: tr("fluidgrids.toolApproval.rejectDialogTitle", v2 ? "Don't allow this action" : "Reject tool call") }), v2 && /* @__PURE__ */ jsx(DialogDescription, { children: tr("fluidgrids.toolApproval.rejectDialogDescription", "The AI assistant won't take this action, and your workflow will continue.") })] }), /* @__PURE__ */ jsx(RejectReasonForm, {
818
+ onCancel: () => onOpenChange(false),
819
+ onConfirm,
820
+ submitting
821
+ })] })
822
+ });
823
+ }
824
+ function RejectReasonForm({ onCancel, onConfirm, submitting }) {
825
+ const tr = useTr();
826
+ const v2 = useNavigationV2();
827
+ const [reason, setReason] = useState("");
828
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
829
+ className: "space-y-1.5",
830
+ children: [/* @__PURE__ */ jsx(Label, {
831
+ htmlFor: "reject-reason",
832
+ children: v2 ? tr("fluidgrids.toolApproval.rejectReasonLabelPlain", "Tell the AI assistant why (optional)") : tr("fluidgrids.toolApproval.rejectReasonLabel", "Reason (optional)")
833
+ }), /* @__PURE__ */ jsx(Textarea, {
834
+ id: "reject-reason",
835
+ "data-testid": "tool-approval-reject-reason",
836
+ value: reason,
837
+ onChange: (e) => setReason(e.target.value),
838
+ placeholder: v2 ? void 0 : tr("fluidgrids.toolApproval.rejectReasonPlaceholder", "Why is this call being rejected? The agent sees this.")
839
+ })]
840
+ }), /* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button$1, {
841
+ variant: "outline",
842
+ onClick: onCancel,
843
+ disabled: submitting,
844
+ children: tr("fluidgrids.toolApproval.cancel", "Cancel")
845
+ }), /* @__PURE__ */ jsx(Button$1, {
846
+ variant: "destructive",
847
+ onClick: () => onConfirm(reason),
848
+ disabled: submitting,
849
+ children: submitting ? tr("fluidgrids.toolApproval.rejecting", "Rejecting…") : tr("fluidgrids.toolApproval.rejectConfirm", v2 ? "Don't allow" : "Reject")
850
+ })] })] });
851
+ }
852
+ /** Navigation v2: "The AI assistant wants to: Send email" + its arguments. */
853
+ function PlainToolCall({ call }) {
854
+ const tr = useTr();
855
+ const summary = summarizeToolArguments(call.argsJson);
856
+ return /* @__PURE__ */ jsxs("div", {
857
+ className: "rounded-md border border-border-default bg-surface-canvas p-3",
858
+ "data-testid": "tool-approval-call",
859
+ children: [/* @__PURE__ */ jsx("p", {
860
+ className: "text-sm font-medium text-text-primary",
861
+ children: tr("fluidgrids.toolApproval.wantsTo", "The AI assistant wants to: {{action}}", { action: friendlyToolName(call.name) })
862
+ }), summary.rows.length > 0 && /* @__PURE__ */ jsxs("dl", {
863
+ className: "mt-2 space-y-1 text-xs",
864
+ children: [summary.rows.map((row) => /* @__PURE__ */ jsxs("div", {
865
+ className: "flex flex-wrap gap-x-2",
866
+ children: [/* @__PURE__ */ jsx("dt", {
867
+ className: "font-medium text-text-secondary",
868
+ children: row.label
869
+ }), /* @__PURE__ */ jsx("dd", {
870
+ className: "min-w-0 whitespace-pre-wrap break-words text-text-primary",
871
+ children: row.value
872
+ })]
873
+ }, row.key)), summary.hidden > 0 && /* @__PURE__ */ jsx("p", {
874
+ className: "text-text-secondary",
875
+ children: tr("fluidgrids.toolApproval.moreArguments", "and {{count}} more (see technical details)", { count: summary.hidden })
876
+ })]
877
+ })]
878
+ });
879
+ }
880
+ /** Today's call block: the raw tool name and its JSON arguments. */
881
+ function RawToolCall({ call }) {
882
+ return /* @__PURE__ */ jsxs("div", {
883
+ className: "rounded-md border border-border-default bg-surface-canvas p-3",
884
+ children: [/* @__PURE__ */ jsxs("div", {
885
+ className: "mb-1 flex items-center gap-2",
886
+ children: [/* @__PURE__ */ jsx(Icon, {
887
+ icon: "mdi:function-variant",
888
+ width: 14,
889
+ className: "text-text-secondary"
890
+ }), /* @__PURE__ */ jsx("span", {
891
+ className: "text-sm font-medium text-text-primary",
892
+ children: call.name
893
+ })]
894
+ }), /* @__PURE__ */ jsx("pre", {
895
+ className: "overflow-x-auto whitespace-pre-wrap break-all text-xs text-text-secondary",
896
+ children: formatToolArguments(call.argsJson)
897
+ })]
898
+ });
899
+ }
900
+ function ToolApprovalCard({ request, onDecided, workflowName, stepName }) {
901
+ const tr = useTr();
902
+ const v2 = useNavigationV2();
903
+ const { decideAll, loading } = useDecideToolApproval();
904
+ const [showReject, setShowReject] = useState(false);
905
+ const [nowMs, setNowMs] = useState(() => Date.now());
906
+ const timeoutState = getToolApprovalTimeoutState(request.timeoutAt, nowMs);
907
+ const timeoutDue = timeoutState === "DUE";
908
+ useEffect(() => {
909
+ if (timeoutState !== "ACTIVE") return;
910
+ const interval = setInterval(() => setNowMs(Date.now()), 1e3);
911
+ return () => clearInterval(interval);
912
+ }, [timeoutState]);
913
+ const handleDecide = async (decision, reason) => {
914
+ try {
915
+ await decideAll(request, decision, reason);
916
+ const approved = decision === "APPROVED";
917
+ toast.success(v2 ? approved ? tr("fluidgrids.toolApproval.allowedToast", "Allowed — your workflow is continuing") : tr("fluidgrids.toolApproval.notAllowedToast", "Not allowed — your workflow is continuing") : approved ? tr("fluidgrids.toolApproval.approvedToast", "Tool call approved — run resumed") : tr("fluidgrids.toolApproval.rejectedToast", "Tool call rejected — run resumed"));
918
+ setShowReject(false);
919
+ onDecided();
920
+ } catch (err) {
921
+ const failed = tr("fluidgrids.toolApproval.decisionFailed", "Failed to record the decision");
922
+ toast.error(failed, { description: describeOperationError(err, failed) });
923
+ }
924
+ };
925
+ const deniedTooltip = tr("fluidgrids.toolApproval.decideDeniedTooltip", "You don't have permission to decide tool approvals");
926
+ return /* @__PURE__ */ jsxs(Card, {
927
+ className: "border border-border-default bg-surface",
928
+ "data-testid": "tool-approval-card",
929
+ "data-request-id": request.id,
930
+ children: [
931
+ /* @__PURE__ */ jsxs(CardHeader, {
932
+ className: "pb-3",
933
+ children: [/* @__PURE__ */ jsxs("div", {
934
+ className: "flex flex-wrap items-center justify-between gap-2",
935
+ children: [/* @__PURE__ */ jsxs("div", {
936
+ className: "flex items-center gap-2",
937
+ children: [
938
+ /* @__PURE__ */ jsx(Icon, {
939
+ icon: "mdi:robot-outline",
940
+ width: 18,
941
+ className: "text-text-secondary"
942
+ }),
943
+ !v2 && /* @__PURE__ */ jsxs("span", {
944
+ className: "text-sm font-semibold text-text-primary",
945
+ children: [
946
+ tr("fluidgrids.toolApproval.nodeLabel", "Node"),
947
+ ":",
948
+ " ",
949
+ request.nodeId
950
+ ]
951
+ }),
952
+ v2 && /* @__PURE__ */ jsx("span", {
953
+ className: "text-sm font-semibold text-text-primary",
954
+ "data-testid": "approval-source",
955
+ children: approvalSourceText(workflowName ?? request.workflowKey, stepName, tr)
956
+ })
957
+ ]
958
+ }), !v2 && /* @__PURE__ */ jsx(Badge, {
959
+ variant: "outline",
960
+ className: "font-mono text-[10px]",
961
+ children: request.workflowKey
962
+ })]
963
+ }), /* @__PURE__ */ jsxs("p", {
964
+ className: "text-xs text-text-secondary",
965
+ children: [
966
+ tr("fluidgrids.toolApproval.requestedAt", "Requested {{when}}", { when: timeAgo(request.requestedAt, tr) }),
967
+ request.timeoutAt && timeoutDue ? ` · ${tr("fluidgrids.toolApproval.timeoutDue", "timeout reached; automatic decision pending")}` : request.timeoutAt && ` · ${timeoutText(request, tr, v2)}`,
968
+ v2 && /* @__PURE__ */ jsxs(Fragment$1, { children: [" · ", /* @__PURE__ */ jsx(OpenRunLink, { runId: request.runId })] })
969
+ ]
970
+ })]
971
+ }),
972
+ /* @__PURE__ */ jsxs(CardContent, {
973
+ className: "space-y-3",
974
+ children: [
975
+ request.toolCalls.map((call) => v2 ? /* @__PURE__ */ jsx(PlainToolCall, { call }, call.callId) : /* @__PURE__ */ jsx(RawToolCall, { call }, call.callId)),
976
+ v2 && request.toolCalls.length > 1 && /* @__PURE__ */ jsx("p", {
977
+ className: "text-xs text-text-secondary",
978
+ "data-testid": "tool-approval-all-or-nothing",
979
+ children: tr("fluidgrids.toolApproval.allOrNothing", "Your decision applies to all {{count}} actions in this request.", { count: request.toolCalls.length })
980
+ }),
981
+ /* @__PURE__ */ jsxs("div", {
982
+ className: "flex items-center gap-2 pt-1",
983
+ children: [/* @__PURE__ */ jsx(SdkPermissionButton, {
984
+ permission: FLUIDGRIDS_PERMISSIONS.TOOL_APPROVAL_REQUEST_EXECUTE,
985
+ deniedTooltip,
986
+ children: /* @__PURE__ */ jsxs(Button$1, {
987
+ "data-agent": "confirm",
988
+ size: "sm",
989
+ disabled: loading || timeoutDue,
990
+ onClick: () => handleDecide("APPROVED"),
991
+ "data-testid": "tool-approval-approve",
992
+ children: [/* @__PURE__ */ jsx(Icon, {
993
+ icon: "mdi:check",
994
+ className: "mr-1.5",
995
+ width: 16
996
+ }), tr("fluidgrids.toolApproval.approve", "Approve")]
997
+ })
998
+ }), /* @__PURE__ */ jsx(SdkPermissionButton, {
999
+ permission: FLUIDGRIDS_PERMISSIONS.TOOL_APPROVAL_REQUEST_EXECUTE,
1000
+ deniedTooltip,
1001
+ children: /* @__PURE__ */ jsxs(Button$1, {
1002
+ size: "sm",
1003
+ variant: "destructive",
1004
+ disabled: loading || timeoutDue,
1005
+ onClick: () => setShowReject(true),
1006
+ "data-testid": "tool-approval-reject",
1007
+ children: [/* @__PURE__ */ jsx(Icon, {
1008
+ icon: "mdi:close",
1009
+ className: "mr-1.5",
1010
+ width: 16
1011
+ }), tr("fluidgrids.toolApproval.reject", v2 ? "Don't allow" : "Reject")]
1012
+ })
1013
+ })]
1014
+ }),
1015
+ v2 && /* @__PURE__ */ jsx(ApprovalTechnicalDetails, {
1016
+ rows: approvalTechnicalRows(request, tr),
1017
+ children: /* @__PURE__ */ jsx("div", {
1018
+ className: "mt-2 space-y-2",
1019
+ children: request.toolCalls.map((call) => /* @__PURE__ */ jsx(RawToolCall, { call }, call.callId))
1020
+ })
1021
+ })
1022
+ ]
1023
+ }),
1024
+ /* @__PURE__ */ jsx(RejectDialog, {
1025
+ open: showReject,
1026
+ onOpenChange: setShowReject,
1027
+ submitting: loading,
1028
+ onConfirm: (reason) => handleDecide("REJECTED", reason || void 0)
1029
+ })
1030
+ ]
1031
+ });
1032
+ }
1033
+
1034
+ // src/modules/tool-approval/pages/ApprovalInboxPage.tsx
1035
+ /**
1036
+ * Approvals inbox (BOFF-7521, BOFF-7651): asks from workflows waiting for a
1037
+ * person, and AI Agent tool calls waiting for a decision (see
1038
+ * `components/ToolApprovalCard.tsx`). A request with several calls is
1039
+ * all-or-nothing: the one decision applies to every call in it (there is no
1040
+ * per-call control). Approving/rejecting resumes the underlying run via
1041
+ * `decideToolApproval`, which reuses the exact same WAITING/
1042
+ * `resumeWorkflowRun` mechanism the Wait node uses.
1043
+ *
1044
+ * Navigation v2 (BOFF-11848, FluidGrids only): both kinds of card name their
1045
+ * workflow and step and link the run, the counter says how many wait in all,
1046
+ * the empty state covers both kinds of ask, and a load error is plain words
1047
+ * with a Retry and the server's message under "Show technical details".
1048
+ */
1049
+ var ApprovalInboxPage_exports = /* @__PURE__ */ __exportAll({ ApprovalInboxPage: () => ApprovalInboxPage });
1050
+ /** Navigation v2: a list that failed to load, with Retry. */
1051
+ function InboxLoadError({ message, detail, onRetry, className }) {
1052
+ const tr = useTr();
1053
+ return /* @__PURE__ */ jsxs("div", {
1054
+ className,
1055
+ role: "alert",
1056
+ "data-testid": "approvals-load-error",
1057
+ children: [/* @__PURE__ */ jsxs("div", {
1058
+ className: "flex flex-wrap items-center gap-3",
1059
+ children: [/* @__PURE__ */ jsx("p", {
1060
+ className: "text-sm text-destructive",
1061
+ children: message
1062
+ }), /* @__PURE__ */ jsx(Button$1, {
1063
+ variant: "outline",
1064
+ size: "sm",
1065
+ onClick: onRetry,
1066
+ children: tr("fluidgrids.humanResponse.retry", "Retry")
1067
+ })]
1068
+ }), /* @__PURE__ */ jsx(TechnicalDetails, {
1069
+ className: "mt-1",
1070
+ children: /* @__PURE__ */ jsx("p", {
1071
+ className: "break-words font-mono text-xs text-text-secondary",
1072
+ children: detail
1073
+ })
1074
+ })]
1075
+ });
1076
+ }
1077
+ /** A list that failed to load: today's line, or (v2) plain words with Retry. */
1078
+ function InboxError({ error, plain, oldText, plainText, className, onRetry }) {
1079
+ if (!error) return null;
1080
+ if (!plain) return /* @__PURE__ */ jsx("p", {
1081
+ className,
1082
+ role: "alert",
1083
+ children: oldText(error.message)
1084
+ });
1085
+ return /* @__PURE__ */ jsx(InboxLoadError, {
1086
+ className: "mb-4",
1087
+ message: plainText,
1088
+ detail: error.message,
1089
+ onRetry
1090
+ });
1091
+ }
1092
+ /** "Waiting for a response": the asks for a person, with their pager. */
1093
+ function HumanRequestsSection({ items, totalCount, offset, onOffsetChange, onAnswered, labelsFor }) {
1094
+ const tr = useTr();
1095
+ return /* @__PURE__ */ jsxs("section", {
1096
+ className: "mb-8",
1097
+ "data-testid": "human-requests-section",
1098
+ "data-tour": "fluidgrids-approvals-human",
1099
+ children: [
1100
+ /* @__PURE__ */ jsx("h2", {
1101
+ className: "mb-1 text-lg font-semibold text-text-primary",
1102
+ children: tr("fluidgrids.humanResponse.inboxHeading", "Waiting for a response")
1103
+ }),
1104
+ /* @__PURE__ */ jsx("p", {
1105
+ className: "mb-3 text-xs text-text-secondary",
1106
+ children: tr("fluidgrids.humanResponse.inboxSubtitle", "Workflows paused on a person — approve, decline or answer to let them continue.")
1107
+ }),
1108
+ /* @__PURE__ */ jsx("div", {
1109
+ className: "grid grid-cols-1 gap-4 lg:grid-cols-2",
1110
+ children: items.map((request) => /* @__PURE__ */ jsx(HumanRequestCard, {
1111
+ request,
1112
+ onAnswered,
1113
+ ...labelsFor?.(request, request.nodeId)
1114
+ }, request.id))
1115
+ }),
1116
+ /* @__PURE__ */ jsx(InboxPager, {
1117
+ offset,
1118
+ shown: items.length,
1119
+ total: totalCount,
1120
+ onOffsetChange
1121
+ })
1122
+ ]
1123
+ });
1124
+ }
1125
+ /** A role that may not read tool approvals (BOFF-10104). */
1126
+ function ToolApprovalsNoAccess() {
1127
+ const tr = useTr();
1128
+ return /* @__PURE__ */ jsx(Card, {
1129
+ className: "mb-6 border border-border-default bg-surface",
1130
+ "data-testid": "tool-approval-no-access",
1131
+ children: /* @__PURE__ */ jsxs(CardContent, {
1132
+ className: "flex items-start gap-3 py-4",
1133
+ children: [/* @__PURE__ */ jsx(Icon, {
1134
+ icon: "mdi:lock-outline",
1135
+ width: 20,
1136
+ className: "mt-0.5 shrink-0 text-text-secondary"
1137
+ }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
1138
+ className: "text-sm font-medium text-text-primary",
1139
+ children: tr("fluidgrids.toolApproval.noAccessTitle", "You can't review AI Agent tool calls")
1140
+ }), /* @__PURE__ */ jsx("p", {
1141
+ className: "mt-1 text-xs text-text-secondary",
1142
+ children: tr("fluidgrids.toolApproval.noAccessSubtitle", "Your role doesn't include permission to read tool approval requests. Ask a workspace admin if you need access.")
1143
+ })] })]
1144
+ })
1145
+ });
1146
+ }
1147
+ /** Nothing waiting: today's words, or (v2) words for both kinds of ask. */
1148
+ function ApprovalsEmptyState({ plain }) {
1149
+ const tr = useTr();
1150
+ return /* @__PURE__ */ jsx("div", {
1151
+ "data-tour": "fluidgrids-approvals-empty",
1152
+ "data-testid": "approvals-empty",
1153
+ children: /* @__PURE__ */ jsx(EmptyState, {
1154
+ kind: "all-done",
1155
+ size: "page",
1156
+ icon: /* @__PURE__ */ jsx(Icon, {
1157
+ icon: "mdi:shield-check-outline",
1158
+ width: 32,
1159
+ className: "text-text-secondary"
1160
+ }),
1161
+ title: tr("fluidgrids.toolApproval.emptyTitle", "Nothing waiting for approval"),
1162
+ description: plain ? tr("fluidgrids.approvals.emptyHint", "When a workflow needs your OK or an answer from you, it shows up here.") : tr("fluidgrids.toolApproval.emptySubtitle", "Runs will appear here when an AI Agent with tool approval enabled proposes a tool call.")
1163
+ })
1164
+ });
1165
+ }
1166
+ /** The AI assistant's actions: the counter, the cards and their pager. */
1167
+ function ToolApprovalsList({ items, totalCount, offset, onOffsetChange, onDecided, labelsFor }) {
1168
+ const tr = useTr();
1169
+ const plain = labelsFor !== void 0;
1170
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1171
+ items.length > 0 && /* @__PURE__ */ jsx("div", {
1172
+ className: "mb-3 text-xs text-text-secondary",
1173
+ "data-testid": "tool-approval-count",
1174
+ children: plain ? tr("fluidgrids.toolApproval.count", "{{count}} waiting for you", {
1175
+ count: totalCount,
1176
+ total: totalCount
1177
+ }) : tr("fluidgrids.toolApproval.count", "{{count}} pending ({{total}} total)", {
1178
+ count: items.length,
1179
+ total: totalCount
1180
+ })
1181
+ }),
1182
+ /* @__PURE__ */ jsx("div", {
1183
+ className: "grid grid-cols-1 gap-4 lg:grid-cols-2",
1184
+ "data-tour": "fluidgrids-approvals-tools",
1185
+ children: items.map((request) => /* @__PURE__ */ jsx(ToolApprovalCard, {
1186
+ request,
1187
+ onDecided,
1188
+ ...labelsFor?.(request, request.nodeId)
1189
+ }, request.id))
1190
+ }),
1191
+ /* @__PURE__ */ jsx(InboxPager, {
1192
+ offset,
1193
+ shown: items.length,
1194
+ total: totalCount,
1195
+ onOffsetChange,
1196
+ "data-testid": "tool-approval-pager"
1197
+ })
1198
+ ] });
1199
+ }
1200
+ const HUMAN_PAGE_SIZE = 50;
1201
+ function ApprovalInboxPage() {
1202
+ const tr = useTr();
1203
+ const v2 = useNavigationV2();
1204
+ const loadingSystem = useLoadingSystem();
1205
+ const navigate = useNavigate();
1206
+ const { allowed: canReadToolApprovals, isLoading: permissionsLoading } = useFluidGridsPermission(FLUIDGRIDS_PERMISSIONS.TOOL_APPROVAL_REQUEST_READ);
1207
+ const [toolOffset, setToolOffset] = useState(0);
1208
+ const { items, totalCount, loading, error, forbidden, refetch } = usePendingToolApprovals({
1209
+ enabled: canReadToolApprovals,
1210
+ limit: 50,
1211
+ offset: toolOffset
1212
+ });
1213
+ const toolPageOffset = clampPageOffset(toolOffset, totalCount);
1214
+ if (toolPageOffset !== toolOffset && !loading) setToolOffset(toolPageOffset);
1215
+ const toolsForbidden = forbidden && !permissionsLoading;
1216
+ const [humanOffset, setHumanOffset] = useState(0);
1217
+ const human = usePendingHumanRequests({
1218
+ limit: HUMAN_PAGE_SIZE,
1219
+ offset: humanOffset
1220
+ });
1221
+ const humanTotal = human.totalCount;
1222
+ useEffect(() => {
1223
+ if (humanOffset > 0 && humanOffset >= humanTotal) setHumanOffset(Math.max(0, Math.ceil(humanTotal / HUMAN_PAGE_SIZE) - 1) * HUMAN_PAGE_SIZE);
1224
+ }, [humanOffset, humanTotal]);
1225
+ const { allowed: canReadWorkflows } = useFluidGridsPermission(FLUIDGRIDS_PERMISSIONS.WORKFLOW_READ);
1226
+ const workflowRefs = [...human.items.map((request) => ({ workflowKey: request.workflowKey })), ...(toolsForbidden ? [] : items).map((request) => ({
1227
+ workflowKey: request.workflowKey,
1228
+ workflowId: request.workflowId
1229
+ }))];
1230
+ const workflows = useApprovalWorkflows(workflowRefs, v2 && canReadWorkflows);
1231
+ const labelsFor = (ref, nodeId) => {
1232
+ const labels = approvalLabels(workflows.get(approvalWorkflowRefKey(ref)), ref.workflowKey, nodeId);
1233
+ return {
1234
+ workflowName: labels.workflow,
1235
+ stepName: labels.step
1236
+ };
1237
+ };
1238
+ const toolsWaiting = (loading || permissionsLoading) && items.length === 0;
1239
+ const waiting = toolsWaiting || human.loading && human.items.length === 0;
1240
+ const inbox = /* @__PURE__ */ jsxs(Fragment$1, { children: [
1241
+ /* @__PURE__ */ jsx(InboxError, {
1242
+ error,
1243
+ plain: v2,
1244
+ className: "text-sm text-destructive",
1245
+ oldText: (message) => tr("fluidgrids.toolApproval.loadFailed", "Failed to load pending approvals: {{message}}", { message }),
1246
+ plainText: tr("fluidgrids.toolApproval.loadFailedPlain", "We couldn't load the actions waiting for your OK. Try again in a moment."),
1247
+ onRetry: () => void refetch()
1248
+ }),
1249
+ human.items.length > 0 && /* @__PURE__ */ jsx(HumanRequestsSection, {
1250
+ items: human.items,
1251
+ totalCount: human.totalCount,
1252
+ offset: humanOffset,
1253
+ onOffsetChange: setHumanOffset,
1254
+ onAnswered: human.refetch,
1255
+ labelsFor: v2 ? labelsFor : void 0
1256
+ }),
1257
+ /* @__PURE__ */ jsx(InboxError, {
1258
+ error: human.error,
1259
+ plain: v2,
1260
+ className: "mb-4 text-sm text-destructive",
1261
+ oldText: (message) => tr("fluidgrids.humanResponse.loadFailed", "Failed to load requests waiting for a response: {{message}}", { message }),
1262
+ plainText: tr("fluidgrids.humanResponse.loadFailedPlain", "We couldn't load the requests waiting for your answer. Try again in a moment."),
1263
+ onRetry: () => void human.refetch()
1264
+ }),
1265
+ toolsForbidden && /* @__PURE__ */ jsx(ToolApprovalsNoAccess, {}),
1266
+ !loading && !permissionsLoading && !toolsForbidden && !error && !human.loading && !human.error && items.length === 0 && human.items.length === 0 && /* @__PURE__ */ jsx(ApprovalsEmptyState, { plain: v2 }),
1267
+ !toolsForbidden && /* @__PURE__ */ jsx(ToolApprovalsList, {
1268
+ items,
1269
+ totalCount,
1270
+ offset: toolOffset,
1271
+ onOffsetChange: setToolOffset,
1272
+ onDecided: refetch,
1273
+ labelsFor: v2 ? labelsFor : void 0
1274
+ }),
1275
+ toolsForbidden && /* @__PURE__ */ jsx("div", {
1276
+ className: "grid grid-cols-1 gap-4 lg:grid-cols-2",
1277
+ "data-tour": "fluidgrids-approvals-tools"
1278
+ })
1279
+ ] });
1280
+ return /* @__PURE__ */ jsxs("div", {
1281
+ className: "p-4 sm:p-6 bg-surface-canvas min-h-screen",
1282
+ children: [/* @__PURE__ */ jsx(PageIntro, {
1283
+ "data-tour": "fluidgrids-approvals-header",
1284
+ title: tr("fluidgrids.approvals.pageTitle", "Approvals"),
1285
+ subtitle: tr("fluidgrids.approvals.pageSubtitle", v2 ? "Requests from your workflows waiting for a person, and actions your AI assistant wants to take" : "Requests from your workflows waiting for a person, and AI Agent tool calls waiting for a decision"),
1286
+ docsLink: /* @__PURE__ */ jsx(FluidGridsDocsLink, {
1287
+ topic: "approvals",
1288
+ className: "mt-1"
1289
+ }),
1290
+ actions: /* @__PURE__ */ jsxs(Button$1, {
1291
+ variant: "outline",
1292
+ onClick: () => navigate("../runs"),
1293
+ children: [/* @__PURE__ */ jsx(Icon, {
1294
+ icon: "mdi:arrow-left",
1295
+ className: "mr-2",
1296
+ width: 16
1297
+ }), tr("fluidgrids.toolApproval.backToRuns", "Back to Runs")]
1298
+ })
1299
+ }), loadingSystem ? /* @__PURE__ */ jsx(LoadRegion, {
1300
+ loading: waiting,
1301
+ skeleton: /* @__PURE__ */ jsx(ApprovalsListSkeleton, {}),
1302
+ label: tr("fluidgrids.toolApproval.loadingRegion", "Loading approvals"),
1303
+ doneLabel: tr("fluidgrids.toolApproval.loadedRegion", "Approvals loaded"),
1304
+ children: inbox
1305
+ }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [toolsWaiting && /* @__PURE__ */ jsx("p", {
1306
+ className: "text-text-secondary text-sm",
1307
+ children: tr("fluidgrids.toolApproval.loading", "Loading…")
1308
+ }), inbox] })]
1309
+ });
1310
+ }
1311
+
1312
+ export { HumanRequestCard as a, usePendingToolApprovals as i, ApprovalInboxPage_exports as n, useDecideToolApproval as r, ApprovalInboxPage as t };