@hotmeshio/long-tail 0.19.0 → 0.19.1
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/build/api/workflows/config.d.ts +5 -1
- package/build/api/workflows/config.js +9 -1
- package/build/api/workflows/index.d.ts +3 -0
- package/build/api/workflows/index.js +7 -1
- package/build/api/workflows/input-validation.d.ts +13 -0
- package/build/api/workflows/input-validation.js +38 -0
- package/build/api/workflows/invocable.d.ts +19 -0
- package/build/api/workflows/invocable.js +106 -0
- package/build/api/workflows/invocation.js +6 -0
- package/build/lib/db/schemas/034_workflow_input_schema.sql +13 -0
- package/build/routes/workflows/config.js +2 -0
- package/build/routes/workflows/discovery.js +14 -0
- package/build/services/config/cache.js +2 -0
- package/build/services/config/read.js +4 -0
- package/build/services/config/sql.d.ts +2 -2
- package/build/services/config/sql.js +7 -5
- package/build/services/config/write.js +11 -1
- package/build/services/interceptor/index.js +7 -0
- package/build/services/invocation-access.d.ts +18 -0
- package/build/services/invocation-access.js +32 -0
- package/build/services/workflow-invocation.js +4 -9
- package/build/shared/form-validation/index.d.ts +1 -0
- package/build/shared/form-validation/index.js +1 -0
- package/build/shared/form-validation/invoke-context.d.ts +7 -0
- package/build/shared/form-validation/invoke-context.js +11 -0
- package/build/shared/form-validation/validate-resolver-payload.d.ts +1 -1
- package/build/shared/form-validation/validate-resolver-payload.js +1 -0
- package/build/shared/form-validation/x-lt-help.d.ts +2 -2
- package/build/shared/form-validation/x-lt-help.js +2 -2
- package/build/shared/form-validation/x-lt-show-if.d.ts +1 -0
- package/build/shared/form-validation/x-lt-show-if.js +3 -0
- package/build/start/workers.js +2 -0
- package/build/system/mcp-servers/admin/workflows.js +15 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/config.d.ts +6 -0
- package/build/types/index.d.ts +2 -0
- package/build/types/index.js +4 -1
- package/build/types/startup.d.ts +10 -0
- package/build/types/validation.d.ts +4 -2
- package/build/types/workflow-icons.d.ts +86 -0
- package/build/types/workflow-icons.js +92 -0
- package/dashboard/dist/assets/{AdminDashboard-DPkWtPc1.js → AdminDashboard-Drs-9TRM.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-DPkWtPc1.js.map → AdminDashboard-Drs-9TRM.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-DRfnLiQS.js → AgentConfigPage-BDPDZ7-v.js} +3 -3
- package/dashboard/dist/assets/{AgentConfigPage-DRfnLiQS.js.map → AgentConfigPage-BDPDZ7-v.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-CufRZXnT.js → AgentDetailPage-CGBulM4_.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-CufRZXnT.js.map → AgentDetailPage-CGBulM4_.js.map} +1 -1
- package/dashboard/dist/assets/AgentsPage-D77JeViQ.js +2 -0
- package/dashboard/dist/assets/{AgentsPage-CoCWGhUd.js.map → AgentsPage-D77JeViQ.js.map} +1 -1
- package/dashboard/dist/assets/{AutoGrowTextarea-DgEQeRQw.js → AutoGrowTextarea-7X3T9La8.js} +2 -2
- package/dashboard/dist/assets/{AutoGrowTextarea-DgEQeRQw.js.map → AutoGrowTextarea-7X3T9La8.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-CqM_MOMy.js +2 -0
- package/dashboard/dist/assets/{AvailableEscalationsPage-BSqOctep.js.map → AvailableEscalationsPage-CqM_MOMy.js.map} +1 -1
- package/dashboard/dist/assets/{BotPicker-DMojDLlV.js → BotPicker-CC5vI_Sv.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-DMojDLlV.js.map → BotPicker-CC5vI_Sv.js.map} +1 -1
- package/dashboard/dist/assets/BulkAssignModal-BXiJnlqt.js +2 -0
- package/dashboard/dist/assets/{BulkAssignModal-DYbM_6Or.js.map → BulkAssignModal-BXiJnlqt.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-CDQ5JHNP.js → CapabilitiesPage-D9TC2iKy.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-CDQ5JHNP.js.map → CapabilitiesPage-D9TC2iKy.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-D4VlCEbD.js → CollapsibleSection-D10lGw_u.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-D4VlCEbD.js.map → CollapsibleSection-D10lGw_u.js.map} +1 -1
- package/dashboard/dist/assets/{ConfirmDeleteModal-DnNHjJtD.js → ConfirmDeleteModal-BJdLN6No.js} +2 -2
- package/dashboard/dist/assets/{ConfirmDeleteModal-DnNHjJtD.js.map → ConfirmDeleteModal-BJdLN6No.js.map} +1 -1
- package/dashboard/dist/assets/{CopyableId-4Lqlc5cU.js → CopyableId-Bn02zYxt.js} +2 -2
- package/dashboard/dist/assets/{CopyableId-4Lqlc5cU.js.map → CopyableId-Bn02zYxt.js.map} +1 -1
- package/dashboard/dist/assets/CountdownTimer-D9B-BjQ7.js +2 -0
- package/dashboard/dist/assets/CountdownTimer-D9B-BjQ7.js.map +1 -0
- package/dashboard/dist/assets/{CredentialsPage-CSYZw-rL.js → CredentialsPage-hniUAFBK.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-CSYZw-rL.js.map → CredentialsPage-hniUAFBK.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-CpmqDrlJ.js → CronLabel-v9DCD2FX.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-CpmqDrlJ.js.map → CronLabel-v9DCD2FX.js.map} +1 -1
- package/dashboard/dist/assets/{DataTable-DFPMeqyQ.js → DataTable-7C7riavf.js} +2 -2
- package/dashboard/dist/assets/{DataTable-DFPMeqyQ.js.map → DataTable-7C7riavf.js.map} +1 -1
- package/dashboard/dist/assets/{DropZone-BbXlQnYB.js → DropZone-XlcY8hEH.js} +2 -2
- package/dashboard/dist/assets/{DropZone-BbXlQnYB.js.map → DropZone-XlcY8hEH.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-Cul22qBS.js → ElapsedCell-_xvVTK8N.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-Cul22qBS.js.map → ElapsedCell-_xvVTK8N.js.map} +1 -1
- package/dashboard/dist/assets/{EmptyState-lpUFYfun.js → EmptyState-DgC_6njU.js} +2 -2
- package/dashboard/dist/assets/{EmptyState-lpUFYfun.js.map → EmptyState-DgC_6njU.js.map} +1 -1
- package/dashboard/dist/assets/{EntityTimelinePanel-CtzpJ-j2.js → EntityTimelinePanel-1lT3jkCM.js} +2 -2
- package/dashboard/dist/assets/{EntityTimelinePanel-CtzpJ-j2.js.map → EntityTimelinePanel-1lT3jkCM.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListSchemaPage-BZQ8Y_UH.js → EscalationListSchemaPage-BeQUTUEO.js} +3 -3
- package/dashboard/dist/assets/{EscalationListSchemaPage-BZQ8Y_UH.js.map → EscalationListSchemaPage-BeQUTUEO.js.map} +1 -1
- package/dashboard/dist/assets/EscalationListView-uuZRMSLB.js +2 -0
- package/dashboard/dist/assets/EscalationListView-uuZRMSLB.js.map +1 -0
- package/dashboard/dist/assets/{EscalationSchemaPage-CydTtq_A.js → EscalationSchemaPage-D4VlEwyS.js} +3 -3
- package/dashboard/dist/assets/{EscalationSchemaPage-CydTtq_A.js.map → EscalationSchemaPage-D4VlEwyS.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-DSYC0nI7.js → EscalationsOverview-Bx6Zrzm-.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-DSYC0nI7.js.map → EscalationsOverview-Bx6Zrzm-.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-s48cTXIw.js → EventTable-KEC3YWBf.js} +2 -2
- package/dashboard/dist/assets/{EventTable-s48cTXIw.js.map → EventTable-KEC3YWBf.js.map} +1 -1
- package/dashboard/dist/assets/{FilterBar-B61qKmFD.js → FilterBar-xwN_b5fj.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-B61qKmFD.js.map → FilterBar-xwN_b5fj.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage-DxZv_KC2.js → GraphInvokePage-DV7Y0fe2.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-DxZv_KC2.js.map → GraphInvokePage-DV7Y0fe2.js.map} +1 -1
- package/dashboard/dist/assets/HomePage-G785SWcW.js +2 -0
- package/dashboard/dist/assets/{HomePage-zK3VP_9g.js.map → HomePage-G785SWcW.js.map} +1 -1
- package/dashboard/dist/assets/ListToolbar-zPVYPg3W.js +2 -0
- package/dashboard/dist/assets/{ListToolbar-DaxloPQc.js.map → ListToolbar-zPVYPg3W.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-Ciq8r6-p.js → McpOverview-CMGUq8hx.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-Ciq8r6-p.js.map → McpOverview-CMGUq8hx.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-DIC0FEEb.js → McpQueryDetailPage-CdhLhaKn.js} +3 -3
- package/dashboard/dist/assets/{McpQueryDetailPage-DIC0FEEb.js.map → McpQueryDetailPage-CdhLhaKn.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-BBy0NSNg.js → McpQueryPage-CNSNMagY.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-BBy0NSNg.js.map → McpQueryPage-CNSNMagY.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-BqKNmIyW.js → McpRunDetailPage-DBm8hUaW.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-BqKNmIyW.js.map → McpRunDetailPage-DBm8hUaW.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-D0RlOpzR.js → McpRunsPage-B6rb5QBf.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-D0RlOpzR.js.map → McpRunsPage-B6rb5QBf.js.map} +1 -1
- package/dashboard/dist/assets/{NamespacePill-Dbtm9R2T.js → NamespacePill-Bb3revqD.js} +2 -2
- package/dashboard/dist/assets/{NamespacePill-Dbtm9R2T.js.map → NamespacePill-Bb3revqD.js.map} +1 -1
- package/dashboard/dist/assets/{OperationsPage-BX0SFizr.js → OperationsPage-Dxk1fAMg.js} +3 -3
- package/dashboard/dist/assets/{OperationsPage-BX0SFizr.js.map → OperationsPage-Dxk1fAMg.js.map} +1 -1
- package/dashboard/dist/assets/OperatorDashboard-DBOscDnf.js +2 -0
- package/dashboard/dist/assets/{OperatorDashboard-vXG0TjAQ.js.map → OperatorDashboard-DBOscDnf.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeader-xB92ELs3.js → PageHeader-Di5Sz3an.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-xB92ELs3.js.map → PageHeader-Di5Sz3an.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-DVo_qqn1.js → PageHeaderWithStats-DutKJ-h2.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-DVo_qqn1.js.map → PageHeaderWithStats-DutKJ-h2.js.map} +1 -1
- package/dashboard/dist/assets/{PersonaDetailPage-w5TXcn4Q.js → PersonaDetailPage-BGRdGpeR.js} +2 -2
- package/dashboard/dist/assets/{PersonaDetailPage-w5TXcn4Q.js.map → PersonaDetailPage-BGRdGpeR.js.map} +1 -1
- package/dashboard/dist/assets/{PersonasPage-Dzcinl1L.js → PersonasPage-DRzOZcVa.js} +2 -2
- package/dashboard/dist/assets/{PersonasPage-Dzcinl1L.js.map → PersonasPage-DRzOZcVa.js.map} +1 -1
- package/dashboard/dist/assets/{PriorityBadge-BETdj4M-.js → PriorityBadge-r33mpDju.js} +2 -2
- package/dashboard/dist/assets/{PriorityBadge-BETdj4M-.js.map → PriorityBadge-r33mpDju.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-BVXieFX1.js → ProcessDetailPage-BLGjZXpM.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-BVXieFX1.js.map → ProcessDetailPage-BLGjZXpM.js.map} +1 -1
- package/dashboard/dist/assets/ProcessesListPage-5NnysKFC.js +2 -0
- package/dashboard/dist/assets/{ProcessesListPage-CKKNpk4z.js.map → ProcessesListPage-5NnysKFC.js.map} +1 -1
- package/dashboard/dist/assets/ResolverForm-Dy0yirtP.js +2 -0
- package/dashboard/dist/assets/ResolverForm-Dy0yirtP.js.map +1 -0
- package/dashboard/dist/assets/{RoleDetailPage-BytSo-YE.js → RoleDetailPage-C_LIoe1j.js} +3 -3
- package/dashboard/dist/assets/{RoleDetailPage-BytSo-YE.js.map → RoleDetailPage-C_LIoe1j.js.map} +1 -1
- package/dashboard/dist/assets/{RolePill-CYpL3a2d.js → RolePill-DhnVPK4q.js} +2 -2
- package/dashboard/dist/assets/{RolePill-CYpL3a2d.js.map → RolePill-DhnVPK4q.js.map} +1 -1
- package/dashboard/dist/assets/RolesPage-BmW1LzkU.js +2 -0
- package/dashboard/dist/assets/{RolesPage-eayR9H4f.js.map → RolesPage-BmW1LzkU.js.map} +1 -1
- package/dashboard/dist/assets/{RowActions-eYrzgQSj.js → RowActions-Bdd7z4eB.js} +2 -2
- package/dashboard/dist/assets/{RowActions-eYrzgQSj.js.map → RowActions-Bdd7z4eB.js.map} +1 -1
- package/dashboard/dist/assets/RunAsSelector-BwZTJ4Yj.js +2 -0
- package/dashboard/dist/assets/{RunAsSelector-D7RPwaAl.js.map → RunAsSelector-BwZTJ4Yj.js.map} +1 -1
- package/dashboard/dist/assets/ScanCodesPage-FiYIYB-m.js +2 -0
- package/dashboard/dist/assets/{ScanCodesPage-C8-ZBXF5.js.map → ScanCodesPage-FiYIYB-m.js.map} +1 -1
- package/dashboard/dist/assets/{ScanSchemeDetailPage-tQhEgFKf.js → ScanSchemeDetailPage-BiAqtD-a.js} +2 -2
- package/dashboard/dist/assets/{ScanSchemeDetailPage-tQhEgFKf.js.map → ScanSchemeDetailPage-BiAqtD-a.js.map} +1 -1
- package/dashboard/dist/assets/ScanStationPage-8CdOtbCD.js +2 -0
- package/dashboard/dist/assets/{ScanStationPage-CuhqsBKo.js.map → ScanStationPage-8CdOtbCD.js.map} +1 -1
- package/dashboard/dist/assets/{ScopeBadge-BmNzZlSj.js → ScopeBadge-CXUg0FHo.js} +2 -2
- package/dashboard/dist/assets/{ScopeBadge-BmNzZlSj.js.map → ScopeBadge-CXUg0FHo.js.map} +1 -1
- package/dashboard/dist/assets/{SegmentedTabs-DXNzY05q.js → SegmentedTabs-BpJh4Hwn.js} +2 -2
- package/dashboard/dist/assets/{SegmentedTabs-DXNzY05q.js.map → SegmentedTabs-BpJh4Hwn.js.map} +1 -1
- package/dashboard/dist/assets/{StatCard-BXQ8dD9Y.js → StatCard-nWY4sndl.js} +2 -2
- package/dashboard/dist/assets/{StatCard-BXQ8dD9Y.js.map → StatCard-nWY4sndl.js.map} +1 -1
- package/dashboard/dist/assets/{StatusBadge-BDeUwPtb.js → StatusBadge-DHVwxre2.js} +2 -2
- package/dashboard/dist/assets/{StatusBadge-BDeUwPtb.js.map → StatusBadge-DHVwxre2.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-BIVTAMnP.js → StickyPagination-DRuqKhZt.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-BIVTAMnP.js.map → StickyPagination-DRuqKhZt.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-CYSC2cO1.js → StreamMessageDetail-JwlbRiMn.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-CYSC2cO1.js.map → StreamMessageDetail-JwlbRiMn.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-BMZAs_2K.js → SwimlaneTimeline-hu3c4bCJ.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-BMZAs_2K.js.map → SwimlaneTimeline-hu3c4bCJ.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-D1uszNd2.js → TagInput-BZ8vb2oW.js} +2 -2
- package/dashboard/dist/assets/{TagInput-D1uszNd2.js.map → TagInput-BZ8vb2oW.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-CVUDUU5Q.js → TaskDetailPage-NqVZF3jW.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-CVUDUU5Q.js.map → TaskDetailPage-NqVZF3jW.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-C2H8oRfn.js → TaskQueuePill-Bxir8WRl.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-C2H8oRfn.js.map → TaskQueuePill-Bxir8WRl.js.map} +1 -1
- package/dashboard/dist/assets/TasksListPage-BQNaSzCn.js +2 -0
- package/dashboard/dist/assets/{TasksListPage-DEQymbXC.js.map → TasksListPage-BQNaSzCn.js.map} +1 -1
- package/dashboard/dist/assets/TimeAgo-Cv35DOiI.js +2 -0
- package/dashboard/dist/assets/{TimeAgo-CCxP67Rb.js.map → TimeAgo-Cv35DOiI.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-CE5ZUYhV.js → TimestampCell-DHUXey9s.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-CE5ZUYhV.js.map → TimestampCell-DHUXey9s.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-D-h8AoB8.js → ToolPill-FkgTXIhq.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-D-h8AoB8.js.map → ToolPill-FkgTXIhq.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-BHuQTyBY.js → ToolTestPanel-DvuLFWqQ.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-BHuQTyBY.js.map → ToolTestPanel-DvuLFWqQ.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-SFuiludx.js → TopicDetailPage-TXX3QNSo.js} +3 -3
- package/dashboard/dist/assets/{TopicDetailPage-SFuiludx.js.map → TopicDetailPage-TXX3QNSo.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-DO8pUmng.js → TopicsPage-h-oyTeEJ.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-DO8pUmng.js.map → TopicsPage-h-oyTeEJ.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-CsLnT75E.js → UserName-BceRCeDF.js} +2 -2
- package/dashboard/dist/assets/{UserName-CsLnT75E.js.map → UserName-BceRCeDF.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowExecutionPage-CmHGcaN9.js +2 -0
- package/dashboard/dist/assets/{WorkflowExecutionPage-BttnEvOd.js.map → WorkflowExecutionPage-CmHGcaN9.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowPill-CZvBbkn4.js → WorkflowPill--AYMW7u_.js} +2 -2
- package/dashboard/dist/assets/WorkflowPill--AYMW7u_.js.map +1 -0
- package/dashboard/dist/assets/WorkflowsDashboard-B0r2lQXk.js +2 -0
- package/dashboard/dist/assets/{WorkflowsDashboard-BRboBhlK.js.map → WorkflowsDashboard-B0r2lQXk.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowsOverview-BTMc2PJ_.js +2 -0
- package/dashboard/dist/assets/{WorkflowsOverview-CDFTYeQo.js.map → WorkflowsOverview-BTMc2PJ_.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-CmnZFevp.js → YamlWorkflowDetailPage-DUiCVnZp.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-CmnZFevp.js.map → YamlWorkflowDetailPage-DUiCVnZp.js.map} +1 -1
- package/dashboard/dist/assets/YamlWorkflowsPage-BAuXfwi0.js +2 -0
- package/dashboard/dist/assets/{YamlWorkflowsPage-Qq1jfcrH.js.map → YamlWorkflowsPage-BAuXfwi0.js.map} +1 -1
- package/dashboard/dist/assets/{agents-C7vUIO7e.js → agents-BvmLCk4h.js} +2 -2
- package/dashboard/dist/assets/{agents-C7vUIO7e.js.map → agents-BvmLCk4h.js.map} +1 -1
- package/dashboard/dist/assets/{bots-BaOblnW4.js → bots-f_tyhl4I.js} +2 -2
- package/dashboard/dist/assets/{bots-BaOblnW4.js.map → bots-f_tyhl4I.js.map} +1 -1
- package/dashboard/dist/assets/capabilities-DNo5bqLx.js +2 -0
- package/dashboard/dist/assets/{capabilities-RZpmDWoy.js.map → capabilities-DNo5bqLx.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-BwGdcwXR.js → controlplane-Dyyj2Irb.js} +2 -2
- package/dashboard/dist/assets/{controlplane-BwGdcwXR.js.map → controlplane-Dyyj2Irb.js.map} +1 -1
- package/dashboard/dist/assets/escalation-columns-DIigeTOK.js +2 -0
- package/dashboard/dist/assets/{escalation-columns-B4DG_5v8.js.map → escalation-columns-DIigeTOK.js.map} +1 -1
- package/dashboard/dist/assets/index-BMlQYOE1.js +67 -0
- package/dashboard/dist/assets/index-BMlQYOE1.js.map +1 -0
- package/dashboard/dist/assets/{index-BICLHYJJ.js → index-BNZknxFY.js} +2 -2
- package/dashboard/dist/assets/{index-BICLHYJJ.js.map → index-BNZknxFY.js.map} +1 -1
- package/dashboard/dist/assets/index-Bpvfr4OW.css +1 -0
- package/dashboard/dist/assets/{index-G3NmdMjt.js → index-C-Xr2V3F.js} +2 -2
- package/dashboard/dist/assets/{index-G3NmdMjt.js.map → index-C-Xr2V3F.js.map} +1 -1
- package/dashboard/dist/assets/index-CegPUKpc.js +3 -0
- package/dashboard/dist/assets/index-CegPUKpc.js.map +1 -0
- package/dashboard/dist/assets/{index-xNFTmmsv.js → index-CsKiRyhy.js} +2 -2
- package/dashboard/dist/assets/{index-xNFTmmsv.js.map → index-CsKiRyhy.js.map} +1 -1
- package/dashboard/dist/assets/index-D7ESqn22.js +2 -0
- package/dashboard/dist/assets/{index-IWufkcH9.js.map → index-D7ESqn22.js.map} +1 -1
- package/dashboard/dist/assets/{index-iegzyfMv.js → index-DL83W7Gu.js} +2 -2
- package/dashboard/dist/assets/{index-iegzyfMv.js.map → index-DL83W7Gu.js.map} +1 -1
- package/dashboard/dist/assets/index-DPLssnMW.js +6 -0
- package/dashboard/dist/assets/index-DPLssnMW.js.map +1 -0
- package/dashboard/dist/assets/{index-BuqpU6ow.js → index-DWse7ERF.js} +2 -2
- package/dashboard/dist/assets/{index-BuqpU6ow.js.map → index-DWse7ERF.js.map} +1 -1
- package/dashboard/dist/assets/index-DoETPlJP.js +11 -0
- package/dashboard/dist/assets/index-DoETPlJP.js.map +1 -0
- package/dashboard/dist/assets/{index-D9NtDRtp.js → index-DvxxrFBo.js} +2 -2
- package/dashboard/dist/assets/{index-D9NtDRtp.js.map → index-DvxxrFBo.js.map} +1 -1
- package/dashboard/dist/assets/{index-DU9-flEo.js → index-PcyGjmBm.js} +2 -2
- package/dashboard/dist/assets/{index-DU9-flEo.js.map → index-PcyGjmBm.js.map} +1 -1
- package/dashboard/dist/assets/{index-BQPUlmmz.js → index-e2X-s0EQ.js} +2 -2
- package/dashboard/dist/assets/{index-BQPUlmmz.js.map → index-e2X-s0EQ.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge-CjwCbm3E.js → knowledge-Coo6CKzo.js} +2 -2
- package/dashboard/dist/assets/{knowledge-CjwCbm3E.js.map → knowledge-Coo6CKzo.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-C-DMktCT.js → mcp-Cz5eFnP_.js} +2 -2
- package/dashboard/dist/assets/{mcp-C-DMktCT.js.map → mcp-Cz5eFnP_.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-KBeBNHb4.js → mcp-query-BtnuO4LF.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-KBeBNHb4.js.map → mcp-query-BtnuO4LF.js.map} +1 -1
- package/dashboard/dist/assets/{personas-B32sSCxm.js → personas-C2-LgpHQ.js} +2 -2
- package/dashboard/dist/assets/{personas-B32sSCxm.js.map → personas-C2-LgpHQ.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-DNLwDumm.js → pipelines-TuXQvUA-.js} +2 -2
- package/dashboard/dist/assets/{pipelines-DNLwDumm.js.map → pipelines-TuXQvUA-.js.map} +1 -1
- package/dashboard/dist/assets/resolver-payload-C1dXB3n6.js +2 -0
- package/dashboard/dist/assets/resolver-payload-C1dXB3n6.js.map +1 -0
- package/dashboard/dist/assets/seed-form-json-DvPsISxD.js +2 -0
- package/dashboard/dist/assets/seed-form-json-DvPsISxD.js.map +1 -0
- package/dashboard/dist/assets/{tasks-DrWSrjmj.js → tasks-OUzpu__z.js} +2 -2
- package/dashboard/dist/assets/{tasks-DrWSrjmj.js.map → tasks-OUzpu__z.js.map} +1 -1
- package/dashboard/dist/assets/{topics-DgzGU-vR.js → topics-B8bdrBaW.js} +2 -2
- package/dashboard/dist/assets/{topics-DgzGU-vR.js.map → topics-B8bdrBaW.js.map} +1 -1
- package/dashboard/dist/assets/useDebouncedValue-Cp5ZOtVE.js +2 -0
- package/dashboard/dist/assets/{useDebouncedValue-DG5JOj1F.js.map → useDebouncedValue-Cp5ZOtVE.js.map} +1 -1
- package/dashboard/dist/assets/{useFilterParams-crmlBw_l.js → useFilterParams-DBRw1Hcv.js} +2 -2
- package/dashboard/dist/assets/{useFilterParams-crmlBw_l.js.map → useFilterParams-DBRw1Hcv.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-CdgF7Jxo.js → useNamespace-DtQe3wZ5.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-CdgF7Jxo.js.map → useNamespace-DtQe3wZ5.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-BEaOtgSZ.js → useYamlActivityEvents-CS22c15X.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-BEaOtgSZ.js.map → useYamlActivityEvents-CS22c15X.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-BCWsItQ7.js → vendor-icons-DeBdvyKJ.js} +364 -144
- package/dashboard/dist/assets/vendor-icons-DeBdvyKJ.js.map +1 -0
- package/dashboard/dist/assets/vendor-query-DvWWuNIB.js +18 -0
- package/dashboard/dist/assets/vendor-query-DvWWuNIB.js.map +1 -0
- package/dashboard/dist/assets/{vendor-react-CdqEC2zv.js → vendor-react-_9U4mKFr.js} +2 -2
- package/dashboard/dist/assets/{vendor-react-CdqEC2zv.js.map → vendor-react-_9U4mKFr.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-YASUDPo0.js → yaml-workflows-HQIki3hI.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-YASUDPo0.js.map → yaml-workflows-HQIki3hI.js.map} +1 -1
- package/dashboard/dist/index.html +5 -5
- package/docs/api/http/workflows.md +25 -1
- package/docs/code-owned-configuration.md +1 -1
- package/docs/dashboard.md +45 -19
- package/docs/events.md +3 -1
- package/docs/faceted-routing.md +1 -1
- package/docs/hitl/iframe.md +35 -6
- package/docs/hitl/invoke-form.md +98 -0
- package/docs/hitl/x-lt-show-if.md +11 -0
- package/docs/hitl-guide.md +4 -2
- package/docs/iam.md +1 -1
- package/docs/scan-codes.md +13 -4
- package/docs/workflows.md +1 -1
- package/package.json +1 -1
- package/dashboard/dist/assets/AgentsPage-CoCWGhUd.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-BSqOctep.js +0 -2
- package/dashboard/dist/assets/BulkAssignModal-DYbM_6Or.js +0 -2
- package/dashboard/dist/assets/CountdownTimer-DPHMBmgz.js +0 -2
- package/dashboard/dist/assets/CountdownTimer-DPHMBmgz.js.map +0 -1
- package/dashboard/dist/assets/HomePage-zK3VP_9g.js +0 -2
- package/dashboard/dist/assets/ListToolbar-DaxloPQc.js +0 -2
- package/dashboard/dist/assets/OperatorDashboard-vXG0TjAQ.js +0 -2
- package/dashboard/dist/assets/ProcessesListPage-CKKNpk4z.js +0 -2
- package/dashboard/dist/assets/RolesPage-eayR9H4f.js +0 -2
- package/dashboard/dist/assets/RunAsSelector-D7RPwaAl.js +0 -2
- package/dashboard/dist/assets/ScanCodesPage-C8-ZBXF5.js +0 -2
- package/dashboard/dist/assets/ScanStationPage-CuhqsBKo.js +0 -2
- package/dashboard/dist/assets/TasksListPage-DEQymbXC.js +0 -2
- package/dashboard/dist/assets/TimeAgo-CCxP67Rb.js +0 -2
- package/dashboard/dist/assets/WorkflowExecutionPage-BttnEvOd.js +0 -2
- package/dashboard/dist/assets/WorkflowPill-CZvBbkn4.js.map +0 -1
- package/dashboard/dist/assets/WorkflowsDashboard-BRboBhlK.js +0 -2
- package/dashboard/dist/assets/WorkflowsOverview-CDFTYeQo.js +0 -2
- package/dashboard/dist/assets/YamlWorkflowsPage-Qq1jfcrH.js +0 -2
- package/dashboard/dist/assets/capabilities-RZpmDWoy.js +0 -2
- package/dashboard/dist/assets/escalation-columns-B4DG_5v8.js +0 -2
- package/dashboard/dist/assets/index-8LIpvj2e.js +0 -3
- package/dashboard/dist/assets/index-8LIpvj2e.js.map +0 -1
- package/dashboard/dist/assets/index-BaC3sbJH.js +0 -67
- package/dashboard/dist/assets/index-BaC3sbJH.js.map +0 -1
- package/dashboard/dist/assets/index-CD6jtND1.css +0 -1
- package/dashboard/dist/assets/index-CsIw-ZLk.js +0 -6
- package/dashboard/dist/assets/index-CsIw-ZLk.js.map +0 -1
- package/dashboard/dist/assets/index-CtJkvX9e.js +0 -5
- package/dashboard/dist/assets/index-CtJkvX9e.js.map +0 -1
- package/dashboard/dist/assets/index-IWufkcH9.js +0 -2
- package/dashboard/dist/assets/useDebouncedValue-DG5JOj1F.js +0 -2
- package/dashboard/dist/assets/vendor-icons-BCWsItQ7.js.map +0 -1
- package/dashboard/dist/assets/vendor-query-RUZdMvN6.js +0 -18
- package/dashboard/dist/assets/vendor-query-RUZdMvN6.js.map +0 -1
- package/dashboard/dist/assets/workflows-CX_oarls.js +0 -2
- package/dashboard/dist/assets/workflows-CX_oarls.js.map +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as c,j as e}from"./vendor-query-RUZdMvN6.js";import{aK as S,aL as m,aM as T,Y as A}from"./index-BaC3sbJH.js";import{P as _}from"./PageHeader-xB92ELs3.js";import{a as I,f as E}from"./vendor-icons-BCWsItQ7.js";import{u as D}from"./vendor-react-CdqEC2zv.js";function P(r){for(let a=10;a<=99;a++)if(!r.has(a))return a;return null}function H(){const r=D(),{data:a,isLoading:i}=S(),[o,l]=c.useState(!1),u=(a==null?void 0:a.schemes)??[],d=new Set(u.map(t=>t.version)),h=P(d);return e.jsxs("div",{children:[e.jsx(_,{title:"Scan Codes"}),e.jsx("p",{className:"text-sm text-text-secondary max-w-form mb-8",children:"A scan code addresses one of your escalations by a value on its label. Add a scheme, name it, and point it at the metadata facet the scanned value matches — then define what each scan does on its detail page."}),i?e.jsx("div",{className:"text-sm text-text-tertiary",children:"Loading…"}):e.jsxs("div",{className:"divide-y divide-surface-border border-y border-surface-border max-w-form",children:[u.map(t=>e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>r(`/admin/scan-codes/${t.version}`),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&r(`/admin/scan-codes/${t.version}`)},className:"flex items-center gap-4 py-3 px-2 cursor-pointer hover:bg-surface-sunken transition-colors",children:[e.jsx("span",{className:"w-9 h-8 flex items-center justify-center text-sm font-mono text-accent border border-surface-border rounded shrink-0",children:t.version}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-text-primary truncate",children:t.name}),e.jsxs("div",{className:"text-2xs text-text-tertiary truncate",children:[t.kind===m.IDENTITY&&"identity badge · ","target facet ",e.jsx("span",{className:"font-mono",children:t.target_facet})," · ",t.encoding==="fixed"?`fixed, ${t.target_length} digit target`:`delimited by "${t.delimiter}"`]})]}),e.jsx("span",{className:`text-2xs uppercase tracking-widest ${t.enabled?"text-status-success":"text-text-quaternary"}`,children:t.enabled?"Enabled":"Disabled"})]},t.version)),e.jsxs("div",{className:"flex items-center gap-4 py-3 px-2",children:[e.jsx("span",{className:"w-9 h-8 flex items-center justify-center text-text-quaternary shrink-0",children:e.jsx(I,{className:"w-4 h-4",strokeWidth:1.5})}),h==null?e.jsx("span",{className:"text-2xs text-text-quaternary",children:"All 90 scheme slots are in use."}):o?e.jsx(L,{version:h,onDone:t=>{l(!1),t!=null&&r(`/admin/scan-codes/${t}`)}}):e.jsxs("button",{type:"button",onClick:()=>l(!0),className:"flex items-center gap-1.5 text-sm text-accent hover:text-accent-hover",children:[e.jsx(E,{className:"w-3.5 h-3.5"})," Add a scheme"]})]})]})]})}function L({version:r,onDone:a}){const i=T(),{data:o}=A(),[l,u]=c.useState(""),[d,h]=c.useState(m.ACTION),[t,p]=c.useState(""),[x,f]=c.useState(""),[N,y]=c.useState(8),[b,v]=c.useState(3600),[j,k]=c.useState(0),w=Array.from(new Set(((o==null?void 0:o.roles)??[]).map(s=>s.priority_facet).filter(Boolean))),n=d===m.IDENTITY,g=b>=1&&b<=86400,C=async()=>{!l||!t||!x||n&&!g||(await i.mutateAsync({version:r,name:l,kind:d,target_facet:t,encoding:x,target_length:x==="fixed"?N:null,grant_ttl_seconds:n?b:null,grant_max_uses:n?j:0}),a(r))};return e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsxs("p",{className:"text-2xs text-text-tertiary",children:["Codes for this scheme start with ",e.jsx("span",{className:"font-mono text-text-secondary",children:r})," — assigned for you."]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Kind ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:n?"A badge — scanning it primes who acts next.":"An item code — scanning it acts on the item."}),e.jsxs("select",{value:d,onChange:s=>h(s.target.value),className:"select",children:[e.jsx("option",{value:m.ACTION,children:"Action"}),e.jsx("option",{value:m.IDENTITY,children:"Identity"})]})]}),e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Name ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:n?'Say who the badge identifies — "Associate badge".':'Say what the target identifies — "Printer serial".'}),e.jsx("input",{value:l,onChange:s=>u(s.target.value),className:"input w-full",placeholder:n?"Associate badge":"Printer serial",autoFocus:!0})]}),e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Target facet ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:n?"The user-metadata key the badge matches (e.g. badge_id).":"The escalation metadata key the scanned value matches."}),e.jsx("input",{value:t,onChange:s=>p(s.target.value),className:"input w-full font-mono",placeholder:n?"badge_id":"serialNumber",list:"scan-facet-suggestions"}),e.jsx("datalist",{id:"scan-facet-suggestions",children:w.map(s=>e.jsx("option",{value:s},s))})]})]}),n&&e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Grant TTL (seconds) ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"How long a badge scan stays primed (1–86400)."}),e.jsx("input",{type:"number",min:1,max:86400,value:b,onChange:s=>v(Number(s.target.value)),className:"input w-[12rem]"}),!g&&e.jsx("span",{className:"block text-2xs text-status-error mt-1",children:"Enter 1–86400 seconds."})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Grant max uses"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"0 = TTL-bound; n = the grant covers n scans."}),e.jsx("input",{type:"number",min:0,value:j,onChange:s=>k(Number(s.target.value)),className:"input w-[12rem]"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Code style ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Delimited for QR / Code 128, fixed digits for numeric UPC labels."}),e.jsxs("select",{value:x,onChange:s=>f(s.target.value),className:"select",children:[e.jsx("option",{value:"",disabled:!0,children:"Choose…"}),e.jsx("option",{value:"delimited",children:"Delimited text (QR / Code 128)"}),e.jsx("option",{value:"fixed",children:"Fixed digits (UPC)"})]})]}),x==="fixed"&&e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Target digits ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"How many digits the target occupies."}),e.jsx("input",{type:"number",min:1,max:20,value:N,onChange:s=>y(Number(s.target.value)),className:"input w-[12rem]"})]})]}),i.error&&e.jsx("p",{className:"text-xs text-status-error",children:i.error.message}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{type:"button",onClick:()=>a(null),className:"btn-secondary text-xs",children:"Discard"}),e.jsx("button",{type:"button",onClick:C,disabled:!l||!t||!x||n&&!g||i.isPending,className:"btn-primary text-xs",children:"Create scheme"})]})]})}export{H as ScanCodesPage};
|
|
2
|
-
//# sourceMappingURL=ScanCodesPage-C8-ZBXF5.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as e,a as o}from"./vendor-query-RUZdMvN6.js";import{ae as E,aS as B,aT as O,M as _,ac as A,_ as R,aU as L,aV as W,aW as C,aa as v}from"./index-BaC3sbJH.js";import{a as D,aX as F,aw as P}from"./vendor-icons-BCWsItQ7.js";import{d as U}from"./metadata-display--TzK0REC.js";import{a as V,u as $}from"./vendor-react-CdqEC2zv.js";function q({stationName:t}){return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center py-24",children:[e.jsx(D,{className:"w-10 h-10 text-accent-muted mb-8",strokeWidth:1}),e.jsx("h1",{className:"text-3xl font-light text-text-primary tracking-tight",children:t}),e.jsx("div",{className:"w-16 border-t border-surface-border my-8"}),e.jsx("p",{className:"text-lg text-text-secondary",children:"Scan your badge to begin"}),e.jsx("p",{className:"text-sm text-text-tertiary mt-2",children:"or scan an item"})]})}function H(t){const r=Math.floor(t/60),c=t%60;return`${r}:${String(c).padStart(2,"0")}`}function Y(){const{identity:t,remainingSeconds:r}=E(),[,c]=o.useState(0);return o.useEffect(()=>{if(!(t!=null&&t.expiresAt))return;const a=setInterval(()=>c(f=>f+1),1e3);return()=>clearInterval(a)},[t]),t?e.jsxs("div",{className:"flex items-center gap-2.5 pb-3 mb-6 border-b border-surface-border",children:[e.jsx(F,{className:"w-4 h-4 text-status-success shrink-0",strokeWidth:1.5}),e.jsxs("span",{className:"text-sm font-medium text-text-primary",children:["Hi ",t.displayName]}),t.expiresAt&&e.jsx("span",{className:"ml-auto text-sm font-mono tabular-nums text-text-tertiary",children:H(r())})]}):null}function M(t,r){return!t.withheld||r}function X(t,r,c){return t.find(a=>!!a.code&&a.code===c&&M(a,r))??null}function G(t){return t==null||t===""?"—":typeof t=="boolean"?t?"Yes":"No":typeof t=="object"?JSON.stringify(t):String(t)}function J({label:t,value:r}){return e.jsxs("div",{className:"flex items-baseline gap-4 py-2",children:[e.jsx("span",{className:"w-32 shrink-0 text-2xs uppercase tracking-wide text-text-quaternary",children:t}),e.jsx("span",{className:"text-sm text-text-primary break-words",children:r})]})}function I(){return e.jsx("span",{className:"text-text-quaternary select-none",children:"·"})}function z({response:t,hasActingIdentity:r,selfId:c,busy:a,onExecute:f,onWithheldSelect:n}){var i,u;const{setCodeInterceptor:h}=B(),[x,d]=o.useState(null),l=t.escalation??{},m=t.choices??[],S=l.metadata??{},b=s=>{s.confirm?d(s):f(s)},j=o.useRef({choices:m,hasActingIdentity:r,select:b});j.current={choices:m,hasActingIdentity:r,select:b},o.useEffect(()=>(h(s=>{const p=j.current,T=X(p.choices,p.hasActingIdentity,s);return T?(p.select(T),!0):!1}),()=>h(null)),[h]);const g=l.assigned_to??null,k=g?g===c?"Claimed by you":"Claimed":"Unclaimed",w=g===c?"text-accent":"text-text-secondary",N=[l.type,l.subtype].filter(Boolean).join(" · "),y=U(S);return e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col max-w-form",children:[e.jsxs("div",{children:[((i=t.rule)==null?void 0:i.name)&&e.jsx("div",{className:"text-2xs font-semibold uppercase tracking-widest text-accent mb-2",children:t.rule.name}),e.jsx("h2",{className:"text-2xl font-medium leading-tight text-text-primary mb-2",children:l.description||N||"Located item"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-text-secondary mb-5",children:[e.jsx("span",{children:String(l.role??"—")}),N&&e.jsxs(e.Fragment,{children:[e.jsx(I,{}),e.jsx("span",{children:N})]}),e.jsx(I,{}),e.jsx("span",{className:w,children:k}),typeof l.created_at=="string"&&e.jsxs(e.Fragment,{children:[e.jsx(I,{}),e.jsx("span",{children:O(l.created_at)})]})]}),y.length>0&&e.jsx("div",{className:"divide-y divide-surface-border border-t border-surface-border",children:y.map(([s,p])=>e.jsx(J,{label:s,value:G(p)},s))})]}),e.jsx("div",{className:"mt-8 space-y-3",children:m.map(s=>{const p=M(s,r);return e.jsx("div",{children:e.jsx("button",{type:"button",disabled:a,onClick:()=>p?b(s):n(s),className:"w-full text-left px-5 py-4 text-lg text-text-primary border border-surface-border rounded hover:bg-surface-sunken transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e.jsxs("span",{className:"flex items-baseline gap-3",children:[s.label,s.code&&e.jsx("span",{className:"ml-auto text-2xs font-mono text-text-quaternary",children:s.code})]})})},s.index)})}),x&&e.jsx(_,{open:!0,onClose:()=>d(null),title:x.label,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-text-secondary",children:(u=x.confirm)==null?void 0:u.prompt}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>d(null),disabled:a,className:"btn-secondary text-xs",children:"No, go back"}),e.jsx("button",{type:"button",onClick:()=>{const s=x;d(null),f(s)},disabled:a,className:"btn-primary text-xs",children:"Yes, continue"})]})]})})]})}function K({choice:t,notPrimedMarkdown:r,primed:c,busy:a,onExecute:f,onCancel:n}){var l;const[h,x]=o.useState(!1),d=o.useRef(!1);return o.useEffect(()=>{if(!c){d.current=!1;return}d.current||(d.current=!0,t.confirm?x(!0):f(t))},[c,t,f]),e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center py-24",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-8",children:[e.jsx(D,{className:"w-8 h-8 text-text-quaternary",strokeWidth:1}),e.jsx(P,{className:"w-10 h-10 text-accent-muted",strokeWidth:1})]}),e.jsx("h2",{className:"text-2xl font-light text-text-primary tracking-tight",children:"Scan your badge to continue"}),e.jsxs("p",{className:"text-lg text-text-secondary mt-2",children:["to ",t.label]}),r&&e.jsx("div",{className:"text-sm text-text-tertiary mt-6 max-w-prose",children:e.jsx(A,{content:r,compact:!0})}),e.jsx("div",{className:"w-16 border-t border-surface-border my-8"}),e.jsx("button",{type:"button",onClick:n,disabled:a,className:"text-sm text-text-tertiary hover:text-text-secondary hover:underline",children:"Cancel"}),h&&e.jsx(_,{open:!0,onClose:n,title:t.label,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-text-secondary",children:(l=t.confirm)==null?void 0:l.prompt}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:n,disabled:a,className:"btn-secondary text-xs",children:"No, go back"}),e.jsx("button",{type:"button",onClick:()=>{x(!1),f(t)},disabled:a,className:"btn-primary text-xs",children:"Yes, continue"})]})]})})]})}const Q=8e3,Z=[v.SHOW_DETAIL,v.CLAIM,v.CLAIM_SHOW_DETAIL];function re(){var y;const t=V(),r=$(),{user:c}=R(),{identity:a,clear:f}=E(),[n,h]=o.useState(null),[x,d]=o.useState(null),[l,m]=o.useState(null),[S,b]=o.useState(!1);o.useEffect(()=>{var s,p;const i=(s=t.state)==null?void 0:s[L];if(!i)return;h(i),m(null);const u=((p=i.choices)==null?void 0:p.length)===1?i.choices[0]:void 0;d(i.autoSelect&&u?{choice:u,returnTo:"idle"}:null),r(t.pathname,{replace:!0,state:null})},[t,r]),o.useEffect(()=>{if(!l)return;const i=setTimeout(()=>m(null),Q);return()=>clearTimeout(i)},[l]);const j=o.useCallback(async i=>{if(!(!(n!=null&&n.rule)||!n.escalation)){b(!0);try{const u=await W({schemeVersion:n.rule.schemeVersion,category:n.rule.category,stepIndex:n.stepIndex??0,choiceIndex:i.index,escalationId:String(n.escalation.id),actingToken:a==null?void 0:a.actingToken});switch(u.outcome){case C.EXECUTED:if(h(null),d(null),Z.includes(i.verb)&&u.escalation){r(`/escalations/detail/${u.escalation.id}`);break}m({at:Date.now(),tone:"text-status-success",text:`${i.label} — done`});break;case C.CONFLICT:h(null),d(null),m({at:Date.now(),tone:"text-status-warning",text:u.error||"The item changed since it was scanned — scan it again."});break;case C.UNCONFIGURED:h(null),d(null),m({at:Date.now(),tone:"text-status-warning",text:u.error||"This choice is no longer configured."});break;case C.NOT_PRIMED:f(),m(null),d(s=>({choice:i,returnTo:(s==null?void 0:s.returnTo)??"choices"}));break;default:m({at:Date.now(),tone:"text-status-error",text:u.error||"The choice did not run."})}}catch(u){m({at:Date.now(),tone:"text-status-error",text:u.message})}finally{b(!1)}}},[n,a,r,f]),g=o.useCallback(i=>{d({choice:i,returnTo:"choices"})},[]),k=o.useCallback(()=>{(x==null?void 0:x.returnTo)==="idle"&&h(null),d(null)},[x]),w=(c==null?void 0:c.displayName)||(c==null?void 0:c.username)||"Scan station",N=!!(n!=null&&n.choices&&n.escalation);return e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[e.jsx(Y,{}),x&&n?e.jsx(K,{choice:x.choice,notPrimedMarkdown:(y=n.notPrimed)==null?void 0:y.markdown,primed:!!a,busy:S,onExecute:j,onCancel:k}):N?e.jsx(z,{response:n,hasActingIdentity:!!a,selfId:(a==null?void 0:a.actorId)??(c==null?void 0:c.userId)??null,busy:S,onExecute:j,onWithheldSelect:g},String(n.escalation.id)):e.jsx(q,{stationName:w}),l&&e.jsxs("div",{role:"status",className:"mt-8 pt-3 border-t border-surface-border",children:[e.jsx("span",{className:`text-sm font-medium ${l.tone}`,children:l.text}),l.markdown&&e.jsx("div",{className:"text-sm text-text-secondary mt-1",children:e.jsx(A,{content:l.markdown,compact:!0})})]})]})}export{re as ScanStationPage};
|
|
2
|
-
//# sourceMappingURL=ScanStationPage-CuhqsBKo.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./vendor-query-RUZdMvN6.js";import{c as u}from"./tasks-DrWSrjmj.js";import{u as g}from"./workflows-CX_oarls.js";import{u as w}from"./useFilterParams-crmlBw_l.js";import{D as y}from"./DataTable-DFPMeqyQ.js";import{S as k}from"./StatusBadge-BDeUwPtb.js";import{P as c}from"./PriorityBadge-BETdj4M-.js";import{T as n}from"./TimeAgo-CCxP67Rb.js";import{S as x}from"./StickyPagination-BIVTAMnP.js";import{F as P,b as p}from"./FilterBar-B61qKmFD.js";import{P as b}from"./PageHeader-xB92ELs3.js";import{W as _}from"./WorkflowPill-CZvBbkn4.js";import{u as j}from"./vendor-react-CdqEC2zv.js";import"./index-BaC3sbJH.js";import"./vendor-icons-BCWsItQ7.js";import"./EmptyState-lpUFYfun.js";const v=[{value:"pending",label:"Pending"},{value:"in_progress",label:"In Progress"},{value:"completed",label:"Completed"},{value:"needs_intervention",label:"Needs Intervention"},{value:"cancelled",label:"Cancelled"}],S=[{key:"status",label:"Status",render:e=>t.jsx(k,{status:e.status}),className:"w-40"},{key:"workflow_type",label:"Workflow Type",render:e=>t.jsx(_,{type:e.workflow_type})},{key:"lt_type",label:"LT Type",render:e=>t.jsx("span",{className:"text-text-secondary text-xs",children:e.lt_type})},{key:"priority",label:"Priority",render:e=>t.jsx(c,{priority:e.priority}),className:"w-20"},{key:"started_at",label:"Started",render:e=>t.jsx(n,{date:e.started_at}),className:"w-28"},{key:"updated_at",label:"Updated",render:e=>t.jsx(n,{date:e.updated_at}),className:"w-28"}];function O(){const e=j(),{filters:r,setFilter:l,pagination:s}=w({filters:{status:"",workflow_type:""}}),{data:m}=g(),d=[...new Set((m??[]).map(a=>a.workflow_type))].sort(),{data:o,isLoading:f}=u({status:r.status||void 0,workflow_type:r.workflow_type||void 0,limit:s.pageSize,offset:s.offset}),i=(o==null?void 0:o.total)??0;return t.jsxs("div",{children:[t.jsx(b,{title:"Tasks"}),t.jsxs(P,{children:[t.jsx(p,{label:"Status",value:r.status,onChange:a=>l("status",a),options:v}),t.jsx(p,{label:"Workflow Type",value:r.workflow_type,onChange:a=>l("workflow_type",a),options:d.map(a=>({value:a,label:a}))})]}),t.jsx(y,{columns:S,data:(o==null?void 0:o.tasks)??[],keyFn:a=>a.id,onRowClick:a=>e(`/workflows/tasks/detail/${a.id}`),isLoading:f,emptyMessage:"No tasks found"}),t.jsx(x,{page:s.page,totalPages:s.totalPages(i),onPageChange:s.setPage,total:i,pageSize:s.pageSize,onPageSizeChange:s.setPageSize})]})}export{O as TasksListPage};
|
|
2
|
-
//# sourceMappingURL=TasksListPage-DEQymbXC.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as w,j as e}from"./vendor-query-RUZdMvN6.js";import{a as B,f as F}from"./workflows-CX_oarls.js";import{P as d,e as b,D as Q,g as M,h as z,J as _,ar as H,o as J}from"./index-BaC3sbJH.js";import{u as Y,E as K}from"./EventTable-s48cTXIw.js";import{b as q,e as Z}from"./tasks-DrWSrjmj.js";import{P as G}from"./PageHeader-xB92ELs3.js";import{S as X}from"./SegmentedTabs-DXNzY05q.js";import{L as ee}from"./ListToolbar-DaxloPQc.js";import{S as te,a as se}from"./StatusBadge-BDeUwPtb.js";import{C as y}from"./CopyableId-4Lqlc5cU.js";import{O as S,as as ae,Q as re,V as ne,Y as le,_ as oe,r as ie}from"./vendor-icons-BCWsItQ7.js";import{L as m,e as ce,u as de}from"./vendor-react-CdqEC2zv.js";import{S as xe}from"./SwimlaneTimeline-BMZAs_2K.js";import"./FilterBar-B61qKmFD.js";import"./StreamMessageDetail-CYSC2cO1.js";function ue(t){const s=t.lastIndexOf("-");return s<=0?{taskQueue:t,workflowType:t}:{taskQueue:t.substring(0,s),workflowType:t.substring(s+1)}}function me({children:t}){return e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:t})}function E({status:t}){return e.jsx("span",{className:`w-2.5 h-2.5 shrink-0 rounded-full dot-ring ${se[t]??"bg-status-active"}`,title:t})}function pe({escalations:t}){return e.jsx("div",{children:t.map(s=>e.jsxs(m,{to:`/escalations/detail/${s.id}`,className:"grid grid-cols-[auto_1fr_auto] items-center gap-x-3 py-2 border-b border-surface-border/40 last:border-b-0 group",children:[e.jsx(E,{status:s.status}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-xs font-mono text-text-primary group-hover:text-accent transition-colors truncate",title:s.type,children:s.type}),e.jsx("span",{className:"block text-2xs text-text-tertiary truncate",children:s.role})]}),e.jsx(b,{date:s.created_at,format:"relative",className:"text-2xs text-text-tertiary whitespace-nowrap text-right"})]},s.id))})}function fe({tasks:t}){return e.jsx("div",{children:t.map(s=>e.jsxs(m,{to:`/workflows/tasks/detail/${s.id}`,className:"grid grid-cols-[auto_1fr_auto] items-center gap-x-3 py-2 border-b border-surface-border/40 last:border-b-0 group",children:[e.jsx(E,{status:s.status}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-xs font-mono text-text-primary group-hover:text-accent transition-colors truncate",title:s.workflow_type,children:s.workflow_type}),e.jsx("span",{className:"block text-2xs text-text-tertiary truncate",children:s.lt_type})]}),e.jsx(b,{date:s.created_at,format:"relative",className:"text-2xs text-text-tertiary whitespace-nowrap text-right"})]},s.id))})}function he({execution:t,parentWorkflowId:s,childTasks:a,escalations:n,headerActions:l,open:i}){const u=n.length>0||a.length>0,[x,o]=w.useState(u?"escalations":"details"),{taskQueue:p,workflowType:j}=ue(t.workflow_type),f=[{id:"details",icon:S,label:"Details",content:e.jsxs("dl",{className:"space-y-3.5",children:[e.jsx(d,{label:"Status",children:e.jsx(te,{status:t.status})}),e.jsx(d,{label:"Workflow Type",children:e.jsx(y,{bare:!0,value:j,href:`/workflows/executions?entity=${encodeURIComponent(j)}`})}),e.jsx(d,{label:"Workflow ID",children:e.jsx(y,{bare:!0,value:t.workflow_id})}),s&&e.jsx(d,{label:"Parent",children:e.jsx(y,{bare:!0,value:s,href:`/workflows/executions/${s}`})}),e.jsx(d,{label:"Task Queue",children:e.jsx("span",{className:"font-mono",children:p})}),e.jsx(d,{label:"Start Time",children:t.start_time?e.jsx(b,{date:t.start_time,format:"datetime"}):e.jsx("span",{className:"text-text-tertiary",children:"--"})}),e.jsx(d,{label:"End Time",children:t.close_time?e.jsx(b,{date:t.close_time,format:"datetime"}):e.jsx("span",{className:"text-text-tertiary",children:"--"})}),e.jsx(d,{label:"Duration",children:e.jsx(Q,{ms:t.duration_ms,className:"font-mono"})}),e.jsxs(d,{label:"History Size",children:[t.summary.total_events," events"]}),e.jsxs(d,{label:"Activities",children:[t.summary.activities.completed," / ",t.summary.activities.total]})]})},{id:"escalations",icon:ae,label:"Escalations",content:e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{children:n.length>0?e.jsx(pe,{escalations:n}):e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"This workflow has not escalated."})}),a.length>0&&e.jsxs("div",{children:[e.jsx(me,{children:"Related Tasks"}),e.jsx(fe,{tasks:a})]})]})}];return e.jsx(M,{open:i,width:384,className:"h-full",children:e.jsx("div",{className:"h-full pl-6",children:e.jsx(z,{views:f,activeId:x,onViewChange:o,headerActions:l,stickyClassName:"h-full min-h-0",labelInline:!0})})})}function we(t){var n;const s=t.events.find(l=>l.event_type==="workflow_execution_started"),a=(n=s==null?void 0:s.attributes)==null?void 0:n.input;return a&&typeof a=="object"?a:null}function je({execution:t}){const s=we(t),a=t.result,n=(a==null?void 0:a.data)??a??null;return!s&&!n?null:e.jsxs("div",{className:"grid grid-cols-1 @form-cols:grid-cols-2 gap-4 mb-6",children:[s!==null&&e.jsx("div",{children:e.jsx(_,{data:s,label:"Input Envelope"})}),n!==null&&e.jsx("div",{children:e.jsx(_,{data:n,label:"Result"})})]})}const be=["details","timeline","events"],T="lt:workflow-execution:tab";function ve({isRunning:t,hasToolCalls:s,workflowId:a,onAction:n}){const[l,i]=w.useState(!1),u=w.useRef(null);return w.useEffect(()=>{if(!l)return;const x=o=>{u.current&&!u.current.contains(o.target)&&i(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[l]),e.jsxs("div",{className:"relative",ref:u,children:[e.jsxs("button",{onClick:()=>i(!l),className:"flex items-center gap-0.5 pl-2 pr-1 py-1 rounded-md text-2xs font-medium text-accent hover:text-accent-hover hover:bg-surface-hover transition-colors",title:"Actions",children:["Actions",e.jsx(ie,{className:`w-3 h-3 transition-transform ${l?"rotate-180":""}`})]}),l&&e.jsxs("div",{className:"absolute right-0 mt-1 w-44 bg-surface-raised border border-surface-border rounded-md shadow-lg z-[100]",children:[e.jsx("button",{onClick:()=>{n("restart"),i(!1)},className:"block w-full text-left px-4 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Restart Workflow"}),t&&e.jsx("button",{onClick:()=>{n("terminate"),i(!1)},className:"block w-full text-left px-4 py-2 text-xs text-status-error hover:bg-surface-hover",children:"Terminate"}),s&&e.jsx(m,{to:`/mcp/queries/${a}?step=3`,className:"block w-full text-left px-4 py-2 text-xs text-accent hover:bg-surface-hover",onClick:()=>i(!1),children:"Compile into Pipeline"}),e.jsx(m,{to:`/mcp/executions/${encodeURIComponent(a)}?namespace=durable`,className:"block w-full text-left px-4 py-2 text-xs text-text-secondary hover:bg-surface-hover",onClick:()=>i(!1),children:"View Pipeline Execution"}),e.jsx(m,{to:`/admin/streams?source=worker&jid=${encodeURIComponent(a)}`,className:"block w-full text-left px-4 py-2 text-xs text-text-secondary hover:bg-surface-hover",onClick:()=>i(!1),children:"Worker Messages"}),e.jsx(m,{to:`/admin/streams?source=engine&jid=${encodeURIComponent(a)}`,className:"block w-full text-left px-4 py-2 text-xs text-text-secondary hover:bg-surface-hover",onClick:()=>i(!1),children:"Engine Messages"})]})]})}function Le(){const{workflowId:t}=ce();H(t);const s="Workflow Execution",{data:a,isLoading:n,error:l,refetch:i,isFetching:u}=B(t),{data:x}=q(t),{data:o}=Z(t),{data:p}=J(t),j=de(),f=F(),{isCollapsed:C,toggle:I}=Y("workflow-execution"),[h,P]=w.useState(()=>{try{const r=localStorage.getItem(T);return r&&be.includes(r)?r:"details"}catch{return"details"}}),R=r=>{P(r);try{localStorage.setItem(T,r)}catch{}},W=r=>{var c;if(r==="terminate")confirm("Are you sure you want to terminate this workflow?")&&f.mutate(t);else if(r==="restart"&&a){const O=a.workflow_id.replace(/-[A-Za-z0-9_-]{20,}$/,""),g=a.events.find(U=>U.event_type==="workflow_execution_started"),N=(c=g==null?void 0:g.attributes)==null?void 0:c.input;N&&sessionStorage.setItem("lt:invoke:prefill",JSON.stringify(N)),j(`/workflows/start?type=${encodeURIComponent(O)}&mode=now`)}};if(n)return e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-64"}),e.jsx("div",{className:"h-60 bg-surface-sunken rounded"})]});if(l||!a){const r=(l==null?void 0:l.message)??"",c=r.includes("expired")||r.includes("no longer available");return e.jsxs("div",{children:[e.jsx(m,{to:"/workflows/executions",className:"text-xs text-text-tertiary hover:text-text-primary",children:"← Workflows"}),e.jsxs("div",{className:"mt-4 text-center py-8",children:[e.jsx("p",{className:"text-sm text-text-primary mb-1",children:c?"Execution data is no longer available":l?"Unable to load execution":"Execution not found"}),e.jsx("p",{className:"text-xs text-text-tertiary",children:c?"This workflow's underlying job has expired. The task record is preserved, but the execution timeline has been cleaned up.":r||"The workflow could not be resolved."})]})]})}const A=a.status!=="completed"&&a.status!=="failed",v=!C("side-panel"),$=a.parent_workflow_id,L=x&&x.workflow_id===a.workflow_id,k=$||(L?x.parent_workflow_id:null)||null,V=k&&k!==a.workflow_id?k:null,D=a.status==="completed"&&a.events.some(r=>{if(r.event_type!=="activity_task_completed")return!1;const c=r.attributes.activity_type;return c==="callDbTool"||c==="callVisionTool"||c==="callMcpTool"||(c==null?void 0:c.startsWith("mcp_"))});return e.jsxs("div",{className:"flex-1 min-h-0 min-w-0 flex items-stretch -mt-8 -mr-page-x -mb-16",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col min-h-0",children:[e.jsxs("div",{className:"shrink-0 pt-8 pr-page-x",children:[e.jsx(G,{title:s,actions:e.jsx("button",{onClick:()=>I("side-panel"),className:"text-accent/60 hover:text-accent transition-colors",title:v?"Hide side panel":"Show side panel",children:v?e.jsx(re,{className:"w-5 h-5",strokeWidth:1.5}):e.jsx(ne,{className:"w-5 h-5",strokeWidth:1.5})})}),f.error&&e.jsxs("p",{className:"text-xs text-status-error py-2",children:["Terminate failed: ",f.error.message]}),e.jsx("div",{className:"mt-2",children:e.jsx(X,{"aria-label":"Execution section",active:h,onChange:R,tabs:[{key:"details",label:"Details",icon:e.jsx(S,{className:"w-3.5 h-3.5"})},{key:"timeline",label:"Execution Timeline",icon:e.jsx(le,{className:"w-3.5 h-3.5"})},{key:"events",label:"Events",icon:e.jsx(oe,{className:"w-3.5 h-3.5"})}]})})]}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto pr-page-x pt-6 pb-16 animate-page-in",children:[h==="details"&&e.jsx(je,{execution:a}),h==="timeline"&&e.jsx(xe,{events:a.events,childTasks:o==null?void 0:o.tasks,jid:t,appId:"durable"}),h==="events"&&e.jsx(K,{events:a.events,childTasks:o==null?void 0:o.tasks,jid:t,appId:"durable"})]},h)]}),e.jsx(he,{execution:a,parentWorkflowId:V,childTasks:(o==null?void 0:o.tasks)??[],escalations:(p==null?void 0:p.escalations)??[],headerActions:e.jsxs(e.Fragment,{children:[e.jsx(ee,{onRefresh:()=>i(),isFetching:u,apiPath:`/workflow-states/${t}/execution`}),e.jsx(ve,{isRunning:A,hasToolCalls:D,workflowId:t,onAction:W})]}),open:v})]})}export{Le as WorkflowExecutionPage};
|
|
2
|
-
//# sourceMappingURL=WorkflowExecutionPage-BttnEvOd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowPill-CZvBbkn4.js","sources":["../../src/components/common/display/WorkflowPill.tsx"],"sourcesContent":["import { Workflow, ShieldCheck, SlidersHorizontal, Wand2, Zap } from 'lucide-react';\n\ntype WorkflowVariant = 'durable' | 'registered' | 'certified' | 'pipeline' | 'capability';\n\ninterface WorkflowPillProps {\n type: string;\n size?: 'xs' | 'sm' | 'md';\n /** @deprecated Use `variant` instead */\n certified?: boolean;\n variant?: WorkflowVariant;\n}\n\nconst VARIANT_ICON: Record<WorkflowVariant, typeof Workflow> = {\n certified: ShieldCheck,\n registered: SlidersHorizontal,\n pipeline: Wand2,\n capability: Zap,\n durable: Workflow,\n};\n\nconst SIZE_CONFIG = {\n xs: { pill: 'px-1 py-px text-2xs gap-1', icon: 'w-2 h-2' },\n sm: { pill: 'px-1.5 py-px text-2xs gap-1', icon: 'w-2 h-2' },\n md: { pill: 'px-2 py-0.5 text-xs gap-1.5', icon: 'w-2.5 h-2.5' },\n} as const;\n\n/**\n * Universal workflow name chip — mono label with a small tier icon\n * (shield = certified, sliders = registered, wand = pipeline, bolt =\n * capability, workflow = durable). Neutral by design; the icon carries\n * the tier, not color. Matches ToolPill styling.\n */\nexport function WorkflowPill({ type, size = 'sm', certified, variant }: WorkflowPillProps) {\n const resolved = variant ?? (certified ? 'certified' : 'durable');\n // Callers pass server-provided tier strings here — fall back to the durable\n // icon on an unrecognized value so version skew degrades instead of crashing.\n const Icon = VARIANT_ICON[resolved] ?? Workflow;\n const s = SIZE_CONFIG[size];\n\n return (\n <span className={`inline-flex items-center max-w-full min-w-0 ${s.pill} font-mono text-text-secondary bg-surface-sunken/50 rounded-md`} title={type}>\n <Icon className={`${s.icon} shrink-0 text-text-quaternary`} strokeWidth={1.5} />\n <span className=\"truncate\">{type}</span>\n </span>\n );\n}\n"],"names":["VARIANT_ICON","ShieldCheck","SlidersHorizontal","Wand2","Zap","Workflow","SIZE_CONFIG","WorkflowPill","type","size","certified","variant","Icon","s","jsxs","jsx"],"mappings":"2HAYA,MAAMA,EAAyD,CAC7D,UAAYC,EACZ,WAAYC,EACZ,SAAYC,EACZ,WAAYC,EACZ,QAAYC,CACd,EAEMC,EAAc,CAClB,GAAI,CAAE,KAAM,4BAA6B,KAAM,SAAA,EAC/C,GAAI,CAAE,KAAM,8BAA+B,KAAM,SAAA,EACjD,GAAI,CAAE,KAAM,8BAA+B,KAAM,aAAA,CACnD,EAQO,SAASC,EAAa,CAAE,KAAAC,EAAM,KAAAC,EAAO,KAAM,UAAAC,EAAW,QAAAC,GAA8B,CAIzF,MAAMC,EAAOZ,EAHIW,IAAYD,EAAY,YAAc,UAGrB,GAAKL,EACjCQ,EAAIP,EAAYG,CAAI,EAE1B,OACEK,OAAC,QAAK,UAAW,+CAA+CD,EAAE,IAAI,iEAAkE,MAAOL,EAC7I,SAAA,CAAAO,EAAAA,IAACH,GAAK,UAAW,GAAGC,EAAE,IAAI,iCAAkC,YAAa,IAAK,EAC9EE,EAAAA,IAAC,OAAA,CAAK,UAAU,WAAY,SAAAP,CAAA,CAAK,CAAA,EACnC,CAEJ"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as d,j as t}from"./vendor-query-RUZdMvN6.js";import{k as W,_ as A,d as z,e as v}from"./index-BaC3sbJH.js";import{E as M}from"./ElapsedCell-Cul22qBS.js";import{u as $,d as L,b as I}from"./workflows-CX_oarls.js";import{u as U}from"./useNamespace-CdgF7Jxo.js";import{u as O}from"./useFilterParams-crmlBw_l.js";import{b as B}from"./api-path-u2Jf9QXS.js";import{D as H}from"./DataTable-DFPMeqyQ.js";import{W as V}from"./WorkflowPill-CZvBbkn4.js";import{P as G}from"./PageHeader-xB92ELs3.js";import{F as J,c as f,b as x}from"./FilterBar-B61qKmFD.js";import{S as K}from"./StickyPagination-BIVTAMnP.js";import{L as q}from"./ListToolbar-DaxloPQc.js";import{R as Q,a as k}from"./RowActions-eYrzgQSj.js";import{K as X,a2 as Y}from"./vendor-icons-BCWsItQ7.js";import{u as Z}from"./vendor-react-CdqEC2zv.js";import"./controlplane-BwGdcwXR.js";import"./EmptyState-lpUFYfun.js";const ee={running:"in_progress",completed:"completed",failed:"failed"},te={in_progress:"bg-status-active",completed:"bg-status-success",failed:"bg-status-error"},se={running:"text-status-active",completed:"text-status-success",failed:"text-status-error"};function ae(p,n,m,l,a){return[{key:"workflow_id",label:"Workflow ID",render:e=>{const o=te[ee[e.status]??e.status]??"bg-status-pending",r=e.status==="running"?" animate-pulse":"";return t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:`w-2.5 h-2.5 shrink-0 rounded-full dot-ring ${o}${r}`,title:e.status}),t.jsx("span",{className:"font-mono text-xs text-text-primary truncate",children:e.workflow_id})]})}},{key:"entity",label:"Type",render:e=>t.jsx(V,{type:e.entity,variant:a.get(e.entity)??"durable",size:"xs"}),className:"w-44 shrink-0"},{key:"created_at",label:"Created",render:e=>t.jsx(v,{date:e.created_at,format:"relative",className:"text-xs text-text-secondary whitespace-nowrap"}),className:"w-32",sortable:!0},{key:"updated_at",label:"Updated",render:e=>t.jsx(v,{date:e.updated_at,format:"relative",className:"text-xs text-text-secondary whitespace-nowrap"}),className:"w-32",sortable:!0},{key:"duration",label:"Duration",render:e=>t.jsx(M,{startDate:e.created_at,endDate:e.status==="running"?null:e.updated_at,isLive:e.status==="running"}),className:"w-28"},{key:"actions",label:"",render:e=>t.jsxs(Q,{children:[t.jsx(k,{icon:X,title:`Filter by ${e.entity}`,onClick:()=>p(e.entity)}),t.jsx("button",{onClick:o=>{o.stopPropagation(),n(e.status)},className:"opacity-0 group-hover/row:opacity-100 transition-opacity",title:`Filter by ${e.status}`,children:t.jsx("svg",{className:`w-[18px] h-[18px] ${se[e.status]??"text-text-tertiary"} hover:opacity-70`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:t.jsx("circle",{cx:"12",cy:"12",r:"6"})})}),m&&t.jsx(k,{icon:Y,title:"View config",onClick:()=>l(`/workflows/registry/${encodeURIComponent(e.entity)}`)})]}),className:"w-24 text-right"}]}function ke({tier:p="all"}){W();const n=Z(),{isSuperAdmin:m}=A(),{namespace:l}=U(),{filters:a,setFilter:e,pagination:o,sort:r,setSort:j}=O({filters:{search:"",entity:"",status:"",tier:p}}),c=a.tier||"all",g=c==="certified"?"true":c==="durable"?"false":void 0,{data:b}=$(),{data:y}=L(),S=d.useMemo(()=>{const s=new Map;for(const w of y??[])s.set(w.workflow_type,w.tier??"durable");return s},[y]),_=ae(s=>e("entity",s),s=>e("status",s),m,n,S),[u,C]=d.useState(a.search);d.useEffect(()=>{if(u===a.search)return;const s=setTimeout(()=>e("search",u),z);return()=>clearTimeout(s)},[u,e,a.search]);const{data:i,isLoading:N,refetch:P,isFetching:T}=I({limit:o.pageSize,offset:o.offset,entity:a.entity||void 0,search:a.search||void 0,status:a.status||void 0,sort_by:r.sort_by||"created_at",order:r.order||"desc",registered:g,namespace:l||void 0}),h=(i==null?void 0:i.total)??0,F=(i==null?void 0:i.jobs)??[],D=d.useMemo(()=>[...new Set((b??[]).map(s=>s.workflow_type))].sort(),[b]),E="Workflow Executions",R=c==="certified"?"No certified workflow executions found":c==="durable"?"No durable workflow executions found":"No workflow executions found";return t.jsxs("div",{children:[t.jsx(G,{title:E,docsHash:"#docs:dashboard.md:procedural-executions"}),t.jsxs(J,{actions:t.jsx(q,{onRefresh:()=>P(),isFetching:T,apiPath:B("/workflow-states/jobs",{limit:o.pageSize,offset:o.offset,entity:a.entity||void 0,search:a.search||void 0,status:a.status||void 0,sort_by:r.sort_by||"created_at",order:r.order||"desc",registered:g,namespace:l||void 0})}),children:[t.jsx("input",{type:"text",placeholder:"Search workflow ID...",value:u,onChange:s=>C(s.target.value),className:"input text-2xs py-1 px-2 w-56"}),t.jsx(f,{}),t.jsx(x,{label:"Type",value:a.entity,onChange:s=>e("entity",s),options:D.map(s=>({value:s,label:s}))}),t.jsx(f,{}),t.jsx(x,{label:"Status",value:a.status,onChange:s=>e("status",s),options:[{value:"running",label:"Running"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}]}),t.jsx(f,{}),t.jsx(x,{label:"Tier",value:a.tier==="all"?"":a.tier,onChange:s=>e("tier",s||"all"),options:[{value:"certified",label:"Certified"},{value:"durable",label:"Durable"}]})]}),t.jsx(H,{columns:_,data:F,keyFn:s=>s.workflow_id,onRowClick:s=>n(`/workflows/executions/${s.workflow_id}`),isLoading:N,emptyMessage:R,sort:r,onSort:j}),t.jsx(K,{page:o.page,totalPages:o.totalPages(h),onPageChange:o.setPage,total:h,pageSize:o.pageSize,onPageSizeChange:o.setPageSize})]})}export{ke as WorkflowsDashboard};
|
|
2
|
-
//# sourceMappingURL=WorkflowsDashboard-BRboBhlK.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as x,j as t}from"./vendor-query-RUZdMvN6.js";import{b as C,u as k}from"./workflows-CX_oarls.js";import{k as $}from"./index-BaC3sbJH.js";import{P as D}from"./PageHeader-xB92ELs3.js";import{S as h}from"./StatCard-BXQ8dD9Y.js";import{u as w}from"./vendor-react-CdqEC2zv.js";import"./vendor-icons-BCWsItQ7.js";const v=[{label:"1h",ms:36e5},{label:"24h",ms:864e5},{label:"7d",ms:6048e5},{label:"30d",ms:2592e6}];function T(r){return r<1e3?`${Math.round(r)}ms`:r<6e4?`${(r/1e3).toFixed(1)}s`:r<36e5?`${(r/6e4).toFixed(1)}m`:`${(r/36e5).toFixed(1)}h`}function p({value:r,colorClass:o,onClick:f}){return r===0?t.jsx("span",{className:"text-text-tertiary",children:"0"}):t.jsx("button",{onClick:f,className:`${o} hover:underline tabular-nums font-medium`,children:r})}function P(){$();const r=w(),[o,f]=x.useState("24h"),{data:c}=C({limit:500}),{data:g}=k(),b=x.useMemo(()=>{const e=v.find(i=>i.label===o);return Date.now()-e.ms},[o]),n=x.useMemo(()=>((c==null?void 0:c.jobs)??[]).filter(e=>new Date(e.created_at).getTime()>=b),[c==null?void 0:c.jobs,b]),j=x.useMemo(()=>{const e=new Map;for(const a of n){const s=e.get(a.entity)??{total:0,running:0,completed:0,failed:0,durations:[]};if(s.total++,a.status==="running"&&s.running++,a.status==="completed"){s.completed++;const m=new Date(a.updated_at).getTime()-new Date(a.created_at).getTime();m>0&&s.durations.push(m)}a.status==="failed"&&s.failed++,e.set(a.entity,s)}const i=[];for(const[a,s]of e)i.push({type:a,...s,avgDuration:s.durations.length>0?s.durations.reduce((m,N)=>m+N,0)/s.durations.length:null});return i.sort((a,s)=>s.total-a.total)},[n]),u=x.useMemo(()=>({total:n.length,running:n.filter(e=>e.status==="running").length,completed:n.filter(e=>e.status==="completed").length,failed:n.filter(e=>e.status==="failed").length}),[n]),y=(g==null?void 0:g.length)??0,l=(e,i)=>{const a=new URLSearchParams;e&&a.set("entity",e),i&&a.set("status",i);const s=a.toString();r(`/workflows/executions${s?`?${s}`:""}`)},d="pb-2 text-2xs font-semibold uppercase tracking-widest text-text-tertiary";return t.jsxs("div",{children:[t.jsx(D,{title:"Workflows",actions:t.jsxs("span",{className:"text-xs text-text-tertiary",children:[y," certified type",y!==1?"s":""]})}),t.jsx("div",{className:"flex items-center gap-1 mb-6",children:v.map(e=>t.jsx("button",{onClick:()=>f(e.label),className:`px-3 py-1 text-xs rounded-full transition-colors ${o===e.label?"bg-accent text-text-inverse":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:e.label},e.label))}),t.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-8",children:[t.jsx(h,{label:"Total",value:u.total,onClick:()=>l()}),t.jsx(h,{label:"Running",value:u.running,colorClass:"text-status-active",onClick:()=>l(void 0,"running")}),t.jsx(h,{label:"Completed",value:u.completed,colorClass:"text-status-success",onClick:()=>l(void 0,"completed")}),t.jsx(h,{label:"Failed",value:u.failed,colorClass:"text-status-error",onClick:()=>l(void 0,"failed")})]}),j.length>0&&t.jsxs("table",{className:"w-full text-left",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-surface-border",children:[t.jsx("th",{className:d,children:"Type"}),t.jsx("th",{className:`${d} text-right w-20`,children:"Total"}),t.jsx("th",{className:`${d} text-right w-20`,children:"Running"}),t.jsx("th",{className:`${d} text-right w-24`,children:"Completed"}),t.jsx("th",{className:`${d} text-right w-20`,children:"Failed"}),t.jsx("th",{className:`${d} text-right w-28`,children:"Avg Duration"})]})}),t.jsx("tbody",{children:j.map(e=>t.jsxs("tr",{className:"border-b border-surface-border last:border-b-0",children:[t.jsx("td",{className:"py-3 text-sm font-mono text-text-primary",children:t.jsx("button",{onClick:()=>l(e.type),className:"hover:text-accent hover:underline",children:e.type})}),t.jsx("td",{className:"py-3 text-sm text-right",children:t.jsx(p,{value:e.total,colorClass:"text-text-secondary",onClick:()=>l(e.type)})}),t.jsx("td",{className:"py-3 text-sm text-right",children:t.jsx(p,{value:e.running,colorClass:"text-status-active",onClick:()=>l(e.type,"running")})}),t.jsx("td",{className:"py-3 text-sm text-right",children:t.jsx(p,{value:e.completed,colorClass:"text-status-success",onClick:()=>l(e.type,"completed")})}),t.jsx("td",{className:"py-3 text-sm text-right",children:t.jsx(p,{value:e.failed,colorClass:"text-status-error",onClick:()=>l(e.type,"failed")})}),t.jsx("td",{className:"py-3 text-sm font-mono text-text-secondary text-right",children:e.avgDuration!==null?T(e.avgDuration):"—"})]},e.type))})]}),j.length===0&&t.jsx("div",{className:"py-16 text-center",children:t.jsxs("p",{className:"text-sm text-text-tertiary",children:["No workflow activity in the last ",o]})})]})}export{P as WorkflowsOverview};
|
|
2
|
-
//# sourceMappingURL=WorkflowsOverview-CDFTYeQo.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./vendor-query-RUZdMvN6.js";import{u as h}from"./yaml-workflows-YASUDPo0.js";import{b as u}from"./index-BaC3sbJH.js";import{u as f}from"./useFilterParams-crmlBw_l.js";import{P as d}from"./PageHeader-xB92ELs3.js";import{F as g,a as w,b}from"./FilterBar-B61qKmFD.js";import{E as p}from"./EmptyState-lpUFYfun.js";import{T as j}from"./ToolPill-D-h8AoB8.js";import{N as v}from"./NamespacePill-Dbtm9R2T.js";import{S as y}from"./StatusBadge-BDeUwPtb.js";import{k as N,W as k}from"./vendor-icons-BCWsItQ7.js";import{u as F}from"./vendor-react-CdqEC2zv.js";function O(){var c;const a=F(),{data:r}=u(),o=!!((c=r==null?void 0:r.ai)!=null&&c.enabled),{filters:t,setFilter:l}=f({filters:{status:"",search:""}}),{data:i,isLoading:m}=h({status:t.status||void 0,search:t.search||void 0,limit:200,offset:0}),n=(i==null?void 0:i.workflows)??[];return m?e.jsxs("div",{children:[e.jsx(d,{title:"Configure",docsHash:"#docs:dashboard.md:graph-workflows"}),e.jsx("div",{className:"animate-pulse space-y-0",children:Array.from({length:4}).map((s,x)=>e.jsx("div",{className:"h-14 border-b last:border-b-0 px-6 flex items-center",children:e.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})},x))})]}):e.jsxs("div",{children:[e.jsx(d,{title:"Configure",docsHash:"#docs:dashboard.md:graph-workflows",actions:o?e.jsx("button",{onClick:()=>a("/mcp/queries/new"),className:"btn-primary text-xs",children:"Design Flow"}):void 0}),e.jsxs("p",{className:"text-sm text-text-secondary mb-6 max-w-2xl leading-relaxed",children:["The compiled form of a durable workflow — the same guarantees at roughly 3× the speed. Each flow is a graph the router discovers and runs on demand. Open one to inspect or run it",o?", or design a new one from a description.":"."]}),e.jsxs(g,{children:[e.jsx(w,{label:"Search",value:t.search,onChange:s=>l("search",s),placeholder:"Flow or namespace…"}),e.jsx(b,{label:"Status",value:t.status,onChange:s=>l("status",s),options:[{value:"draft",label:"Draft"},{value:"deployed",label:"Deployed"},{value:"active",label:"Active"},{value:"archived",label:"Archived"}]})]}),n.length===0?o?e.jsx("div",{className:"cursor-pointer",onClick:()=>a("/mcp/queries/new"),children:e.jsx(p,{icon:N,title:"No graph flows yet",description:"Open the Designer to compile your first flow from a description, or register flows at startup with the graphWorkflows config."})}):e.jsx(p,{icon:k,title:"No graph flows yet",description:"Register graph flows at startup with the graphWorkflows config — see the docs for an example."}):e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"px-6 py-3 text-left text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Flow"}),e.jsx("th",{className:"px-4 py-3 text-left text-2xs font-semibold uppercase tracking-widest text-text-tertiary w-40",children:"Namespace"}),e.jsx("th",{className:"px-4 py-3 text-left text-2xs font-semibold uppercase tracking-widest text-text-tertiary w-20",children:"Version"}),e.jsx("th",{className:"px-4 py-3 text-left text-2xs font-semibold uppercase tracking-widest text-text-tertiary w-28",children:"Status"})]})}),e.jsx("tbody",{children:n.map(s=>e.jsxs("tr",{onClick:()=>a(`/mcp/workflows/${s.id}`),className:"border-b border-surface-border/50 hover:bg-surface-hover/40 transition-colors duration-100 cursor-pointer",children:[e.jsxs("td",{className:"px-6 py-2.5",children:[e.jsx(j,{name:s.graph_topic,size:"md"}),s.description&&e.jsx("p",{className:"text-2xs leading-snug text-text-quaternary mt-0.5",children:s.description})]}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(v,{namespace:s.app_id})}),e.jsxs("td",{className:"px-4 py-2.5 text-2xs text-text-quaternary font-mono whitespace-nowrap",children:["v",s.content_version]}),e.jsx("td",{className:"px-4 py-2.5 whitespace-nowrap",children:e.jsx(y,{status:s.status})})]},s.id))})]})]})}export{O as YamlWorkflowsPage};
|
|
2
|
-
//# sourceMappingURL=YamlWorkflowsPage-Qq1jfcrH.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as g,j as e}from"./vendor-query-RUZdMvN6.js";import{a6 as k,a7 as C,a8 as E,x as N}from"./index-BaC3sbJH.js";import{r as P,ar as S,as as T,at as y,ak as _,b as $,au as L}from"./vendor-icons-BCWsItQ7.js";import{E as O}from"./EntityTimelinePanel-CtzpJ-j2.js";import{F,b as j,c as v,a as A}from"./FilterBar-B61qKmFD.js";import{P as R}from"./PriorityBadge-BETdj4M-.js";import{R as W}from"./RolePill-CYpL3a2d.js";import{W as I}from"./WorkflowPill-CZvBbkn4.js";import{U as q}from"./UserName-CsLnT75E.js";import{C as U,a as B,i as K}from"./CountdownTimer-DPHMBmgz.js";import{L as b}from"./vendor-react-CdqEC2zv.js";function ne({role:t,options:s,onChange:d,emptyLabel:x="All Escalations",locked:p=!1}){var a;const[i,l]=g.useState(!1),o=g.useRef(null);g.useEffect(()=>{if(!i)return;const n=h=>{o.current&&!o.current.contains(h.target)&&l(!1)},u=h=>{h.key==="Escape"&&l(!1)};return document.addEventListener("mousedown",n),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("keydown",u)}},[i]);const m=t?((a=s.find(n=>n.value===t))==null?void 0:a.label)??k(t):x,r=n=>`w-full text-left px-3 py-1.5 text-sm flex items-baseline gap-2 transition-colors ${n?"text-accent bg-accent/5":"text-text-primary hover:bg-surface-hover"}`;return p?e.jsx("h1",{className:"heading-1 min-w-0 truncate","data-testid":"escalation-title-locked",children:m}):e.jsxs("div",{ref:o,className:"relative min-w-0",children:[e.jsxs("button",{type:"button",onClick:()=>l(n=>!n),className:"group flex items-center gap-2 min-w-0 heading-1 hover:text-accent transition-colors",children:[e.jsx("span",{className:"truncate",children:m}),e.jsx(P,{className:`w-6 h-6 shrink-0 text-text-tertiary group-hover:text-accent transition-transform ${i?"rotate-180":""}`,strokeWidth:1.5})]}),i&&e.jsxs("div",{className:"absolute z-[100] top-full left-0 mt-2 min-w-[16rem] max-h-80 overflow-y-auto bg-surface-raised border border-surface-border rounded-md shadow-lg py-1",children:[e.jsx("button",{type:"button",onClick:()=>{d(""),l(!1)},className:r(!t),children:x}),s.length>0&&e.jsx("div",{className:"h-px bg-surface-border my-1"}),s.map(n=>e.jsxs("button",{type:"button",onClick:()=>{d(n.value),l(!1)},className:r(t===n.value),children:[e.jsx("span",{className:"truncate",children:n.label}),n.label!==n.value&&e.jsx("span",{className:"text-2xs font-mono text-text-quaternary shrink-0",children:n.value})]},n.value))]})]})}const f="text-text-secondary transition-colors group-hover/row:text-text-primary";function M({row:t}){if(B(t)){const s=t.status==="resolved"?"text-status-success":"text-text-tertiary";return e.jsx(T,{className:`w-3 h-3 shrink-0 ${s}`})}return t.status==="resolved"?e.jsx(y,{className:"w-2.5 h-2.5 shrink-0 text-status-success",strokeWidth:2.5}):t.status==="cancelled"?e.jsx(y,{className:"w-2.5 h-2.5 shrink-0 text-status-error",strokeWidth:2.5}):t.status==="expired"?e.jsx(y,{className:"w-2.5 h-2.5 shrink-0 text-text-tertiary",strokeWidth:2.5}):K(t)?e.jsx(y,{className:"w-2.5 h-2.5 shrink-0 text-status-warning",strokeWidth:2.5}):e.jsx(y,{className:"w-2.5 h-2.5 shrink-0 text-status-active",strokeWidth:2.5})}function D({metadata:t,role:s,highlightKeys:d}){const[x,p]=g.useState(!1),i=E();if(!t||Object.keys(t).length===0)return e.jsx("span",{className:"text-2xs text-text-tertiary",children:"—"});const l=d??[],o=[...l.filter(a=>a in t),...Object.keys(t).filter(a=>!l.includes(a))],m=x?o:o.slice(0,1),r=o.length-1;return e.jsx("div",{className:"w-full",onClick:a=>a.stopPropagation(),children:e.jsx("div",{className:"space-y-px",children:m.map((a,n)=>{const u=typeof t[a]=="object"&&t[a]!==null?JSON.stringify(t[a]):String(t[a]),h=l.includes(a),w=n===m.length-1;return e.jsxs("div",{className:"group/mrow flex items-center gap-1 min-w-0",children:[e.jsx("span",{className:`shrink-0 w-14 text-2xs font-mono uppercase tracking-wide truncate ${h?"text-accent":"text-text-tertiary"}`,title:a,children:a}),e.jsx("span",{className:`flex-1 min-w-0 text-2xs font-medium truncate ${h?"text-text-primary":"text-text-secondary"}`,title:u,children:u}),e.jsxs("span",{className:"flex items-center gap-px shrink-0 opacity-50 group-hover/mrow:opacity-100 transition-opacity",children:[e.jsx(b,{to:N(a,t[a],s),className:"p-0.5 rounded text-text-quaternary hover:text-accent transition-colors",title:`Filter ${s}: ${a} = ${u}`,onClick:c=>c.stopPropagation(),children:e.jsx(_,{className:"w-3 h-3"})}),e.jsx(b,{to:N(a,t[a]),className:"p-0.5 rounded text-text-quaternary hover:text-accent transition-colors",title:`Search all: ${a} = ${u}`,onClick:c=>c.stopPropagation(),children:e.jsx($,{className:"w-3 h-3"})}),i&&typeof t[a]=="string"&&e.jsx("button",{className:"p-0.5 rounded text-text-quaternary hover:text-accent transition-colors",title:`Timeline: every station ${u} has moved through`,onClick:c=>{c.stopPropagation(),i.setPanel(e.jsx(O,{facetKey:a,value:t[a],role:s}),{key:"entity-timeline",width:420})},children:e.jsx(L,{className:"w-3 h-3"})})]}),!x&&r>0&&e.jsxs("button",{onClick:c=>{c.stopPropagation(),p(!0)},className:"shrink-0 text-2xs text-text-quaternary hover:text-accent transition-colors font-mono",title:`Show ${r} more fields`,children:["+",r]}),x&&w&&r>0&&e.jsx("button",{onClick:c=>{c.stopPropagation(),p(!1)},className:"shrink-0 text-2xs text-text-quaternary hover:text-accent transition-colors",title:"Show less",children:"↑"})]},a)})})})}function z(t={}){return[{key:"description",label:"Summary",priority:1,render:s=>e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx("span",{className:"shrink-0",children:e.jsx(M,{row:s})}),e.jsx("span",{className:`truncate text-xs ${f}`,children:s.description||s.type})]}),className:"max-w-0"},{key:"assigned_to",label:"Assignee",priority:2,render:s=>s.assigned_to?e.jsx(q,{userId:s.assigned_to,className:`block truncate text-xs ${f}`}):e.jsx("span",{className:"text-xs text-text-quaternary",children:"—"}),className:"w-36 max-w-[9rem]"},{key:"role",label:"Role",priority:2,render:s=>e.jsx("span",{className:f,children:e.jsx(W,{role:s.role,size:"md",tone:"inherit"})}),className:"w-44 min-w-[11rem]"},{key:"priority",label:"Pri",priority:2,render:s=>e.jsx("span",{className:f,children:e.jsx(R,{priority:s.priority,size:"sm",tone:"inherit"})}),className:"w-10"},{key:"workflow_type",label:"Workflow",priority:2,showFrom:"split",render:s=>e.jsx(I,{type:s.workflow_type||s.type}),className:"w-40 whitespace-nowrap"},{key:"metadata",label:"Metadata",priority:2,showFrom:"wall",render:s=>e.jsx(D,{metadata:s.metadata,role:s.role,highlightKeys:t.highlightKeys}),className:"w-80 max-w-[19rem] align-top"},{key:"created_at",label:"Ago",priority:1,render:s=>e.jsx("span",{className:`text-xs tabular-nums ${f}`,title:s.created_at,children:C(s.created_at)}),className:"w-14 whitespace-nowrap"}]}const le=z(),ie={key:"expires",label:e.jsx(S,{className:"w-3.5 h-3.5 text-text-tertiary"}),render:t=>t.assigned_until?e.jsx(U,{until:t.assigned_until}):e.jsx("span",{className:"text-xs text-text-tertiary",children:"—"}),className:"w-16 whitespace-nowrap",priority:1},H=[{value:"1",label:"P1"},{value:"2",label:"P2"},{value:"3",label:"P3"},{value:"4",label:"P4"}],J=[{value:"all",label:"All"},{value:"available",label:"Available"},{value:"claimed",label:"Claimed"},{value:"resolved",label:"Resolved"},{value:"cancelled",label:"Cancelled"},{value:"expired",label:"Expired"}];function oe({filters:t,setFilter:s,roles:d,types:x,showStatus:p=!1,showSearch:i=!0,showRole:l=!0,actions:o}){const m=[t.role,t.type,t.priority,t.status&&t.status!=="all"?t.status:"",t.search??""].filter(Boolean).length;return e.jsxs(F,{actions:o,activeFilterCount:m,children:[p&&e.jsxs(e.Fragment,{children:[e.jsx(j,{label:"Status",value:t.status??"",onChange:r=>s("status",r),options:J}),e.jsx(v,{})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx(j,{label:"Role",value:t.role,onChange:r=>s("role",r),options:d.map(r=>({value:r,label:r}))}),e.jsx(v,{})]}),e.jsx(j,{label:"Priority",value:t.priority,onChange:r=>s("priority",r),options:H}),e.jsx(v,{}),e.jsx(j,{label:"Workflow Type",value:t.type,onChange:r=>s("type",r),options:x.map(r=>({value:r,label:r}))}),i&&e.jsxs(e.Fragment,{children:[e.jsx(v,{}),e.jsx(A,{label:"Search",value:t.search??"",onChange:r=>s("search",r),placeholder:"ID, workflow, origin…"})]})]})}export{ne as E,ie as T,oe as a,le as b,z as m};
|
|
2
|
-
//# sourceMappingURL=escalation-columns-B4DG_5v8.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{b as ss,a as p,j as t}from"./vendor-query-RUZdMvN6.js";import{a9 as Gs,M as me,aa as yt,l as Nt,a4 as ee,ab as zt,J as It,g as Qs,h as Ys,P as rt,e as se,x as qe,ac as ne,ad as ns,a7 as pe,_ as fe,a3 as rs,q as as,ae as Zs,af as Ks,ag as tn,ah as en,p as sn,ai as nn,aj as rn,T as an,U as on,b as ln,L as cn,w as dn,ak as un}from"./index-BaC3sbJH.js";import{u as is,C as os,r as xn,B as mn,a as pn}from"./BulkAssignModal-DYbM_6Or.js";import{a as ls,u as ge,L as vt,b as fn,e as gn}from"./vendor-react-CdqEC2zv.js";import{P as hn}from"./PageHeader-xB92ELs3.js";import{L as bn}from"./ListToolbar-DaxloPQc.js";import{i as Ht,b as yn,d as jn,C as Xt,g as he,H as Nn,m as vn,c as at,r as be,s as wn,e as cs}from"./CountdownTimer-DPHMBmgz.js";import{u as kn}from"./workflows-CX_oarls.js";import{S as ds}from"./StatusBadge-BDeUwPtb.js";import{R as _n}from"./RolePill-CYpL3a2d.js";import{C as xt}from"./CopyableId-4Lqlc5cU.js";import{U as St}from"./UserName-CsLnT75E.js";import{d as Cn}from"./metadata-display--TzK0REC.js";import{a4 as us,O as En,S as An,av as Tn,a0 as Rn,m as On,ah as xs,U as In,ak as Sn,b as Mn,aw as ms,al as Dn,aa as $n,ax as Ln,ay as Pn,az as ce,aA as Wn,aB as Ue,aC as Fn,a as qn,Q as Je,V as Ve,aD as Un,X as Jn}from"./vendor-icons-BCWsItQ7.js";import"./constants-BHkpVaqx.js";import"./useDebouncedValue-DG5JOj1F.js";import"./DataTable-DFPMeqyQ.js";import"./EmptyState-lpUFYfun.js";import"./StickyPagination-BIVTAMnP.js";const Vn={SCHEMA_VALIDATION:"schema_validation"};function Hn(e){return typeof e=="object"&&e!==null&&e.code===Vn.SCHEMA_VALIDATION&&Array.isArray(e.violations)}function Bn({escalationId:e}){var b;const s=ls(),r=ge(),n=ss(),i=(b=s.state)==null?void 0:b[Gs],[o,c]=p.useState(!1),[d,u]=p.useState(null),[x,l]=p.useState(!1);if(!i||i.escalationId!==e||x)return null;const m=()=>{l(!0),r(s.pathname,{replace:!0,state:null})},a=async()=>{var w,y,h;c(!0),u(null);try{switch(i.verb){case yt.CANCEL:await Nt(`/escalations/${e}/cancel`,{method:"POST"});break;case yt.CLAIM:case yt.CLAIM_SHOW_DETAIL:await Nt(`/escalations/${e}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:((w=i.params)==null?void 0:w.durationMinutes)??30})});break;case yt.RELEASE:await Nt(`/escalations/${e}/release`,{method:"POST"});break;case yt.RESOLVE:await Nt(`/escalations/${e}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:((y=i.params)==null?void 0:y.resolverPayload)??{}})});break;case yt.ESCALATE:await Nt(`/escalations/${e}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:(h=i.params)==null?void 0:h.targetRole})});break;default:throw new Error(`Unsupported confirm verb "${i.verb}"`)}n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]}),m()}catch(j){u(j.message)}finally{c(!1)}};return t.jsx(me,{open:!0,onClose:m,title:"Confirm scan action",children:t.jsxs("div",{className:"space-y-4",children:[t.jsx("p",{className:"text-sm text-text-secondary",children:i.prompt}),d&&t.jsx("p",{className:"text-xs text-status-error",children:d}),t.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[t.jsx("button",{onClick:m,disabled:o,className:"btn-secondary text-xs",children:"No, go back"}),t.jsx("button",{onClick:a,disabled:o,className:"btn-primary text-xs",children:o?"Working…":"Yes, continue"})]})]})})}const Vt={pending:"rgb(var(--lt-status-queued-graphic))",claimed:"rgb(var(--lt-status-claimed-graphic))",resolved:"rgb(var(--lt-status-success-graphic))",cancelled:"rgb(var(--lt-status-error))"},re=4;function He({pct:e,place:s,label:r,title:n,emphasis:i}){const o=t.jsx("span",{className:"w-px h-1 bg-text-quaternary/70","aria-hidden":!0}),c=t.jsx("span",{className:`whitespace-nowrap leading-none tabular-nums text-[10px] ${i?"text-text-tertiary":"text-text-quaternary"}`,children:r});return t.jsx("div",{title:n,className:`absolute ${s==="above"?"bottom-0":"top-0"} flex flex-col items-center gap-0 -translate-x-1/2 cursor-help`,style:{left:`${e}%`},children:s==="above"?t.jsxs(t.Fragment,{children:[c,o]}):t.jsxs(t.Fragment,{children:[o,c]})})}function zn({esc:e,className:s=""}){const r=new Date(e.created_at).getTime(),n=e.claimed_at?new Date(e.claimed_at).getTime():null,i=e.status==="resolved",o=e.status==="cancelled"||e.status==="expired",c=i||o,d=Ht(e),u=!!n&&(d||c),x=i&&e.resolved_at?new Date(e.resolved_at).getTime():o?new Date(e.updated_at).getTime():Date.now(),l=Math.max(x-r,1),m=u&&n?Math.max(n-r,0):l,a=u&&n?Math.max(x-n,0):0,b=Math.min(100,Math.max(0,m/l*100)),w=u?Math.max(0,100-b):0,y=i?Vt.resolved:o?Vt.cancelled:Vt.claimed,h=i?"Resolved after":o?"Cancelled after":"In progress",j=ee(m),k=ee(l),g=i?`Resolved in ${k} total`:o?`Cancelled after ${k}`:`Open ${k} so far`,A=`Lifecycle bar: blue = time waiting to be claimed, ${i?"green":o?"red":"orange"} = ${h.toLowerCase()} the claim.`;return t.jsxs("div",{className:s,title:A,children:[t.jsx("div",{className:"relative h-2.5 font-mono",children:u&&t.jsx(He,{pct:b,place:"above",label:j,title:`Time to claim: ${j}`})}),t.jsxs("div",{className:"flex w-full rounded-full overflow-hidden",style:{height:re,backgroundColor:"rgb(var(--lt-surface-sunken))"},title:A,children:[t.jsx("div",{style:{width:`${b}%`,minWidth:re,backgroundColor:Vt.pending,opacity:.75},title:`Waiting ${j} — created → claimed`}),u&&w>0&&t.jsx("div",{style:{width:`${w}%`,minWidth:re,backgroundColor:y,opacity:.75},title:`${h} ${ee(a)}`})]}),t.jsx("div",{className:"relative h-2.5 font-mono",children:t.jsx(He,{pct:100,place:"below",emphasis:!0,label:k,title:g})})]})}function Xn({triage:e,payload:s}){const r=e.confidence??0,n=r>=.8?"text-status-success":r>=.5?"text-status-pending":"text-status-error",i=Gn(e.originalData,s);return t.jsxs("div",{className:"space-y-5",children:[e.diagnosis&&t.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:e.diagnosis}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-text-tertiary",children:[e.tool_calls_made!=null&&t.jsxs("span",{children:[e.tool_calls_made," tool call",e.tool_calls_made!==1?"s":""]}),e.tool_calls_made!=null&&t.jsx("span",{className:"text-text-quaternary",children:"·"}),t.jsxs("span",{className:`font-medium ${n}`,children:[Math.round(r*100),"% confidence"]})]}),e.actions_taken&&e.actions_taken.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.actions_taken.map((o,c)=>t.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-2xs
|
|
2
|
-
text-text-secondary`,children:[t.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:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),o]},c))}),e.recommendation&&t.jsx("p",{className:"text-2xs text-text-tertiary italic",children:e.recommendation}),i.length>0&&t.jsx("div",{className:"space-y-4 pt-2",children:i.map(o=>t.jsx(Qn,{diff:o},o.key))})]})}function Gn(e,s){if(!e)return[];const r=[];for(const n of Object.keys(e)){if(n.startsWith("_"))continue;const i=e[n],o=s[n];o!==void 0&&JSON.stringify(i)!==JSON.stringify(o)&&r.push({key:n,label:n.replace(/[_-]/g," "),original:i,corrected:o})}return r}function Qn({diff:e}){const s=Be(e.original),r=Be(e.corrected);return s!==null&&r!==null?t.jsx("div",{className:"@container",children:t.jsxs("div",{className:"grid grid-cols-1 @form-cols:grid-cols-2 gap-x-8 gap-y-3",children:[t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[e.label," ",t.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),t.jsx("p",{className:"text-sm text-text-tertiary leading-relaxed line-through decoration-text-tertiary/30",children:s})]}),t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[e.label," ",t.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),t.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:r})]})]})}):t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[e.label," ",t.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),t.jsx("pre",{className:"text-xs text-text-tertiary font-mono whitespace-pre-wrap leading-relaxed",children:typeof e.original=="object"?JSON.stringify(e.original,null,2):String(e.original)})]}),t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[e.label," ",t.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),t.jsx("pre",{className:"text-xs text-text-primary font-mono whitespace-pre-wrap leading-relaxed",children:typeof e.corrected=="object"?JSON.stringify(e.corrected,null,2):String(e.corrected)})]})]})}function Be(e){return e==null?"null":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):null}function Y(e,s){const r=s==null?void 0:s.title;if(typeof r=="string"&&r.trim().length>0)return r.trim();const n=e.split(/[_-]+/).filter(Boolean);return n.length<=1?e:n.map(i=>Yn(i)?i:i.charAt(0).toUpperCase()+i.slice(1)).join(" ")}function Yn(e){return e.length>1&&e===e.toUpperCase()&&/[A-Z]/.test(e)}const B={HELP:"help",DETAILS:"details",TRIAGE:"triage",METADATA:"metadata",CONTEXT:"context",RECORD:"record",ERRORS:"errors"},ps="lt:escalation:panel:view";function Zn(e){try{const s=localStorage.getItem(ps);if(s&&e.includes(s))return s}catch{}return B.HELP}function Kn({metadata:e,role:s}){const r=Cn(e);return r.length===0?t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No metadata on this escalation."}):t.jsx("dl",{className:"space-y-3.5",children:r.map(([n,i])=>{const o=typeof i=="object"&&i!==null?JSON.stringify(i):String(i),c=qe(n,i,s),d=qe(n,i);return t.jsxs("div",{className:"group relative",children:[t.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:Y(n)}),t.jsxs("dd",{className:"mt-0.5 flex items-center gap-1",children:[t.jsx("span",{className:"text-xs text-text-primary font-mono break-all flex-1",children:o}),t.jsx(vt,{to:c,title:`Filter this queue: ${n} = ${o}`,className:"opacity-50 group-hover:opacity-100 transition-opacity shrink-0 p-0.5 text-text-quaternary hover:text-accent",children:t.jsx(Sn,{className:"w-3 h-3"})}),t.jsx(vt,{to:d,title:`Search all queues: ${n} = ${o}`,className:"opacity-50 group-hover:opacity-100 transition-opacity shrink-0 p-0.5 text-text-quaternary hover:text-accent",children:t.jsx(Mn,{className:"w-3 h-3"})})]})]},n)})})}function tr({esc:e,claimed:s,isTerminal:r,isBuilder:n,traceUrl:i}){return t.jsxs("div",{className:"space-y-5",children:[t.jsxs("dl",{className:"space-y-3.5",children:[t.jsx(rt,{label:"Status",children:t.jsx(ds,{status:e.status})}),t.jsx(rt,{label:"Assigned to Role",children:t.jsx(_n,{role:e.role,size:"md"})}),t.jsxs(rt,{label:"Priority",children:["P",e.priority]}),(s||r)&&e.assigned_to&&t.jsx(rt,{label:"Claimed By",children:t.jsxs("span",{className:"inline-flex items-center gap-1.5 font-medium text-text-primary",children:[t.jsx(In,{className:"w-3 h-3 shrink-0 text-accent/75"}),t.jsx(St,{userId:e.assigned_to})]})}),t.jsx(rt,{label:"Created",children:t.jsx(se,{date:e.created_at})}),(s||r)&&e.claimed_at&&t.jsx(rt,{label:"Claimed",children:t.jsx(se,{date:e.claimed_at})}),s&&!r&&e.assigned_until&&t.jsx(rt,{label:"Time Remaining",children:t.jsx(Xt,{until:e.assigned_until})}),e.resolved_at&&t.jsx(rt,{label:"Completed",children:t.jsx("span",{className:"text-status-success",children:t.jsx(se,{date:e.resolved_at})})})]}),n&&t.jsxs(t.Fragment,{children:[t.jsx("hr",{className:"border-surface-border/60"}),t.jsxs("div",{className:"space-y-3.5",children:[t.jsx(xt,{label:"Escalation ID",value:e.id}),e.task_id&&t.jsx(xt,{label:"Task ID",value:e.task_id,href:`/workflows/tasks/detail/${e.task_id}`}),e.workflow_type&&t.jsx(xt,{label:"Workflow Name",value:e.workflow_type,href:`/workflows/executions?entity=${encodeURIComponent(e.workflow_type)}`}),e.workflow_id&&t.jsx(xt,{label:"Workflow ID",value:e.workflow_id,href:`/workflows/executions/${e.workflow_id}`}),e.task_queue&&t.jsx(xt,{label:"Task Queue",value:e.task_queue,href:`/admin/controlplane?queue=${encodeURIComponent(e.task_queue)}`}),e.origin_id&&e.origin_id!==e.workflow_id&&t.jsx(xt,{label:"Origin",value:e.origin_id,href:`/processes/detail/${e.origin_id}`}),e.trace_id&&t.jsx(xt,{label:"Trace",value:e.trace_id,href:i?i.replace("{traceId}",e.trace_id):void 0,external:!0})]})]})]})}function er({errors:e,schema:s}){const r=n=>{const i=document.querySelector(`[data-field-key="${n}"]`);i&&(i.scrollIntoView({behavior:"smooth",block:"center"}),i.focus({preventScroll:!0}))};return e.length===0?t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No errors to display."}):t.jsxs("div",{className:"space-y-1",role:"alert","aria-live":"polite",children:[t.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-wider text-status-error mb-4",children:[e.length," ",e.length===1?"issue":"issues"," to resolve"]}),t.jsx("div",{className:"space-y-1.5",children:e.map(({field:n,message:i})=>{var o;return t.jsxs("button",{onClick:()=>r(n),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:[t.jsx(xs,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-status-error/60 group-hover:text-status-error transition-colors"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-2xs font-semibold text-text-primary leading-snug",children:Y(n,(o=s==null?void 0:s.properties)==null?void 0:o[n])}),t.jsx("p",{className:"text-2xs text-text-tertiary group-hover:text-text-secondary transition-colors leading-snug mt-0.5",children:i})]})]},n)})}),t.jsx("p",{className:"text-2xs text-text-quaternary mt-4 px-3",children:"Click an issue to scroll to and focus the field."})]})}function sr({esc:e,schema:s,envelope:r,payload:n,resolver:i,triage:o,hasAI:c,claimed:d,claimedByMe:u,isTerminal:x,isBuilder:l,traceUrl:m,open:a,noGutter:b,formErrors:w,activePanel:y,onPanelChange:h}){const j=ge(),k=Object.values(B),[g,A]=p.useState(()=>Zn(k)),D=y??g,M=p.useCallback(_=>{try{localStorage.setItem(ps,_)}catch{}A(_),h==null||h(_)},[h]);p.useEffect(()=>{y&&y!==g&&A(y)},[y]);const $=p.useMemo(()=>yn(s,{escalation:e,metadata:e.metadata??null,envelope:r,payload:n,resolver:i})??jn({isTerminal:x,status:e.status,claimed:d,claimedByMe:u}),[s,e,r,n,i,x,d,u]),P=p.useCallback(_=>{const R=_.target.closest("a"),O=R==null?void 0:R.getAttribute("href");O!=null&&O.startsWith("/")&&(_.preventDefault(),j(O))},[j]),T=[{id:B.HELP,icon:us,label:"Instructions",content:t.jsx(zt,{content:$,onClick:P})},{id:B.DETAILS,icon:En,label:"Details",content:t.jsx(tr,{esc:e,claimed:d,isTerminal:x,isBuilder:l,traceUrl:m})},...c&&o?[{id:B.TRIAGE,icon:An,label:"AI Analysis",content:t.jsx(Xn,{triage:o,payload:n??{}})}]:[],{id:B.METADATA,icon:Tn,label:"Metadata",content:t.jsx(Kn,{metadata:e.metadata,role:e.role})},{id:B.CONTEXT,icon:Rn,label:"Context",content:t.jsxs("div",{className:"space-y-5",children:[r!=null&&t.jsx(It,{data:r,label:"Input Envelope"}),n!=null&&t.jsx(It,{data:n,label:"Escalation Context"}),i!=null&&t.jsx(It,{data:i,label:"Resolver Payload"}),r==null&&n==null&&i==null&&t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No context on this escalation."})]})},...l?[{id:B.RECORD,icon:On,label:"Record",content:t.jsx(It,{data:e,label:"Escalation Record"})}]:[],...w&&w.length>0?[{id:B.ERRORS,icon:(({className:_})=>t.jsx(xs,{className:`${_??""} text-status-error`})),label:"Errors",content:t.jsx(er,{errors:w,schema:s})}]:[]];return t.jsx(Qs,{open:a,width:384,className:"h-full",children:t.jsx("div",{className:`h-full${b?"":" pl-6"}`,children:t.jsxs("div",{className:"h-full flex flex-col bg-surface-hover",children:[t.jsx("div",{className:"shrink-0 pt-2 pb-0 flex justify-center",children:t.jsx(zn,{esc:e,className:"w-[80%]"})}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(Ys,{views:T,activeId:D,onViewChange:M,stickyClassName:"h-full min-h-0"})})]})})})}const nr=/\{\{\s*([^{}]+?)\s*\}\}/g;function de(e){return typeof e=="string"&&/\{\{[^{}]+\}\}/.test(e)}function ye(e,s){if(!s)return;const r=e.indexOf("."),n=s[r===-1?e:e.slice(0,r)];if(r===-1)return n;if(!(n===null||typeof n!="object"))return he(n,e.slice(r+1))}function fs(e,s){let r=!1;const n=e.replace(nr,(i,o)=>{const c=ye(o,s);return typeof c=="string"&&c.trim().length>0?c:typeof c=="number"&&Number.isFinite(c)?String(c):(r=!0,"")});return r?null:n}const rr="x-lt-options";function ze(e){return typeof e=="string"||typeof e=="number"&&Number.isFinite(e)}function ar(e){if(ze(e))return{value:e,label:String(e)};if(e&&typeof e=="object"&&!Array.isArray(e)){const s=e,r=s.value!==void 0?s.value:s.id;if(ze(r)&&typeof s.label=="string"&&s.label.length>0)return{value:r,label:s.label}}return null}function gs(e,s){if(!e)return;const r=e.enum;if(Array.isArray(r)&&r.length>0)return r.map(c=>({value:c,label:String(c)}));const n=e[rr],i=(typeof n=="string"?[n]:Array.isArray(n)?n:[]).filter(c=>typeof c=="string"&&c.length>0);if(i.length===0)return;const o=i.some(de)?[]:void 0;for(const c of i){let d=c;if(de(c)){const l=fs(c,s);if(l===null)continue;d=l}const u=ye(d,s);if(!Array.isArray(u))continue;const x=u.map(ar).filter(l=>l!==null);if(x.length>0)return x}return o}function je(e,s){const r=(typeof e=="string"?[e]:Array.isArray(e)?e:[]).filter(n=>typeof n=="string"&&n.length>0);if(r.length===0||!s)return[];for(const n of r){let i=n;if(de(n)){const c=fs(n,s);if(c===null)continue;i=c}const o=ye(i,s);if(Array.isArray(o)&&o.length>0)return o}return[]}const ir="x-lt-default-checked";function or(e,s,r){if((e==null?void 0:e["x-lt-widget"])!=="checklist"||e[ir]!==!0||s&&typeof s=="object"&&!Array.isArray(s)&&Object.keys(s).length>0)return null;const n=je(e["x-lt-source"],r);return n.length===0?null:Object.fromEntries(n.map(i=>[i.id,!0]))}function lr(e,s,r){if((s==null?void 0:s["x-lt-widget"])!=="checklist"||s["x-lt-require-all"]!==!0)return;const i=je(s["x-lt-source"],r).filter(d=>d.required!==!1);if(i.length===0)return;const o=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},c=i.filter(d=>!o[d.id]).length;if(c!==0)return`${c} of ${i.length} checks incomplete`}function cr(e,s){const r=s==null?void 0:s.type;if(typeof r=="string"&&!(e==null||e===""))switch(r){case"string":return typeof e=="string"?void 0:"Expected text";case"number":return typeof e=="number"&&Number.isFinite(e)?void 0:"Expected a number";case"integer":return typeof e=="number"&&Number.isInteger(e)?void 0:"Expected a whole number";case"boolean":return typeof e=="boolean"?void 0:"Expected true or false";case"array":return Array.isArray(e)?void 0:"Expected a list";case"object":return typeof e=="object"&&!Array.isArray(e)?void 0:"Expected an object";default:return}}function dr(e,s,r){if(!s)return;const n=gs(s,r);if(n!==void 0&&e!==void 0&&e!==null&&e!==""){if(n.length===0)return"No valid options for this selection";if(!n.some(i=>i.value===e))return`Must be one of: ${n.map(i=>String(i.value)).join(", ")}`}if(typeof e=="string"){const i=e.trim();if(i==="")return;const o=jt(s.minLength,s["x-lt-min-length"],r);if(o!==void 0&&i.length<o)return`Minimum ${o} character${o===1?"":"s"}`;const c=jt(s.maxLength,s["x-lt-max-length"],r);if(c!==void 0&&i.length>c)return`Maximum ${c} characters (${i.length} entered)`;const d=s.pattern;if(d)try{if(!new RegExp(d).test(i))return s["x-lt-pattern-error"]??"Invalid format"}catch{}const u=s.format;if(u==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i))return"Enter a valid email address";if(u==="uri"&&!/^https?:\/\/.+/.test(i))return"Enter a valid URL"}if(typeof e=="number"){const i=jt(s.minimum,s["x-lt-minimum"],r),o=jt(s.exclusiveMinimum,void 0,r),c=jt(s.maximum,s["x-lt-maximum"],r),d=jt(s.exclusiveMaximum,void 0,r);if(i!==void 0&&e<i)return`Minimum value is ${i}`;if(o!==void 0&&e<=o)return`Must be greater than ${o}`;if(c!==void 0&&e>c)return`Maximum value is ${c}`;if(d!==void 0&&e>=d)return`Must be less than ${d}`}}function jt(e,s,r){if(typeof e=="number")return e;if(typeof s=="string"&&r){const n=s.indexOf(".");if(n!==-1){const i=s.slice(0,n),o=s.slice(n+1),c=r[i];if(c&&typeof c=="object"){const d=o.split(".");let u=c;for(const x of d)if(u=u[x],u===void 0)break;if(typeof u=="number")return u;if(typeof u=="string"){const x=Number(u);if(!Number.isNaN(x))return x}}}}}function hs(e,s,r,n,i){if(!n)return;if(r){if(e==null||typeof e=="boolean"&&!e||typeof e=="string"&&e.trim()==="")return"Required";if(typeof e=="object"&&!Array.isArray(e)&&e!==null){const d=Object.values(e);if(d.length===0||d.every(u=>!u))return"Required"}}const o=cr(e,s);if(o)return o;const c=lr(e,s,i);return c||dr(e,s,i)}function Xe(e){return e!=null&&e!==""&&e!==!1&&e!==0}function ur(e){return e==null?"":typeof e=="object"?JSON.stringify(e):String(e)}function Ge(e,s){const r=e.indexOf("."),n=r===-1?e:e.slice(0,r);if(!Nn.includes(n))return{known:!1,value:void 0};const i=s[n];if(r===-1)return{known:!0,value:i};try{return{known:!0,value:he(i,e.slice(r+1))}}catch{return{known:!0,value:void 0}}}function Bt(e,s){if(typeof e!="string"||e.length===0||!s)return!0;const r=e.startsWith("!"),n=r?e.slice(1):e,i=n.indexOf("!="),o=n.indexOf("=");if(i!==-1||o!==-1&&o!==i+1){const u=i!==-1&&(o===-1||i<o),x=u?i:o,l=n.slice(0,x).trim(),m=n.slice(x+(u?2:1)).trim(),{known:a,value:b}=Ge(l,s);if(!a)return!0;const w=ur(b)===m,y=u?!w:w;return r?!y:y}const{known:c,value:d}=Ge(n,s);return c?r?!Xe(d):Xe(d):!0}const xr="x-lt-require-any";function mr(e){const s=e==null?void 0:e[xr];return Array.isArray(s)?s.filter(r=>Array.isArray(r)).map(r=>r.filter(n=>typeof n=="string"&&n.length>0)).filter(r=>r.length>0):[]}function pr(e){return e==null?!1:typeof e=="string"?e.trim().length>0:!0}const fr="x-lt-require-sum";function gr(e){const s=e==null?void 0:e[fr];if(!Array.isArray(s))return[];const r=[];for(const n of s){if(!n||typeof n!="object"||Array.isArray(n))continue;const{fields:i,minimum:o}=n;if(!Array.isArray(i))continue;const c=i.filter(d=>typeof d=="string"&&d.length>0);c.length!==0&&(o!==void 0&&typeof o!="number"||r.push({fields:c,minimum:typeof o=="number"?o:1}))}return r}function hr(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()!==""){const s=Number(e);if(!Number.isNaN(s))return s}return 0}function bs(e,s,r){if(!e)return[];const n=e.properties??{},i=new Set(e.required??[]),o={...r??{},resolver:s},c=[];for(const[d,u]of Object.entries(n)){if(!Bt(u["x-lt-showIf"],o))continue;const x=hs(s[d],u,i.has(d),!0,o);x&&c.push({field:d,message:x})}for(const d of mr(e)){const u=d.filter(l=>n[l]&&Bt(n[l]["x-lt-showIf"],o));if(u.length===0||u.some(l=>pr(s[l])))continue;const x=u.map(l=>n[l].title??l);c.push({field:u[0],message:`Enter a value for at least one of: ${x.join(", ")}`})}for(const d of gr(e)){const u=d.fields.filter(m=>n[m]&&Bt(n[m]["x-lt-showIf"],o));if(u.length===0||u.reduce((m,a)=>m+hr(s[a]),0)>=d.minimum)continue;const l=u.map(m=>n[m].title??m);c.push({field:u[0],message:`Combined value of ${l.join(", ")} must be at least ${d.minimum}`})}return c}function ue(e,s){let r;try{r=JSON.parse(e)}catch{return{payload:null,errors:[],parseError:"Invalid JSON"}}const n=r._form_schema;if(n){const c=bs(n,r,s);if(c.length>0)return{payload:null,errors:c,parseError:null}}const{_form_schema:i,...o}=r;return{payload:vn(o,n),errors:[],parseError:null}}function br(e){const{mode:s,activeView:r,onActiveViewChange:n,onClaim:i,claimPending:o,claimNudge:c,workflowType:d,json:u,onResolve:x,resolvePending:l,resolveError:m,requestTriage:a,triageNotes:b,onRelease:w,releasePending:y,onCancel:h,assignedTo:j,assignedUntil:k,onSubmitAttempt:g,onValidationErrors:A,escalationContext:D,labels:M={},submitBlocked:$,submitBlockedMessage:P,actingName:T,submitNeedsBadge:_,canManage:R,onReassign:O,onUnassign:I,unassignPending:F}=e,q=is(),[z,V]=p.useState("30"),[G,Z]=p.useState(0),[N,E]=p.useState(""),v=z==="custom",L=p.useCallback(S=>Z(S),[]),U=!!$&&!a;if(s==="terminal")return null;const ft=()=>{const S=v?G:parseInt(z);!S||S<=0||i(S)},gt=()=>{if(E(""),a){const K={_lt:{needsTriage:!0}};b.trim()&&(K.notes=b.trim()),x(K);return}const S=ue(u,D);if(S.parseError){E(S.parseError);return}if(S.errors.length>0){g==null||g(),A==null||A(S.errors);return}x(S.payload)},it=S=>`text-xs transition-colors ${S?"text-accent font-medium":"text-text-tertiary hover:text-accent"}`;return t.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:[s==="available"&&t.jsxs("div",{"data-testid":"claim-bar",children:[t.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[q.map(S=>t.jsx("button",{onClick:()=>{V(S.value),Z(0)},className:it(!v&&z===S.value),children:S.label},S.value)),t.jsx("button",{onClick:()=>V("custom"),className:it(v),children:"Other"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[M.cancel!==!1&&t.jsx("button",{onClick:h,className:"text-xs text-text-tertiary hover:text-status-error transition-colors",children:M.cancel??"Cancel escalation"}),t.jsx("div",{className:"flex-1"}),v&&t.jsx(os,{onChange:L,compact:!0,autoFocus:!0}),t.jsx("button",{onClick:ft,disabled:o||v&&G<=0,className:`btn-primary text-xs ${c?"animate-[field-shake_0.4s_ease-in-out]":""}`,"data-testid":"claim-button",children:o?"Claiming...":M.claim??"Claim"},c)]})]}),s==="claimed_by_other"&&t.jsxs("div",{className:"flex items-center gap-4","data-testid":"claimed-other-bar",children:[t.jsxs("p",{className:"text-sm text-text-secondary",children:["Claimed by ",t.jsx("span",{className:"font-medium text-text-primary",children:j?t.jsx(St,{userId:j}):"unknown"})]}),k&&t.jsx(Xt,{until:k}),m&&t.jsx("span",{className:"text-xs text-status-error",children:m.message}),R&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex-1"}),t.jsx("button",{onClick:O,className:"text-xs text-text-tertiary hover:text-accent transition-colors","data-testid":"admin-reassign",children:"Reassign…"}),t.jsx("button",{onClick:I,disabled:F,className:"text-xs text-text-tertiary hover:text-status-error transition-colors disabled:opacity-50","data-testid":"admin-unassign",children:F?"Returning…":"Return to queue"})]})]}),s==="claimed_by_me"&&t.jsxs("div",{"data-testid":"action-bar",children:[t.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[t.jsx("button",{onClick:()=>n("resolve"),className:it(r==="resolve"),children:d?"Resolve":"Acknowledge"}),t.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:M.release??"Release"}),M.cancel!==!1&&t.jsx("button",{onClick:h,className:"text-xs transition-colors text-text-tertiary hover:text-status-error",children:M.cancel??"Cancel"})]}),r==="resolve"&&t.jsxs("div",{className:"flex items-center gap-4",children:[_?t.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-text-secondary","data-testid":"submit-badge-warning",children:[t.jsx(ms,{className:"w-4 h-4 text-accent-muted shrink-0",strokeWidth:1.5}),"When you submit, you'll scan your badge to confirm you're"," ",t.jsx("span",{className:"font-medium text-text-primary",children:j?t.jsx(St,{userId:j}):"the claimant"}),"."]}):T&&t.jsxs("p",{className:"text-sm text-text-secondary","data-testid":"acting-claim-note",children:["Claimed by you ",t.jsxs("span",{className:"font-medium text-text-primary",children:["(",T,")"]})]}),!_&&T&&k&&t.jsx(Xt,{until:k}),t.jsx("div",{className:"flex-1"}),N&&t.jsx("span",{className:"text-xs text-status-error",children:N}),m&&t.jsx("span",{className:"text-xs text-status-error",children:m.message}),U&&P&&t.jsx("span",{className:"text-xs text-status-pending","data-testid":"submit-guard-message",children:P}),t.jsx("button",{onClick:gt,disabled:l||U,className:"btn-primary text-xs",children:l?d?"Submitting...":"Acknowledging...":a?"Send to Triage":M.submit??(d?"Submit":"Acknowledge")})]}),r==="release"&&t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-xs text-text-secondary",children:"Release back to pool?"}),t.jsx("div",{className:"flex-1"}),t.jsx("button",{onClick:()=>n("resolve"),className:"btn-secondary text-xs",children:"Back"}),t.jsx("button",{onClick:w,disabled:y,className:"btn-primary text-xs bg-status-error hover:bg-status-error/80",children:y?"Releasing...":"Yes, Release"})]})]})]})}function ae({children:e}){return t.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:e})}function yr({payload:e,isTerminal:s,resolverPayload:r,onRetryTriage:n,isRetrying:i}){const o=e.title,c=e.summary,d=e.diagnosis,u=e.tool_calls_made,x=e.result,l=r==null?void 0:r._lt,m=(l==null?void 0:l.triaged)===!0,a=l==null?void 0:l.triageWorkflowId,b=s&&m,[w,y]=p.useState(!1);return b?t.jsxs("div",{className:"rounded-md border border-status-success/30 bg-surface-raised",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4 text-status-success shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:t.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"})}),t.jsx("span",{className:"text-xs font-medium text-status-success",children:"Resolved by AI Triage"})]}),typeof u=="number"&&t.jsxs("span",{className:"text-2xs font-mono px-2 py-0.5 rounded-full bg-status-success/10 text-status-success",children:[u," tool calls used"]})]}),t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[o&&t.jsx("p",{className:"text-sm font-medium text-text-primary",children:o}),d&&t.jsxs("div",{children:[t.jsx(ae,{children:"Triage diagnosis"}),t.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:t.jsx(ne,{content:d})})]}),t.jsx("div",{className:"flex items-center gap-3",children:a&&t.jsx(vt,{to:`/workflows/executions/${a}`,className:"text-2xs text-accent hover:underline",children:"View triage execution"})})]})]}):t.jsxs("div",{className:"rounded-md border border-status-warning/30 bg-surface-raised",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4 text-status-warning shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:t.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"})}),t.jsx("span",{className:"text-xs font-medium text-status-warning",children:"Tool Rounds Exhausted"})]}),typeof u=="number"&&t.jsxs("span",{className:"text-2xs font-mono px-2 py-0.5 rounded-full bg-status-warning/10 text-status-warning",children:[u," tool calls used"]})]}),t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[o&&t.jsx("p",{className:"text-sm font-medium text-text-primary",children:o}),c&&t.jsxs("div",{children:[t.jsx(ae,{children:"What happened"}),t.jsx("div",{className:"text-xs text-text-secondary leading-relaxed",children:t.jsx(ne,{content:c})})]}),d&&t.jsxs("div",{children:[t.jsx(ae,{children:"What went wrong"}),t.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:t.jsx(ne,{content:d})})]}),x!=null&&t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>y(!w),className:"flex items-center gap-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary hover:text-text-secondary transition-colors",children:[t.jsx("svg",{className:`w-3 h-3 transition-transform ${w?"rotate-90":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:t.jsx("path",{d:"M4.5 2l4 4-4 4"})}),"Partial results"]}),w&&t.jsx("div",{className:"mt-2",children:t.jsx(It,{data:x,defaultMode:"tree"})})]}),n&&!s&&t.jsx("div",{className:"pt-2",children:t.jsxs("button",{onClick:n,disabled:i,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:[t.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 14 14",fill:"currentColor",children:t.jsx("path",{d:"M7 1a6 6 0 100 12A6 6 0 007 1zm2.5 6.5l-3.5 2V5.5l3.5 2z"})}),i?"Sending to triage...":"Retry with AI Triage"]})})]})]})}function Qe(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function ys({src:e,escalation:s,schema:r,onResolve:n,onEscalate:i,submitAttempted:o,fill:c}){const d=p.useRef(null),u=p.useRef("");p.useEffect(()=>{try{const l=new URL(e);u.current=l.origin}catch{u.current=""}},[e]);const x=p.useCallback(()=>{const l=d.current;if(!(l!=null&&l.contentWindow)||!u.current)return;const a={type:"lt:init",escalation:{id:s.id,type:s.type,subtype:s.subtype,description:s.description,status:s.status,priority:s.priority,role:s.role,workflow_type:s.workflow_type,envelope:Qe(s.envelope),metadata:s.metadata??null,escalation_payload:Qe(s.escalation_payload)},schema:r};l.contentWindow.postMessage(a,u.current)},[s,r]);return p.useEffect(()=>{const l=m=>{if(m.origin!==u.current)return;const a=m.data;if(!(!a||typeof a!="object"||typeof a.type!="string"))switch(a.type){case"lt:ready":x();break;case"lt:submit":a.payload&&typeof a.payload=="object"&&n(a.payload);break;case"lt:escalate":typeof a.target=="string"&&a.target&&i(a.target);break;case"lt:resize":{const b=d.current;b&&typeof a.height=="number"&&a.height>0&&(b.style.height=`${Math.min(a.height,2e3)}px`);break}}};return window.addEventListener("message",l),()=>window.removeEventListener("message",l)},[x,n,i]),p.useEffect(()=>{if(!o)return;const l=d.current;l!=null&&l.contentWindow&&u.current&&l.contentWindow.postMessage({type:"lt:validate"},u.current)},[o]),c?t.jsx("div",{className:"absolute inset-0 overflow-hidden",children:t.jsx("iframe",{ref:d,src:e,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:x})}):t.jsx("div",{className:"rounded-md border border-surface-border overflow-hidden bg-white",children:t.jsx("iframe",{ref:d,src:e,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:x})})}const jr=2600;function Nr({hint:e,onLockedClick:s,children:r}){const[n,i]=p.useState(null);p.useEffect(()=>{if(!n)return;const c=setTimeout(()=>i(null),jr);return()=>clearTimeout(c)},[n]);const o=c=>{if(s==null||s(),e){const d=Math.min(Math.max(c.clientX,96),window.innerWidth-96);i(u=>({x:d,y:c.clientY,n:((u==null?void 0:u.n)??0)+1}))}};return t.jsxs("div",{className:"pb-8 max-w-form",onClick:o,"data-testid":"locked-form-frame",children:[r,e&&n&&t.jsxs("div",{role:"status",className:"fixed z-[60] pointer-events-none flex items-center gap-2 px-3 py-1.5 rounded-md bg-surface-raised border border-surface-border shadow-lg text-xs font-medium text-text-primary whitespace-nowrap animate-[click-hint_2.6s_ease-in-out_both]",style:{left:n.x,top:n.y-12},onAnimationEnd:()=>i(null),"data-testid":"locked-form-hint",children:[t.jsx(Dn,{className:"w-3.5 h-3.5 text-accent shrink-0",strokeWidth:1.5}),e]},n.n)]})}function W({children:e,isRequired:s,htmlFor:r}){return t.jsxs("label",{htmlFor:r,className:"block text-2xs font-semibold uppercase tracking-wider text-text-secondary",children:[e,s&&t.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})}function X({id:e,children:s}){return t.jsx("p",{id:e,className:"text-2xs text-text-tertiary mt-0.5 leading-snug",children:s})}function mt({error:e,id:s}){return e?t.jsx("p",{id:s,role:"alert",className:"text-2xs text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:e}):null}function Tt(e){return e?"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 vr(e){return e?"select text-sm mt-1 min-w-[min(16rem,100%)] max-w-full border-status-error/50 focus:border-status-error animate-[field-shake_0.4s_ease-in-out]":"select text-sm mt-1 min-w-[min(16rem,100%)] max-w-full"}function wr({fieldKey:e,value:s,onChange:r,schema:n,isRequired:i}){const o=p.useRef(null),c=(n==null?void 0:n.accept)??void 0,d=Y(e,n),u=n==null?void 0:n.description,x=p.useCallback(m=>{var w;const a=(w=m.target.files)==null?void 0:w[0];if(!a)return;const b=new FileReader;b.onload=()=>{typeof b.result=="string"&&r(b.result)},b.readAsDataURL(a)},[r]),l=s.startsWith("data:");return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,children:d}),u&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:u}),t.jsxs("div",{className:"mt-1",children:[t.jsx("input",{ref:o,type:"file",accept:c,onChange:x,className:"hidden"}),t.jsx("button",{type:"button",onClick:()=>{var m;return(m=o.current)==null?void 0:m.click()},className:"btn-secondary text-xs px-3 py-1.5",children:l?"Replace file":"Choose file"}),l&&t.jsx("span",{className:"ml-2 text-xs text-status-success",children:"File attached"})]})]})}function kr({fieldKey:e,value:s,onChange:r,schema:n,isRequired:i}){const o=Y(e,n),c=n==null?void 0:n.description,d=(n==null?void 0:n["x-lt-language"])??"",u=p.useCallback(x=>{if(x.key==="Tab"){x.preventDefault();const l=x.currentTarget,m=l.selectionStart,a=l.selectionEnd,b=s.substring(0,m)+" "+s.substring(a);r(b),requestAnimationFrame(()=>{l.selectionStart=l.selectionEnd=m+2})}},[s,r]);return t.jsxs("div",{children:[t.jsxs(W,{isRequired:i,children:[o,d&&t.jsx("span",{className:"ml-2 text-text-tertiary/60 normal-case font-normal",children:d})]}),c&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:c}),t.jsx("textarea",{value:s,onChange:x=>r(x.target.value),onKeyDown:u,className:"input w-full mt-1 font-mono text-xs leading-relaxed",rows:10,spellCheck:!1})]})}function _r({fieldKey:e,value:s,onChange:r,schema:n,isRequired:i}){const o=p.useRef(null),[c,d]=p.useState(!1),u=Y(e,n),x=n==null?void 0:n.description;p.useEffect(()=>{const y=o.current;if(!y)return;const h=y.getContext("2d");if(h&&(h.lineWidth=2,h.lineCap="round",h.strokeStyle="#1E1535",s&&s.startsWith("data:"))){const j=new Image;j.onload=()=>h.drawImage(j,0,0),j.src=s}},[]);const l=p.useCallback(y=>{const h=o.current,j=h.getBoundingClientRect(),k=j.width>0?h.width/j.width:1,g=j.height>0?h.height/j.height:1;return"touches"in y?{x:(y.touches[0].clientX-j.left)*k,y:(y.touches[0].clientY-j.top)*g}:{x:(y.clientX-j.left)*k,y:(y.clientY-j.top)*g}},[]),m=p.useCallback(y=>{var k;d(!0);const h=(k=o.current)==null?void 0:k.getContext("2d");if(!h)return;const j=l(y);h.beginPath(),h.moveTo(j.x,j.y)},[l]),a=p.useCallback(y=>{var k;if(!c)return;const h=(k=o.current)==null?void 0:k.getContext("2d");if(!h)return;const j=l(y);h.lineTo(j.x,j.y),h.stroke()},[c,l]),b=p.useCallback(()=>{d(!1);const y=o.current;y&&r(y.toDataURL("image/png"))},[r]),w=p.useCallback(()=>{const y=o.current;if(!y)return;const h=y.getContext("2d");h&&(h.clearRect(0,0,y.width,y.height),r(""))},[r]);return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,children:u}),x&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:x}),t.jsx("div",{className:"mt-1 max-w-[25rem] border border-surface-border rounded-md overflow-hidden bg-white",children:t.jsx("canvas",{ref:o,width:400,height:150,className:"w-full cursor-crosshair touch-none",onMouseDown:m,onMouseMove:a,onMouseUp:b,onMouseLeave:b,onTouchStart:m,onTouchMove:a,onTouchEnd:b})}),t.jsx("button",{type:"button",onClick:w,className:"mt-1 text-2xs text-text-tertiary hover:text-accent transition-colors",children:"Clear"})]})}function Cr({fieldKey:e,value:s,onChange:r,schema:n,isRequired:i}){const o=Y(e,n),c=n==null?void 0:n.description;return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,children:o}),c&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:c}),t.jsx("textarea",{value:s,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 Er({fieldKey:e,value:s,onChange:r,schema:n,isRequired:i}){const[o,c]=p.useState("write"),d=Y(e,n),u=n==null?void 0:n.description;return(n==null?void 0:n.readOnly)===!0?t.jsx(zt,{content:s,className:"my-1"}):t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(W,{isRequired:i,children:d}),t.jsx("div",{className:"flex items-center gap-0.5",children:["write","preview"].map(l=>t.jsx("button",{type:"button",onClick:()=>c(l),className:`px-2 py-0.5 text-2xs rounded transition-colors ${o===l?"bg-accent/10 text-accent font-semibold":"text-text-quaternary hover:text-text-secondary"}`,children:l==="write"?"Write":"Preview"},l))})]}),u&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:u}),o==="write"?t.jsx("textarea",{value:s,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."}):t.jsx("div",{className:"mt-1 px-3 py-2 border border-surface-border rounded min-h-[120px]",children:s.trim()?t.jsx(zt,{content:s}):t.jsx("p",{className:"text-xs text-text-quaternary italic",children:"Nothing to preview."})})]})}const Ar=28;function Tr({fieldKey:e,value:s,onChange:r,schema:n,escalationContext:i,isRequired:o,submitAttempted:c,error:d}){const u=(n==null?void 0:n["x-lt-require-all"])===!0,x=je(n==null?void 0:n["x-lt-source"],i);let l={};try{s&&(l=JSON.parse(s))}catch{}const m=(()=>{const g=or(n,l,i);return g?JSON.stringify(g):null})();p.useEffect(()=>{m&&r(m)},[m]);const a=g=>r(JSON.stringify({...l,[g]:!l[g]})),b=Y(e,n),w=n==null?void 0:n.description;if(x.length===0)return t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-xs text-text-tertiary italic mt-1",children:"No checklist items. None of the field's x-lt-source paths resolved on this escalation."}),d&&t.jsx("p",{className:"text-2xs text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:d})]});const y=n==null?void 0:n["x-lt-variant"],h=y==="chips"||y==="rows"?y:u||x.some(g=>g.label.length>Ar)?"rows":"chips",j=x.filter(g=>l[g.id]).length,k=(x.find(g=>!l[g.id]&&g.required!==!1)??x[0]).id;return t.jsxs("div",{role:"group","aria-label":b,"aria-required":o||void 0,"aria-invalid":d?!0:void 0,children:[t.jsx(W,{isRequired:o,children:b}),w&&t.jsx(X,{children:w}),h==="chips"?t.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:x.map(g=>{const A=l[g.id]??!1,D=!A&&!!c&&j===0&&(g.required||o);return t.jsxs("label",{className:`inline-flex items-center gap-1.5 cursor-pointer select-none px-3.5 py-2 text-sm border transition-colors rounded-[var(--lt-radius-field)] ${A?"bg-accent border-accent text-text-inverse":D?"bg-surface-field border-status-error/60 text-status-error":"bg-surface-field border-surface-field-border text-text-secondary hover:border-accent hover:text-text-primary"}`,children:[t.jsx("input",{type:"checkbox",checked:A,onChange:()=>a(g.id),className:"sr-only","data-testid":`checklist-item-${g.id}`,...g.id===k?{"data-field-key":e}:{}}),A&&t.jsx($n,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:2.5}),g.label]},g.id)})}):t.jsx("div",{className:"space-y-2.5 mt-2",children:x.map(g=>{const A=l[g.id]??!1,D=!A&&!!c&&(u?g.required!==!1:j===0&&(g.required||o));return t.jsxs("label",{className:`flex items-start gap-3 cursor-pointer group select-none rounded px-2 py-1 -mx-2 transition-colors ${D?"bg-status-error/5":"hover:bg-surface-hover"}`,children:[t.jsx("input",{type:"checkbox",checked:A,onChange:()=>a(g.id),className:`mt-0.5 w-3.5 h-3.5 shrink-0 rounded ${D?"accent-status-error":"accent-accent"}`,"data-testid":`checklist-item-${g.id}`,...g.id===k?{"data-field-key":e}:{}}),t.jsxs("span",{className:`text-sm leading-snug transition-colors ${D?"text-status-error":"text-text-secondary group-hover:text-text-primary"}`,children:[g.label,g.required&&t.jsx("span",{className:`ml-0.5 text-2xs ${D?"text-status-error":"text-text-quaternary"}`,children:"*"})]})]},g.id)})}),t.jsx("p",{className:"text-2xs text-text-quaternary mt-3 tabular-nums",children:h==="chips"?t.jsxs(t.Fragment,{children:[j," selected",o&&j===0&&!!c&&t.jsx("span",{className:"ml-1 text-text-quaternary/60",children:"(check at least one)"})]}):t.jsxs(t.Fragment,{children:[j," / ",x.length," confirmed",u?t.jsxs("span",{className:"ml-1 text-text-quaternary/60",children:["(all required",x.some(g=>g.required===!1)?" except optional":"",")"]}):o&&j===0&&!!c&&t.jsx("span",{className:"ml-1 text-text-quaternary/60",children:"(at least one required)"})]})}),d&&t.jsx("p",{role:"alert",className:"text-2xs text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:d})]})}const Rr=/\.(png|jpe?g|gif|webp|avif|bmp|svg)(\?.*)?$/i;function Or(e){var n,i,o,c;const s=e.trim();if(!s)return{kind:"none"};const r=(i=(n=/^data:([^;,]+)[;,]/.exec(s))==null?void 0:n[1])==null?void 0:i.toLowerCase();if(r)return r.startsWith("image/")?{kind:"image",src:s}:{kind:"file",href:s,label:r==="application/pdf"?"PDF":r,isData:!0};if(/^https?:\/\//i.test(s)){if(Rr.test(s))return{kind:"image",src:s};const d=(c=(o=/\.([a-z0-9]{2,5})(\?.*)?$/i.exec(s))==null?void 0:o[1])==null?void 0:c.toUpperCase();return{kind:"file",href:s,label:d??"attachment",isData:!1}}return{kind:"none"}}function Ye({fieldKey:e,value:s,schema:r}){const[n,i]=p.useState(!1),o=Or(s??""),c=e.replace(/[_-]/g," "),d=r==null?void 0:r.description,u=t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:c}),d&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:d})]});return o.kind==="none"?t.jsxs("div",{children:[u,t.jsx("p",{className:"text-xs text-text-quaternary italic mt-1",children:"No attachment"})]}):o.kind==="image"?t.jsxs("div",{children:[u,t.jsxs("div",{className:"mt-1",children:[t.jsx("button",{type:"button",onClick:()=>i(!0),className:"block rounded-[0.125em] border border-surface-border overflow-hidden hover:border-accent transition-colors",title:"View full size",children:t.jsx("img",{src:o.src,alt:e.replace(/[_-]/g," "),className:"max-h-48 max-w-full object-contain","data-testid":`attachment-image-${e}`})}),n&&t.jsx("div",{className:"fixed inset-0 z-[100] bg-text-primary/60 backdrop-blur-sm flex items-center justify-center p-8 cursor-zoom-out",onClick:()=>i(!1),role:"dialog","aria-modal":"true","aria-label":`${c} — full size`,children:t.jsx("img",{src:o.src,alt:c,className:"max-h-[90vh] max-w-[90vw] object-contain"})})]})]}):t.jsxs("div",{children:[u,t.jsx("div",{className:"mt-1",children:t.jsxs("a",{href:o.href,...o.isData?{download:`${e}.${o.label==="PDF"?"pdf":"bin"}`}:{target:"_blank",rel:"noopener noreferrer"},className:"inline-flex items-center gap-1.5 text-xs text-accent hover:text-accent-hover transition-colors","data-testid":`attachment-link-${e}`,children:[t.jsx(Ln,{className:"w-3.5 h-3.5",strokeWidth:1.5}),o.isData?`Download ${o.label}`:`Open ${o.label}`,o.isData?t.jsx(Pn,{className:"w-3 h-3",strokeWidth:1.5}):t.jsx(ce,{className:"w-3 h-3",strokeWidth:1.5})]})})]})}function Ir({fieldKey:e,schema:s,escalationContext:r}){const n=(s==null?void 0:s["x-lt-href"])??"",i=n&&r?at(n,r):n,o=(s==null?void 0:s.title)??(s==null?void 0:s.description)??"Open",c=s==null?void 0:s.description,d=i.startsWith("/"),u=!i.trim();return t.jsxs("div",{"data-field-key":e,children:[t.jsx(W,{children:o}),c&&t.jsx(X,{children:c}),t.jsx("div",{className:"mt-1",children:u?t.jsx("span",{className:"text-xs text-text-quaternary italic",children:"No link configured"}):d?t.jsxs(vt,{to:i,className:"inline-flex items-center gap-1 text-xs text-accent hover:text-accent-hover transition-colors","data-testid":`link-widget-${e}`,children:[o,t.jsx(ce,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}):t.jsxs("a",{href:i,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-accent hover:text-accent-hover transition-colors","data-testid":`link-widget-${e}`,children:[o,t.jsx(ce,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]})})]})}function js({to:e,className:s=""}){return t.jsxs(vt,{to:e,title:"View details",tabIndex:-1,className:`inline-flex items-center justify-center w-6 h-6 shrink-0 rounded border border-surface-border text-accent/70 hover:text-accent hover:border-accent/60 hover:bg-accent/5 transition-colors ${s}`,children:[t.jsx(Wn,{className:"w-3.5 h-3.5",strokeWidth:2}),t.jsx("span",{className:"sr-only",children:"View details"})]})}const Ze="—";function Sr(e,s){if(!e||!s)return"";const r=e.indexOf(".");if(r===-1)return"";const n=e.slice(0,r),i=e.slice(r+1);try{const o=he(s[n],i);return typeof o=="string"?o:""}catch{return""}}function Mr(e,s){if(!e||e===Ze)return Ze;if(s==="age"){const r=new Date(e);return Number.isNaN(r.getTime())?e:pe(e)}return e}function Dr({fieldKey:e,schema:s,escalationContext:r}){const n=s==null?void 0:s["x-lt-source"],i=(s==null?void 0:s["x-lt-fields"])??[],o=(s==null?void 0:s.title)??"Linked escalation",c=s==null?void 0:s.description,d=Sr(n,r),{data:u,isLoading:x,isError:l}=ns(d);return t.jsxs("div",{"data-field-key":e,children:[t.jsx(W,{children:o}),c&&t.jsx(X,{children:c}),t.jsx("div",{className:"mt-1",children:!d||l?t.jsx("p",{className:"text-xs text-text-quaternary italic","data-testid":`escalation-widget-empty-${e}`,children:"No linked record"}):x?t.jsx(Lr,{}):u?t.jsx($r,{esc:u,fields:i,fieldKey:e}):t.jsx("p",{className:"text-xs text-text-quaternary italic",children:"No linked record"})})]})}function $r({esc:e,fields:s,fieldKey:r}){if(!e)return null;const n=be(e);return t.jsxs("div",{className:"border-l-2 border-accent-faint pl-3 py-2 space-y-2","data-testid":`escalation-widget-card-${r}`,children:[t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("span",{className:"text-2xs font-semibold uppercase tracking-wider text-text-secondary",children:[e.type,e.subtype&&e.subtype!==e.type?` · ${e.subtype}`:""]}),t.jsx(ds,{status:e.status})]}),e.description&&t.jsx("p",{className:"text-xs text-text-primary leading-snug",children:e.description}),s.length>0&&t.jsx("dl",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-0.5",children:s.map(i=>{const o=at(i.value,n),c=Mr(o,i.format);return t.jsxs("div",{className:"contents",children:[t.jsx("dt",{className:"text-2xs text-text-tertiary whitespace-nowrap",children:i.label}),t.jsx("dd",{className:"text-2xs text-text-primary",children:c})]},i.label)})}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("span",{className:"text-2xs text-text-quaternary",children:[e.role," · ",pe(e.created_at)]}),t.jsx(js,{to:`/escalations/detail/${e.id}`})]})]})}function Lr(){return t.jsxs("div",{className:"border-l-2 border-accent-faint pl-3 py-2 space-y-2 animate-pulse",children:[t.jsx("div",{className:"h-3 w-32 bg-surface-sunken rounded"}),t.jsx("div",{className:"h-3 w-48 bg-surface-sunken rounded"}),t.jsx("div",{className:"h-3 w-24 bg-surface-sunken rounded"})]})}function Pr(e,s){if(!e)return{};const r={};for(const[n,i]of Object.entries(e))r[n]=typeof i=="string"?at(i,s):i;return r}function Ns(e,s,r){const n=Pr(e.facets,s),i={role:e.role,status:e.status??"pending",facets:n,limit:e.limit,enabled:!!(e.role||Object.keys(n).length)};return e.assigned==="me"?{...i,assigned_to:r,available:!1,enabled:i.enabled&&!!r}:e.assigned==="any"?i:{...i,available:e.available??!0}}const Wr=[{label:"Description",value:"{{escalation.description}}"},{label:"Role",value:"{{escalation.role}}"},{label:"Age",value:"{{escalation.created_at}}",format:"age"}],Ke="—";function Fr(e,s){if(!e||e===Ke)return Ke;if(s==="age"){const r=new Date(e);return Number.isNaN(r.getTime())?e:pe(e)}return e}function xe(e,s){return typeof e=="string"?at(e,s):Array.isArray(e)?e.map(r=>xe(r,s)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([r,n])=>[r,xe(n,s)])):e}function qr({fieldKey:e,schema:s,escalationContext:r}){const n=(s==null?void 0:s["x-lt-query"])??{},i=(s==null?void 0:s["x-lt-columns"])??Wr,o=(s==null?void 0:s["x-lt-actions"])??[],c=(s==null?void 0:s.title)??"Related items",d=s==null?void 0:s.description,u=r??{},{user:x}=fe(),l=Ns(n,u,x==null?void 0:x.userId),{data:m,isLoading:a}=rs({role:l.role,status:l.status,facets:l.facets,assigned_to:l.assigned_to,available:l.available,limit:l.limit??5,enabled:l.enabled,include:wn({columns:i,actions:o})?"envelope":void 0}),b=(m==null?void 0:m.escalations)??[],w=as(),[y,h]=p.useState({}),[j,k]=p.useState(null),g=async(A,D)=>{const M=be(A);if(!(D.confirm&&!window.confirm(at(D.confirm,M)))){k(A.id),h($=>({...$,[A.id]:""}));try{await w.mutateAsync({id:A.id,resolverPayload:xe(D.resolverPayload,M)})}catch($){h(P=>({...P,[A.id]:$.message}))}finally{k(null)}}};return t.jsxs("div",{"data-field-key":e,children:[t.jsx(W,{children:c}),d&&t.jsx(X,{children:d}),t.jsx("div",{className:"mt-1","data-testid":`escalation-list-widget-${e}`,children:a?t.jsx(Jr,{columns:i.length}):t.jsx(Ur,{escalations:b,columns:i,fieldKey:e,actions:o,onAction:g,pendingRow:j,rowErrors:y})})]})}function Ur({escalations:e,columns:s,fieldKey:r,actions:n,onAction:i,pendingRow:o,rowErrors:c}){return e.length===0?t.jsx("p",{className:"text-xs text-text-quaternary italic py-1","data-testid":`escalation-list-empty-${r}`,children:"No items found"}):t.jsxs("table",{className:"w-full text-xs border-collapse","data-testid":`escalation-list-table-${r}`,children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-surface-border",children:[s.map(d=>t.jsx("th",{className:"text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary pb-1 pr-3 last:pr-0",children:d.label},d.label)),n.length>0&&t.jsx("th",{className:"w-px"}),t.jsx("th",{className:"w-8"})]})}),t.jsx("tbody",{children:e.map(d=>{const u=be(d),x=c[d.id];return t.jsxs("tr",{className:"border-b border-surface-border/50 last:border-0 hover:bg-surface-sunken/50 transition-colors",children:[s.map(l=>{const m=at(l.value,u),a=Fr(m,l.format);return t.jsx("td",{className:"py-1 pr-3 last:pr-0 text-text-primary align-top",children:a},l.label)}),n.length>0&&t.jsxs("td",{className:"py-1 pr-2 align-top whitespace-nowrap",children:[n.map(l=>t.jsx("button",{type:"button",onClick:()=>i(d,l),disabled:o===d.id,className:"px-2 py-0.5 text-2xs font-medium text-accent border border-accent/40 rounded hover:bg-accent/10 disabled:opacity-40 disabled:cursor-default transition-colors ml-1 first:ml-0","data-testid":`escalation-list-action-${d.id}`,children:l.label},l.label)),x&&t.jsx("p",{className:"text-2xs text-status-error mt-0.5 whitespace-normal max-w-[16rem]","data-testid":`escalation-list-action-error-${d.id}`,children:x})]}),t.jsx("td",{className:"py-1 pl-2 align-top",children:t.jsx(js,{to:`/escalations/detail/${d.id}`})})]},d.id)})})]})}function Jr({columns:e}){return t.jsx("div",{className:"space-y-1.5 animate-pulse",children:[0,1,2].map(s=>t.jsx("div",{className:"flex gap-4",children:Array.from({length:e},(r,n)=>t.jsx("div",{className:"h-3 bg-surface-sunken rounded flex-1"},n))},s))})}const ie={"file-upload":wr,"code-editor":kr,signature:_r,"rich-text":Cr,markdown:Er,checklist:Tr,attachment:Ye,image:Ye,link:Ir,escalation:Dr,"escalation-list":qr};function vs({fieldKey:e,value:s,onChange:r,onBlur:n,schema:i,isRequired:o,isReadOnly:c,error:d,escalationContext:u,submitAttempted:x}){var P;const l=(P=i==null?void 0:i.properties)==null?void 0:P[e],m=Y(e,l),a=l==null?void 0:l["x-lt-widget"],b=`lt-field-${e}`,w=`${b}-error`,y=`${b}-help`,h=typeof(l==null?void 0:l.description)=="string"&&l.description.length>0?l.description:void 0,g={id:b,"aria-required":o||void 0,"aria-invalid":d?!0:void 0,"aria-describedby":d?w:h!==void 0?y:void 0},A=a==="markdown"&&typeof s=="string",D=(a==="attachment"||a==="image")&&typeof s=="string",M=!!(a&&a in ie);if(c&&!A&&!D&&!M){const T=s===null?"null":typeof s=="object"?JSON.stringify(s,null,2):String(s);return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,children:m}),t.jsx("p",{className:"text-sm text-text-secondary mt-0.5 whitespace-pre-wrap",children:T})]})}if(a&&a in ie){const T=ie[a],_=o||(l==null?void 0:l["x-lt-require-all"])===!0,R={fieldKey:e,schema:l,escalationContext:u,isRequired:_,submitAttempted:x,error:d};if((l==null?void 0:l.type)==="object"){const O=typeof s=="string"?s:typeof s=="object"&&s!==null&&!Array.isArray(s)?JSON.stringify(s):"";return t.jsx(T,{...R,value:O,onChange:I=>{try{r(JSON.parse(I))}catch{r(I)}}})}if(typeof s=="string")return t.jsx(T,{...R,value:s,onChange:O=>r(O)});if(typeof s=="object"&&s!==null&&!Array.isArray(s))return t.jsx(T,{...R,value:JSON.stringify(s),onChange:O=>{try{r(JSON.parse(O))}catch{r(O)}}})}const $=gs(l,u);if($&&(s===null||typeof s=="string"||typeof s=="number")){const T=s===null?"":String(s),_=$.some(R=>String(R.value)===T);return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:b,children:m}),h&&t.jsx(X,{id:y,children:h}),t.jsxs("select",{value:_?T:"",disabled:$.length===0,onChange:R=>{const O=$.find(I=>String(I.value)===R.target.value);r(O?O.value:R.target.value)},onBlur:n,"data-field-key":e,className:vr(!!d),...g,children:[!_&&t.jsx("option",{value:"",disabled:!0,children:"Choose…"}),$.map(R=>t.jsx("option",{value:String(R.value),children:R.label},String(R.value)))]}),t.jsx(mt,{error:d,id:w})]})}if(typeof s=="boolean")return t.jsxs("div",{children:[t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:s,onChange:T=>{r(T.target.checked),n==null||n()},className:"w-3.5 h-3.5 rounded accent-accent","data-field-key":e,...g}),t.jsxs("span",{className:"text-2xs font-semibold uppercase tracking-wider text-text-secondary",children:[m,o&&t.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})]}),h&&t.jsx(X,{id:y,children:h}),t.jsx(mt,{error:d,id:w})]});if(typeof s=="number")return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:b,children:m}),h&&t.jsx(X,{id:y,children:h}),t.jsx("input",{type:"number",value:s,onChange:T=>r(parseFloat(T.target.value)||0),onBlur:n,step:"any","data-field-key":e,className:`${Tt(!!d)} max-w-48`,...g}),t.jsx(mt,{error:d,id:w})]});if(typeof s=="string"){if((l==null?void 0:l.format)==="password")return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:b,children:m}),h&&t.jsx(X,{id:y,children:h}),t.jsx("input",{type:"password",value:s,onChange:I=>r(I.target.value),onBlur:n,"data-field-key":e,className:Tt(!!d),autoComplete:"off",...g}),t.jsx(mt,{error:d,id:w})]});const _=l==null?void 0:l.format,R={date:"date","date-time":"datetime-local",email:"email",uri:"url"},O={date:"max-w-48","date-time":"max-w-64"};if(_&&_ in R)return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:b,children:m}),h&&t.jsx(X,{id:y,children:h}),t.jsx("input",{type:R[_],value:s,onChange:I=>r(I.target.value),onBlur:n,"data-field-key":e,className:`${Tt(!!d)} ${O[_]??""}`,...g}),t.jsx(mt,{error:d,id:w})]});if(_==="textarea"||s.length>80){const I=l==null?void 0:l.maxLength,F=l==null?void 0:l["x-lt-max-length"];let q=I;if(q===void 0&&F&&u){const V=F.indexOf(".");if(V!==-1){const G=F.slice(0,V),Z=F.slice(V+1),N=u[G];if(N&&typeof N=="object"){let E=N;for(const v of Z.split("."))if(E=E[v],E===void 0)break;if(typeof E=="number")q=E;else if(typeof E=="string"){const v=Number(E);Number.isNaN(v)||(q=v)}}}}const z=q!==void 0&&s.length>q;return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:b,children:m}),h&&t.jsx(X,{id:y,children:h}),t.jsx("textarea",{value:s,onChange:V=>{r(V.target.value),n==null||n()},onBlur:n,"data-field-key":e,className:`${Tt(!!d)} leading-relaxed`,rows:Math.min(6,Math.max(3,Math.ceil(s.length/60))),...g}),q!==void 0&&t.jsxs("p",{className:`text-2xs mt-0.5 text-right tabular-nums ${z?"text-status-error font-medium":"text-text-quaternary"}`,children:[s.length," / ",q]}),t.jsx(mt,{error:d,id:w})]})}return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:b,children:m}),h&&t.jsx(X,{id:y,children:h}),t.jsx("input",{type:"text",value:s,onChange:I=>r(I.target.value),onBlur:n,"data-field-key":e,className:Tt(!!d),...g}),t.jsx(mt,{error:d,id:w})]})}if(s===null)return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,children:m}),t.jsx("p",{className:"text-xs text-text-tertiary italic mt-1",children:"null"})]});if(Array.isArray(s))return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,children:m}),t.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:s.map((T,_)=>t.jsx("span",{className:"px-2 py-0.5 text-2xs font-mono bg-surface-sunken rounded text-text-secondary",children:String(T)},_))})]});if(typeof s=="object"){const T=Object.entries(s);return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,children:m}),t.jsx("div",{className:"ml-4 mt-2 pl-4 border-l border-accent-faint space-y-3",children:T.map(([_,R])=>t.jsx(vs,{fieldKey:_,value:R,onChange:O=>r({...s,[_]:O})},_))})]})}return null}function Vr({items:e,columns:s=1}){if(e.length===0)return null;const r=s>=2&&e.length>1?"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr] @dict-pairs:grid-cols-[max-content_1fr_max-content_1fr]":"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr]";return t.jsx("div",{className:"@container",children:t.jsx("dl",{className:`grid ${r} items-baseline gap-x-6 @dict-pairs:gap-x-8 gap-y-1.5`,children:e.map(({key:n,label:i,value:o})=>t.jsxs(p.Fragment,{children:[t.jsx("dt",{className:"text-2xs font-semibold uppercase tracking-wide text-text-secondary mt-2 first:mt-0 @dict-inline:mt-0",children:i}),t.jsx("dd",{className:"text-sm text-text-primary break-words min-w-0","data-field-key":n,children:Hr(o)})]},n))})})}function Hr(e){return e==null||e===""?"—":typeof e=="boolean"?e?"Yes":"No":typeof e=="object"?JSON.stringify(e):String(e)}const oe="dictionary",Br=new Set(["markdown","attachment","image"]);function ws(e,s){if(!s)return;const r=e==null?void 0:e["x-lt-section-options"],n=r==null?void 0:r[s];return n&&typeof n=="object"?n:void 0}function zr(e,s,r){var d,u;const n=(d=e==null?void 0:e.properties)==null?void 0:d[r];if((n==null?void 0:n.readOnly)!==!0)return!1;const i=n==null?void 0:n["x-lt-widget"];if(typeof i=="string"&&Br.has(i))return!1;const o=n==null?void 0:n["x-lt-display"];if(typeof o=="string")return o===oe;const c=(u=ws(e,s))==null?void 0:u.display;return typeof c=="string"?c===oe:(e==null?void 0:e["x-lt-display"])===oe}function Xr(e,s,r,n){var o;const i=[];for(const c of e){const[d]=c,u=i[i.length-1];if(zr(s,r,d)){(u==null?void 0:u.kind)==="dictionary"?u.entries.push(c):i.push({kind:"dictionary",entries:[c]});continue}const x=(o=s==null?void 0:s.properties)==null?void 0:o[d],l=x==null?void 0:x["x-lt-column-group"];if(n==="two-column"&&typeof l=="string"&&l.trim()){(u==null?void 0:u.kind)==="column-group"&&u.name===l?u.entries.push(c):i.push({kind:"column-group",name:l,entries:[c]});continue}i.push({kind:"field",entry:c})}return i}function Gr({name:e,entries:s,formSchema:r,layout:n,renderField:i}){const o=Xr(s,r,e,n),c=ws(r,e),d=(c==null?void 0:c.columns)??(n==="two-column"?2:1),u=l=>l.map(([m,a])=>{var b;return{key:m,label:Y(m,(b=r==null?void 0:r.properties)==null?void 0:b[m]),value:a}}),x=()=>o.map((l,m)=>l.kind==="dictionary"?t.jsx("div",{className:n==="two-column"?"col-span-full":"",children:t.jsx(Vr,{items:u(l.entries),columns:d})},`dict-${m}`):l.kind==="column-group"?t.jsx("div",{className:"@container",children:t.jsx("div",{className:"grid grid-cols-1 @grp-cols:grid-cols-2 gap-x-4 gap-y-5",children:l.entries.map(a=>i(a))})},`group-${l.name}-${m}`):i(l.entry));return t.jsxs("div",{className:e?"border border-surface-border bg-surface-sunken rounded-[var(--lt-radius-section)] p-4 animate-[section-enter_0.25s_ease-out]":"",children:[e&&t.jsx("p",{className:"mb-4 text-[1.40625rem] font-semibold tracking-wider text-heading [font-variant-caps:small-caps]",children:e}),n==="two-column"?t.jsx("div",{className:"@container",children:t.jsx("div",{className:"grid grid-cols-1 @form-cols:grid-cols-2 gap-x-col-gap gap-y-5",children:x()})}):t.jsx("div",{className:"space-y-5",children:x()})]})}function ks({value:e,onChange:s,disabled:r,submitAttempted:n,escalationContext:i,onOpenHelp:o,onDisabledClick:c,disabledHint:d}){var G,Z;const[u,x]=p.useState({}),[l,m]=p.useState({}),[a,b]=p.useState(null),[w,y]=p.useState(!1),[h,j]=p.useState(new Set);p.useEffect(()=>{try{const N=JSON.parse(e);if(typeof N=="object"&&N!==null&&!Array.isArray(N)){const E={},v={};for(const[L,U]of Object.entries(N))L.startsWith("_")?v[L]=U:E[L]=U;x(E),m(v),b(v._form_schema&&typeof v._form_schema=="object"?v._form_schema:null),y(!1)}}catch{y(!0)}},[e]);const k=p.useCallback(N=>{x(N),s(JSON.stringify({...N,...l},null,2))},[l,s]),g=p.useCallback((N,E)=>{k({...u,[N]:E})},[u,k]),A=p.useCallback(N=>{j(E=>{if(E.has(N))return E;const v=new Set(E);return v.add(N),v})},[]);if(w)return t.jsx("p",{className:"text-xs text-status-error",children:"Unable to parse resolver data as form. Use the JSON editor below."});const D=Object.entries(u);if(D.length===0)return t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No resolver fields defined."});const M=a==null?void 0:a["x-lt-order"],$=M?[...D].sort((N,E)=>{const v=M.indexOf(N[0]),L=M.indexOf(E[0]);return(v===-1?1/0:v)-(L===-1?1/0:L)}):D,P={...i??{},resolver:u},T=$.filter(([N,E])=>{var L;const v=(L=a==null?void 0:a.properties)==null?void 0:L[N];return!(!Bt(v==null?void 0:v["x-lt-showIf"],P)||(v==null?void 0:v["x-lt-hide-if-empty"])===!0&&(E==null||E===""||E===!1||E===0))}),_=new Set((a==null?void 0:a.required)??[]),R=a==null?void 0:a["x-lt-layout"],O=a==null?void 0:a.title,I=a==null?void 0:a.description,F=typeof(a==null?void 0:a["x-lt-help"])=="string"||typeof(a==null?void 0:a["x-lt-context"])=="string",q=[];for(const N of T){const[E]=N,v=(G=a==null?void 0:a.properties)==null?void 0:G[E],L=((Z=v==null?void 0:v["x-lt-section"])==null?void 0:Z.trim())||null,U=q[q.length-1];!U||U.name!==L?q.push({name:L,entries:[N]}):U.entries.push(N)}const z=([N,E])=>{var S;const v=(S=a==null?void 0:a.properties)==null?void 0:S[N],L=(v==null?void 0:v.readOnly)===!0,U=(v==null?void 0:v["x-lt-span"])??1,ft=_.has(N),gt=h.has(N)||!!n,it=hs(E,v,ft,gt,P);return t.jsx("div",{className:`animate-[field-enter_0.2s_ease-out] ${R==="two-column"&&U>=2?"col-span-full":""}`,children:t.jsx(vs,{fieldKey:N,value:E,onChange:K=>g(N,K),onBlur:()=>A(N),schema:a,isRequired:ft,isReadOnly:L,error:it,escalationContext:P,submitAttempted:!!n})},N)},V=t.jsxs("div",{className:r?"pointer-events-none":void 0,inert:r||void 0,"aria-disabled":r||void 0,children:[O&&t.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[t.jsx("h3",{className:"heading-3",children:O}),F&&o&&t.jsx("button",{type:"button",onClick:o,title:"Open instructions","aria-label":"Open instructions",className:"p-1 rounded-md text-text-tertiary hover:text-accent hover:bg-surface-hover transition-colors",children:t.jsx(us,{className:"w-4 h-4",strokeWidth:1.5})})]}),I&&t.jsx("p",{className:"text-sm text-text-secondary leading-relaxed mb-6",children:I}),t.jsx("div",{className:"space-y-8",children:q.map((N,E)=>t.jsx(Gr,{name:N.name,entries:N.entries,formSchema:a,layout:R,renderField:z},N.name??`__s${E}`))})]});return r?t.jsx(Nr,{hint:d,onLockedClick:c,children:V}):t.jsx("div",{className:"pb-8 max-w-form",children:V})}function Qr({json:e,onJsonChange:s,requestTriage:r,onRequestTriageChange:n,triageNotes:i,onTriageNotesChange:o,disabled:c=!1,submitAttempted:d=!1,showTriage:u=!1,escalationContext:x,onOpenHelp:l,onDisabledClick:m,disabledHint:a}){return t.jsxs(t.Fragment,{children:[u&&t.jsx("div",{className:"flex items-center justify-between mb-3",children:r?t.jsxs("button",{onClick:()=>n(!1),className:"group flex items-center gap-2 text-left","data-testid":"triage-cancel",children:[t.jsx("span",{className:"flex items-center justify-center w-5 h-5 rounded-full bg-accent/10 text-accent shrink-0",children:t.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),t.jsxs("span",{className:"text-xs text-text-secondary group-hover:text-text-primary transition-colors",children:["AI Triage active."," ",t.jsx("span",{className:"text-accent group-hover:underline",children:"Cancel"})]})]}):t.jsxs("button",{onClick:()=>n(!0),className:"group flex items-center gap-2.5 text-left my-4","data-testid":"triage-callout",children:[t.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:t.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.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"})})}),t.jsxs("span",{className:"text-sm text-text-secondary group-hover:text-text-primary transition-colors",children:["This form doesn't capture the issue?"," ",t.jsx("span",{className:"text-accent group-hover:underline",children:"Request AI Triage"})]})]})}),t.jsxs("div",{className:"relative min-h-[200px]",children:[t.jsx("div",{className:r?"pointer-events-none select-none":"",children:t.jsx(ks,{value:e,onChange:s,disabled:c,submitAttempted:d,escalationContext:x,onOpenHelp:l,onDisabledClick:m,disabledHint:a})}),r&&t.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:[t.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."}),t.jsx("textarea",{value:i,onChange:b=>o(b.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 _s(e,s){if(!e.includes("{"))return e;try{const r=i=>{if(!i)return{};try{return JSON.parse(i)}catch{return{}}},n={...s.metadata??{},...r(s.envelope),...r(s.escalation_payload)};return e.replace(/\{([^}]+)\}/g,(i,o)=>Object.prototype.hasOwnProperty.call(n,o)?String(n[o]):`{${o}}`)}catch{return e}}function ts(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function pt(e,s){return{escalation:e,metadata:e.metadata??null,envelope:ts(e.envelope),payload:ts(e.escalation_payload),resolver:null,...s?{lookup:s}:{}}}function Yr({isRoundsExhausted:e,payloadObj:s,isTerminal:r,resolverPayload:n,onRetryTriage:i,isRetrying:o}){return t.jsxs(t.Fragment,{children:[e&&s&&t.jsx("div",{className:"mt-8",children:t.jsx(yr,{payload:s,isTerminal:r,resolverPayload:n,onRetryTriage:i,isRetrying:o})}),(s==null?void 0:s.category)==="missing_credential"&&t.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:[t.jsx(Ue,{size:20,className:"text-status-warning mt-0.5 shrink-0"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-text-primary mb-1",children:"Missing Credential"}),t.jsxs("p",{className:"text-xs text-text-secondary mb-3",children:["This workflow requires a ",t.jsx("span",{className:"font-medium capitalize",children:String(s.provider)})," credential to continue. Register one and then resolve this escalation to retry."]}),t.jsxs(vt,{to:"/credentials",className:"btn-primary text-xs inline-flex items-center gap-1.5",children:[t.jsx(Ue,{size:12}),"Go to Credentials"]})]})]})]})}function Zr({esc:e,resolverPayload:s,isTerminal:r,editable:n,activeView:i,metadataFormSchema:o,effectiveSchema:c,lookup:d,json:u,onJsonChange:x,requestTriage:l,onRequestTriageChange:m,triageNotes:a,onTriageNotesChange:b,onResolve:w,onEscalate:y,onClaim:h,submitAttempted:j,isCertified:k,hasAI:g,onOpenHelp:A,onDisabledClick:D,disabledHint:M}){const $=c,P=pt(e,d);if(r){if(s==null)return null;const O=typeof s=="object"&&s!==null?s:{},I=c??o,F=I!=null&&I.properties?{...cs(O,I),_form_schema:I}:O;return t.jsx("div",{className:"mt-3",children:t.jsx(ks,{value:JSON.stringify(F,null,2),onChange:()=>{},disabled:!0,escalationContext:P,disabledHint:M})})}if(i!=="resolve"||!(e.workflow_type||c))return null;const T=$==null?void 0:$["x-lt-viewport"],_=(T==null?void 0:T.type)==="iframe"&&!!T.src&&w&&y;if(_&&!n)return t.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:[t.jsx(Fn,{className:"w-10 h-10 text-text-tertiary group-hover:text-accent transition-colors",strokeWidth:1}),t.jsx("p",{className:"text-base font-medium text-text-primary group-hover:text-accent transition-colors",children:"Claim to launch the editor"})]});const R=_?_s(T.src,e):"";return t.jsx("div",{className:"mt-3",children:_?t.jsx(ys,{src:R,escalation:e,schema:$,onResolve:w,onEscalate:y,submitAttempted:j}):t.jsx(Qr,{json:u,onJsonChange:x,requestTriage:l,onRequestTriageChange:m,triageNotes:a,onTriageNotesChange:b,disabled:!n,submitAttempted:j,showTriage:!!k&&!!g,escalationContext:P,onOpenHelp:A,onDisabledClick:D,disabledHint:M})})}function Kr({open:e,assignedUntil:s,onClose:r,onExtend:n,isPending:i}){const o=is(),[c,d]=p.useState("30"),[u,x]=p.useState(0),l=c==="custom",m=l?u:parseInt(c),a=p.useCallback(b=>x(b),[]);return t.jsx(me,{open:e,onClose:r,title:"Claim Expiring",children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-sm text-text-secondary",children:["Your claim on this escalation expires in"," ",t.jsx(Xt,{until:s}),". When it lapses, the form locks and the item returns to the queue — your edits are kept as a draft. Extend to keep working."]}),t.jsxs("select",{value:c,onChange:b=>{d(b.target.value),x(0)},className:"select w-full text-sm","aria-label":"Extension duration",children:[o.map(b=>t.jsx("option",{value:b.value,children:b.label},b.value)),t.jsx("option",{value:"custom",children:"Other..."})]}),l&&t.jsx(os,{onChange:a,autoFocus:!0}),t.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[t.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Dismiss"}),t.jsx("button",{onClick:()=>n(m),className:"btn-primary text-xs",disabled:i||!m||m<=0,children:i?"Extending...":"Extend Claim"})]})]})})}const ta=9e4;function ea(e,s=ta){const[,r]=p.useState(0);if(p.useEffect(()=>{if(!e)return;const i=new Date(e).getTime()-Date.now();if(i<=0)return;const o=()=>r(u=>u+1),c=[],d=i-s;return d>0&&c.push(window.setTimeout(o,d)),c.push(window.setTimeout(o,i)),()=>c.forEach(u=>window.clearTimeout(u))},[e,s]),!e)return{expired:!1,expiringSoon:!1,msRemaining:0};const n=Math.max(0,new Date(e).getTime()-Date.now());return{expired:n<=0,expiringSoon:n>0&&n<=s,msRemaining:n}}const sa="lt:escalation:draft:";function Ne(e){return`${sa}${e}`}function na(e){try{return localStorage.getItem(Ne(e))}catch{return null}}function ra(e,s){try{localStorage.setItem(Ne(e),s)}catch{}}function le(e){try{localStorage.removeItem(Ne(e))}catch{}}const aa="x-lt-transition",ia="x-lt-transition-message",oa="x-lt-transition-max-wait-seconds",la="x-lt-transition-done",ca="Submitted. Preparing your next step…",da=30,ua=5,xa=300;function ma(e){const s=typeof e=="number"?e:Number(e);return!Number.isFinite(s)||s<=0?da:Math.min(xa,Math.max(ua,Math.round(s)))}function es(e){if(!e||!e[aa])return null;const s=e[ia];return{message:typeof s=="string"&&s.trim().length>0?s:ca,maxWaitSeconds:ma(e[oa])}}function pa(e){const s=e==null?void 0:e[la];return typeof s=="string"&&s.trim().length>0?s:null}const fa="x-lt-submit-on-claim";function ga(e){return!!(e!=null&&e[fa])}const ha="x-lt-submit-guard",ba="{{count}} related items are still pending";function ya(e){const s=e==null?void 0:e[ha];if(!s||typeof s!="object"||Array.isArray(s))return;const r=s;if(!(!r.query||typeof r.query!="object"))return r}function ja(e,s){const{user:r}=fe(),n=Ns((e==null?void 0:e.query)??{},s??{},r==null?void 0:r.userId),{data:i,isSuccess:o}=rs({role:n.role,status:n.status,facets:n.facets,assigned_to:n.assigned_to,available:n.available,limit:1,enabled:!!e&&n.enabled}),c=!!e&&e.mustBeEmpty!==!1&&n.enabled,d=(i==null?void 0:i.total)??0,u=c&&o&&d===0,x=c&&!u;let l="";if(x)if(d>0){const m=(e==null?void 0:e.message)??ba;l=at(m.replace(/\{\{count\}\}/g,String(d)),s??{})}else l="Checking related items…";return{blocked:x,count:d,message:l,confirmedEmpty:u}}function Na({open:e,message:s}){return e?fn.createPortal(t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center px-4",children:[t.jsx("div",{className:"absolute inset-0 bg-text-primary/40 backdrop-blur-sm"}),t.jsxs("div",{role:"status","aria-live":"polite",className:"relative w-full max-w-sm bg-surface-raised border border-surface-border rounded-lg shadow-xl px-6 py-7 text-center",children:[t.jsx("div",{className:"flex justify-center mb-4","aria-hidden":"true",children:t.jsx("span",{className:"inline-block w-7 h-7 rounded-full border-2 border-surface-border border-t-accent animate-spin"})}),t.jsx("div",{className:"text-sm text-text-secondary [&_p]:m-0 [&_p+p]:mt-2",children:t.jsx(zt,{content:s})})]})]}),document.body):null}function va({open:e,verb:s="submit",claimantId:r,wrongBadgeName:n,onCancel:i}){return e?t.jsx(me,{open:!0,onClose:i,title:`Scan your badge to ${s}`,children:t.jsxs("div",{className:"flex flex-col items-center text-center py-6","data-testid":"station-write-challenge",children:[t.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[t.jsx(qn,{className:"w-7 h-7 text-text-quaternary",strokeWidth:1}),t.jsx(ms,{className:"w-9 h-9 text-accent-muted",strokeWidth:1})]}),t.jsxs("p",{className:"text-lg text-text-secondary",children:["Scan your badge to ",s," as"," ",t.jsx("span",{className:"font-medium text-text-primary",children:r?t.jsx(St,{userId:r}):"the claimant"}),"."]}),n&&t.jsxs("p",{className:"text-sm text-status-error mt-3","data-testid":"wrong-badge",children:["That badge is ",n,"'s — scan the claimant's badge to ",s,"."]}),t.jsx("div",{className:"w-16 border-t border-surface-border my-6"}),t.jsx("button",{type:"button",onClick:i,className:"text-sm text-text-tertiary hover:text-text-secondary hover:underline",children:"Cancel"})]})}):null}const Cs="lt:escalation:panel:open";function wa(){try{const e=localStorage.getItem(Cs);return e===null?!0:e==="true"}catch{return!0}}function Rt(e){try{localStorage.setItem(Cs,String(e))}catch{}}function Ot(e){if(!e)return null;try{return JSON.parse(e)}catch{return e}}function Ha(){const{id:e}=gn();return t.jsx(ka,{id:e},e)}function ka({id:e}){var Se,Me,De,$e,Le;const{user:s,isSuperAdmin:r,hasRoleType:n}=fe(),i=r||n("admin"),{identity:o,clear:c}=Zs(),d=Ks(),u=(o==null?void 0:o.actorId)??(s==null?void 0:s.userId),x=ge(),l=ls(),m=ss(),{data:a,isLoading:b,refetch:w,isFetching:y}=ns(e);tn(e);const h=p.useMemo(()=>{if(!(a!=null&&a.envelope))return!1;try{const f=JSON.parse(a.envelope);return Array.isArray(f==null?void 0:f.lookups)&&f.lookups.length>0}catch{return!1}},[a==null?void 0:a.envelope]),{data:j}=en(e,h),k=p.useMemo(()=>{var f;return(f=j==null?void 0:j.lookups)!=null&&f.length?Object.fromEntries(j.lookups.filter(C=>!C.missing).map(C=>[C.as??C.key,C.data])):null},[j]),g=sn(),A=as(),D=nn(),M=rn(),$=an(),P=on(),[T,_]=p.useState(!1),[R,O]=p.useState(!1),{data:I}=kn(),{data:F}=ln(),{isBuilder:q}=cn(),z=I==null?void 0:I.find(f=>f.workflow_type===(a==null?void 0:a.workflow_type)),V=((Se=F==null?void 0:F.telemetry)==null?void 0:Se.traceUrl)??null,[G,Z]=p.useState("resolve"),[N,E]=p.useState("{}"),[v,L]=p.useState(wa),[U,ft]=p.useState(!1),[gt,it]=p.useState(""),[S,K]=p.useState(!1),[Es,wt]=p.useState([]),[As,Ts]=p.useState(0),[Rs,kt]=p.useState(void 0),[tt,Gt]=p.useState(null),[Os,ve]=p.useState(!1),we=p.useRef(!1),Mt=p.useRef(null),ke=p.useRef(!1),Dt=p.useRef(null),[ot,Qt]=p.useState(null),Is=ea(a==null?void 0:a.assigned_until),[Ss,Ms]=p.useState(null);p.useEffect(()=>{if(!(!S||!a))try{const f=JSON.parse(N),C=f._form_schema;if(!C){wt([]);return}wt(bs(C,f,pt(a,k)))}catch{}},[N,S,a]);const $t=((Me=a==null?void 0:a.metadata)==null?void 0:Me.form_schema)??null,ht=(a==null?void 0:a.form_schema)??(z==null?void 0:z.resolver_schema)??null,J=$t??ht,_e=ga(J),et=xn(J),_t=ya(J),Ct=ja(_t,a?pt(a,k):void 0),Lt=p.useRef(!1),Pt=p.useRef(null);p.useEffect(()=>{if(Lt.current)return;const f=$t??(ht!=null&&ht.properties?ht:null);if(f!=null&&f.properties){Lt.current=!0;const C=Ot(a==null?void 0:a.envelope),H=C==null?void 0:C.formDefaults,Q={...(a==null?void 0:a.metadata)??{},...typeof H=="object"&&H!==null?H:{}},ut=cs(Q,f),nt={_form_schema:f};for(const[We,zs]of Object.entries(f.properties)){const Fe=zs,Xs=Fe.type==="object"?{}:"";nt[We]=ut[We]??Fe.default??Xs}Pt.current=JSON.stringify(nt,null,2);const Pe=!((a==null?void 0:a.status)==="resolved"||(a==null?void 0:a.status)==="cancelled")&&(a!=null&&a.id)?na(a.id):null,Jt=Pe?Ot(Pe):null;Jt&&typeof Jt=="object"&&!Array.isArray(Jt)?E(JSON.stringify({...Jt,_form_schema:f},null,2)):E(Pt.current)}else J&&(Lt.current=!0,E(JSON.stringify(J,null,2)))},[J,$t,ht,a==null?void 0:a.envelope,a==null?void 0:a.metadata,a==null?void 0:a.id,a==null?void 0:a.status]),p.useEffect(()=>{if(!Lt.current||Pt.current===null||!(a!=null&&a.id)||a.status!=="pending")return;const f=a.id,C=window.setTimeout(()=>{N===Pt.current?le(f):ra(f,N)},400);return()=>window.clearTimeout(C)},[N,a==null?void 0:a.id,a==null?void 0:a.status]),p.useEffect(()=>{if(!tt)return;const f=window.setTimeout(async()=>{var H;try{const Q=new URLSearchParams({parent_id:e,assigned_to:u??"",status:"pending",limit:"1"}),ut=await Nt(`/escalations?${Q}`),nt=(H=ut==null?void 0:ut.escalations)==null?void 0:H[0];if(nt!=null&&nt.id&&nt.parent_id===e){Gt(null),x(`/escalations/detail/${nt.id}`);return}}catch{}Gt(null),m.resetQueries({queryKey:["escalations"]}),m.resetQueries({queryKey:["escalationStats"]});const C=tt.doneDest;C?C.startsWith("/")?x(C):window.location.assign(C):x(-1)},tt.maxWaitSeconds*1e3);return()=>window.clearTimeout(f)},[tt,e,u,x,m]),p.useEffect(()=>{var f,C;we.current||(f=l.state)!=null&&f.autoStart&&(!a||a.status!=="pending"||Ht(a)||N!=="{}"&&(we.current=!0,(C=Mt.current)==null||C.call(Mt)))},[a,N,l.state]),p.useEffect(()=>{var f;ke.current||!(_t!=null&&_t.autoResolveWhenEmpty)||!Ct.confirmedEmpty||!a||a.status!=="pending"||!Ht(a)||a.assigned_to===u&&N!=="{}"&&(ke.current=!0,(f=Dt.current)==null||f.call(Dt))},[Ct.confirmedEmpty,_t,a,N,u]),p.useEffect(()=>{if(!(!ot||!a)&&o&&o.actorId===a.assigned_to){const{run:f}=ot;Qt(null),f()}},[o,ot,a==null?void 0:a.assigned_to]);const Ds=(a==null?void 0:a.subtype)==="rounds_exhausted";if(b)return t.jsxs("div",{className:"animate-pulse space-y-8",children:[t.jsx("div",{className:"h-8 bg-surface-sunken rounded w-64"}),t.jsx("div",{className:"h-32 bg-surface-sunken rounded w-full"})]});if(!a)return t.jsx("p",{className:"text-sm text-text-secondary",children:"Escalation not found."});const Wt=Ht(a),lt=Wt&&a.assigned_to===u,$s=Wt&&!lt,ct=a.status==="resolved"||a.status==="cancelled",Yt=d&&Wt&&!ct,Ce=lt||Yt,Ee=Yt&&a.assigned_to!==(s==null?void 0:s.userId),dt=J==null?void 0:J["x-lt-viewport"],Zt=(dt==null?void 0:dt.type)==="iframe"&&!!(dt!=null&&dt.src)&&Ce&&!ct,Ft=Ot(a.escalation_payload),bt=Ot(a.resolver_payload),qt=Ot(a.envelope),Ls=!!((De=qt==null?void 0:qt.metadata)!=null&&De.certified),Ae=dn(),Te=Ae!==null?Ae:!!(($e=F==null?void 0:F.ai)!=null&&$e.enabled),st=typeof Ft=="object"&&Ft!==null&&!Array.isArray(Ft)?Ft:null,Ps=st==null?void 0:st._triage,Ws=typeof bt=="object"&&bt!==null&&!Array.isArray(bt)?bt:null,Kt=ct?"terminal":lt||Yt?"claimed_by_me":$s?"claimed_by_other":"available",Fs=Kt==="available"?`${typeof et.claim=="string"?et.claim:"Claim"} this escalation to edit the form`:Kt==="claimed_by_other"?t.jsxs(t.Fragment,{children:["Claimed by ",a.assigned_to?t.jsx(St,{userId:a.assigned_to}):"another user"]}):a.status==="cancelled"?"This escalation is cancelled":a.status==="resolved"?"This escalation is resolved — the submitted values are shown":null,te=f=>{g.mutate({id:e,durationMinutes:f})},Et=()=>{m.resetQueries({queryKey:["escalations"]}),m.resetQueries({queryKey:["escalationStats"]}),x(-1)},qs=()=>{const f=pa(J);return f&&at(f,pt(a,k))||null},Us=f=>{m.resetQueries({queryKey:["escalations"]}),m.resetQueries({queryKey:["escalationStats"]}),f.startsWith("/")?x(f):window.location.assign(f)},Js=async f=>{try{await A.mutateAsync({id:e,resolverPayload:f})}catch(Q){if(Q instanceof un&&Hn(Q.body)){K(!0),wt(Q.body.violations),kt(B.ERRORS);return}throw Q}le(e);const C=es(J),H=qs();if(C){Gt({...C,doneDest:H});return}if(H){Us(H);return}Et()},Ut=(f,C)=>{if(Ee){c(),Qt({verb:f,run:C});return}C()},At=async f=>{Ut("submit",()=>Js(f))},Re=async f=>{try{await g.mutateAsync({id:e,durationMinutes:f})}catch{return}if(Ct.blocked)return;const C=ue(N,pt(a,k));if(!C.parseError){if(C.errors.length>0){K(!0),wt(C.errors),L(!0),Rt(!0),kt(B.ERRORS);return}await At(C.payload)}};Mt.current=async()=>{var C;const f=(C=l.state)==null?void 0:C.durationMinutes;ve(!0),await Re(typeof f=="number"&&f>0?f:30),ve(!1)},Dt.current=()=>{const f=ue(N,pt(a,k));f.parseError||f.errors.length>0||At(f.payload)};const Oe=f=>{f&&Ut("escalate",async()=>{await D.mutateAsync({id:e,targetRole:f}),Et()})},Vs=async()=>{lt||await g.mutateAsync({id:e,durationMinutes:30});const f=(st==null?void 0:st.diagnosis)||a.description||"";await A.mutateAsync({id:e,resolverPayload:{_lt:{needsTriage:!0},notes:f}}),Et()},Ie=()=>{Ut("release",async()=>{await g.mutateAsync({id:e,durationMinutes:0}),Et()})},Hs=()=>{_(!1),Ut("cancel",async()=>{await M.mutateAsync(e),le(e),Et()})},Bs=t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(bn,{onRefresh:()=>w(),isFetching:y,apiPath:`/escalations/${a.id}`,standalone:!0}),t.jsx("button",{onClick:()=>L(f=>(Rt(!f),!f)),className:"ml-2 text-accent/60 hover:text-accent transition-colors",title:v?"Hide side panel":"Show side panel",children:v?t.jsx(Je,{className:"w-5 h-5",strokeWidth:1.5}):t.jsx(Ve,{className:"w-5 h-5",strokeWidth:1.5})})]});return t.jsxs("div",{className:"flex-1 min-h-0 min-w-0 flex items-stretch -mt-8 -mr-page-x -mb-16",children:[t.jsxs("div",{className:"flex-1 min-w-0 flex flex-col min-h-0",children:[Zt?t.jsxs("div",{className:"relative flex-1 min-h-0 -ml-page-x",children:[t.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:Ie,disabled:g.isPending,label:et.release??"Release",hoverClass:"hover:text-accent",icon:t.jsx(Un,{className:"w-4 h-4",strokeWidth:1.5})},...et.cancel===!1?[]:[{onClick:()=>_(!0),disabled:!1,label:et.cancel??"Cancel",hoverClass:"hover:text-status-error",icon:t.jsx(Jn,{className:"w-4 h-4",strokeWidth:1.5})}],{onClick:()=>L(f=>(Rt(!f),!f)),disabled:!1,label:v?"Hide panel":"Show panel",hoverClass:"hover:text-accent",icon:v?t.jsx(Je,{className:"w-4 h-4",strokeWidth:1.5}):t.jsx(Ve,{className:"w-4 h-4",strokeWidth:1.5})}].map(({onClick:f,disabled:C,label:H,hoverClass:Q,icon:ut})=>t.jsxs("div",{className:"relative group/tip",children:[t.jsx("button",{onClick:f,disabled:C,className:`text-text-tertiary ${Q} transition-colors disabled:opacity-40 disabled:cursor-default p-1.5 rounded-md`,children:ut}),t.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-2xs bg-surface-sunken text-text-primary whitespace-nowrap opacity-0 group-hover/tip:opacity-100 transition-opacity",children:H})]},H))}),t.jsx(ys,{src:_s(dt.src,a),escalation:a,schema:J,onResolve:At,onEscalate:Oe,submitAttempted:S,fill:!0})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"shrink-0 pt-8 pr-page-x",children:t.jsx(hn,{title:a.description||"Escalation",actions:Bs})}),t.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto pr-page-x",children:[t.jsx(Yr,{isRoundsExhausted:Ds,payloadObj:st,isTerminal:ct,resolverPayload:bt,onRetryTriage:Vs,isRetrying:g.isPending||A.isPending}),t.jsx(Zr,{esc:a,resolverPayload:bt,isTerminal:ct,editable:Ce,activeView:G,lookup:k,metadataFormSchema:$t,effectiveSchema:J,json:N,onJsonChange:E,requestTriage:U,onRequestTriageChange:ft,triageNotes:gt,onTriageNotesChange:it,onResolve:At,onEscalate:Oe,onClaim:()=>te(30),submitAttempted:S,isCertified:Ls,hasAI:Te,onOpenHelp:()=>{L(!0),Rt(!0),kt(B.HELP)},onDisabledClick:()=>Ts(f=>f+1),disabledHint:Fs}),t.jsx("div",{className:"h-10"})]})]}),!Zt&&t.jsx(br,{escalationContext:pt(a,k),mode:Kt,activeView:G,onActiveViewChange:Z,onClaim:_e?Re:te,claimPending:g.isPending||_e&&A.isPending,claimNudge:As,workflowType:a.workflow_type,json:N,onResolve:At,resolvePending:A.isPending||A.isSuccess,resolveError:A.error,requestTriage:U,triageNotes:gt,onRelease:Ie,releasePending:g.isPending,onCancel:()=>_(!0),assignedTo:a.assigned_to,assignedUntil:a.assigned_until,actingName:o&<?o.displayName:null,submitNeedsBadge:Ee,onSubmitAttempt:()=>K(!0),onValidationErrors:f=>{wt(f),L(!0),Rt(!0),kt(B.ERRORS)},labels:et,submitBlocked:Ct.blocked,submitBlockedMessage:Ct.message,canManage:i,onReassign:()=>O(!0),onUnassign:()=>P.mutate({ids:[e]}),unassignPending:P.isPending})]}),t.jsx(sr,{esc:a,schema:J,envelope:qt,payload:st,resolver:Ws,triage:Ps??null,hasAI:Te,claimed:Wt,claimedByMe:lt,isTerminal:ct,isBuilder:q,traceUrl:V,open:v,noGutter:Zt,formErrors:Es,activePanel:Rs,onPanelChange:kt}),t.jsx(mn,{open:R,onClose:()=>O(!1),selectedCount:1,selectedRoles:a?[a.role]:[],onSubmit:(f,C)=>$.mutate({ids:[e],targetUserId:f,durationMinutes:C,reassign:!0},{onSuccess:()=>O(!1)}),isPending:$.isPending}),t.jsx(pn,{open:T,onClose:()=>_(!1),onConfirm:Hs,isPending:M.isPending,error:M.error,actionLabel:typeof et.cancel=="string"?et.cancel:void 0}),t.jsx(Bn,{escalationId:e}),t.jsx(va,{open:!!ot,verb:(ot==null?void 0:ot.verb)??"submit",claimantId:a.assigned_to,wrongBadgeName:o&&o.actorId!==a.assigned_to?o.displayName:null,onCancel:()=>Qt(null)}),t.jsx(Na,{open:!!tt||Os,message:(tt==null?void 0:tt.message)??((Le=es(J))==null?void 0:Le.message)??"Starting…"}),lt&&!ct&&a.assigned_until&&t.jsx(Kr,{open:Is.expiringSoon&&a.assigned_until!==Ss,assignedUntil:a.assigned_until,onClose:()=>Ms(a.assigned_until??null),onExtend:te,isPending:g.isPending})]})}export{Ha as EscalationDetailPage};
|
|
3
|
-
//# sourceMappingURL=index-8LIpvj2e.js.map
|