@hotmeshio/long-tail 0.9.6 → 0.10.0
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.
- package/README.md +22 -93
- package/build/api/escalations/helpers.d.ts +27 -0
- package/build/api/escalations/helpers.js +34 -0
- package/build/api/escalations/list.d.ts +2 -0
- package/build/api/escalations/list.js +13 -3
- package/build/api/escalations/resolve.js +16 -4
- package/build/routes/escalations/list.js +2 -0
- package/build/services/escalation/crud.d.ts +1 -1
- package/build/services/escalation/crud.js +6 -2
- package/build/services/escalation/facet-sql.d.ts +8 -1
- package/build/services/escalation/facet-sql.js +29 -1
- package/build/types/facets.d.ts +9 -0
- package/dashboard/dist/assets/{AdminDashboard-DXFIKXO3.js → AdminDashboard-DQS74RL0.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-DXFIKXO3.js.map → AdminDashboard-DQS74RL0.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-CQE1mfjk.js → AgentConfigPage-CSMCrFR4.js} +7 -7
- package/dashboard/dist/assets/{AgentConfigPage-CQE1mfjk.js.map → AgentConfigPage-CSMCrFR4.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-DM59ozP_.js → AgentDetailPage-CDiopQ7D.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-DM59ozP_.js.map → AgentDetailPage-CDiopQ7D.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-DSK2uXI5.js → AgentsPage-CyUXe9n4.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-DSK2uXI5.js.map → AgentsPage-CyUXe9n4.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-AiuiLcz-.js +2 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-AiuiLcz-.js.map +1 -0
- package/dashboard/dist/assets/BotPicker-BuCGvEed.js +2 -0
- package/dashboard/dist/assets/BotPicker-BuCGvEed.js.map +1 -0
- package/dashboard/dist/assets/CapabilitiesPage-nTv4STcG.js +2 -0
- package/dashboard/dist/assets/{CapabilitiesPage-DFQryGBj.js.map → CapabilitiesPage-nTv4STcG.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-B7-d5O_x.js → CollapsibleSection-CkOks9Cf.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-B7-d5O_x.js.map → CollapsibleSection-CkOks9Cf.js.map} +1 -1
- package/dashboard/dist/assets/{ConfirmDeleteModal-D9_1b4MW.js → ConfirmDeleteModal-C0x0HcHX.js} +2 -2
- package/dashboard/dist/assets/{ConfirmDeleteModal-D9_1b4MW.js.map → ConfirmDeleteModal-C0x0HcHX.js.map} +1 -1
- package/dashboard/dist/assets/CountdownTimer-DdKL8Ryt.js +2 -0
- package/dashboard/dist/assets/CountdownTimer-DdKL8Ryt.js.map +1 -0
- package/dashboard/dist/assets/CredentialsPage-BwA7k9Cb.js +2 -0
- package/dashboard/dist/assets/{CredentialsPage-BWVgxRpZ.js.map → CredentialsPage-BwA7k9Cb.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-DNnyNqXH.js → CronLabel-jC_i-Lh9.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-DNnyNqXH.js.map → CronLabel-jC_i-Lh9.js.map} +1 -1
- package/dashboard/dist/assets/{CustomDurationPicker-SNsQZL_U.js → CustomDurationPicker-F6bR2Q5A.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-SNsQZL_U.js.map → CustomDurationPicker-F6bR2Q5A.js.map} +1 -1
- package/dashboard/dist/assets/{DropZone-C1TpkVQG.js → DropZone-zxH-9B8c.js} +2 -2
- package/dashboard/dist/assets/{DropZone-C1TpkVQG.js.map → DropZone-zxH-9B8c.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-C4r0IvUt.js → ElapsedCell-DZ3RTZFc.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-C4r0IvUt.js.map → ElapsedCell-DZ3RTZFc.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListSchemaPage-D8Ec8Zhj.js → EscalationListSchemaPage-CaMydHIO.js} +3 -3
- package/dashboard/dist/assets/{EscalationListSchemaPage-D8Ec8Zhj.js.map → EscalationListSchemaPage-CaMydHIO.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationSchemaPage-BmEv7qU2.js → EscalationSchemaPage-BlMx2WE6.js} +3 -3
- package/dashboard/dist/assets/{EscalationSchemaPage-BmEv7qU2.js.map → EscalationSchemaPage-BlMx2WE6.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-DkIy025e.js → EscalationsOverview-DcMkbiSo.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-DkIy025e.js.map → EscalationsOverview-DcMkbiSo.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-Co4RYeKO.js → EventTable-CuZ2Q_wH.js} +2 -2
- package/dashboard/dist/assets/{EventTable-Co4RYeKO.js.map → EventTable-CuZ2Q_wH.js.map} +1 -1
- package/dashboard/dist/assets/FilterBar-B5Vk5tBF.js +2 -0
- package/dashboard/dist/assets/FilterBar-B5Vk5tBF.js.map +1 -0
- package/dashboard/dist/assets/{GraphInvokePage-b7ukMy0z.js → GraphInvokePage-CXElQqcV.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-b7ukMy0z.js.map → GraphInvokePage-CXElQqcV.js.map} +1 -1
- package/dashboard/dist/assets/HomePage-DcWfjZA-.js +2 -0
- package/dashboard/dist/assets/HomePage-DcWfjZA-.js.map +1 -0
- package/dashboard/dist/assets/ListToolbar-Dmd1UiM-.js +2 -0
- package/dashboard/dist/assets/{ListToolbar-DDG6DXVF.js.map → ListToolbar-Dmd1UiM-.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-P2o3b3mi.js → McpOverview-Cul2LFEw.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-P2o3b3mi.js.map → McpOverview-Cul2LFEw.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-C2CeBLb0.js → McpQueryDetailPage-BVlQ0WBa.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-C2CeBLb0.js.map → McpQueryDetailPage-BVlQ0WBa.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-D_N-3lp0.js → McpQueryPage-B7PmO_V-.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-D_N-3lp0.js.map → McpQueryPage-B7PmO_V-.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-uDw3MWR_.js → McpRunDetailPage-B1RhxxlU.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-uDw3MWR_.js.map → McpRunDetailPage-B1RhxxlU.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-CDTUxghb.js → McpRunsPage-DlSrpxiv.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-CDTUxghb.js.map → McpRunsPage-DlSrpxiv.js.map} +1 -1
- package/dashboard/dist/assets/Modal-D4afnAjc.js +2 -0
- package/dashboard/dist/assets/Modal-D4afnAjc.js.map +1 -0
- package/dashboard/dist/assets/{NamespacePill--ikKtMvx.js → NamespacePill-BQNMfY0m.js} +2 -2
- package/dashboard/dist/assets/{NamespacePill--ikKtMvx.js.map → NamespacePill-BQNMfY0m.js.map} +1 -1
- package/dashboard/dist/assets/OperationsPage-vm_ByX41.js +2 -0
- package/dashboard/dist/assets/OperationsPage-vm_ByX41.js.map +1 -0
- package/dashboard/dist/assets/OperatorDashboard-zviIxH-0.js +2 -0
- package/dashboard/dist/assets/{OperatorDashboard-CVRD8nQH.js.map → OperatorDashboard-zviIxH-0.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeader-CiFhzGc0.js → PageHeader-BIY1YvKR.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-CiFhzGc0.js.map → PageHeader-BIY1YvKR.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-_zOnWAhq.js → PageHeaderWithStats-TUyglVW0.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-_zOnWAhq.js.map → PageHeaderWithStats-TUyglVW0.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-Dt6PAK04.js → ProcessDetailPage-txiMHbMI.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-Dt6PAK04.js.map → ProcessDetailPage-txiMHbMI.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-CMkjASgs.js → ProcessesListPage-CRttlU3L.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-CMkjASgs.js.map → ProcessesListPage-CRttlU3L.js.map} +1 -1
- package/dashboard/dist/assets/RoleDetailPage-DBIl_mhK.js +8 -0
- package/dashboard/dist/assets/RoleDetailPage-DBIl_mhK.js.map +1 -0
- package/dashboard/dist/assets/RolePill-4LO_CuO3.js +2 -0
- package/dashboard/dist/assets/RolePill-4LO_CuO3.js.map +1 -0
- package/dashboard/dist/assets/RolesPage-DzrSv6m-.js +2 -0
- package/dashboard/dist/assets/{RolesPage-DtHIjDss.js.map → RolesPage-DzrSv6m-.js.map} +1 -1
- package/dashboard/dist/assets/RunAsSelector-CiLjlmIE.js +2 -0
- package/dashboard/dist/assets/{RunAsSelector-C198CpFs.js.map → RunAsSelector-CiLjlmIE.js.map} +1 -1
- package/dashboard/dist/assets/{SlidePanel-BcWKelpn.js → SlidePanel-DK4sWXmp.js} +2 -2
- package/dashboard/dist/assets/{SlidePanel-BcWKelpn.js.map → SlidePanel-DK4sWXmp.js.map} +1 -1
- package/dashboard/dist/assets/StickyPagination-Di6b2GDE.js +2 -0
- package/dashboard/dist/assets/{StickyPagination-eZ6WhMrL.js.map → StickyPagination-Di6b2GDE.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-7xq_dddO.js → StreamMessageDetail-BbkU45X_.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-7xq_dddO.js.map → StreamMessageDetail-BbkU45X_.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-Yg5QT0nI.js → SwimlaneTimeline-BzsvdstG.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-Yg5QT0nI.js.map → SwimlaneTimeline-BzsvdstG.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-BaFJCq9A.js → TagInput-CK-JhBG2.js} +2 -2
- package/dashboard/dist/assets/{TagInput-BaFJCq9A.js.map → TagInput-CK-JhBG2.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-Wc3AFnqs.js → TaskDetailPage-Biikk9o_.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-Wc3AFnqs.js.map → TaskDetailPage-Biikk9o_.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-D9e16qkU.js → TaskQueuePill-C_Vo2Clc.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-D9e16qkU.js.map → TaskQueuePill-C_Vo2Clc.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-V-1J_B_L.js → TasksListPage-t9WAft9-.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-V-1J_B_L.js.map → TasksListPage-t9WAft9-.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-XdHghs5F.js → TimeAgo-I7X6jdne.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-XdHghs5F.js.map → TimeAgo-I7X6jdne.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-BrzctPWT.js → TimestampCell-Cex9nr0t.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-BrzctPWT.js.map → TimestampCell-Cex9nr0t.js.map} +1 -1
- package/dashboard/dist/assets/ToolPill-BCi101Jh.js +2 -0
- package/dashboard/dist/assets/{ToolPill-Enc3nyic.js.map → ToolPill-BCi101Jh.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-CGfGUsaq.js → ToolTestPanel--MGaDY-1.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-CGfGUsaq.js.map → ToolTestPanel--MGaDY-1.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-CcAgD2k5.js → TopicDetailPage-B8pHHweA.js} +3 -3
- package/dashboard/dist/assets/{TopicDetailPage-CcAgD2k5.js.map → TopicDetailPage-B8pHHweA.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-BOQG7s4P.js → TopicsPage-tiOEQz2m.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-BOQG7s4P.js.map → TopicsPage-tiOEQz2m.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-BzxR0Ihp.js → UserName-Cdhyuv5K.js} +2 -2
- package/dashboard/dist/assets/{UserName-BzxR0Ihp.js.map → UserName-Cdhyuv5K.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-hRsDMByj.js → WorkflowExecutionPage-DD1BKj5k.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-hRsDMByj.js.map → WorkflowExecutionPage-DD1BKj5k.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowPill-DHxrAkp3.js +2 -0
- package/dashboard/dist/assets/{WorkflowPill-S6VV2Eax.js.map → WorkflowPill-DHxrAkp3.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-ky0ulsUe.js → WorkflowsDashboard-BeWjDHYW.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-ky0ulsUe.js.map → WorkflowsDashboard-BeWjDHYW.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-CzRJUV58.js → WorkflowsOverview-CkI-Pmj7.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-CzRJUV58.js.map → WorkflowsOverview-CkI-Pmj7.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-Beqzy9Ph.js → YamlWorkflowDetailPage-BQnO8-PQ.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-Beqzy9Ph.js.map → YamlWorkflowDetailPage-BQnO8-PQ.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-BzBUU2ug.js → YamlWorkflowsPage-DjmNTQ5r.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-BzBUU2ug.js.map → YamlWorkflowsPage-DjmNTQ5r.js.map} +1 -1
- package/dashboard/dist/assets/{agents-Dlu4m6jy.js → agents-2DaoprdB.js} +2 -2
- package/dashboard/dist/assets/{agents-Dlu4m6jy.js.map → agents-2DaoprdB.js.map} +1 -1
- package/dashboard/dist/assets/{bots-C4G5U-6Q.js → bots-BdwLwMUg.js} +2 -2
- package/dashboard/dist/assets/{bots-C4G5U-6Q.js.map → bots-BdwLwMUg.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-BSFP_boq.js → capabilities-BsuFeK9J.js} +2 -2
- package/dashboard/dist/assets/{capabilities-BSFP_boq.js.map → capabilities-BsuFeK9J.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-qCqoP2ZV.js → controlplane-CxKOrcFO.js} +2 -2
- package/dashboard/dist/assets/{controlplane-qCqoP2ZV.js.map → controlplane-CxKOrcFO.js.map} +1 -1
- package/dashboard/dist/assets/escalation-columns-y5SQ2Ulh.js +2 -0
- package/dashboard/dist/assets/escalation-columns-y5SQ2Ulh.js.map +1 -0
- package/dashboard/dist/assets/index-BC1NxetR.js +2 -0
- package/dashboard/dist/assets/{index-C0KklOM4.js.map → index-BC1NxetR.js.map} +1 -1
- package/dashboard/dist/assets/index-BVZINC_p.js +2 -0
- package/dashboard/dist/assets/{index-QL26JxBF.js.map → index-BVZINC_p.js.map} +1 -1
- package/dashboard/dist/assets/{index-CGVqW6MI.js → index-BXbt5NHG.js} +2 -2
- package/dashboard/dist/assets/{index-CGVqW6MI.js.map → index-BXbt5NHG.js.map} +1 -1
- package/dashboard/dist/assets/{index-CuC_mNNA.js → index-BYEkfaUq.js} +2 -2
- package/dashboard/dist/assets/{index-CuC_mNNA.js.map → index-BYEkfaUq.js.map} +1 -1
- package/dashboard/dist/assets/index-B_68lp-B.js +5 -0
- package/dashboard/dist/assets/index-B_68lp-B.js.map +1 -0
- package/dashboard/dist/assets/index-BeivyVtT.css +1 -0
- package/dashboard/dist/assets/{index-DUhettdV.js → index-CRBXgMsh.js} +2 -2
- package/dashboard/dist/assets/{index-DUhettdV.js.map → index-CRBXgMsh.js.map} +1 -1
- package/dashboard/dist/assets/{index-BObWYPxd.js → index-Cfq3UKd8.js} +2 -2
- package/dashboard/dist/assets/{index-BObWYPxd.js.map → index-Cfq3UKd8.js.map} +1 -1
- package/dashboard/dist/assets/{index-D_FNaSoe.js → index-DJ5nhcGB.js} +2 -2
- package/dashboard/dist/assets/{index-D_FNaSoe.js.map → index-DJ5nhcGB.js.map} +1 -1
- package/dashboard/dist/assets/{index-DCTWUswT.js → index-DVLBkcoD.js} +4 -4
- package/dashboard/dist/assets/index-DVLBkcoD.js.map +1 -0
- package/dashboard/dist/assets/index-DjI2AUbn.js +5 -0
- package/dashboard/dist/assets/{index-DWSNtg28.js.map → index-DjI2AUbn.js.map} +1 -1
- package/dashboard/dist/assets/{index-Dzhn5MDY.js → index-DyS2DHqy.js} +2 -2
- package/dashboard/dist/assets/{index-Dzhn5MDY.js.map → index-DyS2DHqy.js.map} +1 -1
- package/dashboard/dist/assets/index-H6Vp-gPG.js +2 -0
- package/dashboard/dist/assets/{index-BtEWQNcP.js.map → index-H6Vp-gPG.js.map} +1 -1
- package/dashboard/dist/assets/index-YPLTjeli.js +63 -0
- package/dashboard/dist/assets/index-YPLTjeli.js.map +1 -0
- package/dashboard/dist/assets/{knowledge-CTdgLX5j.js → knowledge-CLnYcq0Y.js} +2 -2
- package/dashboard/dist/assets/{knowledge-CTdgLX5j.js.map → knowledge-CLnYcq0Y.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-BEsMr678.js → mcp-C1-iXkg7.js} +2 -2
- package/dashboard/dist/assets/{mcp-BEsMr678.js.map → mcp-C1-iXkg7.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-CmamHKIR.js → mcp-query-DcyDxuGY.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-CmamHKIR.js.map → mcp-query-DcyDxuGY.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-taOXA2-y.js → pipelines-BvG5D6bV.js} +2 -2
- package/dashboard/dist/assets/{pipelines-taOXA2-y.js.map → pipelines-BvG5D6bV.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-DEaDdyBh.js → tasks-qwh8q5q7.js} +2 -2
- package/dashboard/dist/assets/{tasks-DEaDdyBh.js.map → tasks-qwh8q5q7.js.map} +1 -1
- package/dashboard/dist/assets/{topics-2qRx68Ft.js → topics-MLKKA-Ql.js} +2 -2
- package/dashboard/dist/assets/{topics-2qRx68Ft.js.map → topics-MLKKA-Ql.js.map} +1 -1
- package/dashboard/dist/assets/{useEventHooks-oXjfKrbI.js → useEventHooks-B8uNFB-l.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-oXjfKrbI.js.map → useEventHooks-B8uNFB-l.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-YdT1Zouk.js → useNamespace-DjZmztJM.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-YdT1Zouk.js.map → useNamespace-DjZmztJM.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-Bt-RZ7Zl.js → useYamlActivityEvents-DIvK20uI.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-Bt-RZ7Zl.js.map → useYamlActivityEvents-DIvK20uI.js.map} +1 -1
- package/dashboard/dist/assets/{users-DbX5JZ_w.js → users-CVjajeDg.js} +2 -2
- package/dashboard/dist/assets/{users-DbX5JZ_w.js.map → users-CVjajeDg.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-DPmIjhZB.js → vendor-icons-Qk9qLjF_.js} +131 -126
- package/dashboard/dist/assets/vendor-icons-Qk9qLjF_.js.map +1 -0
- package/dashboard/dist/assets/{workflows-acMcPTC5.js → workflows-BziTcJNq.js} +2 -2
- package/dashboard/dist/assets/{workflows-acMcPTC5.js.map → workflows-BziTcJNq.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-D6kzrMYx.js → yaml-workflows-Dr-ZcE_0.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-D6kzrMYx.js.map → yaml-workflows-Dr-ZcE_0.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/docs/dashboard.md +2 -2
- package/docs/faceted-routing.md +9 -0
- package/docs/hitl/escalation.md +206 -0
- package/docs/hitl/form.md +162 -0
- package/docs/hitl/iframe.md +170 -0
- package/docs/hitl/resolution.md +166 -0
- package/docs/hitl/roles.md +72 -0
- package/docs/hitl/x-lt-layout.md +167 -0
- package/docs/hitl/x-lt-list-schema.md +75 -0
- package/docs/hitl/x-lt-show-if.md +128 -0
- package/docs/hitl/x-lt-validation.md +168 -0
- package/docs/hitl/x-lt-widget.md +152 -0
- package/docs/hitl-guide.md +83 -1315
- package/docs/iam.md +1 -1
- package/package.json +2 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-BVgMtftp.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-BVgMtftp.js.map +0 -1
- package/dashboard/dist/assets/BotPicker-DJ0YYKZA.js +0 -2
- package/dashboard/dist/assets/BotPicker-DJ0YYKZA.js.map +0 -1
- package/dashboard/dist/assets/CapabilitiesPage-DFQryGBj.js +0 -2
- package/dashboard/dist/assets/CountdownTimer-BTJmh4Xw.js +0 -2
- package/dashboard/dist/assets/CountdownTimer-BTJmh4Xw.js.map +0 -1
- package/dashboard/dist/assets/CredentialsPage-BWVgxRpZ.js +0 -2
- package/dashboard/dist/assets/FilterBar-DDIn8TOs.js +0 -2
- package/dashboard/dist/assets/FilterBar-DDIn8TOs.js.map +0 -1
- package/dashboard/dist/assets/HomePage-K0U3yMdU.js +0 -2
- package/dashboard/dist/assets/HomePage-K0U3yMdU.js.map +0 -1
- package/dashboard/dist/assets/ListToolbar-DDG6DXVF.js +0 -2
- package/dashboard/dist/assets/Modal-CSrxpXeM.js +0 -2
- package/dashboard/dist/assets/Modal-CSrxpXeM.js.map +0 -1
- package/dashboard/dist/assets/OperationsPage-Daah4pNk.js +0 -2
- package/dashboard/dist/assets/OperationsPage-Daah4pNk.js.map +0 -1
- package/dashboard/dist/assets/OperatorDashboard-CVRD8nQH.js +0 -2
- package/dashboard/dist/assets/RoleDetailPage-6H1AY6sK.js +0 -8
- package/dashboard/dist/assets/RoleDetailPage-6H1AY6sK.js.map +0 -1
- package/dashboard/dist/assets/RolePill-CUIJSgRq.js +0 -2
- package/dashboard/dist/assets/RolePill-CUIJSgRq.js.map +0 -1
- package/dashboard/dist/assets/RolesPage-DtHIjDss.js +0 -2
- package/dashboard/dist/assets/RunAsSelector-C198CpFs.js +0 -2
- package/dashboard/dist/assets/StickyPagination-eZ6WhMrL.js +0 -2
- package/dashboard/dist/assets/ToolPill-Enc3nyic.js +0 -2
- package/dashboard/dist/assets/WorkflowPill-S6VV2Eax.js +0 -2
- package/dashboard/dist/assets/escalation-columns-Ck7ZOd7Z.js +0 -2
- package/dashboard/dist/assets/escalation-columns-Ck7ZOd7Z.js.map +0 -1
- package/dashboard/dist/assets/index-BtEWQNcP.js +0 -2
- package/dashboard/dist/assets/index-C0KklOM4.js +0 -2
- package/dashboard/dist/assets/index-CY3hpJR-.js +0 -5
- package/dashboard/dist/assets/index-CY3hpJR-.js.map +0 -1
- package/dashboard/dist/assets/index-DCTWUswT.js.map +0 -1
- package/dashboard/dist/assets/index-DWSNtg28.js +0 -5
- package/dashboard/dist/assets/index-DcQiD6OF.js +0 -63
- package/dashboard/dist/assets/index-DcQiD6OF.js.map +0 -1
- package/dashboard/dist/assets/index-QL26JxBF.js +0 -2
- package/dashboard/dist/assets/index-waKF7bKZ.css +0 -1
- package/dashboard/dist/assets/roles-BiUJAsVM.js +0 -2
- package/dashboard/dist/assets/roles-BiUJAsVM.js.map +0 -1
- package/dashboard/dist/assets/vendor-icons-DPmIjhZB.js.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{j as e,a as p,b as Rt}from"./vendor-query-B2UbickB.js";import{G as Te,M as Oe,J as ye,b as Re,m as $t,L as Mt,g as St,h as At,O as It,P as Ot,Q as Dt,u as Pt,o as Lt,l as Wt}from"./index-YPLTjeli.js";import{b as Ft,d as qt,H as Jt,g as rt,u as it,C as lt,m as Vt,c as ot,a as Ht}from"./CustomDurationPicker-F6bR2Q5A.js";import{P as Ut}from"./PageHeader-BIY1YvKR.js";import{L as zt}from"./ListToolbar-Dmd1UiM-.js";import{i as ct,C as Pe,m as Be}from"./CountdownTimer-DdKL8Ryt.js";import{u as Gt}from"./workflows-BziTcJNq.js";import{g as Yt}from"./useEventHooks-B8uNFB-l.js";import{S as Bt,a as Qt,P as X}from"./SlidePanel-DK4sWXmp.js";import{S as Xt}from"./StatusBadge-CEQMRmSQ.js";import{R as Kt}from"./RolePill-4LO_CuO3.js";import{C as te}from"./CopyableId-uot2mE_g.js";import{U as dt}from"./UserName-Cdhyuv5K.js";import{K as Zt,al as es,S as ts,am as ss,z as xt,i as ns,a6 as ut,U as as,aa as rs,ab as is,an as Qe,ao as ls,ap as Xe,aq as Ke,ar as os,X as cs}from"./vendor-icons-Qk9qLjF_.js";import{c as mt,L as ke,e as ds}from"./vendor-react-CXumBFUA.js";import{M as xs}from"./Modal-D4afnAjc.js";import"./constants-BHkpVaqx.js";import"./users-CVjajeDg.js";const we={pending:"#0ea5e9",claimed:"#f97316",resolved:"#16a34a",cancelled:"#ef4444"},$e=5;function Ze({pct:t,place:a,label:r,title:n,emphasis:s}){const i=e.jsx("span",{className:"w-px h-1.5 bg-slate-300","aria-hidden":!0}),d=e.jsx("span",{className:`whitespace-nowrap leading-none tabular-nums ${s?"text-text-secondary":"text-text-tertiary"}`,children:r});return e.jsx("div",{title:n,className:`absolute ${a==="above"?"bottom-0":"top-0"} flex flex-col items-center gap-0 -translate-x-1/2 cursor-help`,style:{left:`${t}%`},children:a==="above"?e.jsxs(e.Fragment,{children:[d,i]}):e.jsxs(e.Fragment,{children:[i,d]})})}function us({esc:t,className:a=""}){const r=new Date(t.created_at).getTime(),n=t.claimed_at?new Date(t.claimed_at).getTime():null,s=t.status==="resolved",i=t.status==="cancelled"||t.status==="expired",d=s||i,c=ct(t),o=!!n&&(c||d),l=s&&t.resolved_at?new Date(t.resolved_at).getTime():i?new Date(t.updated_at).getTime():Date.now(),x=Math.max(l-r,1),u=o&&n?Math.max(n-r,0):x,g=o&&n?Math.max(l-n,0):0,m=Math.min(100,Math.max(0,u/x*100)),f=o?Math.max(0,100-m):0,h=s?we.resolved:i?we.cancelled:we.claimed,j=s?"Resolved after":i?"Cancelled after":"In progress",S=Te(u),R=Te(x),I=s?`Resolved in ${R} total`:i?`Cancelled after ${R}`:`Open ${R} so far`,O=`Lifecycle bar: blue = time waiting to be claimed, ${s?"green":i?"red":"orange"} = ${j.toLowerCase()} the claim.`;return e.jsxs("div",{className:a,title:O,children:[e.jsx("div",{className:"relative h-3 text-[9px] font-mono",children:o&&e.jsx(Ze,{pct:m,place:"above",label:S,title:`Time to claim: ${S}`})}),e.jsxs("div",{className:"flex w-full rounded-full overflow-hidden",style:{height:$e,backgroundColor:"#e2e8f0"},title:O,children:[e.jsx("div",{style:{width:`${m}%`,minWidth:$e,backgroundColor:we.pending,opacity:.75},title:`Waiting ${S} — created → claimed`}),o&&f>0&&e.jsx("div",{style:{width:`${f}%`,minWidth:$e,backgroundColor:h,opacity:.75},title:`${j} ${Te(g)}`})]}),e.jsx("div",{className:"relative h-3 text-[9px] font-mono",children:e.jsx(Ze,{pct:100,place:"below",emphasis:!0,label:R,title:I})})]})}function ms({triage:t,payload:a}){const r=t.confidence??0,n=r>=.8?"text-status-success":r>=.5?"text-status-pending":"text-status-error",s=ps(t.originalData,a);return e.jsxs("div",{className:"space-y-5",children:[t.diagnosis&&e.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:t.diagnosis}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-text-tertiary",children:[t.tool_calls_made!=null&&e.jsxs("span",{children:[t.tool_calls_made," tool call",t.tool_calls_made!==1?"s":""]}),t.tool_calls_made!=null&&e.jsx("span",{className:"text-text-quaternary",children:"·"}),e.jsxs("span",{className:`font-medium ${n}`,children:[Math.round(r*100),"% confidence"]})]}),t.actions_taken&&t.actions_taken.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.actions_taken.map((i,d)=>e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px]
|
|
2
|
+
text-text-secondary`,children:[e.jsx("svg",{className:"w-3 h-3 text-status-success shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),i]},d))}),t.recommendation&&e.jsx("p",{className:"text-[11px] text-text-tertiary italic",children:t.recommendation}),s.length>0&&e.jsx("div",{className:"space-y-4 pt-2",children:s.map(i=>e.jsx(fs,{diff:i},i.key))})]})}function ps(t,a){if(!t)return[];const r=[];for(const n of Object.keys(t)){if(n.startsWith("_"))continue;const s=t[n],i=a[n];i!==void 0&&JSON.stringify(s)!==JSON.stringify(i)&&r.push({key:n,label:n.replace(/[_-]/g," "),original:s,corrected:i})}return r}function fs({diff:t}){const a=et(t.original),r=et(t.corrected);return a!==null&&r!==null?e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),e.jsx("p",{className:"text-sm text-text-tertiary leading-relaxed line-through decoration-text-tertiary/30",children:a})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),e.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:r})]})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),e.jsx("pre",{className:"text-xs text-text-tertiary font-mono whitespace-pre-wrap leading-relaxed",children:typeof t.original=="object"?JSON.stringify(t.original,null,2):String(t.original)})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),e.jsx("pre",{className:"text-xs text-text-primary font-mono whitespace-pre-wrap leading-relaxed",children:typeof t.corrected=="object"?JSON.stringify(t.corrected,null,2):String(t.corrected)})]})]})}function et(t){return t==null?"null":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):null}const z={HELP:"help",DETAILS:"details",TRIAGE:"triage",METADATA:"metadata",CONTEXT:"context",RECORD:"record",ERRORS:"errors"},pt="lt:escalation:panel:view";function hs(t){try{const a=localStorage.getItem(pt);if(a&&t.includes(a))return a}catch{}return z.HELP}const gs=new Set(["form_schema"]);function js({metadata:t,role:a}){const r=Object.entries(t??{}).filter(([n])=>!n.startsWith("_")&&!gs.has(n));return r.length===0?e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No metadata on this escalation."}):e.jsx("dl",{className:"space-y-3.5",children:r.map(([n,s])=>{const i=typeof s=="object"&&s!==null?JSON.stringify(s):String(s),d=Be(n,s,a),c=Be(n,s);return e.jsxs("div",{className:"group relative",children:[e.jsx("dt",{className:"text-[11px] font-medium text-text-secondary uppercase tracking-wide",children:n.replace(/[_-]/g," ")}),e.jsxs("dd",{className:"mt-0.5 flex items-center gap-1",children:[e.jsx("span",{className:"text-[12px] text-text-primary font-mono break-all flex-1",children:i}),e.jsx(ke,{to:d,title:`Filter this queue: ${n} = ${i}`,className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0 p-0.5 text-text-quaternary hover:text-accent",children:e.jsx(rs,{className:"w-3 h-3"})}),e.jsx(ke,{to:c,title:`Search all queues: ${n} = ${i}`,className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0 p-0.5 text-text-quaternary hover:text-accent",children:e.jsx(is,{className:"w-3 h-3"})})]})]},n)})})}function bs({esc:t,claimed:a,isTerminal:r,isBuilder:n,traceUrl:s}){return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("dl",{className:"space-y-3.5",children:[e.jsx(X,{label:"Status",children:e.jsx(Xt,{status:t.status})}),e.jsx(X,{label:"Assigned to Role",children:e.jsx(Kt,{role:t.role,size:"md"})}),e.jsxs(X,{label:"Priority",children:["P",t.priority]}),(a||r)&&t.assigned_to&&e.jsx(X,{label:"Claimed By",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-medium text-text-primary",children:[e.jsx(as,{className:"w-3 h-3 shrink-0 text-accent/75"}),e.jsx(dt,{userId:t.assigned_to})]})}),e.jsx(X,{label:"Created",children:e.jsx(Re,{date:t.created_at})}),(a||r)&&t.claimed_at&&e.jsx(X,{label:"Claimed",children:e.jsx(Re,{date:t.claimed_at})}),a&&!r&&t.assigned_until&&e.jsx(X,{label:"Time Remaining",children:e.jsx(Pe,{until:t.assigned_until})}),t.resolved_at&&e.jsx(X,{label:"Completed",children:e.jsx("span",{className:"text-status-success",children:e.jsx(Re,{date:t.resolved_at})})})]}),n&&e.jsxs(e.Fragment,{children:[e.jsx("hr",{className:"border-surface-border/60"}),e.jsxs("div",{className:"space-y-3.5",children:[e.jsx(te,{label:"Escalation ID",value:t.id}),t.task_id&&e.jsx(te,{label:"Task ID",value:t.task_id,href:`/workflows/tasks/detail/${t.task_id}`}),t.workflow_type&&e.jsx(te,{label:"Workflow Name",value:t.workflow_type,href:`/workflows/executions?entity=${encodeURIComponent(t.workflow_type)}`}),t.workflow_id&&e.jsx(te,{label:"Workflow ID",value:t.workflow_id,href:`/workflows/executions/${t.workflow_id}`}),t.task_queue&&e.jsx(te,{label:"Task Queue",value:t.task_queue,href:`/admin/controlplane?queue=${encodeURIComponent(t.task_queue)}`}),t.origin_id&&t.origin_id!==t.workflow_id&&e.jsx(te,{label:"Origin",value:t.origin_id,href:`/processes/detail/${t.origin_id}`}),t.trace_id&&e.jsx(te,{label:"Trace",value:t.trace_id,href:s?s.replace("{traceId}",t.trace_id):void 0,external:!0})]})]})]})}function ys({errors:t}){const a=r=>{const n=document.querySelector(`[data-field-key="${r}"]`);n&&(n.scrollIntoView({behavior:"smooth",block:"center"}),n.focus({preventScroll:!0}))};return t.length===0?e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No errors to display."}):e.jsxs("div",{className:"space-y-1",role:"alert","aria-live":"polite",children:[e.jsxs("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-status-error mb-4",children:[t.length," ",t.length===1?"issue":"issues"," to resolve"]}),e.jsx("div",{className:"space-y-1.5",children:t.map(({field:r,message:n})=>e.jsxs("button",{onClick:()=>a(r),className:"w-full text-left flex items-start gap-3 px-3 py-2.5 rounded hover:bg-status-error/5 transition-colors group",children:[e.jsx(ut,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-status-error/60 group-hover:text-status-error transition-colors"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold text-text-primary capitalize leading-snug",children:r.replace(/[_-]/g," ")}),e.jsx("p",{className:"text-[11px] text-text-tertiary group-hover:text-text-secondary transition-colors leading-snug mt-0.5",children:n})]})]},r))}),e.jsx("p",{className:"text-[10px] text-text-quaternary mt-4 px-3",children:"Click an issue to scroll to and focus the field."})]})}function Ns({esc:t,schema:a,envelope:r,payload:n,resolver:s,triage:i,hasAI:d,claimed:c,claimedByMe:o,isTerminal:l,isBuilder:x,traceUrl:u,open:g,noGutter:m,formErrors:f,activePanel:h,onPanelChange:j}){const S=mt(),R=Object.values(z),[I,O]=p.useState(()=>hs(R)),T=h??I,C=p.useCallback(k=>{try{localStorage.setItem(pt,k)}catch{}O(k),j==null||j(k)},[j]);p.useEffect(()=>{h&&h!==I&&O(h)},[h]);const _=p.useMemo(()=>Ft(a,{escalation:t,metadata:t.metadata??null,envelope:r,payload:n,resolver:s})??qt({isTerminal:l,status:t.status,claimed:c,claimedByMe:o}),[a,t,r,n,s,l,c,o]),$=p.useCallback(k=>{const P=k.target.closest("a"),A=P==null?void 0:P.getAttribute("href");A!=null&&A.startsWith("/")&&(k.preventDefault(),S(A))},[S]),D=[{id:z.HELP,icon:Zt,label:"Instructions",content:e.jsx(Oe,{content:_,onClick:$})},{id:z.DETAILS,icon:es,label:"Details",content:e.jsx(bs,{esc:t,claimed:c,isTerminal:l,isBuilder:x,traceUrl:u})},...d&&i?[{id:z.TRIAGE,icon:ts,label:"AI Analysis",content:e.jsx(ms,{triage:i,payload:n??{}})}]:[],{id:z.METADATA,icon:ss,label:"Metadata",content:e.jsx(js,{metadata:t.metadata,role:t.role})},{id:z.CONTEXT,icon:xt,label:"Context",content:e.jsxs("div",{className:"space-y-5",children:[r!=null&&e.jsx(ye,{data:r,label:"Input Envelope"}),n!=null&&e.jsx(ye,{data:n,label:"Escalation Context"}),s!=null&&e.jsx(ye,{data:s,label:"Resolver Payload"}),r==null&&n==null&&s==null&&e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No context on this escalation."})]})},...x?[{id:z.RECORD,icon:ns,label:"Record",content:e.jsx(ye,{data:t,label:"Escalation Record"})}]:[],...f&&f.length>0?[{id:z.ERRORS,icon:(({className:k})=>e.jsx(ut,{className:`${k??""} text-status-error`})),label:"Errors",content:e.jsx(ys,{errors:f})}]:[]];return e.jsx(Bt,{open:g,width:384,className:"h-full",children:e.jsx("div",{className:`h-full${m?"":" pl-6"}`,children:e.jsxs("div",{className:"h-full flex flex-col bg-surface-hover",children:[e.jsx("div",{className:"shrink-0 pt-1.5 pb-0.5 flex justify-center",children:e.jsx(us,{esc:t,className:"w-[80%]"})}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Qt,{views:D,activeId:T,onViewChange:C,stickyClassName:"h-full min-h-0"})})]})})})}function tt(t){return t!=null&&t!==""&&t!==!1&&t!==0}function Le(t,a){if(typeof t!="string"||t.length===0||!a)return!0;const r=t.startsWith("!"),n=r?t.slice(1):t,s=n.indexOf("."),i=s===-1?n:n.slice(0,s);if(!Jt.includes(i))return!0;const d=a[i];let c;if(s===-1)c=d;else try{c=rt(d,n.slice(s+1))}catch{c=void 0}return r?!tt(c):tt(c)}function vs(t,a,r){if(a){if(typeof t=="string"){const n=t.trim();if(n==="")return;const s=ce(a.minLength,a["x-lt-min-length"],r);if(s!==void 0&&n.length<s)return`Minimum ${s} character${s===1?"":"s"}`;const i=ce(a.maxLength,a["x-lt-max-length"],r);if(i!==void 0&&n.length>i)return`Maximum ${i} characters (${n.length} entered)`;const d=a.pattern;if(d)try{if(!new RegExp(d).test(n))return a["x-lt-pattern-error"]??"Invalid format"}catch{}const c=a.format;if(c==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n))return"Enter a valid email address";if(c==="uri"&&!/^https?:\/\/.+/.test(n))return"Enter a valid URL"}if(typeof t=="number"){const n=ce(a.minimum,a["x-lt-minimum"],r),s=ce(a.exclusiveMinimum,void 0,r),i=ce(a.maximum,a["x-lt-maximum"],r),d=ce(a.exclusiveMaximum,void 0,r);if(n!==void 0&&t<n)return`Minimum value is ${n}`;if(s!==void 0&&t<=s)return`Must be greater than ${s}`;if(i!==void 0&&t>i)return`Maximum value is ${i}`;if(d!==void 0&&t>=d)return`Must be less than ${d}`}}}function ce(t,a,r){if(typeof t=="number")return t;if(typeof a=="string"&&r){const n=a.indexOf(".");if(n!==-1){const s=a.slice(0,n),i=a.slice(n+1),d=r[s];if(d&&typeof d=="object"){const c=i.split(".");let o=d;for(const l of c)if(o=o[l],o===void 0)break;if(typeof o=="number")return o;if(typeof o=="string"){const l=Number(o);if(!Number.isNaN(l))return l}}}}}function We(t,a,r,n,s){if(n){if(r){if(t==null||typeof t=="boolean"&&!t||typeof t=="string"&&t.trim()==="")return"Required";if(typeof t=="object"&&!Array.isArray(t)&&t!==null){const i=Object.values(t);if(i.length===0||i.every(d=>!d))return"Required"}}return vs(t,a,s)}}function ws(t){const{mode:a,activeView:r,onActiveViewChange:n,onClaim:s,claimPending:i,workflowType:d,json:c,onResolve:o,resolvePending:l,resolveError:x,requestTriage:u,triageNotes:g,currentRole:m,escalationTargets:f,onEscalate:h,escalatePending:j,escalateError:S,onRelease:R,releasePending:I,onCancel:O,assignedTo:T,assignedUntil:C,onSubmitAttempt:_,onValidationErrors:$,escalationContext:D}=t,k=it(),[P,A]=p.useState("30"),[G,L]=p.useState(0),[N,v]=p.useState(""),[b,E]=p.useState(""),M=P==="custom",de=p.useCallback(w=>L(w),[]);if(a==="terminal")return null;const ne=()=>{const w=M?G:parseInt(P);!w||w<=0||s(w)},xe=()=>{if(v(""),u){const re={_lt:{needsTriage:!0}};g.trim()&&(re.notes=g.trim()),o(re);return}let w;try{w=JSON.parse(c)}catch{v("Invalid JSON");return}const W=w._form_schema;if(W){const re=W.properties??{},me=new Set(W.required??[]),H={...D??{},resolver:w},Z=[];for(const[q,F]of Object.entries(re)){if(!Le(F["x-lt-showIf"],H))continue;const Y=We(w[q],F,me.has(q),!0,H);Y&&Z.push({field:q,message:Y})}if(Z.length>0){_==null||_(),$==null||$(Z);const q=Z[0],F=Z.map(ie=>ie.field.replace(/[_-]/g," ")),Y=F.length<=2?F.join(", "):`${F.slice(0,2).join(", ")}...`;v(q.message==="Required"?`Required: ${Y}`:`${q.message} — ${Y}`);return}}const{_form_schema:ue,...ae}=w;o(Vt(ae,W))},J=w=>`text-xs transition-colors ${w?"text-accent font-medium":"text-text-tertiary hover:text-accent"}`;return e.jsxs("div",{className:"shrink-0 h-[80px] bg-surface/95 backdrop-blur-sm border-t border-surface-border -ml-10 pl-10 pr-10 pt-3 pb-5","data-testid":"escalation-action-bar",children:[a==="available"&&e.jsxs("div",{"data-testid":"claim-bar",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[k.map(w=>e.jsx("button",{onClick:()=>{A(w.value),L(0)},className:J(!M&&P===w.value),children:w.label},w.value)),e.jsx("button",{onClick:()=>A("custom"),className:J(M),children:"Other"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:O,className:"text-xs text-text-tertiary hover:text-status-error transition-colors",children:"Cancel escalation"}),e.jsx("div",{className:"flex-1"}),M&&e.jsx(lt,{onChange:de,compact:!0,autoFocus:!0}),e.jsx("button",{onClick:ne,disabled:i||M&&G<=0,className:"btn-primary text-xs",children:i?"Claiming...":"Claim"})]})]}),a==="claimed_by_other"&&e.jsxs("div",{className:"flex items-center gap-4","data-testid":"claimed-other-bar",children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Claimed by ",e.jsx("span",{className:"font-medium text-text-primary",children:T?e.jsx(dt,{userId:T}):"unknown"})]}),C&&e.jsx(Pe,{until:C})]}),a==="claimed_by_me"&&e.jsxs("div",{"data-testid":"action-bar",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[e.jsx("button",{onClick:()=>n("resolve"),className:J(r==="resolve"),children:d?"Resolve":"Acknowledge"}),f.length>0&&e.jsx("button",{onClick:()=>n("escalate"),className:J(r==="escalate"),children:"Escalate"}),e.jsx("button",{onClick:()=>n("release"),className:`text-xs transition-colors ${r==="release"?"text-status-error font-medium":"text-text-tertiary hover:text-status-error"}`,children:"Release"}),e.jsx("button",{onClick:O,className:"text-xs transition-colors text-text-tertiary hover:text-status-error",children:"Cancel"})]}),r==="resolve"&&e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex-1"}),N&&e.jsx("span",{className:"text-xs text-status-error",children:N}),x&&e.jsx("span",{className:"text-xs text-status-error",children:x.message}),e.jsx("button",{onClick:xe,disabled:l,className:"btn-primary text-xs",children:l?d?"Submitting...":"Acknowledging...":u?"Send to Triage":d?"Submit":"Acknowledge"})]}),r==="escalate"&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-xs text-text-secondary",children:["From ",e.jsx("span",{className:"font-medium text-text-primary",children:m})," to"]}),e.jsxs("select",{value:b,onChange:w=>E(w.target.value),className:"select text-xs","data-testid":"escalate-select",children:[e.jsx("option",{value:"",children:"Select role..."}),f.map(w=>e.jsx("option",{value:w,children:w},w))]}),e.jsx("div",{className:"flex-1"}),S&&e.jsx("span",{className:"text-xs text-status-error",children:S.message}),e.jsx("button",{onClick:()=>h(b),disabled:!b||j,className:"btn-primary text-xs",children:j?"Escalating...":"Escalate"})]}),r==="release"&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Release back to pool?"}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>n("resolve"),className:"btn-secondary text-xs",children:"Back"}),e.jsx("button",{onClick:R,disabled:I,className:"btn-primary text-xs bg-status-error hover:bg-status-error/80",children:I?"Releasing...":"Yes, Release"})]})]})]})}function K(t){return t.replace(/`([^`]+)`/g,'<code class="px-1 py-0.5 bg-surface-sunken rounded text-xs font-mono">$1</code>').replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent-primary hover:underline" target="_blank" rel="noopener noreferrer">$1</a>')}function Me({content:t,compact:a}){const r=[],n=/^```(\w*)\n([\s\S]*?)^```$/gm;let s=0,i;for(;(i=n.exec(t))!==null;)i.index>s&&r.push({type:"text",text:t.slice(s,i.index)}),r.push({type:"code",lang:i[1],code:i[2].replace(/\n$/,"")}),s=i.index+i[0].length;s<t.length&&r.push({type:"text",text:t.slice(s)});const d=a?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-[11px]"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs"},c=[];for(const o of r){if(o.type==="code"){const l=o.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");c.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${d.code} font-mono text-text-secondary leading-relaxed">${l}</code></pre>`);continue}c.push(...ks(o.text,d))}return e.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:c.join(`
|
|
3
|
+
`)}})}function ks(t,a){const r=t.split(`
|
|
4
|
+
`),n=[];let s=!1,i=!1,d=[];for(const c of r){const o=c.trim();if(o.startsWith("|")&&o.endsWith("|")){const l=o.slice(1,-1).split("|").map(x=>x.trim());if(l.every(x=>/^[-:]+$/.test(x)))continue;i||(i=!0,d=[]),d.push(l);continue}if(i){i=!1;const[l,...x]=d;n.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const u of l)n.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${K(u)}</th>`);n.push("</tr></thead><tbody>");for(const u of x){n.push("<tr>");for(const g of u)n.push(`<td class="py-1 px-2 border-b border-border/50">${K(g)}</td>`);n.push("</tr>")}n.push("</tbody></table></div>"),d=[]}if(!o){s&&(n.push("</ul>"),s=!1);continue}if(o.startsWith("### ")){s&&(n.push("</ul>"),s=!1),n.push(`<h4 class="${a.heading} font-semibold text-text-primary mt-3 mb-1">${K(o.slice(4))}</h4>`);continue}if(o.startsWith("## ")){s&&(n.push("</ul>"),s=!1),n.push(`<h3 class="${a.heading} font-semibold text-text-primary mt-3 mb-1">${K(o.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(o)){s&&(n.push("</ul>"),s=!1),n.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(o)){s||(n.push('<ul class="space-y-1 my-1">'),s=!0),n.push(`<li class="${a.list} text-text-secondary flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${K(o.slice(2))}</span></li>`);continue}s&&(n.push("</ul>"),s=!1),n.push(`<p class="${a.text} text-text-secondary my-1">${K(o)}</p>`)}if(i&&d.length){const[c,...o]=d;n.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const l of c)n.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${K(l)}</th>`);n.push("</tr></thead><tbody>");for(const l of o){n.push("<tr>");for(const x of l)n.push(`<td class="py-1 px-2 border-b border-border/50">${K(x)}</td>`);n.push("</tr>")}n.push("</tbody></table></div>")}return s&&n.push("</ul>"),n}function Se({children:t}){return e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:t})}function Cs({payload:t,isTerminal:a,resolverPayload:r,onRetryTriage:n,isRetrying:s}){const i=t.title,d=t.summary,c=t.diagnosis,o=t.tool_calls_made,l=t.result,x=r==null?void 0:r._lt,u=(x==null?void 0:x.triaged)===!0,g=x==null?void 0:x.triageWorkflowId,m=a&&u,[f,h]=p.useState(!1);return m?e.jsxs("div",{className:"rounded-md border border-status-success/30 bg-surface-raised",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-status-success shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:e.jsx("path",{d:"M8 1a7 7 0 110 14A7 7 0 018 1zm3.36 4.65a.5.5 0 00-.72 0L7 9.29 5.36 7.65a.5.5 0 10-.72.7l2 2a.5.5 0 00.72 0l4-4a.5.5 0 000-.7z"})}),e.jsx("span",{className:"text-xs font-medium text-status-success",children:"Resolved by AI Triage"})]}),typeof o=="number"&&e.jsxs("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded-full bg-status-success/10 text-status-success",children:[o," tool calls used"]})]}),e.jsxs("div",{className:"px-4 py-4 space-y-4",children:[i&&e.jsx("p",{className:"text-sm font-medium text-text-primary",children:i}),c&&e.jsxs("div",{children:[e.jsx(Se,{children:"Triage diagnosis"}),e.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:e.jsx(Me,{content:c})})]}),e.jsx("div",{className:"flex items-center gap-3",children:g&&e.jsx(ke,{to:`/workflows/executions/${g}`,className:"text-[10px] text-accent hover:underline",children:"View triage execution"})})]})]}):e.jsxs("div",{className:"rounded-md border border-status-warning/30 bg-surface-raised",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-status-warning shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:e.jsx("path",{d:"M8 1a7 7 0 110 14A7 7 0 018 1zm0 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 4zm0 7a.75.75 0 100-1.5.75.75 0 000 1.5z"})}),e.jsx("span",{className:"text-xs font-medium text-status-warning",children:"Tool Rounds Exhausted"})]}),typeof o=="number"&&e.jsxs("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded-full bg-status-warning/10 text-status-warning",children:[o," tool calls used"]})]}),e.jsxs("div",{className:"px-4 py-4 space-y-4",children:[i&&e.jsx("p",{className:"text-sm font-medium text-text-primary",children:i}),d&&e.jsxs("div",{children:[e.jsx(Se,{children:"What happened"}),e.jsx("div",{className:"text-xs text-text-secondary leading-relaxed",children:e.jsx(Me,{content:d})})]}),c&&e.jsxs("div",{children:[e.jsx(Se,{children:"What went wrong"}),e.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:e.jsx(Me,{content:c})})]}),l!=null&&e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>h(!f),className:"flex items-center gap-1 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary hover:text-text-secondary transition-colors",children:[e.jsx("svg",{className:`w-3 h-3 transition-transform ${f?"rotate-90":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:e.jsx("path",{d:"M4.5 2l4 4-4 4"})}),"Partial results"]}),f&&e.jsx("div",{className:"mt-2",children:e.jsx(ye,{data:l,defaultMode:"tree"})})]}),n&&!a&&e.jsx("div",{className:"pt-2",children:e.jsxs("button",{onClick:n,disabled:s,className:"inline-flex items-center gap-2 px-4 py-2 text-xs font-medium bg-accent text-text-inverse rounded-md hover:bg-accent/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 14 14",fill:"currentColor",children:e.jsx("path",{d:"M7 1a6 6 0 100 12A6 6 0 007 1zm2.5 6.5l-3.5 2V5.5l3.5 2z"})}),s?"Sending to triage...":"Retry with AI Triage"]})})]})]})}function st(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}function ft({src:t,escalation:a,schema:r,onResolve:n,onEscalate:s,submitAttempted:i,fill:d}){const c=p.useRef(null),o=p.useRef("");p.useEffect(()=>{try{const x=new URL(t);o.current=x.origin}catch{o.current=""}},[t]);const l=p.useCallback(()=>{const x=c.current;if(!(x!=null&&x.contentWindow)||!o.current)return;const g={type:"lt:init",escalation:{id:a.id,type:a.type,subtype:a.subtype,description:a.description,status:a.status,priority:a.priority,role:a.role,workflow_type:a.workflow_type,envelope:st(a.envelope),metadata:a.metadata??null,escalation_payload:st(a.escalation_payload)},schema:r};x.contentWindow.postMessage(g,o.current)},[a,r]);return p.useEffect(()=>{const x=u=>{if(u.origin!==o.current)return;const g=u.data;if(!(!g||typeof g!="object"||typeof g.type!="string"))switch(g.type){case"lt:ready":l();break;case"lt:submit":g.payload&&typeof g.payload=="object"&&n(g.payload);break;case"lt:escalate":typeof g.target=="string"&&g.target&&s(g.target);break;case"lt:resize":{const m=c.current;m&&typeof g.height=="number"&&g.height>0&&(m.style.height=`${Math.min(g.height,2e3)}px`);break}}};return window.addEventListener("message",x),()=>window.removeEventListener("message",x)},[l,n,s]),p.useEffect(()=>{if(!i)return;const x=c.current;x!=null&&x.contentWindow&&o.current&&x.contentWindow.postMessage({type:"lt:validate"},o.current)},[i]),d?e.jsx("div",{className:"absolute inset-0 overflow-hidden",children:e.jsx("iframe",{ref:c,src:t,sandbox:"allow-scripts allow-same-origin allow-forms allow-pointer-lock allow-downloads",className:"w-full h-full border-0 block",title:"HITL Viewport",onLoad:l})}):e.jsx("div",{className:"rounded-md border border-surface-border overflow-hidden bg-white",children:e.jsx("iframe",{ref:c,src:t,sandbox:"allow-scripts allow-same-origin allow-forms allow-pointer-lock allow-downloads",className:"w-full border-0",style:{minHeight:"600px"},title:"HITL Viewport",onLoad:l})})}function _s({fieldKey:t,value:a,onChange:r,schema:n}){const s=p.useRef(null),i=(n==null?void 0:n.accept)??void 0,d=t.replace(/[_-]/g," "),c=n==null?void 0:n.description,o=p.useCallback(x=>{var m;const u=(m=x.target.files)==null?void 0:m[0];if(!u)return;const g=new FileReader;g.onload=()=>{typeof g.result=="string"&&r(g.result)},g.readAsDataURL(u)},[r]),l=a.startsWith("data:");return e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:d}),c&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:c}),e.jsxs("div",{className:"mt-1",children:[e.jsx("input",{ref:s,type:"file",accept:i,onChange:o,className:"hidden"}),e.jsx("button",{type:"button",onClick:()=>{var x;return(x=s.current)==null?void 0:x.click()},className:"btn-secondary text-xs px-3 py-1.5",children:l?"Replace file":"Choose file"}),l&&e.jsx("span",{className:"ml-2 text-xs text-status-success",children:"File attached"})]})]})}function Es({fieldKey:t,value:a,onChange:r,schema:n}){const s=t.replace(/[_-]/g," "),i=n==null?void 0:n.description,d=(n==null?void 0:n["x-lt-language"])??"",c=p.useCallback(o=>{if(o.key==="Tab"){o.preventDefault();const l=o.currentTarget,x=l.selectionStart,u=l.selectionEnd,g=a.substring(0,x)+" "+a.substring(u);r(g),requestAnimationFrame(()=>{l.selectionStart=l.selectionEnd=x+2})}},[a,r]);return e.jsxs("div",{children:[e.jsxs("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:[s,d&&e.jsx("span",{className:"ml-2 text-text-tertiary/60 normal-case font-normal",children:d})]}),i&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:i}),e.jsx("textarea",{value:a,onChange:o=>r(o.target.value),onKeyDown:c,className:"input w-full mt-1 font-mono text-xs leading-relaxed",rows:10,spellCheck:!1})]})}function Ts({fieldKey:t,value:a,onChange:r,schema:n}){const s=p.useRef(null),[i,d]=p.useState(!1),c=t.replace(/[_-]/g," "),o=n==null?void 0:n.description;p.useEffect(()=>{const f=s.current;if(!f)return;const h=f.getContext("2d");if(h&&(h.lineWidth=2,h.lineCap="round",h.strokeStyle="#1E1535",a&&a.startsWith("data:"))){const j=new Image;j.onload=()=>h.drawImage(j,0,0),j.src=a}},[]);const l=p.useCallback(f=>{const j=s.current.getBoundingClientRect();return"touches"in f?{x:f.touches[0].clientX-j.left,y:f.touches[0].clientY-j.top}:{x:f.clientX-j.left,y:f.clientY-j.top}},[]),x=p.useCallback(f=>{var S;d(!0);const h=(S=s.current)==null?void 0:S.getContext("2d");if(!h)return;const j=l(f);h.beginPath(),h.moveTo(j.x,j.y)},[l]),u=p.useCallback(f=>{var S;if(!i)return;const h=(S=s.current)==null?void 0:S.getContext("2d");if(!h)return;const j=l(f);h.lineTo(j.x,j.y),h.stroke()},[i,l]),g=p.useCallback(()=>{d(!1);const f=s.current;f&&r(f.toDataURL("image/png"))},[r]),m=p.useCallback(()=>{const f=s.current;if(!f)return;const h=f.getContext("2d");h&&(h.clearRect(0,0,f.width,f.height),r(""))},[r]);return e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:c}),o&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:o}),e.jsx("div",{className:"mt-1 border border-surface-border rounded-md overflow-hidden bg-white",children:e.jsx("canvas",{ref:s,width:400,height:150,className:"w-full cursor-crosshair touch-none",onMouseDown:x,onMouseMove:u,onMouseUp:g,onMouseLeave:g,onTouchStart:x,onTouchMove:u,onTouchEnd:g})}),e.jsx("button",{type:"button",onClick:m,className:"mt-1 text-[10px] text-text-tertiary hover:text-accent transition-colors",children:"Clear"})]})}function Rs({fieldKey:t,value:a,onChange:r,schema:n}){const s=t.replace(/[_-]/g," "),i=n==null?void 0:n.description;return e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:s}),i&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:i}),e.jsx("textarea",{value:a,onChange:d=>r(d.target.value),className:"input w-full mt-1 text-sm leading-relaxed",rows:8,placeholder:"Supports plain text. Markdown formatting is preserved."})]})}function $s({fieldKey:t,value:a,onChange:r,schema:n}){const[s,i]=p.useState("write"),d=t.replace(/[_-]/g," "),c=n==null?void 0:n.description;return(n==null?void 0:n.readOnly)===!0?e.jsx(Oe,{content:a,className:"my-1"}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:d}),e.jsx("div",{className:"flex items-center gap-0.5",children:["write","preview"].map(l=>e.jsx("button",{type:"button",onClick:()=>i(l),className:`px-2 py-0.5 text-[10px] rounded transition-colors ${s===l?"bg-accent/10 text-accent font-semibold":"text-text-quaternary hover:text-text-secondary"}`,children:l==="write"?"Write":"Preview"},l))})]}),c&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:c}),s==="write"?e.jsx("textarea",{value:a,onChange:l=>r(l.target.value),className:"input w-full mt-1 text-sm font-mono leading-relaxed",rows:10,placeholder:"Write markdown — headings, lists, tables, code blocks, and links all render."}):e.jsx("div",{className:"mt-1 px-3 py-2 border border-surface-border rounded min-h-[120px]",children:a.trim()?e.jsx(Oe,{content:a}):e.jsx("p",{className:"text-xs text-text-quaternary italic",children:"Nothing to preview."})})]})}function Ms({value:t,onChange:a,schema:r,escalationContext:n,isRequired:s,submitAttempted:i,error:d}){const c=r==null?void 0:r["x-lt-source"],o=[];if(c&&n){const m=c.indexOf(".");if(m!==-1){const f=c.slice(0,m),h=c.slice(m+1);try{const j=rt(n[f],h);Array.isArray(j)&&o.push(...j)}catch{}}}let l={};try{t&&(l=JSON.parse(t))}catch{}const x=m=>a(JSON.stringify({...l,[m]:!l[m]}));if(o.length===0)return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-text-tertiary italic mt-1",children:"No checklist items. Provide checklist_items in the escalation envelope or metadata."}),d&&e.jsx("p",{className:"text-[10px] text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:d})]});const u=o.filter(m=>l[m.id]).length,g=(r==null?void 0:r.description)||"Checklist";return e.jsxs("div",{role:"group","aria-label":g,"aria-required":s||void 0,"aria-invalid":d?!0:void 0,children:[e.jsx("div",{className:"space-y-2.5 mt-1",children:o.map(m=>{const f=l[m.id]??!1,h=!f&&!!i&&u===0&&(m.required||s);return e.jsxs("label",{className:`flex items-start gap-3 cursor-pointer group select-none rounded px-2 py-1 -mx-2 transition-colors ${h?"bg-status-error/5":"hover:bg-surface-hover"}`,children:[e.jsx("input",{type:"checkbox",checked:f,onChange:()=>x(m.id),className:`mt-0.5 w-3.5 h-3.5 shrink-0 rounded ${h?"accent-status-error":"accent-accent"}`,"data-testid":`checklist-item-${m.id}`}),e.jsxs("span",{className:`text-sm leading-snug transition-colors ${h?"text-status-error":"text-text-secondary group-hover:text-text-primary"}`,children:[m.label,m.required&&e.jsx("span",{className:`ml-0.5 text-[10px] ${h?"text-status-error":"text-text-quaternary"}`,children:"*"})]})]},m.id)})}),e.jsxs("p",{className:"text-[10px] text-text-quaternary mt-3 tabular-nums",children:[u," / ",o.length," confirmed",s&&u===0&&!!i&&e.jsx("span",{className:"ml-1 text-text-quaternary/60",children:"(at least one required)"})]}),d&&e.jsx("p",{role:"alert",className:"text-[10px] text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:d})]})}const nt={"file-upload":_s,"code-editor":Es,signature:Ts,"rich-text":Rs,markdown:$s,checklist:Ms};function ht({value:t,onChange:a,disabled:r,submitAttempted:n,escalationContext:s}){var G,L;const[i,d]=p.useState({}),[c,o]=p.useState({}),[l,x]=p.useState(null),[u,g]=p.useState(!1),[m,f]=p.useState(new Set);p.useEffect(()=>{try{const N=JSON.parse(t);if(typeof N=="object"&&N!==null&&!Array.isArray(N)){const v={},b={};for(const[E,M]of Object.entries(N))E.startsWith("_")?b[E]=M:v[E]=M;d(v),o(b),x(b._form_schema&&typeof b._form_schema=="object"?b._form_schema:null),g(!1)}}catch{g(!0)}},[t]);const h=p.useCallback(N=>{d(N),a(JSON.stringify({...N,...c},null,2))},[c,a]),j=p.useCallback((N,v)=>{h({...i,[N]:v})},[i,h]),S=p.useCallback(N=>{f(v=>{if(v.has(N))return v;const b=new Set(v);return b.add(N),b})},[]);if(u)return e.jsx("p",{className:"text-xs text-status-error",children:"Unable to parse resolver data as form. Use the JSON editor below."});const R=Object.entries(i);if(R.length===0)return e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No resolver fields defined."});const I=l==null?void 0:l["x-lt-order"],O=I?[...R].sort((N,v)=>{const b=I.indexOf(N[0]),E=I.indexOf(v[0]);return(b===-1?1/0:b)-(E===-1?1/0:E)}):R,T={...s??{},resolver:i},C=O.filter(([N,v])=>{var E;const b=(E=l==null?void 0:l.properties)==null?void 0:E[N];return!(!Le(b==null?void 0:b["x-lt-showIf"],T)||(b==null?void 0:b["x-lt-hide-if-empty"])===!0&&(v==null||v===""||v===!1||v===0))}),_=new Set((l==null?void 0:l.required)??[]),$=l==null?void 0:l["x-lt-layout"],D=l==null?void 0:l.title,k=l==null?void 0:l.description,P=[];for(const N of C){const[v]=N,b=(G=l==null?void 0:l.properties)==null?void 0:G[v],E=((L=b==null?void 0:b["x-lt-section"])==null?void 0:L.trim())||null,M=P[P.length-1];!M||M.name!==E?P.push({name:E,entries:[N]}):M.entries.push(N)}const A=N=>N.map(([v,b])=>{var w;const E=(w=l==null?void 0:l.properties)==null?void 0:w[v],M=(E==null?void 0:E.readOnly)===!0,de=(E==null?void 0:E["x-lt-span"])??1,ne=_.has(v),xe=m.has(v)||!!n,J=We(b,E,ne,xe,T);return e.jsx("div",{className:`animate-[field-enter_0.2s_ease-out] ${$==="two-column"&&de>=2?"col-span-2":""}`,children:e.jsx(gt,{fieldKey:v,value:b,onChange:W=>j(v,W),onBlur:()=>S(v),schema:l,isRequired:ne,isReadOnly:M,error:J,escalationContext:T,submitAttempted:!!n})},v)});return e.jsxs("div",{className:`pb-8 ${r?"opacity-60 pointer-events-none":""}`,inert:r||void 0,"aria-disabled":r||void 0,children:[D&&e.jsx("h3",{className:"text-lg font-light text-text-primary mb-1",children:D}),k&&e.jsx("p",{className:"text-sm text-text-secondary leading-relaxed mb-6",children:k}),e.jsx("div",{className:"space-y-10",children:P.map((N,v)=>e.jsxs("div",{className:N.name?"border-l-2 border-accent/30 bg-[#f0f6ff4a] rounded-[0.125em] p-4 animate-[section-enter_0.25s_ease-out]":"",children:[N.name&&e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(xt,{className:"w-3.5 h-3.5 text-accent/50 shrink-0",strokeWidth:1.5}),e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:N.name})]}),$==="two-column"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-14 gap-y-6",children:A(N.entries)}):e.jsx("div",{className:"space-y-6",children:A(N.entries)})]},N.name??`__s${v}`))})]})}function gt({fieldKey:t,value:a,onChange:r,onBlur:n,schema:s,isRequired:i,isReadOnly:d,error:c,escalationContext:o,submitAttempted:l}){var O;const x=t.replace(/[_-]/g," "),u=(O=s==null?void 0:s.properties)==null?void 0:O[t],g=u==null?void 0:u["x-lt-widget"],m=`lt-field-${t}`,f=`${m}-error`,h=`${m}-help`,j=typeof(u==null?void 0:u.description)=="string"&&u.description.length>0,R={id:m,"aria-required":i||void 0,"aria-invalid":c?!0:void 0,"aria-describedby":c?f:j?h:void 0};if(d&&!(g==="markdown"&&typeof a=="string")){const T=a===null?"null":typeof a=="object"?JSON.stringify(a,null,2):String(a);return e.jsxs("div",{children:[e.jsx(U,{isRequired:i,children:x}),e.jsx("p",{className:"text-sm text-text-secondary mt-0.5 whitespace-pre-wrap",children:T})]})}if(g&&g in nt){const T=nt[g],C={fieldKey:t,schema:u,escalationContext:o,isRequired:i,submitAttempted:l,error:c};if(typeof a=="string")return e.jsx(T,{...C,value:a,onChange:_=>r(_)});if(typeof a=="object"&&a!==null&&!Array.isArray(a))return e.jsx(T,{...C,value:JSON.stringify(a),onChange:_=>{try{r(JSON.parse(_))}catch{r(_)}}})}if(typeof a=="boolean")return e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:a,onChange:T=>{r(T.target.checked),n==null||n()},className:"w-3.5 h-3.5 rounded accent-accent","data-field-key":t,...R}),e.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-secondary",children:[x,i&&e.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})]}),e.jsx(se,{error:c,id:f})]});if(typeof a=="number")return e.jsxs("div",{children:[e.jsx(U,{isRequired:i,htmlFor:m,children:x}),e.jsx("input",{type:"number",value:a,onChange:T=>r(parseFloat(T.target.value)||0),onBlur:n,step:"any","data-field-key":t,className:je(!!c),...R}),e.jsx(se,{error:c,id:f})]});if(typeof a=="string"){const T=(u==null?void 0:u.format)==="password",C=u==null?void 0:u.enum,_=u==null?void 0:u.description;if(C!=null&&C.length)return e.jsxs("div",{children:[e.jsx(U,{isRequired:i,htmlFor:m,children:x}),_&&e.jsx("p",{id:h,className:"text-[10px] text-text-tertiary mt-0.5",children:_}),e.jsx("select",{value:a,onChange:k=>r(k.target.value),onBlur:n,"data-field-key":t,className:Ss(!!c),...R,children:C.map(k=>e.jsx("option",{value:k,children:k},k))}),e.jsx(se,{error:c,id:f})]});if(T)return e.jsxs("div",{children:[e.jsx(U,{isRequired:i,htmlFor:m,children:x}),_&&e.jsx("p",{id:h,className:"text-[10px] text-text-tertiary mt-0.5",children:_}),e.jsx("input",{type:"password",value:a,onChange:k=>r(k.target.value),onBlur:n,"data-field-key":t,className:je(!!c),autoComplete:"off",...R}),e.jsx(se,{error:c,id:f})]});const $=u==null?void 0:u.format,D={date:"date","date-time":"datetime-local",email:"email",uri:"url"};if($&&$ in D)return e.jsxs("div",{children:[e.jsx(U,{isRequired:i,htmlFor:m,children:x}),_&&e.jsx("p",{id:h,className:"text-[10px] text-text-tertiary mt-0.5",children:_}),e.jsx("input",{type:D[$],value:a,onChange:k=>r(k.target.value),onBlur:n,"data-field-key":t,className:je(!!c),...R}),e.jsx(se,{error:c,id:f})]});if($==="textarea"||a.length>80){const k=u==null?void 0:u.maxLength,P=u==null?void 0:u["x-lt-max-length"];let A=k;if(A===void 0&&P&&o){const L=P.indexOf(".");if(L!==-1){const N=P.slice(0,L),v=P.slice(L+1),b=o[N];if(b&&typeof b=="object"){let E=b;for(const M of v.split("."))if(E=E[M],E===void 0)break;if(typeof E=="number")A=E;else if(typeof E=="string"){const M=Number(E);Number.isNaN(M)||(A=M)}}}}const G=A!==void 0&&a.length>A;return e.jsxs("div",{children:[e.jsx(U,{isRequired:i,htmlFor:m,children:x}),_&&e.jsx("p",{id:h,className:"text-[10px] text-text-tertiary mt-0.5",children:_}),e.jsx("textarea",{value:a,onChange:L=>{r(L.target.value),n==null||n()},onBlur:n,"data-field-key":t,className:`${je(!!c)} leading-relaxed`,rows:Math.min(6,Math.max(3,Math.ceil(a.length/60))),...R}),A!==void 0&&e.jsxs("p",{className:`text-[10px] mt-0.5 text-right tabular-nums ${G?"text-status-error font-medium":"text-text-quaternary"}`,children:[a.length," / ",A]}),e.jsx(se,{error:c,id:f})]})}return e.jsxs("div",{children:[e.jsx(U,{isRequired:i,htmlFor:m,children:x}),_&&e.jsx("p",{id:h,className:"text-[10px] text-text-tertiary mt-0.5",children:_}),e.jsx("input",{type:"text",value:a,onChange:k=>r(k.target.value),onBlur:n,"data-field-key":t,className:je(!!c),...R}),e.jsx(se,{error:c,id:f})]})}if(a===null)return e.jsxs("div",{children:[e.jsx(U,{isRequired:i,children:x}),e.jsx("p",{className:"text-xs text-text-tertiary italic mt-1",children:"null"})]});if(Array.isArray(a))return e.jsxs("div",{children:[e.jsx(U,{isRequired:i,children:x}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:a.map((T,C)=>e.jsx("span",{className:"px-2 py-0.5 text-[11px] font-mono bg-surface-sunken rounded text-text-secondary",children:String(T)},C))})]});if(typeof a=="object"){const T=Object.entries(a);return e.jsxs("div",{children:[e.jsx(U,{isRequired:i,children:x}),e.jsx("div",{className:"ml-4 mt-2 pl-4 border-l border-accent-faint space-y-3",children:T.map(([C,_])=>e.jsx(gt,{fieldKey:C,value:_,onChange:$=>r({...a,[C]:$})},C))})]})}return null}function U({children:t,isRequired:a,htmlFor:r}){return e.jsxs("label",{htmlFor:r,className:"text-[11px] font-semibold uppercase tracking-wider text-text-secondary",children:[t,a&&e.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})}function se({error:t,id:a}){return t?e.jsx("p",{id:a,role:"alert",className:"text-[10px] text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:t}):null}function je(t){return t?"input text-sm w-full mt-1 border-status-error/50 focus:border-status-error animate-[field-shake_0.4s_ease-in-out]":"input text-sm w-full mt-1"}function Ss(t){return t?"select text-sm w-full mt-1 border-status-error/50 focus:border-status-error animate-[field-shake_0.4s_ease-in-out]":"select text-sm w-full mt-1"}function As({json:t,onJsonChange:a,requestTriage:r,onRequestTriageChange:n,triageNotes:s,onTriageNotesChange:i,disabled:d=!1,submitAttempted:c=!1,showTriage:o=!1,escalationContext:l}){return e.jsxs(e.Fragment,{children:[o&&e.jsx("div",{className:"flex items-center justify-between mb-3",children:r?e.jsxs("button",{onClick:()=>n(!1),className:"group flex items-center gap-2 text-left","data-testid":"triage-cancel",children:[e.jsx("span",{className:"flex items-center justify-center w-5 h-5 rounded-full bg-accent/10 text-accent shrink-0",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),e.jsxs("span",{className:"text-xs text-text-secondary group-hover:text-text-primary transition-colors",children:["AI Triage active."," ",e.jsx("span",{className:"text-accent group-hover:underline",children:"Cancel"})]})]}):e.jsxs("button",{onClick:()=>n(!0),className:"group flex items-center gap-2.5 text-left my-4","data-testid":"triage-callout",children:[e.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-accent/10 text-accent shrink-0 animate-[triage-glow_6s_ease-in-out_infinite]",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.674M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),e.jsxs("span",{className:"text-[13px] text-text-secondary group-hover:text-text-primary transition-colors",children:["This form doesn't capture the issue?"," ",e.jsx("span",{className:"text-accent group-hover:underline",children:"Request AI Triage"})]})]})}),e.jsxs("div",{className:"relative min-h-[200px]",children:[e.jsx("div",{className:r?"pointer-events-none select-none":"",children:e.jsx(ht,{value:t,onChange:a,disabled:d,submitAttempted:c,escalationContext:l})}),r&&e.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col bg-surface/90 backdrop-blur-[2px] rounded-md border border-accent/20 p-5","data-testid":"triage-overlay",children:[e.jsx("p",{className:"text-xs text-text-secondary mb-3 leading-relaxed",children:"The resolution form will not be submitted. Describe the issue so AI triage can diagnose and fix it using available tools. The corrected result will come back as a new escalation for your review."}),e.jsx("textarea",{value:s,onChange:x=>i(x.target.value),placeholder:"e.g. Content is in Spanish — needs translation to English before review...",className:"input text-xs w-full flex-1 min-h-[80px] resize-none",autoFocus:!0,"data-testid":"triage-notes"})]})]})]})}function jt(t,a){if(!t.includes("{"))return t;try{const r=s=>{if(!s)return{};try{return JSON.parse(s)}catch{return{}}},n={...a.metadata??{},...r(a.envelope),...r(a.escalation_payload)};return t.replace(/\{([^}]+)\}/g,(s,i)=>Object.prototype.hasOwnProperty.call(n,i)?String(n[i]):`{${i}}`)}catch{return t}}function at(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}function De(t){return{escalation:t,metadata:t.metadata??null,envelope:at(t.envelope),payload:at(t.escalation_payload),resolver:null}}function Is({isRoundsExhausted:t,payloadObj:a,isTerminal:r,resolverPayload:n,onRetryTriage:s,isRetrying:i}){return e.jsxs(e.Fragment,{children:[t&&a&&e.jsx("div",{className:"mt-8",children:e.jsx(Cs,{payload:a,isTerminal:r,resolverPayload:n,onRetryTriage:s,isRetrying:i})}),(a==null?void 0:a.category)==="missing_credential"&&e.jsxs("div",{className:"mt-8 bg-status-warning/10 border border-status-warning/30 rounded-md px-5 py-4 flex items-start gap-3",children:[e.jsx(Qe,{size:20,className:"text-status-warning mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-text-primary mb-1",children:"Missing Credential"}),e.jsxs("p",{className:"text-xs text-text-secondary mb-3",children:["This workflow requires a ",e.jsx("span",{className:"font-medium capitalize",children:String(a.provider)})," credential to continue. Register one and then resolve this escalation to retry."]}),e.jsxs(ke,{to:"/credentials",className:"btn-primary text-xs inline-flex items-center gap-1.5",children:[e.jsx(Qe,{size:12}),"Go to Credentials"]})]})]})]})}function Os({esc:t,resolverPayload:a,isTerminal:r,claimedByMe:n,activeView:s,metadataFormSchema:i,effectiveSchema:d,json:c,onJsonChange:o,requestTriage:l,onRequestTriageChange:x,triageNotes:u,onTriageNotesChange:g,onResolve:m,onEscalate:f,onClaim:h,submitAttempted:j,isCertified:S,hasAI:R}){const I=d,O=De(t);if(r){if(a==null)return null;const $=typeof a=="object"&&a!==null?a:{},D=d??i,k=D!=null&&D.properties?{...ot($,D),_form_schema:D}:$;return e.jsx("div",{className:"mt-8 pt-6",children:e.jsx(ht,{value:JSON.stringify(k,null,2),onChange:()=>{},disabled:!0,escalationContext:O})})}if(s!=="resolve"||!(t.workflow_type||d))return null;const T=I==null?void 0:I["x-lt-viewport"],C=(T==null?void 0:T.type)==="iframe"&&!!T.src&&m&&f;if(C&&!n)return e.jsxs("button",{onClick:()=>h==null?void 0:h(),disabled:!h,className:"flex flex-col items-center justify-center min-h-[55vh] w-full gap-3 text-center group disabled:opacity-50 disabled:cursor-default",children:[e.jsx(ls,{className:"w-10 h-10 text-text-tertiary group-hover:text-accent transition-colors",strokeWidth:1}),e.jsx("p",{className:"text-base font-medium text-text-primary group-hover:text-accent transition-colors",children:"Claim to launch the editor"})]});const _=C?jt(T.src,t):"";return e.jsx("div",{className:"mt-8 pt-6",children:C?e.jsx(ft,{src:_,escalation:t,schema:I,onResolve:m,onEscalate:f,submitAttempted:j}):e.jsx(As,{json:c,onJsonChange:o,requestTriage:l,onRequestTriageChange:x,triageNotes:u,onTriageNotesChange:g,disabled:!n,submitAttempted:j,showTriage:!!S&&!!R,escalationContext:O})})}function Ds({open:t,assignedUntil:a,onClose:r,onExtend:n,isPending:s}){const i=it(),[d,c]=p.useState("30"),[o,l]=p.useState(0),x=d==="custom",u=x?o:parseInt(d),g=p.useCallback(m=>l(m),[]);return e.jsx(xs,{open:t,onClose:r,title:"Claim Expiring",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Your claim on this escalation expires in"," ",e.jsx(Pe,{until:a}),". When it lapses, the form locks and the item returns to the queue — your edits are kept as a draft. Extend to keep working."]}),e.jsxs("select",{value:d,onChange:m=>{c(m.target.value),l(0)},className:"select w-full text-sm","aria-label":"Extension duration",children:[i.map(m=>e.jsx("option",{value:m.value,children:m.label},m.value)),e.jsx("option",{value:"custom",children:"Other..."})]}),x&&e.jsx(lt,{onChange:g,autoFocus:!0}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Dismiss"}),e.jsx("button",{onClick:()=>n(u),className:"btn-primary text-xs",disabled:s||!u||u<=0,children:s?"Extending...":"Extend Claim"})]})]})})}const Ps=9e4;function Ls(t,a=Ps){const[,r]=p.useState(0);if(p.useEffect(()=>{if(!t)return;const s=new Date(t).getTime()-Date.now();if(s<=0)return;const i=()=>r(o=>o+1),d=[],c=s-a;return c>0&&d.push(window.setTimeout(i,c)),d.push(window.setTimeout(i,s)),()=>d.forEach(o=>window.clearTimeout(o))},[t,a]),!t)return{expired:!1,expiringSoon:!1,msRemaining:0};const n=Math.max(0,new Date(t).getTime()-Date.now());return{expired:n<=0,expiringSoon:n>0&&n<=a,msRemaining:n}}const Ws="lt:escalation:draft:";function Fe(t){return`${Ws}${t}`}function Fs(t){try{return localStorage.getItem(Fe(t))}catch{return null}}function qs(t,a){try{localStorage.setItem(Fe(t),a)}catch{}}function Ae(t){try{localStorage.removeItem(Fe(t))}catch{}}const bt="lt:escalation:panel:open";function Js(){try{const t=localStorage.getItem(bt);return t===null?!0:t==="true"}catch{return!0}}function Ie(t){try{localStorage.setItem(bt,String(t))}catch{}}function be(t){if(!t)return null;try{return JSON.parse(t)}catch{return t}}function on(){var He,Ue,ze,Ge;const{id:t}=ds(),{user:a}=$t(),r=mt(),n=Rt(),{data:s,isLoading:i,refetch:d,isFetching:c}=Mt(t);Yt(t);const o=St(),l=At(),x=It(),u=Ot(),[g,m]=p.useState(!1),{data:f}=Dt((s==null?void 0:s.role)??""),{data:h}=Gt(),{data:j}=Pt(),{isBuilder:S}=Lt(),R=h==null?void 0:h.find(y=>y.workflow_type===(s==null?void 0:s.workflow_type)),I=((He=j==null?void 0:j.telemetry)==null?void 0:He.traceUrl)??null,[O,T]=p.useState("resolve"),[C,_]=p.useState("{}"),[$,D]=p.useState(Js),[k,P]=p.useState(!1),[A,G]=p.useState(""),[L,N]=p.useState(!1),[v,b]=p.useState([]),[E,M]=p.useState(void 0),de=Ls(s==null?void 0:s.assigned_until),[ne,xe]=p.useState(null);p.useEffect(()=>{if(!(!L||!s))try{const y=JSON.parse(C),V=y._form_schema;if(!V){b([]);return}const Q=V.properties??{},fe=new Set(V.required??[]),oe={...De(s),resolver:y},he=[];for(const[ve,ge]of Object.entries(Q)){if(!Le(ge["x-lt-showIf"],oe))continue;const ee=We(y[ve],ge,fe.has(ve),!0,oe);ee&&he.push({field:ve,message:ee})}b(he)}catch{}},[C,L,s]);const J=((Ue=s==null?void 0:s.metadata)==null?void 0:Ue.form_schema)??null,w=(s==null?void 0:s.form_schema)??(R==null?void 0:R.resolver_schema)??null,W=J??w,ue=p.useRef(!1),ae=p.useRef(null);p.useEffect(()=>{if(ue.current)return;const y=J??(w!=null&&w.properties?w:null);if(y!=null&&y.properties){ue.current=!0;const V=be(s==null?void 0:s.envelope),Q=V==null?void 0:V.formDefaults,fe={...(s==null?void 0:s.metadata)??{},...typeof Q=="object"&&Q!==null?Q:{}},oe=ot(fe,y),he={_form_schema:y};for(const[Ye,Et]of Object.entries(y.properties)){const Tt=Et;he[Ye]=oe[Ye]??Tt.default??""}ae.current=JSON.stringify(he,null,2);const ge=!((s==null?void 0:s.status)==="resolved"||(s==null?void 0:s.status)==="cancelled")&&(s!=null&&s.id)?Fs(s.id):null,ee=ge?be(ge):null;ee&&typeof ee=="object"&&!Array.isArray(ee)?_(JSON.stringify({...ee,_form_schema:y},null,2)):_(ae.current)}else W&&(ue.current=!0,_(JSON.stringify(W,null,2)))},[W,J,w,s==null?void 0:s.envelope,s==null?void 0:s.metadata,s==null?void 0:s.id,s==null?void 0:s.status]),p.useEffect(()=>{if(!ue.current||ae.current===null||!(s!=null&&s.id)||s.status!=="pending")return;const y=s.id,V=window.setTimeout(()=>{C===ae.current?Ae(y):qs(y,C)},400);return()=>window.clearTimeout(V)},[C,s==null?void 0:s.id,s==null?void 0:s.status]);const re=(s==null?void 0:s.subtype)==="rounds_exhausted";if(i)return e.jsxs("div",{className:"animate-pulse space-y-8",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-64"}),e.jsx("div",{className:"h-32 bg-surface-sunken rounded w-full"})]});if(!s)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Escalation not found."});const me=ct(s),H=me&&s.assigned_to===(a==null?void 0:a.userId),Z=me&&!H,q=s.status==="resolved"||s.status==="cancelled",F=W==null?void 0:W["x-lt-viewport"],Y=(F==null?void 0:F.type)==="iframe"&&!!(F!=null&&F.src)&&H&&!q,ie=be(s.escalation_payload),le=be(s.resolver_payload),Ne=be(s.envelope),yt=!!((ze=Ne==null?void 0:Ne.metadata)!=null&&ze.certified),qe=Wt(),Je=qe!==null?qe:!!((Ge=j==null?void 0:j.ai)!=null&&Ge.enabled),B=typeof ie=="object"&&ie!==null&&!Array.isArray(ie)?ie:null,Nt=B==null?void 0:B._triage,vt=typeof le=="object"&&le!==null&&!Array.isArray(le)?le:null,wt=q?"terminal":H?"claimed_by_me":Z?"claimed_by_other":"available",Ce=y=>{o.mutate({id:s.id,durationMinutes:y})},pe=()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]}),r(-1)},_e=async y=>{await l.mutateAsync({id:s.id,resolverPayload:y}),Ae(s.id),pe()},Ee=async y=>{y&&(await x.mutateAsync({id:s.id,targetRole:y}),pe())},kt=async()=>{H||await o.mutateAsync({id:s.id,durationMinutes:30});const y=(B==null?void 0:B.diagnosis)||s.description||"";await l.mutateAsync({id:s.id,resolverPayload:{_lt:{needsTriage:!0},notes:y}}),pe()},Ve=async()=>{await o.mutateAsync({id:s.id,durationMinutes:0}),pe()},Ct=async()=>{await u.mutateAsync(s.id),Ae(s.id),m(!1),pe()},_t=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(zt,{onRefresh:()=>d(),isFetching:c,apiPath:`/escalations/${s.id}`}),e.jsx("button",{onClick:()=>D(y=>(Ie(!y),!y)),className:"ml-2 text-text-tertiary hover:text-accent transition-colors",title:$?"Hide side panel":"Show side panel",children:$?e.jsx(Xe,{className:"w-5 h-5",strokeWidth:1.5}):e.jsx(Ke,{className:"w-5 h-5",strokeWidth:1.5})})]});return e.jsxs("div",{className:"flex-1 min-h-0 min-w-0 flex items-stretch -mt-10 -mr-10 -mb-16",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col min-h-0",children:[Y?e.jsxs("div",{className:"relative flex-1 min-h-0 -ml-10",children:[e.jsx("div",{className:"absolute top-3 right-3 z-50 flex items-center gap-0.5 bg-surface/90 backdrop-blur-sm rounded-lg px-1.5 py-1 shadow-sm border border-surface-border/40",children:[{onClick:Ve,disabled:o.isPending,label:"Release",hoverClass:"hover:text-accent",icon:e.jsx(os,{className:"w-4 h-4",strokeWidth:1.5})},{onClick:()=>m(!0),disabled:!1,label:"Cancel",hoverClass:"hover:text-status-error",icon:e.jsx(cs,{className:"w-4 h-4",strokeWidth:1.5})},{onClick:()=>D(y=>(Ie(!y),!y)),disabled:!1,label:$?"Hide panel":"Show panel",hoverClass:"hover:text-accent",icon:$?e.jsx(Xe,{className:"w-4 h-4",strokeWidth:1.5}):e.jsx(Ke,{className:"w-4 h-4",strokeWidth:1.5})}].map(({onClick:y,disabled:V,label:Q,hoverClass:fe,icon:oe})=>e.jsxs("div",{className:"relative group/tip",children:[e.jsx("button",{onClick:y,disabled:V,className:`text-text-tertiary ${fe} transition-colors disabled:opacity-40 disabled:cursor-default p-1.5 rounded-md`,children:oe}),e.jsx("span",{className:"pointer-events-none absolute top-full left-1/2 -translate-x-1/2 mt-1.5 px-2 py-0.5 rounded text-[11px] bg-surface-sunken text-text-primary whitespace-nowrap opacity-0 group-hover/tip:opacity-100 transition-opacity",children:Q})]},Q))}),e.jsx(ft,{src:jt(F.src,s),escalation:s,schema:W,onResolve:_e,onEscalate:Ee,submitAttempted:L,fill:!0})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"shrink-0 pt-10 pr-10",children:e.jsx(Ut,{title:s.description||"Escalation",actions:_t})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto pr-10",children:[e.jsx(Is,{isRoundsExhausted:re,payloadObj:B,isTerminal:q,resolverPayload:le,onRetryTriage:kt,isRetrying:o.isPending||l.isPending}),e.jsx(Os,{esc:s,resolverPayload:le,isTerminal:q,claimedByMe:H,activeView:O,metadataFormSchema:J,effectiveSchema:W,json:C,onJsonChange:_,requestTriage:k,onRequestTriageChange:P,triageNotes:A,onTriageNotesChange:G,onResolve:_e,onEscalate:Ee,onClaim:()=>Ce(30),submitAttempted:L,isCertified:yt,hasAI:Je}),e.jsx("div",{className:"h-10"})]})]}),!Y&&e.jsx(ws,{escalationContext:De(s),mode:wt,activeView:O,onActiveViewChange:T,onClaim:Ce,claimPending:o.isPending,workflowType:s.workflow_type,json:C,onResolve:_e,resolvePending:l.isPending,resolveError:l.error,requestTriage:k,triageNotes:A,currentRole:s.role,escalationTargets:((f==null?void 0:f.targets)??[]).filter(y=>y!==s.role),onEscalate:Ee,escalatePending:x.isPending,escalateError:x.error,onRelease:Ve,releasePending:o.isPending,onCancel:()=>m(!0),assignedTo:s.assigned_to,assignedUntil:s.assigned_until,onSubmitAttempt:()=>N(!0),onValidationErrors:y=>{b(y),D(!0),Ie(!0),M(z.ERRORS)}})]}),e.jsx(Ns,{esc:s,schema:W,envelope:Ne,payload:B,resolver:vt,triage:Nt??null,hasAI:Je,claimed:me,claimedByMe:H,isTerminal:q,isBuilder:S,traceUrl:I,open:$,noGutter:Y,formErrors:v,activePanel:E,onPanelChange:M}),e.jsx(Ht,{open:g,onClose:()=>m(!1),onConfirm:Ct,isPending:u.isPending,error:u.error}),H&&!q&&s.assigned_until&&e.jsx(Ds,{open:de.expiringSoon&&s.assigned_until!==ne,assignedUntil:s.assigned_until,onClose:()=>xe(s.assigned_until??null),onExtend:Ce,isPending:o.isPending})]})}export{on as EscalationDetailPage};
|
|
5
|
+
//# sourceMappingURL=index-B_68lp-B.js.map
|